-
-
Save joooyzee/b053ab09eb908996633c269c6492cffd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from .helpers import * | |
class Agent: | |
def __init__(self): | |
''' | |
Place any initialization code for your agent here (if any) | |
''' | |
self.pending_actions = [] | |
def next_move(self, game_state, player_state): | |
''' | |
This method is called each time your Agent is required to choose an action | |
''' | |
print(f"tick: {game_state.tick_number}") | |
# ammo spawns randomly | |
ammo = get_ammo(game_state) | |
treasure = get_treasure(game_state) | |
if len(self.pending_actions) > 0: | |
action = self.pending_actions.pop() | |
print(f"moving: {action}") | |
elif ammo: | |
path = astar(game_state, player_state.location, ammo) | |
if path: | |
actions = get_path_actions(path) | |
print(f"--ACTIONS: {actions}") | |
for action in actions: | |
self.pending_actions.append(action) | |
action = self.pending_actions.pop() | |
else: | |
action = '' | |
else: | |
action = '' | |
return action |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment