Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions agent_code/rule_based_agent/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ def act(self, game_state):
arena = game_state['field']
_, score, bombs_left, (x, y) = game_state['self']
bombs = game_state['bombs']
bomb_xys = [xy for (xy, t) in bombs]
bomb_xys = [xy for (xy, t, _) in bombs]
others = [xy for (n, s, b, xy) in game_state['others']]
coins = game_state['coins']
bomb_map = np.ones(arena.shape) * 5
for (xb, yb), t in bombs:
for (xb, yb), t, _ in bombs:
for (i, j) in [(xb + h, yb) for h in range(-3, 4)] + [(xb, yb + h) for h in range(-3, 4)]:
if (0 < i < bomb_map.shape[0]) and (0 < j < bomb_map.shape[1]):
bomb_map[i, j] = min(bomb_map[i, j], t)
Expand Down Expand Up @@ -175,7 +175,7 @@ def act(self, game_state):
action_ideas.append('BOMB')

# Add proposal to run away from any nearby bomb about to blow
for (xb, yb), t in bombs:
for (xb, yb), t, _ in bombs:
if (xb == x) and (abs(yb - y) < 4):
# Run away
if (yb > y): action_ideas.append('UP')
Expand All @@ -191,7 +191,7 @@ def act(self, game_state):
action_ideas.append('UP')
action_ideas.append('DOWN')
# Try random direction if directly on top of a bomb
for (xb, yb), t in bombs:
for (xb, yb), t, _ in bombs:
if xb == x and yb == y:
action_ideas.extend(action_ideas[:4])

Expand Down
2 changes: 1 addition & 1 deletion items.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def avatar(self):
return Bomb.DEFAULT_AVATARS[self.color]

def get_state(self):
return (self.x, self.y), self.timer
return (self.x, self.y), self.timer, self.owner.name

def get_blast_coords(self, arena):
x, y = self.x, self.y
Expand Down