def test_blocked_player_wins(): board = SpargoState("""\ A C E G 7 . W W . 7 5 W W W W 5 3 B B B B 3 1 . B B B 1 A C E G B D F 6 . W . 6 4 B W B 4 2 . B B 2 B D F C E 5 . . 5 3 . W 3 C E >B """) assert board.is_ended() assert board.is_win(board.BLACK) assert not board.is_win(board.WHITE) assert board.get_winner() == board.BLACK
def test_draw(): board = SpargoState("""\ A C E G 7 . W W . 7 5 W W W W 5 3 B B B B 3 1 . B B B 1 A C E G B D F 6 . W . 6 4 W B W 4 2 . B W 2 B D F C E 5 . . 5 3 . B 3 C E >B """) assert board.is_ended() assert not board.is_win(board.BLACK) assert not board.is_win(board.WHITE) assert board.get_winner() == board.NO_PLAYER
def test_winner(): board = SpargoState("""\ A C E G 7 . B B . 7 5 B B B B 5 3 B B B B 3 1 . B B . 1 A C E G >W """) assert board.is_ended() assert board.is_win(board.BLACK) assert not board.is_win(board.WHITE) assert board.get_winner() == board.BLACK