示例#1
0
def test_valid_drop_only(start: int, end: int, expected_valid: bool, reason: str):
    """ Ghost has neighbours, but none are free.

    Valid moves are to remove opponent pieces.
    """
    board = SpookState("""\
  A C E G
7 B B . . 7

5 R R . . 5

3 . . . B 3

1 . . . R 1
  A C E G
   B D F
 6 W . . 6

 4 . . . 4

 2 . . . 2
   B D F
>B(B,R)
""")
    valid_moves = board.get_valid_moves()
    for move in range(start, end):
        assert valid_moves[move] == expected_valid, move
示例#2
0
def test_valid_removes_black(start: int,
                             end: int,
                             expected_valid: bool,
                             reason: str):
    board = SpookState("""\
  A C E G
7 B B B B 7

5 B B B B 5

3 R R R R 3

1 R R R R 1
  A C E G
   B D F
 6 B W . 6

 4 R R B 4

 2 R R R 2
   B D F
>R(B)
""")
    valid_moves = board.get_valid_moves()
    assert len(valid_moves) == 31  # 30 removes, plus pass
    for move in range(start, end):
        assert valid_moves[move] == expected_valid, move
示例#3
0
def test_valid_remove_only_free(start: int,
                                end: int,
                                expected_valid: bool,
                                reason: str):
    board = SpookState("""\
  A C E G
7 B B . . 7

5 B B . . 5

3 . W R . 3

1 . . . . 1
  A C E G
   B D F
 6 B . . 6

 4 . . . 4

 2 . . . 2
   B D F
>R(B,R)
""")
    valid_moves = board.get_valid_moves()
    assert len(valid_moves) == 31  # 30 removes, plus pass
    for move in range(start, end):
        assert valid_moves[move] == expected_valid, move
示例#4
0
def test_valid_ghost(start: int, end: int, expected_valid: bool, reason: str):
    board = SpookState("""\
  A C E G
7 B B . R 7

5 B B . . 5

3 . . . . 3

1 W . . . 1
  A C E G
>R(B,R)
""")
    valid_moves = board.get_valid_moves()
    for move in range(start, end):
        assert valid_moves[move] == expected_valid, move
示例#5
0
def test_valid_adds(start: int, end: int, expected_valid: bool, reason: str):
    board = SpookState("""\
  A C E G
7 . . . . 7

5 . . . . 5

3 . . . . 3

1 . . R . 1
  A C E G
>B
""")
    valid_moves = board.get_valid_moves()
    assert len(valid_moves) == 31  # 30 adds, plus pass
    for move in range(start, end):
        assert valid_moves[move] == expected_valid, move