示例#1
0
 def test_game_computer_turn_cant_move(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.objects[(game.kx * 2, game.ky)] = Computer_checkers(game.kx * 2,
                                                              game.ky,
                                                              game.kx,
                                                              (255, 0, 0))
     game.objects[(game.kx * 2, game.ky * 3)] = Player_checkers(game.kx * 2,
                                                                game.ky * 3,
                                                                game.kx,
                                                                (0, 0, 0))
     game.objects[(game.kx * 2, game.ky * 5)] = Player_checkers(game.kx * 2,
                                                                game.ky * 5,
                                                                game.kx,
                                                                (0, 0, 0))
     game.objects[(game.kx * 5, game.ky * 2)] = Player_checkers(game.kx * 5,
                                                                game.ky * 2,
                                                                game.kx,
                                                                (0, 0, 0))
     game.objects[(game.kx * 8, game.ky * 3)] = Player_checkers(game.kx * 8,
                                                                game.ky * 3,
                                                                game.kx,
                                                                (0, 0, 0))
     game.computer_turn()
     self.assertTrue(game.objects[(game.kx * 2, game.ky)] is not None)
示例#2
0
 def test_game_computer_turn_move_checker_become_king(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.objects[(game.kx * 5, game.ky * 18)] = Computer_checkers(
         game.kx * 5, game.ky * 18, game.kx, (255, 0, 0))
     game.computer_turn()
     game.computer_turn()
     game.computer_turn()
     self.assertTrue(True)
示例#3
0
 def test_game_computer_turn_move_and_eat_checker_up_right(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.objects[(game.kx * 2, game.ky * 5)] = Computer_checkers(
         game.kx * 2, game.ky * 5, game.kx, (255, 0, 0))
     game.objects[(game.kx * 5, game.ky * 4)] = Player_checkers(game.kx * 5,
                                                                game.ky * 4,
                                                                game.kx,
                                                                (0, 0, 0))
     game.computer_turn()
     self.assertTrue(game.objects[(game.kx * 5, game.ky * 4)] is None)
示例#4
0
 def test_game_computer_turn_move_and_eat_checker_down_left_king(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.objects[(game.kx * 8, game.ky * 3)] = Computer_checkers(
         game.kx * 8, game.ky * 3, game.kx, (255, 0, 0))
     game.objects[(game.kx * 8, game.ky * 3)].checkers_type = "king"
     game.objects[(game.kx * 5, game.ky * 4)] = Player_checkers(game.kx * 5,
                                                                game.ky * 4,
                                                                game.kx,
                                                                (0, 0, 0))
     game.computer_turn()
     self.assertTrue(game.objects[(game.kx * 5, game.ky * 4)] is None)
示例#5
0
 def test_game_computer_turn_move_checker(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.objects[(game.kx * 5, game.ky * 2)] = Computer_checkers(
         game.kx * 5, game.ky * 2, game.kx, (255, 0, 0))
     game.objects[(game.kx * 5, game.ky * 6)] = Player_checkers(game.kx * 5,
                                                                game.ky * 6,
                                                                game.kx,
                                                                (0, 0, 0))
     game.objects[(game.kx * 5, game.ky * 8)] = Player_checkers(game.kx * 5,
                                                                game.ky * 8,
                                                                game.kx,
                                                                (0, 0, 0))
     game.computer_turn()
     game.computer_turn()
     self.assertEqual(None, game.objects.get((game.kx * 5, game.ky * 4)))