Esempio n. 1
0
class TestUtils(unittest.TestCase):
    def test_get_drop_lists(self):
        carry = 1
        moves = 1
        self.assertEqual(get_drop_lists(carry, moves), [[1]])

        carry = 2
        moves = 1
        self.assertEqual(get_drop_lists(carry, moves), [[2]])

        carry = 2
        moves = 2
        self.assertEqual(get_drop_lists(carry, moves), [[1, 1]])

        carry = 3
        moves = 2
        self.assertEqual(get_drop_lists(carry, moves), [[1, 2], [2, 1]])

        carry = 6
        moves = 3
        self.assertEqual(get_drop_lists(carry, moves), [
            [2, 2, 2],
            [3, 1, 2],
            [1, 3, 2],
            [3, 2, 1],
            [2, 1, 3],
            [1, 4, 1],
            [2, 3, 1],
            [1, 2, 3],
            [4, 1, 1],
            [1, 1, 4],
        ])

    def test_split_stack(self):
        a = ['a', 'b', 'c', 'd', 'e', 'f']
        b = []
        c = ['a']

        expected_1 = ['a', 'b', 'c']
        expected_2 = ['d', 'e', 'f']
        actual_1, actual_2 = split_stack(a, 3)
        self.assertEqual(actual_1, expected_1)
        self.assertEqual(actual_2, expected_2)

        expected_1 = []
        expected_2 = ['a']
        actual_1, actual_2 = split_stack(c, 1)
        self.assertEqual(actual_1, expected_1)
        self.assertEqual(actual_2, expected_2)

        expected_1 = []
        expected_2 = ['a', 'b', 'c', 'd', 'e', 'f']
        actual_1, actual_2 = split_stack(a, 6)
        self.assertEqual(actual_1, expected_1)
        self.assertEqual(actual_2, expected_2)

        with self.assertRaises(RuntimeError):
            split_stack(a, 0)

        with self.assertRaises(RuntimeError):
            split_stack(b, 1)

    def test_get_controlled(self):
        board = self.blank_state.board
        coord = (1, 1)
        color = Color.BLACK
        self.assertEqual(False, get_controlled(board, coord, color))

        board = self.test_state_1.board
        self.assertEqual(False, get_controlled(board, coord, color))

        color = Color.WHITE
        self.assertEqual(True, get_controlled(board, coord, color))

    def test_bfs(self):
        board = self.blank_state.board
        start = (0, 0)
        goal = [(3, 0), (3, 1), (3, 2), (3, 3)]
        color = Color.WHITE
        self.assertEqual(False, bfs(board, start, goal, color))

        board = self.bfs_state_1.board
        self.assertEqual(True, bfs(board, start, goal, color))

        board = self.bfs_state_2.board
        self.assertEqual(True, bfs(board, start, goal, color))

        color = Color.BLACK
        self.assertEqual(False, bfs(board, start, goal, color))

        board = self.bfs_state_3.board
        self.assertEqual(False, bfs(board, start, goal, color))

    def test_get_path(self):
        state = self.blank_state
        self.assertEqual((False, False), get_path(state))

        state = self.bfs_state_1
        self.assertEqual((False, True), get_path(state))

        state = self.get_path_1
        self.assertEqual((True, True), get_path(state))

    def setUp(self):
        self.blank_state = State(to_move=Color.BLACK,
                                 black_stones=15,
                                 white_stones=15,
                                 board=[
                                     [[], [], [], []],
                                     [[], [], [], []],
                                     [[], [], [], []],
                                     [[], [], [], []],
                                 ])

        self.test_state_1 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[], [Piece.WHITE_FLAT], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.bfs_state_1 = self.blank_state._replace(board=[
            [[Piece.WHITE_FLAT], [], [], []],
            [[Piece.WHITE_FLAT], [], [], []],
            [[Piece.WHITE_FLAT], [], [], []],
            [[Piece.WHITE_FLAT], [], [], []],
        ])

        self.bfs_state_2 = self.blank_state._replace(board=[
            [[Piece.WHITE_FLAT], [], [], []],
            [[Piece.WHITE_FLAT], [Piece.WHITE_FLAT], [Piece.WHITE_FLAT],
             [Piece.WHITE_FLAT]],
            [[], [], [], [Piece.WHITE_FLAT]],
            [[], [], [], [Piece.WHITE_FLAT]],
        ])

        self.bfs_state_3 = self.blank_state._replace(board=[
            [[Piece.WHITE_FLAT], [], [], []],
            [[Piece.WHITE_FLAT], [Piece.WHITE_FLAT], [Piece.WHITE_FLAT],
             [Piece.WHITE_FLAT]],
            [[], [], [], [Piece.WHITE_STANDING]],
            [[], [], [], [Piece.WHITE_FLAT]],
        ])

        self.get_path_1 = self.blank_state._replace(board=[
            [[Piece.WHITE_FLAT], [], [], []],
            [[Piece.WHITE_FLAT], [Piece.WHITE_FLAT], [Piece.WHITE_FLAT],
             [Piece.WHITE_FLAT]],
            [[Piece.BLACK_FLAT], [Piece.BLACK_FLAT], [Piece.BLACK_FLAT],
             [Piece.BLACK_FLAT]],
            [[], [], [], [Piece.WHITE_FLAT]],
        ])
