def test_remove_drop(): state1 = 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 B B 5 3 R R 3 C E D 4 W 4 D >R(B,R) """) expected_display = """\ 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 B W 5 3 R R 3 C E >B(B,R) """ state2 = state1.make_move(28) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.BLACK
def test_pass(): state1 = SpookState("""\ A C E G 7 B B . R 7 5 B B . . 5 3 . . . . 3 1 W R . . 1 A C E G >R(R) """) expected_display = """\ A C E G 7 B B . R 7 5 B B . . 5 3 . . . . 3 1 W R . . 1 A C E G >B(B,R) """ state2 = state1.make_move(30) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.BLACK
def test_remove_first_neighbour(): """ One neighbour on same level with another of that colour. """ state1 = 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 B W 5 3 R R 3 C E >B(B,R) """) expected_display = """\ 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 B . 5 3 R W 3 C E >B(R) """ state2 = state1.make_move(26) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.BLACK
def test_remove_only_neighbour(): """ One neighbour on same level with no more of that colour. """ state1 = 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 B W 5 3 R R 3 C E >B(B,R) """) expected_display = """\ 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 W . 5 3 R R 3 C E >R(B,R) """ state2 = state1.make_move(27) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.RED
def test_remove_only_free_neighbour(): """ One neighbour on same level with no more of that colour. """ state1 = SpookState("""\ A C E G 7 B B . . 7 5 B B B W 5 3 . . . . 3 1 . . . . 1 A C E G B D F 6 R . . 6 4 . . . 4 2 . . . 2 B D F >B(B,R) """) expected_display = """\ A C E G 7 B B . . 7 5 B B W . 5 3 . . . . 3 1 . . . . 1 A C E G B D F 6 R . . 6 4 . . . 4 2 . . . 2 B D F >R(B,R) """ state2 = state1.make_move(10) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.RED
def test_remove_opponent_piece_with_free_neighbour(): state1 = SpookState("""\ A C E G 7 B B . . 7 5 R R . . 5 3 W . . R 3 1 . . . R 1 A C E G B D F 6 B . . 6 4 . . . 4 2 . . . 2 B D F >B(B,R) """) expected_display = """\ A C E G 7 B B . . 7 5 R R . . 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) """ state2 = state1.make_move(3) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.RED
def test_move_ghost_one_space(): state1 = SpookState("""\ A C E G 7 B R . . 7 5 B R . W 5 3 B R . . 3 1 . . . . 1 A C E G B D F 6 . . . 6 4 B . . 4 2 . . . 2 B D F >R(B,R) """) expected_display = """\ A C E G 7 B R . . 7 5 B R W . 5 3 B R . . 3 1 . . . . 1 A C E G B D F 6 . . . 6 4 B . . 4 2 . . . 2 B D F >B(B,R) """ state2 = state1.make_move(10) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.BLACK
def test_add_move(): expected_display = """\ A C E G 7 . . . . 7 5 . . . . 5 3 . . . . 3 1 . . R . 1 A C E G >B """ state1 = SpookState() state2 = state1.make_move(2) display = state2.display() active_player = state2.get_active_player() assert display == expected_display assert active_player == state2.BLACK
def test_add_last_piece(): state1 = 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 . B 5 3 R . 3 C E >B """) expected_display = """\ 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 B B 6 4 R R B 4 2 R R R 2 B D F C E 5 B B 5 3 R R 3 C E D 4 W 4 D >R(B,R) """ state2 = state1.make_move(27) display = state2.display() active_player = state2.get_active_player() assert state1.get_move_count() == 27 assert state2.get_move_count() == 28 assert display == expected_display assert active_player == state2.RED