def p2_turn(self):
    "\n        Execute a turn for Player 2.\n\n        Handles input and output for the turn and updates both player's grids.\n\n        Returns\n        -------\n        bool\n            True if game ends after the move, False otherwise\n        "
    print(('\n' * PAD_AMOUNT))
    Utils.box_string("Player 2's Turn", min_width=((self.width * 4) + 5), print_string=True)
    self.p2_move = ''
    if (not self.p2_cpu):
        Utils.box_string('Player 1, please look away.', min_width=((self.width * 4) + 5), print_string=True)
        sleep(self.settings['player_timer'])
        self.print_board(1)
        if (self.p1_move != ''):
            Utils.box_string(('Note: ' + self.p1_move), min_width=((self.width * 4) + 5), print_string=True)
        if self.settings['allow_moves']:
            if (self.settings['allow_mines'] and (self.p2_mines > 0)):
                action = Utils.num_input('What do you want to do?', 'Fire Missile', 'Move a Ship', 'Clear Misses', 'Clear Hits', 'Place a Mine')
            else:
                action = Utils.num_input('What do you want to do?', 'Fire Missile', 'Move a Ship', 'Clear Misses', 'Clear Hits')
            if (action == 0):
                error = ''
                while True:
                    (y_pos, x_pos) = Utils.grid_pos_input(self.height, self.width, question=(error + '\nWhere do you want to fire?').strip())
                    if ((True in [((y_pos, x_pos) in self.p1_ships[x]['hits']) for x in range(len(self.p1_ships))]) or (self.p2_grid_2[y_pos][x_pos] > 26)):
                        error = 'ERROR: You already guessed there!'
                        continue
                    if (self.p1_grid[y_pos][x_pos] > 26):
                        error = 'ERROR: You already guessed there!'
                        continue
                    if (self.p1_grid[y_pos][x_pos] != 0):
                        Utils.box_string('Direct Hit!', min_width=((self.width * 4) + 5), print_string=True)
                        self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] -= 1
                        self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['hits'].append((y_pos, x_pos))
                        if (self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] == 0):
                            Utils.box_string('You sunk a ship!', min_width=((self.width * 4) + 5), print_string=True)
                        self.p2_grid_2[y_pos][x_pos] = 27
                        self.p1_grid[y_pos][x_pos] = 27
                    else:
                        Utils.box_string('Miss!', min_width=((self.width * 4) + 5), print_string=True)
                        self.p2_grid_2[y_pos][x_pos] = 28
                        self.p1_grid[y_pos][x_pos] = 28
                    break
            elif (action == 1):
                error = ''
                ship_num = (- 1)
                while True:
                    ship_num = letters.index(Utils.string_input((error + '\nWhich ship do you want to move?').strip(), condition=('[A-%sa-%s]' % (letters[(len(self.p1_ships) - 1)], letters[(len(self.p1_ships) - 1)].lower()))).upper())
                    ship = self.p2_ships[ship_num]
                    if (ship['health'] == 0):
                        error = 'ERROR: That ship is sunk!'
                        continue
                    move_direction = Utils.num_input('Which direction do you want to move it?', 'Up', 'Down', 'Left', 'Right')
                    error = ''
                    try:
                        if (move_direction < 2):
                            true_dir = ((- 1) if (move_direction == 0) else 1)
                            board = self.p2_grid
                            if (ship['direction'] == 0):
                                for i in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == (ship['y_pos'] + true_dir)) and ((ship2['x_pos'] + k) == (ship['x_pos'] + i))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == (ship['y_pos'] + true_dir)) and (ship2['x_pos'] == (ship['x_pos'] + i))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] <= 26) or (board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] == 29)) and (board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] != (ship_num + 1))) or ((ship['y_pos'] + true_dir) < 0) or (ship['y_pos'] >= self.height)):
                                        error = 'ERROR: You cannot move your ship there!'
                            else:
                                for j in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == ((ship['y_pos'] + j) + true_dir)) and ((ship2['x_pos'] + k) == ship['x_pos'])):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == ((ship['y_pos'] + j) + true_dir)) and (ship2['x_pos'] == ship['x_pos'])):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] <= 26) or (board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] == 29)) and (board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] != (ship_num + 1))) or (((ship['y_pos'] + j) + true_dir) < 0) or (ship['y_pos'] >= self.height)):
                                        error = 'ERROR: You cannot move your ship there!'
                            if (error == ''):
                                self.p2_ships[ship_num]['setup'] = False
                                self.p2_ships[ship_num]['y_pos'] += true_dir
                                self.p2_move = ('Player 2 just moved a ship ' + ('up!' if (move_direction == 0) else 'down!'))
                                if (ship['direction'] == 0):
                                    for i in range((ship['size'] - 1)):
                                        board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] = 0
                                else:
                                    for j in range((ship['size'] - 1)):
                                        board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] = 0
                                break
                        else:
                            true_dir = ((- 1) if (move_direction == 2) else 1)
                            board = self.p2_grid
                            if (ship['direction'] == 0):
                                for i in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == ship['y_pos']) and ((ship2['x_pos'] + k) == ((ship['x_pos'] + i) + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == ship['y_pos']) and (ship2['x_pos'] == ((ship['x_pos'] + i) + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] <= 26) or (board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] == 29)) and (board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] != (ship_num + 1))) or (((ship['x_pos'] + i) + true_dir) < 0) or (ship['x_pos'] >= self.width)):
                                        error = 'ERROR: You cannot move your ship there!'
                            else:
                                for j in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == (ship['y_pos'] + j)) and ((ship2['x_pos'] + k) == (ship['x_pos'] + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == (ship['y_pos'] + j)) and (ship2['x_pos'] == (ship['x_pos'] + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] <= 26) or (board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] == 29)) and (board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] != (ship_num + 1))) or ((ship['x_pos'] + true_dir) < 0) or (ship['x_pos'] >= self.width)):
                                        error = 'ERROR: You cannot move your ship there!'
                            if (error == ''):
                                self.p2_ships[ship_num]['setup'] = False
                                self.p2_ships[ship_num]['x_pos'] += true_dir
                                self.p2_move = ('Player 2 just moved a ship to the ' + ('left!' if (move_direction == 2) else 'right!'))
                                if (ship['direction'] == 0):
                                    for i in range((ship['size'] - 1)):
                                        board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] = 0
                                else:
                                    for j in range((ship['size'] - 1)):
                                        board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] = 0
                                break
                    except IndexError:
                        error = 'ERROR: You cannot move your ship there! (INDEX ERROR)'
                for i in range(self.height):
                    for j in range(self.width):
                        if (board[i][j] == (ship_num + 1)):
                            board[i][j] = 0
                self.p2_ships[ship_num]['hits'] = []
                self.update_board(1)
            elif (action == 2):
                for i in range(self.height):
                    for j in range(self.width):
                        if (self.p2_grid_2[i][j] == 28):
                            self.p2_grid_2[i][j] = 0
                return self.p2_turn()
            elif (action == 3):
                for i in range(self.height):
                    for j in range(self.width):
                        if (self.p2_grid_2[i][j] == 27):
                            self.p2_grid_2[i][j] = 0
                return self.p2_turn()
            else:
                error = ''
                while True:
                    (y_pos, x_pos) = Utils.grid_pos_input(self.height, self.width, question=(error + '\nWhere do you want to place the mine?').strip())
                    if (self.p1_grid[y_pos][x_pos] == 29):
                        error = 'ERROR: You already placed a mine there!'
                        continue
                    if (1 <= self.p1_grid[y_pos][x_pos] <= 26):
                        ship_num = (self.p1_grid[y_pos][x_pos] - 1)
                        self.p1_ships[ship_num]['health'] = 0
                        for i in range(self.height):
                            for j in range(self.width):
                                if (self.p1_grid[i][j] == (ship_num + 1)):
                                    self.p1_grid[i][j] = 27
                        Utils.box_string('You sunk a ship!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p1_grid[y_pos][x_pos] = 29
                    self.p2_grid_2[y_pos][x_pos] = 29
                    self.p2_mines -= 1
                    break
        else:
            error = ''
            while True:
                (y_pos, x_pos) = Utils.grid_pos_input(self.height, self.width, question=(error + '\nWhere do you want to fire?').strip())
                if (self.p2_grid_2[y_pos][x_pos] != 0):
                    error = 'ERROR: You already guessed there!'
                    continue
                if (self.p1_grid[y_pos][x_pos] > 26):
                    error = 'ERROR: You already guessed there!'
                    continue
                if (self.p1_grid[y_pos][x_pos] != 0):
                    Utils.box_string('Direct Hit!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] -= 1
                    self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['hits'].append((y_pos, x_pos))
                    if (self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] == 0):
                        Utils.box_string('You sunk a ship!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p2_grid_2[y_pos][x_pos] = 27
                    self.p1_grid[y_pos][x_pos] = 27
                else:
                    Utils.box_string('Miss!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p2_grid_2[y_pos][x_pos] = 28
                    self.p1_grid[y_pos][x_pos] = 28
                break
    else:
        Utils.box_string('CPU is deciding...', min_width=((self.width * 4) + 5), print_string=True)
        sleep(2)
        rng = Random()
        while True:
            pos = (rng.randrange(self.height), rng.randrange(self.width))
            (y_pos, x_pos) = pos
            if (self.p1_grid[y_pos][x_pos] != 0):
                self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] -= 1
                self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['hits'].append((y_pos, x_pos))
                if (self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] == 0):
                    self.cpu_data['p1_ships'][('%d_ships' % self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['size'])] -= 1
                self.p2_grid_2[y_pos][x_pos] = 27
                self.p1_grid[y_pos][x_pos] = 27
            else:
                self.p2_grid_2[y_pos][x_pos] = 28
                self.p1_grid[y_pos][x_pos] = 28
            break
    Utils.box_string('Your turn is now over.', print_string=True)
    sleep(self.settings['player_timer'])
    return (sum([x['health'] for x in self.p1_ships]) == 0)
Execute a turn for Player 2.

Handles input and output for the turn and updates both player's grids.

Returns
-------
bool
    True if game ends after the move, False otherwise
def p2_turn(self):
    "\n        Execute a turn for Player 2.\n\n        Handles input and output for the turn and updates both player's grids.\n\n        Returns\n        -------\n        bool\n            True if game ends after the move, False otherwise\n        "
    print(('\n' * PAD_AMOUNT))
    Utils.box_string("Player 2's Turn", min_width=((self.width * 4) + 5), print_string=True)
    self.p2_move = 
    if (not self.p2_cpu):
        Utils.box_string('Player 1, please look away.', min_width=((self.width * 4) + 5), print_string=True)
        sleep(self.settings['player_timer'])
        self.print_board(1)
        if (self.p1_move != ):
            Utils.box_string(('Note: ' + self.p1_move), min_width=((self.width * 4) + 5), print_string=True)
        if self.settings['allow_moves']:
            if (self.settings['allow_mines'] and (self.p2_mines > 0)):
                action = Utils.num_input('What do you want to do?', 'Fire Missile', 'Move a Ship', 'Clear Misses', 'Clear Hits', 'Place a Mine')
            else:
                action = Utils.num_input('What do you want to do?', 'Fire Missile', 'Move a Ship', 'Clear Misses', 'Clear Hits')
            if (action == 0):
                error = 
                while True:
                    (y_pos, x_pos) = Utils.grid_pos_input(self.height, self.width, question=(error + '\nWhere do you want to fire?').strip())
                    if ((True in [((y_pos, x_pos) in self.p1_ships[x]['hits']) for x in range(len(self.p1_ships))]) or (self.p2_grid_2[y_pos][x_pos] > 26)):
                        error = 'ERROR: You already guessed there!'
                        continue
                    if (self.p1_grid[y_pos][x_pos] > 26):
                        error = 'ERROR: You already guessed there!'
                        continue
                    if (self.p1_grid[y_pos][x_pos] != 0):
                        Utils.box_string('Direct Hit!', min_width=((self.width * 4) + 5), print_string=True)
                        self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] -= 1
                        self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['hits'].append((y_pos, x_pos))
                        if (self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] == 0):
                            Utils.box_string('You sunk a ship!', min_width=((self.width * 4) + 5), print_string=True)
                        self.p2_grid_2[y_pos][x_pos] = 27
                        self.p1_grid[y_pos][x_pos] = 27
                    else:
                        Utils.box_string('Miss!', min_width=((self.width * 4) + 5), print_string=True)
                        self.p2_grid_2[y_pos][x_pos] = 28
                        self.p1_grid[y_pos][x_pos] = 28
                    break
            elif (action == 1):
                error = 
                ship_num = (- 1)
                while True:
                    ship_num = letters.index(Utils.string_input((error + '\nWhich ship do you want to move?').strip(), condition=('[A-%sa-%s]' % (letters[(len(self.p1_ships) - 1)], letters[(len(self.p1_ships) - 1)].lower()))).upper())
                    ship = self.p2_ships[ship_num]
                    if (ship['health'] == 0):
                        error = 'ERROR: That ship is sunk!'
                        continue
                    move_direction = Utils.num_input('Which direction do you want to move it?', 'Up', 'Down', 'Left', 'Right')
                    error = 
                    try:
                        if (move_direction < 2):
                            true_dir = ((- 1) if (move_direction == 0) else 1)
                            board = self.p2_grid
                            if (ship['direction'] == 0):
                                for i in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == (ship['y_pos'] + true_dir)) and ((ship2['x_pos'] + k) == (ship['x_pos'] + i))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == (ship['y_pos'] + true_dir)) and (ship2['x_pos'] == (ship['x_pos'] + i))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] <= 26) or (board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] == 29)) and (board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] != (ship_num + 1))) or ((ship['y_pos'] + true_dir) < 0) or (ship['y_pos'] >= self.height)):
                                        error = 'ERROR: You cannot move your ship there!'
                            else:
                                for j in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == ((ship['y_pos'] + j) + true_dir)) and ((ship2['x_pos'] + k) == ship['x_pos'])):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == ((ship['y_pos'] + j) + true_dir)) and (ship2['x_pos'] == ship['x_pos'])):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] <= 26) or (board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] == 29)) and (board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] != (ship_num + 1))) or (((ship['y_pos'] + j) + true_dir) < 0) or (ship['y_pos'] >= self.height)):
                                        error = 'ERROR: You cannot move your ship there!'
                            if (error == ):
                                self.p2_ships[ship_num]['setup'] = False
                                self.p2_ships[ship_num]['y_pos'] += true_dir
                                self.p2_move = ('Player 2 just moved a ship ' + ('up!' if (move_direction == 0) else 'down!'))
                                if (ship['direction'] == 0):
                                    for i in range((ship['size'] - 1)):
                                        board[(ship['y_pos'] + true_dir)][(ship['x_pos'] + i)] = 0
                                else:
                                    for j in range((ship['size'] - 1)):
                                        board[((ship['y_pos'] + j) + true_dir)][ship['x_pos']] = 0
                                break
                        else:
                            true_dir = ((- 1) if (move_direction == 2) else 1)
                            board = self.p2_grid
                            if (ship['direction'] == 0):
                                for i in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == ship['y_pos']) and ((ship2['x_pos'] + k) == ((ship['x_pos'] + i) + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == ship['y_pos']) and (ship2['x_pos'] == ((ship['x_pos'] + i) + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] <= 26) or (board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] == 29)) and (board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] != (ship_num + 1))) or (((ship['x_pos'] + i) + true_dir) < 0) or (ship['x_pos'] >= self.width)):
                                        error = 'ERROR: You cannot move your ship there!'
                            else:
                                for j in range(ship['size']):
                                    for ship2 in self.p2_ships:
                                        if (ship2['direction'] == 0):
                                            for k in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and (ship2['y_pos'] == (ship['y_pos'] + j)) and ((ship2['x_pos'] + k) == (ship['x_pos'] + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                        else:
                                            for l in range(ship2['size']):
                                                if ((ship2['num'] != ship_num) and ((ship2['y_pos'] + l) == (ship['y_pos'] + j)) and (ship2['x_pos'] == (ship['x_pos'] + true_dir))):
                                                    error = 'ERROR: You cannot move your ship there!'
                                                    continue
                                    if ((((1 <= board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] <= 26) or (board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] == 29)) and (board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] != (ship_num + 1))) or ((ship['x_pos'] + true_dir) < 0) or (ship['x_pos'] >= self.width)):
                                        error = 'ERROR: You cannot move your ship there!'
                            if (error == ):
                                self.p2_ships[ship_num]['setup'] = False
                                self.p2_ships[ship_num]['x_pos'] += true_dir
                                self.p2_move = ('Player 2 just moved a ship to the ' + ('left!' if (move_direction == 2) else 'right!'))
                                if (ship['direction'] == 0):
                                    for i in range((ship['size'] - 1)):
                                        board[ship['y_pos']][((ship['x_pos'] + i) + true_dir)] = 0
                                else:
                                    for j in range((ship['size'] - 1)):
                                        board[(ship['y_pos'] + j)][(ship['x_pos'] + true_dir)] = 0
                                break
                    except IndexError:
                        error = 'ERROR: You cannot move your ship there! (INDEX ERROR)'
                for i in range(self.height):
                    for j in range(self.width):
                        if (board[i][j] == (ship_num + 1)):
                            board[i][j] = 0
                self.p2_ships[ship_num]['hits'] = []
                self.update_board(1)
            elif (action == 2):
                for i in range(self.height):
                    for j in range(self.width):
                        if (self.p2_grid_2[i][j] == 28):
                            self.p2_grid_2[i][j] = 0
                return self.p2_turn()
            elif (action == 3):
                for i in range(self.height):
                    for j in range(self.width):
                        if (self.p2_grid_2[i][j] == 27):
                            self.p2_grid_2[i][j] = 0
                return self.p2_turn()
            else:
                error = 
                while True:
                    (y_pos, x_pos) = Utils.grid_pos_input(self.height, self.width, question=(error + '\nWhere do you want to place the mine?').strip())
                    if (self.p1_grid[y_pos][x_pos] == 29):
                        error = 'ERROR: You already placed a mine there!'
                        continue
                    if (1 <= self.p1_grid[y_pos][x_pos] <= 26):
                        ship_num = (self.p1_grid[y_pos][x_pos] - 1)
                        self.p1_ships[ship_num]['health'] = 0
                        for i in range(self.height):
                            for j in range(self.width):
                                if (self.p1_grid[i][j] == (ship_num + 1)):
                                    self.p1_grid[i][j] = 27
                        Utils.box_string('You sunk a ship!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p1_grid[y_pos][x_pos] = 29
                    self.p2_grid_2[y_pos][x_pos] = 29
                    self.p2_mines -= 1
                    break
        else:
            error = 
            while True:
                (y_pos, x_pos) = Utils.grid_pos_input(self.height, self.width, question=(error + '\nWhere do you want to fire?').strip())
                if (self.p2_grid_2[y_pos][x_pos] != 0):
                    error = 'ERROR: You already guessed there!'
                    continue
                if (self.p1_grid[y_pos][x_pos] > 26):
                    error = 'ERROR: You already guessed there!'
                    continue
                if (self.p1_grid[y_pos][x_pos] != 0):
                    Utils.box_string('Direct Hit!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] -= 1
                    self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['hits'].append((y_pos, x_pos))
                    if (self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] == 0):
                        Utils.box_string('You sunk a ship!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p2_grid_2[y_pos][x_pos] = 27
                    self.p1_grid[y_pos][x_pos] = 27
                else:
                    Utils.box_string('Miss!', min_width=((self.width * 4) + 5), print_string=True)
                    self.p2_grid_2[y_pos][x_pos] = 28
                    self.p1_grid[y_pos][x_pos] = 28
                break
    else:
        Utils.box_string('CPU is deciding...', min_width=((self.width * 4) + 5), print_string=True)
        sleep(2)
        rng = Random()
        while True:
            pos = (rng.randrange(self.height), rng.randrange(self.width))
            (y_pos, x_pos) = pos
            if (self.p1_grid[y_pos][x_pos] != 0):
                self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] -= 1
                self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['hits'].append((y_pos, x_pos))
                if (self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['health'] == 0):
                    self.cpu_data['p1_ships'][('%d_ships' % self.p1_ships[(self.p1_grid[y_pos][x_pos] - 1)]['size'])] -= 1
                self.p2_grid_2[y_pos][x_pos] = 27
                self.p1_grid[y_pos][x_pos] = 27
            else:
                self.p2_grid_2[y_pos][x_pos] = 28
                self.p1_grid[y_pos][x_pos] = 28
            break
    Utils.box_string('Your turn is now over.', print_string=True)
    sleep(self.settings['player_timer'])
    return (sum([x['health'] for x in self.p1_ships]) == 0)