class TestValidateMove(unittest.TestCase):
    def test_valid_coordinates(self):
        # row_s, row_e, col_s, col_e < 0
        move = validate_action(self.blank_state, self.invalid_coord_1,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_coord_2,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_coord_3,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_coord_4,
                               self.debug)
        self.assertEqual(move, False)

        # row_s, row_e, col_s, col_e > 3
        move = validate_action(self.blank_state, self.invalid_coord_5,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_coord_6,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_coord_7,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_coord_8,
                               self.debug)
        self.assertEqual(move, False)

    def test_player_control(self):
        # attempt to move empty square
        move = validate_action(self.blank_state, self.invalid_control,
                               self.debug)
        self.assertEqual(move, False)

        # attempt to move other player's single piece
        move = validate_action(self.single_state_1, self.invalid_control,
                               self.debug)
        self.assertEqual(move, False)

        # attempt to move other player's stack
        move = validate_action(self.single_state_2, self.invalid_control,
                               self.debug)
        self.assertEqual(move, False)

    def test_stack_size_limit(self):
        # carry size > 4
        move = validate_action(self.valid_move_state_1,
                               self.invalid_carry_size_1, self.debug)
        self.assertEqual(move, False)

    def test_actual_stack_size(self):
        # carry size < 1
        move = validate_action(self.valid_move_state_1,
                               self.invalid_carry_size_2, self.debug)
        self.assertEqual(move, False)

        # carry size > 1 with one piece
        move = validate_action(self.valid_move_state_1,
                               self.invalid_carry_size_3, self.debug)
        self.assertEqual(move, False)

        # carry size > stack size
        move = validate_action(self.valid_move_state_2,
                               self.invalid_carry_size_4, self.debug)
        self.assertEqual(move, False)

    def test_valid_direction(self):
        # start == end
        move = validate_action(self.valid_move_state_1,
                               self.invalid_direction_1, self.debug)
        self.assertEqual(move, False)

        # diagonal movement
        move = validate_action(self.valid_move_state_1,
                               self.invalid_direction_2, self.debug)
        self.assertEqual(move, False)

    def test_drop_list(self):
        # length 0
        move = validate_action(self.valid_move_state_2,
                               self.invalid_drop_list_1, self.debug)
        self.assertEqual(move, False)

        # length > 3
        move = validate_action(self.valid_move_state_2,
                               self.invalid_drop_list_2, self.debug)
        self.assertEqual(move, False)

        # length > row/col delta
        move = validate_action(self.valid_move_state_2,
                               self.invalid_drop_list_3, self.debug)
        self.assertEqual(move, False)

        # length < row/col delta
        move = validate_action(self.valid_move_state_2,
                               self.invalid_drop_list_4, self.debug)
        self.assertEqual(move, False)

        # sum different from carry size
        move = validate_action(self.valid_move_state_2,
                               self.invalid_drop_list_5, self.debug)
        self.assertEqual(move, False)

    def test_movement_blocked_by_walls(self):
        # positive row over wall
        move = validate_action(self.wall_state_1, self.invalid_wall_move_1,
                               self.debug)
        self.assertEqual(move, False)

        # negative row over wall
        move = validate_action(self.wall_state_2, self.invalid_wall_move_3,
                               self.debug)
        self.assertEqual(move, False)

        # positive col over wall
        move = validate_action(self.wall_state_1, self.invalid_wall_move_2,
                               self.debug)
        self.assertEqual(move, False)

        # negative col over wall
        move = validate_action(self.wall_state_2, self.invalid_wall_move_4,
                               self.debug)
        self.assertEqual(move, False)

        # end on wall
        move = validate_action(self.wall_state_2, self.invalid_wall_move_5,
                               self.debug)
        self.assertEqual(move, False)

    def test_valid_moves(self):
        # moving a wall
        move = validate_action(self.valid_move_state_2, self.valid_move_5,
                               self.debug)
        self.assertEqual(move, True)

        # move to corners
        move = validate_action(self.valid_move_state_3, self.valid_move_1,
                               self.debug)
        self.assertEqual(move, True)

        move = validate_action(self.valid_move_state_4, self.valid_move_2,
                               self.debug)
        self.assertEqual(move, True)

        move = validate_action(self.valid_move_state_5, self.valid_move_3,
                               self.debug)
        self.assertEqual(move, True)

        move = validate_action(self.valid_move_state_6, self.valid_move_4,
                               self.debug)
        self.assertEqual(move, True)

        # single stack
        move = validate_action(self.valid_move_state_2, self.valid_move_6,
                               self.debug)
        self.assertEqual(move, True)

    def test_place_coord(self):
        move = validate_action(self.blank_state, self.invalid_place_coord_1,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_place_coord_2,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_place_coord_3,
                               self.debug)
        self.assertEqual(move, False)

        move = validate_action(self.blank_state, self.invalid_place_coord_4,
                               self.debug)
        self.assertEqual(move, False)

    def test_place_occupied(self):
        move = validate_action(self.single_state_1, self.occupied_place,
                               self.debug)
        self.assertEqual(move, False)

    def test_place_wrong_color(self):
        move = validate_action(self.blank_state, self.wrong_color, self.debug)
        self.assertEqual(move, False)

    def setUp(self):
        self.debug = False

        #
        # States
        #

        self.blank_state = State(to_move=Color.WHITE,
                                 white_stones=10,
                                 black_stones=10,
                                 board=[
                                     [[], [], [], []],
                                     [[], [], [], []],
                                     [[], [], [], []],
                                     [[], [], [], []],
                                 ])
        self.single_state_1 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[], [Piece.BLACK_FLAT], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.single_state_2 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[],
             [
                 Piece.BLACK_FLAT, Piece.WHITE_FLAT, Piece.WHITE_FLAT,
                 Piece.BLACK_STANDING
             ], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.valid_move_state_1 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[], [Piece.WHITE_FLAT], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.valid_move_state_2 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[],
             [
                 Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_FLAT,
                 Piece.WHITE_STANDING
             ], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.wall_state_1 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[],
             [
                 Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_FLAT,
                 Piece.WHITE_STANDING
             ], [Piece.WHITE_STANDING], []],
            [[], [Piece.WHITE_STANDING], [], []],
            [[], [], [], []],
        ])

        self.wall_state_2 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[], [], [Piece.WHITE_STANDING], []],
            [[], [Piece.WHITE_STANDING],
             [
                 Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_FLAT,
                 Piece.WHITE_STANDING
             ], []],
            [[], [], [], []],
        ])

        self.valid_move_state_3 = self.blank_state._replace(board=[
            [[Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_FLAT], [], [],
             []],
            [[], [], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.valid_move_state_4 = self.blank_state._replace(board=[
            [[], [], [],
             [Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_FLAT]],
            [[], [], [], []],
            [[], [], [], []],
            [[], [], [], []],
        ])

        self.valid_move_state_5 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[], [], [], []],
            [[], [], [], []],
            [[], [], [],
             [Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_STANDING]],
        ])

        self.valid_move_state_6 = self.blank_state._replace(board=[
            [[], [], [], []],
            [[], [], [], []],
            [[], [], [], []],
            [[Piece.WHITE_FLAT, Piece.WHITE_FLAT, Piece.WHITE_STANDING], [],
             [], []],
        ])

        #
        # Moves
        #

        # invalid coordinates
        self.invalid_coord_1 = Move(
            start_coord=(-1, 1),
            end_coord=(1, 1),
            carry_size=1,
            drop_list=[1],
        )
        self.invalid_coord_2 = self.invalid_coord_1._replace(start_coord=(1,
                                                                          -1))
        self.invalid_coord_3 = self.invalid_coord_2._replace(start_coord=(1,
                                                                          1),
                                                             end_coord=(-1, 1))
        self.invalid_coord_4 = self.invalid_coord_3._replace(end_coord=(1, -1))
        self.invalid_coord_5 = self.invalid_coord_1._replace(start_coord=(4,
                                                                          1))
        self.invalid_coord_6 = self.invalid_coord_1._replace(start_coord=(1,
                                                                          4))
        self.invalid_coord_7 = self.invalid_coord_3._replace(end_coord=(4, 1))
        self.invalid_coord_8 = self.invalid_coord_7._replace(end_coord=(1, 4))

        # invalid player control
        self.invalid_control = Move(
            start_coord=(1, 1),
            end_coord=(1, 2),
            carry_size=1,
            drop_list=[1],
        )

        # invalid carry size
        self.invalid_carry_size_1 = Move(
            start_coord=(1, 1),
            end_coord=(1, 2),
            carry_size=5,
            drop_list=[1],
        )
        self.invalid_carry_size_2 = self.invalid_carry_size_1._replace(
            carry_size=0)
        self.invalid_carry_size_3 = self.invalid_carry_size_1._replace(
            carry_size=2)
        self.invalid_carry_size_4 = self.invalid_carry_size_1._replace(
            carry_size=4)

        # valid direction
        self.invalid_direction_1 = Move(
            start_coord=(1, 1),
            end_coord=(1, 1),
            carry_size=1,
            drop_list=[1],
        )
        self.invalid_direction_2 = self.invalid_direction_1._replace(
            end_coord=(2, 3))

        # drop list
        self.invalid_drop_list_1 = Move(
            start_coord=(1, 1),
            end_coord=(1, 2),
            carry_size=1,
            drop_list=[],
        )
        self.invalid_drop_list_2 = self.invalid_drop_list_1._replace(
            carry_size=4, drop_list=[1, 1, 1, 1])
        self.invalid_drop_list_3 = self.invalid_drop_list_1._replace(
            carry_size=2, drop_list=[1, 1])
        self.invalid_drop_list_4 = self.invalid_drop_list_1._replace(
            carry_size=1, drop_list=[1], end_coord=(1, 3))
        self.invalid_drop_list_5 = self.invalid_drop_list_1._replace(
            carry_size=1, drop_list=[1, 1], end_coord=(1, 3))

        # wall moves
        self.invalid_wall_move_1 = Move(
            start_coord=(1, 1),
            end_coord=(3, 1),
            carry_size=3,
            drop_list=[1, 2],
        )
        self.invalid_wall_move_2 = self.invalid_wall_move_1._replace(
            end_coord=(1, 3))
        self.invalid_wall_move_3 = Move(
            start_coord=(2, 2),
            end_coord=(0, 2),
            carry_size=3,
            drop_list=[1, 2],
        )
        self.invalid_wall_move_4 = self.invalid_wall_move_3._replace(
            end_coord=(2, 0))
        self.invalid_wall_move_5 = self.invalid_wall_move_3._replace(
            end_coord=(2, 1),
            drop_list=[3],
        )

        # moves
        self.valid_move_1 = Move(
            start_coord=(0, 0),
            end_coord=(0, 3),
            carry_size=3,
            drop_list=[1, 1, 1],
        )
        self.valid_move_2 = self.valid_move_1._replace(
            start_coord=(0, 3),
            end_coord=(3, 3),
        )
        self.valid_move_3 = self.valid_move_1._replace(
            start_coord=(3, 3),
            end_coord=(3, 0),
        )
        self.valid_move_4 = self.valid_move_1._replace(
            start_coord=(3, 0),
            end_coord=(0, 0),
        )
        self.valid_move_5 = Move(
            start_coord=(1, 1),
            end_coord=(0, 1),
            carry_size=1,
            drop_list=[1],
        )
        self.valid_move_6 = self.valid_move_5._replace(carry_size=3,
                                                       drop_list=[3])

        #
        # PLACES
        #

        self.invalid_place_coord_1 = Place(coord=(-1, 1),
                                           piece=Piece.WHITE_FLAT)
        self.invalid_place_coord_2 = self.invalid_place_coord_1._replace(
            coord=(1, -1))
        self.invalid_place_coord_3 = self.invalid_place_coord_1._replace(
            coord=(4, 1))
        self.invalid_place_coord_4 = self.invalid_place_coord_1._replace(
            coord=(1, 4))

        self.occupied_place = Place(
            coord=(1, 1),
            piece=Piece.WHITE_FLAT,
        )

        self.wrong_color = Place(
            coord=(0, 0),
            piece=Piece.BLACK_STANDING,
        )
