Skip to content

Commit

Permalink
diminuição dos steps
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelRDuarte committed Dec 2, 2019
1 parent 8c9d69b commit 8ccbc24
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def astar(maze, start, end, mapa, exat_pos):
open_list.append(child)
#print('Adicionar à lista de nos abertos')
count_open_nodes += 1
if count_open_nodes > 500:
if count_open_nodes > 300:
return []


Expand Down
17 changes: 8 additions & 9 deletions stuPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ async def agent_loop(server_address="localhost:8000", agent_name="student"):
enemyCloseCounter = 0

# ignora powerups não utilizados
if level == 2 or level == 5 or level == 6 or level == 11 or level == 12 or level == 13 or level == 14 or level==15:
if level == 2 or level == 5 or level == 6 or level == 10 or level == 11 or level == 12 or level == 13 or level == 14 or level==15:
got_powerup = True

if detonador:
if level == 8 or level == 13:
got_powerup = True


my_pos = state['bomberman']
ways = get_possible_ways(mapa, my_pos)
Expand All @@ -90,12 +94,10 @@ async def agent_loop(server_address="localhost:8000", agent_name="student"):
# verificar se tem detonador
if my_pos == powerup:
got_powerup = True
if level == 3:
if level == 3 or level == 8 or level == 13:
detonador = True
if level == 9:
bombpass = True
if level == 10:
wallpass = True


'''
Expand Down Expand Up @@ -243,6 +245,8 @@ async def agent_loop(server_address="localhost:8000", agent_name="student"):
print("going to exit")

key, positions, goal = goTo(mapa, my_pos, ways, positions, state['exit'], True)
if key == '':
key, positions, goal = goTo(mapa, my_pos, ways, positions, state['exit'], True)
print('positions: ' + str(positions))
print('key from goTo (exit): ' + key)
print('goal' + str(goal))
Expand Down Expand Up @@ -277,10 +281,6 @@ async def agent_loop(server_address="localhost:8000", agent_name="student"):
key = 'B'
ways.append('B')

# para apanhar o detonator
elif state['level'] == 3 and len(enemies) == 1 and not detonador:
print('Encontrar caminho até à parede alvo, só 1 enemie: ' + str(wall))
key, positions, goal = goTo(mapa, ways, my_pos, positions, wall, True)

# ha inimigos
elif enemies !=[] :
Expand Down Expand Up @@ -376,7 +376,6 @@ async def agent_loop(server_address="localhost:8000", agent_name="student"):
print("got_powerup: ",got_powerup)
print('Detonador: ', detonador)
print('Bombpass: ', bombpass)
print('Wallpass: ', wallpass)

await websocket.send(
json.dumps({"cmd": "key", "key": key})
Expand Down

0 comments on commit 8ccbc24

Please sign in to comment.