def start_game(self):
    "\n        Start a new game.\n\n        Starts a game with the settings provided in the constructor.\n        All game code is contained here, with relevant helper methods also called here.\n        Every game has two stages: Setup and Play.\n\n        Returns\n        -------\n        int\n            Winning player's number. Zero-indexed.\n        "
    print(('\n' * PAD_AMOUNT))
    Utils.box_string('Setup Phase', min_width=((self.width * 4) + 5), print_string=True)
    Utils.box_string("Player 1's Turn", min_width=((self.width * 4) + 5), print_string=True)
    if (not self.p2_cpu):
        Utils.box_string('Player 2, please look away.', min_width=((self.width * 4) + 5), print_string=True)
        sleep(self.settings['player_timer'])
    Utils.box_string('Player 1 Setup', min_width=((self.width * 4) + 5), print_string=True)
    p1_ship_count = 0
    for i in range(5):
        p1_ship_count = self.setup_ships((i + 1), 0, p1_ship_count)
    if self.p2_cpu:
        self.cpu_data['p1_ships'] = {}
        for size in range(1, 6):
            self.cpu_data['p1_ships'][('%d_ships' % size)] = self.settings[('%d_ships' % size)]
        p2_ship_count = 0
        rng = Random()
        for size in range(1, 6):
            count = 0
            for i in range(self.settings[('%d_ships' % size)]):
                while True:
                    pos = (rng.randrange(self.height), rng.randrange(self.width))
                    direction = rng.randrange(2)
                    error = self.setup_ship(pos, direction, 1, (p2_ship_count + count), size)
                    if (error is None):
                        print(((((((('Placed ship ' + str((p2_ship_count + count))) + ' at ') + str(pos)) + ' with direction ') + str(direction)) + ' with size ') + str(size)))
                        break
                count += 1
            p2_ship_count += count
    else:
        print(('\n' * PAD_AMOUNT))
        Utils.box_string("Player 2's Turn", min_width=((self.width * 4) + 5), print_string=True)
        Utils.box_string('Player 1, please look away.', min_width=((self.width * 4) + 5), print_string=True)
        sleep(self.settings['player_timer'])
        Utils.box_string('Player 2 Setup', min_width=((self.width * 4) + 5), print_string=True)
        p2_ship_count = 0
        for i in range(5):
            p2_ship_count = self.setup_ships((i + 1), 1, p2_ship_count)
    self.update_board(0)
    self.update_board(1)
    Utils.box_string('Play Phase', min_width=((self.width * 4) + 5), print_string=True)
    winner = None
    while True:
        if ((self.settings['mine_turns'] is not None) and ((self.turn % (self.settings['mine_turns'] * 2)) == 0)):
            self.p1_mines += 1
            self.p2_mines += 1
        if ((self.turn % 2) == 0):
            if self.p1_turn():
                winner = 1
                break
        elif self.p2_turn():
            winner = 2
            break
        self.turn += 1
    Utils.box_string(('Player %d won!' % winner), min_width=((self.width * 4) + 5), print_string=True)
    return winner
Start a new game.

Starts a game with the settings provided in the constructor.
All game code is contained here, with relevant helper methods also called here.
Every game has two stages: Setup and Play.

Returns
-------
int
    Winning player's number. Zero-indexed.
def start_game(self):
    "\n        Start a new game.\n\n        Starts a game with the settings provided in the constructor.\n        All game code is contained here, with relevant helper methods also called here.\n        Every game has two stages: Setup and Play.\n\n        Returns\n        -------\n        int\n            Winning player's number. Zero-indexed.\n        "
    print(('\n' * PAD_AMOUNT))
    Utils.box_string('Setup Phase', min_width=((self.width * 4) + 5), print_string=True)
    Utils.box_string("Player 1's Turn", min_width=((self.width * 4) + 5), print_string=True)
    if (not self.p2_cpu):
        Utils.box_string('Player 2, please look away.', min_width=((self.width * 4) + 5), print_string=True)
        sleep(self.settings['player_timer'])
    Utils.box_string('Player 1 Setup', min_width=((self.width * 4) + 5), print_string=True)
    p1_ship_count = 0
    for i in range(5):
        p1_ship_count = self.setup_ships((i + 1), 0, p1_ship_count)
    if self.p2_cpu:
        self.cpu_data['p1_ships'] = {}
        for size in range(1, 6):
            self.cpu_data['p1_ships'][('%d_ships' % size)] = self.settings[('%d_ships' % size)]
        p2_ship_count = 0
        rng = Random()
        for size in range(1, 6):
            count = 0
            for i in range(self.settings[('%d_ships' % size)]):
                while True:
                    pos = (rng.randrange(self.height), rng.randrange(self.width))
                    direction = rng.randrange(2)
                    error = self.setup_ship(pos, direction, 1, (p2_ship_count + count), size)
                    if (error is None):
                        print(((((((('Placed ship ' + str((p2_ship_count + count))) + ' at ') + str(pos)) + ' with direction ') + str(direction)) + ' with size ') + str(size)))
                        break
                count += 1
            p2_ship_count += count
    else:
        print(('\n' * PAD_AMOUNT))
        Utils.box_string("Player 2's Turn", min_width=((self.width * 4) + 5), print_string=True)
        Utils.box_string('Player 1, please look away.', min_width=((self.width * 4) + 5), print_string=True)
        sleep(self.settings['player_timer'])
        Utils.box_string('Player 2 Setup', min_width=((self.width * 4) + 5), print_string=True)
        p2_ship_count = 0
        for i in range(5):
            p2_ship_count = self.setup_ships((i + 1), 1, p2_ship_count)
    self.update_board(0)
    self.update_board(1)
    Utils.box_string('Play Phase', min_width=((self.width * 4) + 5), print_string=True)
    winner = None
    while True:
        if ((self.settings['mine_turns'] is not None) and ((self.turn % (self.settings['mine_turns'] * 2)) == 0)):
            self.p1_mines += 1
            self.p2_mines += 1
        if ((self.turn % 2) == 0):
            if self.p1_turn():
                winner = 1
                break
        elif self.p2_turn():
            winner = 2
            break
        self.turn += 1
    Utils.box_string(('Player %d won!' % winner), min_width=((self.width * 4) + 5), print_string=True)
    return winner