How would I remove a coordinates from my half of the arena from the find path to edge func?

How would I remove a coordinates from my half of the arena from the find path to edge func?
0

#1

So I have a variable named br = game_state.game_map.get_edge_locations(game_state.game_map.BOTTOM_RIGHT)
I want to do
br.remove(half_pos)
where half_pos are all the positions on my side of the arena so that I only get the points an IU would follow on the opponent’s side of the arena.


#2

You can get the entire path with the regular pathfinding function then manually sort this out with the path afterwards. Just loop through the path and extract the locations that are at y >= 14 (the enemy’s side).


#3

Also, I have a problem in my algo that I’m struggling with:
This is the code I have:
for x in br:#br is the bottom right
container = game_state.find_path_to_edge(x, game_state.game_map.TOP_LEFT)
for r in container:
if r[1] <= 13:
container.remove®
and, on my second turn(technically first in the error message), this error occurs:
for r in container:

TypeError: ‘NoneType’ object is not iterable
HELP!!!


#4

Deleting items in the middle of an iteration can (will) cause issues, see this for reference.

There are several ways do get around this, the preferred ones listed nicely in that answer. For simplicity I would just construct a second list of the ones that pass your condition (r[1] > 13).