def test_computer_put_his_ships(self): computer = single_player.player.Player(10, 5) single_player.computer_put_his_ships(computer) number_of_parts = 0 for row in computer.sea.board: part = filter(lambda cell: isinstance(cell.content, ShipPart), row) number_of_parts += len(list(part)) self.assertEqual(number_of_parts, 17)
pygame.display.flip() else: print("You lost!") image = pygame.image.load(".\images\you_lost.jpg") screen.blit(image, (30, 100)) pygame.display.flip() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() turn = True put_your_ships(player1) single_player.computer_put_his_ships(computer) while True: draw_board() pygame.display.flip() for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() while turn: for event in pygame.event.get(): if event.type == pygame.QUIT: