Skip to content
Snippets Groups Projects

Resolve "simple pathfinding"

Merged Fabian Heinrich requested to merge 120-simple-pathfinding into dev
2 files
+ 12
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -175,7 +175,7 @@ async def agent():
try:
path = networkx.astar_path(
restrict_movement_graph(
graph=movement_graph.copy(),
graph=movement_graph,
player_positions=[
p["pos"]
for p in state["players"]
@@ -207,6 +207,8 @@ async def agent():
do_movement = True
else:
# no paths available
print("NO PATHS")
# task_type = None
# task_args = None
do_movement = False
@@ -251,6 +253,7 @@ async def agent():
await websocket.recv()
else:
# Target reached here.
print("TARGET REACHED")
task_type = None
task_args = None
case "INTERACT":
@@ -307,7 +310,8 @@ async def agent():
...
if not task_type:
task_type = random.choice(["GOTO", "PUT", "INTERACT"])
# task_type = random.choice(["GOTO", "PUT", "INTERACT"])
task_type = random.choice(["GOTO"])
threshold = datetime.now() + timedelta(seconds=TIME_TO_STOP_ACTION)
if task_type == "GOTO":
# counter_type = random.choice(list(counters.keys()))
Loading