class TestCheckVictory(unittest.TestCase):
    def setUp(self):
        bf = Piece.BLACK_FLAT
        bs = Piece.BLACK_STANDING
        wf = Piece.WHITE_FLAT
        ws = Piece.WHITE_STANDING

        # full board
        self.full_state = State(
            to_move = Color.BLACK,
            white_stones = 5,
            black_stones = 5,
            board = [
                [[bf], [bf], [bf], [bf]],
                [[bf], [bf], [bf], [bf]],
                [[wf, wf], [wf], [wf], [wf]],
                [[wf], [wf], [wf], [wf]],
            ]
        )

        # white_stones == 0
        self.stones_1 = self.full_state._replace(
            white_stones = 0,
            board = [
                [[bf], [bf], [bf], [bf]],
                [[], [], [bf], [bf]],
                [[], [wf], [wf], [wf]],
                [[wf], [wf], [wf], [wf]],
            ]
        )

        # black_stones == 0
        self.stones_2 = self.full_state._replace(
            black_stones = 0,
            board = [
                [[bf], [bf], [bf], [bf]],
                [[bf], [bf], [bf], [bf]],
                [[], [wf], [wf], [wf]],
                [[wf], [wf], [wf], [wf]],
            ]
        )

        self.path_1 = State(
            to_move = Color.BLACK,
            white_stones = 5,
            black_stones = 5,
            board = [
                [[ws], [wf], [], [bs]],
                [[bf], [wf], [bs], [bs]],
                [[bf], [wf], [wf], [bs]],
                [[ws], [bs], [wf], [bs]],
            ]
        )

        self.path_2 = self.path_1._replace(
            board = [
                [[ws], [wf], [bs], []],
                [[bf], [bf], [bf], [bf]],
                [[bf], [wf], [wf], [bs]],
                [[ws], [bs], [wf], [bs]],
            ]
        )

        self.path_3 = self.path_1._replace(
            board = [
                [[ws], [wf], [bs], []],
                [[bf], [bf], [bf], [bf]],
                [[wf], [wf], [wf], [bs]],
                [[ws], [bs], [wf], [wf]],
            ]
        )

        self.no_victory = self.path_1._replace(
            board = [
                [[ws], [wf], [bs], []],
                [[bf], [bs], [bf], [bf]],
                [[wf], [wf], [ws], [bs]],
                [[ws], [bs], [wf], [wf]],
            ]
        )

    def test_check_victory(self):
        # full board
        state = self.full_state
        self.assertEqual((0.5, 0.5), check_victory(state))

        # white stones == 0
        state = self.stones_1
        self.assertEqual((0.0, 1.0), check_victory(state))

        # black stones == 0
        state = self.stones_2
        self.assertEqual((1.0, 0.0), check_victory(state))

        # white path
        state = self.path_1
        self.assertEqual((0.0, 1.0), check_victory(state))
        
        # black path
        state = self.path_2
        self.assertEqual((1.0, 0.0), check_victory(state))
        
        # dual paths
        state = self.path_3
        self.assertEqual((0.0, 1.0), check_victory(state))

        # no victory
        state = self.no_victory
        self.assertEqual(None, check_victory(state))
