def test_add_ship(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [])

        player.add_ship(ship)

        self.assertListEqual(player.ships, [ship])
    def test_overlap_fail3(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 2, [(1, 2), (2, 2)])
        ship2 = fy.Ship("Ship2", 3, [(4, 2), (3, 2), (2, 2)])

        player.add_ship(ship)
        self.assertTrue(fy.overlap(ship2, player))
    def test_overlap_pass(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 2, [(1, 2), (2, 2)])
        ship2 = fy.Ship("Ship2", 3, [(5, 2), (6, 2), (7, 2)])

        player.add_ship(ship)
        self.assertFalse(fy.overlap(ship2, player))
    def test_hit_check_hit_no_kill(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 2, [(1, 2), (2, 2)])

        player.add_ship(ship)
        hit, kill = fy.hit_check(1, 2, player)
        self.assertTrue(hit)
        self.assertFalse(kill)
    def test_hit_check_miss(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [(1, 2)])

        player.add_ship(ship)
        hit, kill = fy.hit_check(1, 1, player)
        self.assertFalse(hit)
        self.assertFalse(kill)
    def test_kill_ship_get_score(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [])
        ship2 = fy.Ship("Ship2", 1, [])
        ship3 = fy.Ship("Ship3", 1, [])

        player.add_ship(ship)
        player.add_ship(ship2)
        player.add_ship(ship3)

        player.kill_ship(ship2)

        self.assertEqual(player.get_score(), (2, 1))
    def test_kill_ship2(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [])
        ship2 = fy.Ship("Ship2", 1, [])
        ship3 = fy.Ship("Ship3", 1, [])

        player.add_ship(ship)
        player.add_ship(ship2)
        player.add_ship(ship3)

        player.kill_ship(ship2)

        self.assertListEqual(player.ships, [ship, ship3])
    def test_reset2(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [])
        ship2 = fy.Ship("Ship2", 1, [])
        ship3 = fy.Ship("Ship3", 1, [])

        player.add_ship(ship)
        player.add_ship(ship2)
        player.add_ship(ship3)

        player.kill_ship(ship2)

        player.reset()
        self.assertEqual(player.ships, [])
    def test_reset1(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [])
        ship2 = fy.Ship("Ship2", 1, [])
        ship3 = fy.Ship("Ship3", 1, [])

        player.add_ship(ship)
        player.add_ship(ship2)
        player.add_ship(ship3)

        player.kill_ship(ship2)

        player.reset()
        self.assertEqual(player.get_score(), (0, 0))
    def test_reset3(self):
        player = fy.Players("Player")
        ship = fy.Ship("Ship", 1, [])
        ship2 = fy.Ship("Ship2", 1, [])
        ship3 = fy.Ship("Ship3", 1, [])

        player.add_ship(ship)
        player.add_ship(ship2)
        player.add_ship(ship3)

        player.kill_ship(ship2)

        player.add_win()

        player.reset()
        self.assertEqual(player.get_wins(), 1)
    def test_get_score(self):
        player = fy.Players("Player")

        self.assertEqual(player.get_score(), (0, 0))
    def test_add_win(self):
        player = fy.Players("Player")

        player.add_win()

        self.assertEqual(player.get_wins(), 1)
    def test_get_win(self):
        player = fy.Players("Player")

        self.assertEqual(player.get_wins(), 0)
    def test_player_creation(self):
        player = fy.Players("Player")

        self.assertIsInstance(player, fy.Players)
    def test_create_ship(self):
        player = fy.Players("Player")

        self.assertIsNotNone(player.ships)
    new_game_button = gui.tkinter.Button(gui.mainWindow,
                                         text="New Game",
                                         command=new_game)
    new_game_button.grid(row=9, column=10, sticky="nsew")

    # Offset used for ship creation on correct side of the screen
    offset = 11
    for i in range(2, ships + 2):
        ship_name_a = "Ship" + str(i) + "A"
        ship_name_b = "Ship" + str(i) + "B"

        fy.create_ship(player_a, ship_name_a, i, 0)
        fy.create_ship(player_b, ship_name_b, i, offset)

    gui.score_box(player_a.get_score(), player_b.get_score(), player1.name,
                  player2.name)
    gui.wins_label(player1.get_wins(), player2.get_wins(), player1.name,
                   player2.name)


if __name__ == "__main__":
    ship_num = int(input("Please input number of ships: "))
    p1 = input("Please input Player 1's name: ")
    p2 = input("Please input Player 2's name: ")
    import gui
    gui.quit_game()
    player1 = fy.Players(p1)
    player2 = fy.Players(p2)
    play(player1, player2, ship_num)
    gui.set_up()