Exemplo n.º 1
0
    def test_execute_action_illegal(self):
        # tests the behavior of execute_action with regards to an illegal move
        board = Board(4, 5, {}, num_of_fish_per_tile=2)
        state = GameState(board, {1: "black", 2: "white"}, [2, 1],
                          penguin_posns={1: [[0, 0], [0, 1], [0, 2], [1, 3]], 2: [[1, 0], [1, 1], [1, 2], [1, 4]]})
        game = GameTree(state)

        game.next_layer()
        assert not game.execute_action(((-1,0), (3,0)))
        assert not game.execute_action(((1, 0), (4, 0)))
Exemplo n.º 2
0
    def test_execute_action_legal(self):
        # tests the behavior of execute_action with regards to a legal move
        board = Board(4, 5, {}, num_of_fish_per_tile=2)
        state = GameState(board, {1: "black", 2: "white"}, [2, 1],
                          penguin_posns={1: [[0, 0], [0, 1], [0, 2], [1, 3]], 2: [[1, 0], [1, 1], [1, 2], [1, 4]]})
        game = GameTree(state)


        game.next_layer()

        assert game.execute_action(((1, 0), (3, 0)))

        game.next_layer()

        game_tree_child_1 = game.get_map_action_to_child_nodes()[((1, 0), (3, 0))]

        assert game_tree_child_1.execute_action(((0,0), (2,0)))