Esempio n. 4
0
class TestGetActions(unittest.TestCase):
    def test_get_actions(self):
        expected = [
            Place(coord=(0, 0), piece=Piece.WHITE_FLAT),
            Place(coord=(0, 1), piece=Piece.WHITE_FLAT),
            Place(coord=(0, 2), piece=Piece.WHITE_FLAT),
            Place(coord=(0, 3), piece=Piece.WHITE_FLAT),
            Place(coord=(1, 0), piece=Piece.WHITE_FLAT),
            Place(coord=(1, 1), piece=Piece.WHITE_FLAT),
            Place(coord=(1, 2), piece=Piece.WHITE_FLAT),
            Place(coord=(1, 3), piece=Piece.WHITE_FLAT),
            Place(coord=(2, 0), piece=Piece.WHITE_FLAT),
            Place(coord=(2, 1), piece=Piece.WHITE_FLAT),
            Place(coord=(2, 2), piece=Piece.WHITE_FLAT),
            Place(coord=(2, 3), piece=Piece.WHITE_FLAT),
            Place(coord=(3, 0), piece=Piece.WHITE_FLAT),
            Place(coord=(3, 1), piece=Piece.WHITE_FLAT),
            Place(coord=(3, 2), piece=Piece.WHITE_FLAT),
            Place(coord=(3, 3), piece=Piece.WHITE_FLAT),
            Place(coord=(0, 0), piece=Piece.WHITE_STANDING),
            Place(coord=(0, 1), piece=Piece.WHITE_STANDING),
            Place(coord=(0, 2), piece=Piece.WHITE_STANDING),
            Place(coord=(0, 3), piece=Piece.WHITE_STANDING),
            Place(coord=(1, 0), piece=Piece.WHITE_STANDING),
            Place(coord=(1, 1), piece=Piece.WHITE_STANDING),
            Place(coord=(1, 2), piece=Piece.WHITE_STANDING),
            Place(coord=(1, 3), piece=Piece.WHITE_STANDING),
            Place(coord=(2, 0), piece=Piece.WHITE_STANDING),
            Place(coord=(2, 1), piece=Piece.WHITE_STANDING),
            Place(coord=(2, 2), piece=Piece.WHITE_STANDING),
            Place(coord=(2, 3), piece=Piece.WHITE_STANDING),
            Place(coord=(3, 0), piece=Piece.WHITE_STANDING),
            Place(coord=(3, 1), piece=Piece.WHITE_STANDING),
            Place(coord=(3, 2), piece=Piece.WHITE_STANDING),
            Place(coord=(3, 3), piece=Piece.WHITE_STANDING),
        ]
        self.assertEqual(set(expected), set(get_actions(self.blank_state)))

        expected_2 = [
            Move(start_coord=(3, 3),
                 end_coord=(0, 3),
                 carry_size=4,
                 drop_list=[1, 1, 2]),
            Move(start_coord=(3, 3),
                 end_coord=(0, 3),
                 carry_size=4,
                 drop_list=[1, 2, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(0, 3),
                 carry_size=4,
                 drop_list=[2, 1, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(0, 3),
                 carry_size=3,
                 drop_list=[1, 1, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(1, 3),
                 carry_size=4,
                 drop_list=[2, 2]),
            Move(start_coord=(3, 3),
                 end_coord=(1, 3),
                 carry_size=4,
                 drop_list=[1, 3]),
            Move(start_coord=(3, 3),
                 end_coord=(1, 3),
                 carry_size=4,
                 drop_list=[3, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(1, 3),
                 carry_size=3,
                 drop_list=[2, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(1, 3),
                 carry_size=3,
                 drop_list=[1, 2]),
            Move(start_coord=(3, 3),
                 end_coord=(1, 3),
                 carry_size=2,
                 drop_list=[1, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(2, 3),
                 carry_size=4,
                 drop_list=[4]),
            Move(start_coord=(3, 3),
                 end_coord=(2, 3),
                 carry_size=3,
                 drop_list=[3]),
            Move(start_coord=(3, 3),
                 end_coord=(2, 3),
                 carry_size=2,
                 drop_list=[2]),
            Move(start_coord=(3, 3),
                 end_coord=(2, 3),
                 carry_size=1,
                 drop_list=[1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 0),
                 carry_size=4,
                 drop_list=[1, 1, 2]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 0),
                 carry_size=4,
                 drop_list=[1, 2, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 0),
                 carry_size=4,
                 drop_list=[2, 1, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 0),
                 carry_size=3,
                 drop_list=[1, 1, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 1),
                 carry_size=4,
                 drop_list=[2, 2]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 1),
                 carry_size=4,
                 drop_list=[1, 3]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 1),
                 carry_size=4,
                 drop_list=[3, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 1),
                 carry_size=3,
                 drop_list=[2, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 1),
                 carry_size=3,
                 drop_list=[1, 2]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 1),
                 carry_size=2,
                 drop_list=[1, 1]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 2),
                 carry_size=4,
                 drop_list=[4]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 2),
                 carry_size=3,
                 drop_list=[3]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 2),
                 carry_size=2,
                 drop_list=[2]),
            Move(start_coord=(3, 3),
                 end_coord=(3, 2),
                 carry_size=1,
                 drop_list=[1]),
            Move(start_coord=(1, 1),
                 end_coord=(0, 1),
                 carry_size=2,
                 drop_list=[2]),
            Move(start_coord=(1, 1),
                 end_coord=(1, 0),
                 carry_size=2,
                 drop_list=[2]),
            Move(start_coord=(1, 1),
                 end_coord=(2, 1),
                 carry_size=2,
                 drop_list=[2]),
            Move(start_coord=(1, 1),
                 end_coord=(1, 2),
                 carry_size=2,
                 drop_list=[2]),
            Move(start_coord=(1, 1),
                 end_coord=(1, 3),
                 carry_size=2,
                 drop_list=[1, 1]),
            Move(start_coord=(1, 1),
                 end_coord=(3, 1),
                 carry_size=2,
                 drop_list=[1, 1]),
            Move(start_coord=(1, 1),
                 end_coord=(0, 1),
                 carry_size=1,
                 drop_list=[1]),
            Move(start_coord=(1, 1),
                 end_coord=(1, 0),
                 carry_size=1,
                 drop_list=[1]),
            Move(start_coord=(1, 1),
                 end_coord=(2, 1),
                 carry_size=1,
                 drop_list=[1]),
            Move(start_coord=(1, 1),
                 end_coord=(1, 2),
                 carry_size=1,
                 drop_list=[1]),
        ]
        self.assertEqual(len(expected_2), len(get_actions(self.test_state_1)))

        self.assertEqual(get_actions(self.error_state), [])

    def setUp(self):
        self.blank_state = State(to_move=Color.WHITE,
                                 white_stones=10,
                                 black_stones=10,
                                 board=[
                                     [[], [], [], []],
                                     [[], [], [], []],
                                     [[], [], [], []],
                                     [[], [], [], []],
                                 ])

        ws = Piece.WHITE_STANDING
        wf = Piece.WHITE_FLAT
        bf = Piece.BLACK_FLAT

        self.test_state_1 = State(to_move=Color.WHITE,
                                  white_stones=10,
                                  black_stones=10,
                                  board=[
                                      [[bf], [bf], [bf], [bf]],
                                      [[bf], [bf, ws], [bf], [bf]],
                                      [[bf], [bf], [bf], [bf]],
                                      [[bf], [bf], [bf], [bf, wf, wf, ws]],
                                  ])

        self.error_state = self.blank_state._replace(black_stones=0)