예제 #1
0
    def test_random_agent(self):
        # Givent
        g = Game()
        a = RandomAgent(0)

        m = a.get_move(g)

        self.assertTrue(type(m) is Move)
예제 #2
0
    def test_greedy_point_agent(self):
        # Givent
        g = Game()
        a = GreedyPointAgent(0)

        m = a.get_move(g)

        self.assertTrue(type(m) is Move)
예제 #3
0
    def test_pop(self):

        g1 = Game()
        g2 = Game()

        self.assertEqual(g1, g2)

        g1.make_move(moves[0])

        self.assertNotEqual(g1, g2)

        g1.pop()

        self.assertEqual(g1, g2)
예제 #4
0
    def test_game(self):
        # Given
        game = Game()

        # When
        actual_moves = [set(game.get_players_moves(i)) for i in range(4)]
        self.assertEqual(turn_moves[0], actual_moves)

        for move, expected_moves in zip(moves, turn_moves[1:]):

            game.make_move(move)

            actual_moves = [set(game.get_players_moves(i)) for i in range(4)]

            self.assertEqual(actual_moves, expected_moves)

        self.assertFalse(game.has_moves())
예제 #5
0
def time_game():
    g = Game()
    for move in moves:
        g.make_move(move)

    return g