Example #1
0
def test_win():
    state = SpookState("""\
  A C E G
7 . . . . 7

5 . . B W 5

3 . . . . 3

1 . . . . 1
  A C E G
>B(B,R)
""")

    assert not state.is_win(state.BLACK)
    assert state.is_win(state.RED)
    assert state.get_winner() == state.RED
    assert state.is_ended()
Example #2
0
def test_start():
    expected_display = """\
  A C E G
7 . . . . 7

5 . . . . 5

3 . . . . 3

1 . . . . 1
  A C E G
>R
"""
    state = SpookState()

    display = state.display()
    active_player = state.get_active_player()

    assert display == expected_display
    assert active_player == state.RED
    assert not state.is_ended()