MultiAgentLearning / playground

PlayGround: AI Research into Multi-Agent Learning.
https://www.pommerman.com
Apache License 2.0
768 stars 216 forks source link

V1 Enviroment - Wall collapsing on square shared by agent AND bomb #175

Closed suphoff closed 5 years ago

suphoff commented 6 years ago

The code below fails if square contains an agent AND a bomb and leaves the game state inconsistent.

Should contain:

if utility.position_is_bomb(self._bombs, (r, c)):

instead of

 elif utility.position_is_bomb(self._bombs, (r, c)):
  def collapse(r, c):
            '''Handles the collapsing of the board. Will
            kill of remove any item/agent that is on the
            collapsing tile.'''
            if utility.position_is_agent(board, (r, c)):
                # Agent. Kill it.
                num_agent = board[r][c] - constants.Item.Agent0.value
                agent = self._agents[num_agent]
                agent.die()
            elif utility.position_is_bomb(self._bombs, (r, c)):
                # Bomb. Remove the bomb. Update agent's ammo tally.
                new_bombs = []
                for b in self._bombs:
                    if b.position == (r, c):
                        b.bomber.incr_ammo()
                    else:
                        new_bombs.append(b)
                self._bombs = new_bombs
cinjon commented 5 years ago

Thanks for pointing this out. Finally got to it in cd5f9fe.