def update_board(self, player):
    "\n        Update both grids for a player.\n\n        Adds new ships and puts them into the right locations.\n\n        Parameters\n        ----------\n        player : int\n            Determines which player's grids to print. Zero-indexed.\n        "
    if (player == 0):
        board = self.p1_grid
        for ship in self.p1_ships:
            if (not ship['setup']):
                if (ship['direction'] == 0):
                    for i in range(ship['size']):
                        if (not ((1 <= board[ship['y_pos']][(ship['x_pos'] + i)] <= 26) or (board[ship['y_pos']][(ship['x_pos'] + i)] == 26))):
                            board[ship['y_pos']][(ship['x_pos'] + i)] = (ship['num'] + 1)
                else:
                    for j in range(ship['size']):
                        if (not ((1 <= board[(ship['y_pos'] + j)][ship['x_pos']] <= 26) or (board[(ship['y_pos'] + j)][ship['x_pos']] == 26))):
                            board[(ship['y_pos'] + j)][ship['x_pos']] = (ship['num'] + 1)
                ship['setup'] = True
    else:
        board = self.p2_grid
        for ship in self.p2_ships:
            if (not ship['setup']):
                if (ship['direction'] == 0):
                    for i in range(ship['size']):
                        if (not ((1 <= board[ship['y_pos']][(ship['x_pos'] + i)] <= 26) or (board[ship['y_pos']][(ship['x_pos'] + i)] == 26))):
                            board[ship['y_pos']][(ship['x_pos'] + i)] = (ship['num'] + 1)
                else:
                    for j in range(ship['size']):
                        if (not ((1 <= board[(ship['y_pos'] + j)][ship['x_pos']] <= 26) or (board[(ship['y_pos'] + j)][ship['x_pos']] == 26))):
                            board[(ship['y_pos'] + j)][ship['x_pos']] = (ship['num'] + 1)
                ship['setup'] = True
Update both grids for a player.

Adds new ships and puts them into the right locations.

Parameters
----------
player : int
    Determines which player's grids to print. Zero-indexed.
def update_board(self, player):
    "\n        Update both grids for a player.\n\n        Adds new ships and puts them into the right locations.\n\n        Parameters\n        ----------\n        player : int\n            Determines which player's grids to print. Zero-indexed.\n        "
    if (player == 0):
        board = self.p1_grid
        for ship in self.p1_ships:
            if (not ship['setup']):
                if (ship['direction'] == 0):
                    for i in range(ship['size']):
                        if (not ((1 <= board[ship['y_pos']][(ship['x_pos'] + i)] <= 26) or (board[ship['y_pos']][(ship['x_pos'] + i)] == 26))):
                            board[ship['y_pos']][(ship['x_pos'] + i)] = (ship['num'] + 1)
                else:
                    for j in range(ship['size']):
                        if (not ((1 <= board[(ship['y_pos'] + j)][ship['x_pos']] <= 26) or (board[(ship['y_pos'] + j)][ship['x_pos']] == 26))):
                            board[(ship['y_pos'] + j)][ship['x_pos']] = (ship['num'] + 1)
                ship['setup'] = True
    else:
        board = self.p2_grid
        for ship in self.p2_ships:
            if (not ship['setup']):
                if (ship['direction'] == 0):
                    for i in range(ship['size']):
                        if (not ((1 <= board[ship['y_pos']][(ship['x_pos'] + i)] <= 26) or (board[ship['y_pos']][(ship['x_pos'] + i)] == 26))):
                            board[ship['y_pos']][(ship['x_pos'] + i)] = (ship['num'] + 1)
                else:
                    for j in range(ship['size']):
                        if (not ((1 <= board[(ship['y_pos'] + j)][ship['x_pos']] <= 26) or (board[(ship['y_pos'] + j)][ship['x_pos']] == 26))):
                            board[(ship['y_pos'] + j)][ship['x_pos']] = (ship['num'] + 1)
                ship['setup'] = True