(self, ring)
return board
Collapses the board at a certain ring radius.

        For example, if the board is 13x13 and ring is 0, then the the ring of
        the first row, last row, first column, and last column is all going to
        be turned into rigid walls. All agents in that ring die and all bombs
        are removed without detonating.
        
        For further rings, the values get closer to the center.

        Args:
          ring: Integer value of which cells to collapse.
Collapses the board at a certain ring radius.
Collapses the board at a certain ring radius .
def _collapse_board(self, ring):
        """Collapses the board at a certain ring radius.

        For example, if the board is 13x13 and ring is 0, then the the ring of
        the first row, last row, first column, and last column is all going to
        be turned into rigid walls. All agents in that ring die and all bombs
        are removed without detonating.
        
        For further rings, the values get closer to the center.

        Args:
          ring: Integer value of which cells to collapse.
        """
        board = self._board.copy()

        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()
            if 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
            if utility.position_is_flames(board, (r, c)):
                self._flames = [f for f in self._flames if f.position != (r,c)]
            if (r, c) in self._items:
                # Item. Remove the item.
                del self._items[(r, c)]
            board[r][c] = constants.Item.Rigid.value

        for cell in range(ring, self._board_size - ring):
            collapse(ring, cell)
            if ring != cell:
                collapse(cell, ring)

            end = self._board_size - ring - 1
            collapse(end, cell)
            if end != cell:
                collapse(cell, end)

        return board
def _collapse_board ( self , ring ) : board = self . _board . copy ( ) 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 ( ) if 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 if utility . position_is_flames ( board , ( r , c ) ) : self . _flames = [ f for f in self . _flames if f . position != ( r , c ) ] if ( r , c ) in self . _items : # Item. Remove the item. del self . _items [ ( r , c ) ] board [ r ] [ c ] = constants . Item . Rigid . value for cell in range ( ring , self . _board_size - ring ) : collapse ( ring , cell ) if ring != cell : collapse ( cell , ring ) end = self . _board_size - ring - 1 collapse ( end , cell ) if end != cell : collapse ( cell , end ) return board