Example #1
0
def test_start_valid_moves():
    board = SplineState()
    expected_moves = [True] * 16 + [False] * 14

    valid_moves = board.get_valid_moves()

    assert valid_moves.tolist() == expected_moves
Example #2
0
def test_valid_moves_after_win():
    board = SplineState("""\
  A C E G
7 . W B . 7

5 . W B . 5

3 . W B . 3

1 . . B . 1
  A C E G
""")
    expected_valid_moves = [False] * 30

    valid_moves = board.get_valid_moves()

    assert expected_valid_moves == valid_moves.tolist()
Example #3
0
def test_full_spaces_valid_moves():
    board = SplineState("""\
  A C E G
7 . . . . 7

5 . W . . 5

3 . . B . 3

1 . . . . 1
  A C E G
""")
    expected_valid_moves = [True] * 16 + [False] * 14
    # full spaces are no longer valid moves
    expected_valid_moves[6] = expected_valid_moves[9] = False

    valid_moves = board.get_valid_moves()

    assert valid_moves.tolist() == expected_valid_moves
Example #4
0
def test_second_level_valid_moves():
    board = SplineState("""\
  A C E G
7 . . . . 7

5 . W B . 5

3 . W B . 3

1 . . . . 1
  A C E G
""")
    expected_valid_moves = [True] * 16 + [False] * 14
    # full spaces are no longer valid moves
    expected_valid_moves[5:7] = expected_valid_moves[9:11] = [False, False]
    # centre of second level is now supported
    expected_valid_moves[20] = True

    valid_moves = board.get_valid_moves()

    assert valid_moves.tolist() == expected_valid_moves