def test_minimax_depth_4_game_completion(minimax_engines): """ Tests that minimax at depth 4 doesn't hang """ engine = minimax_engines[1] engine.depth = 4 simulation = ChessPlayground(CaptureHighestValue(), engine) simulation.fen = FEN_MAPS["easy_black_win"] simulation.play_game()
def test_minimax_depth_1_and_2_game_completion(minimax_engines): """ Tests that minimax at depths 1 & 2 doesn't hang """ mm1 = minimax_engines[0] mm2 = minimax_engines[1] mm2.depth = 2 simulation = ChessPlayground(mm1, mm2) simulation.fen = FEN_MAPS["easy_white_win"] simulation.play_game()
def test_minimax_depth_3_game_completion(minimax_engines): """ Tests that minimax at depth 3 doesn't hang or return illegal moves. @ depth>=3, minimax evaluates own position in recursive call whereas @ depth<3, minimax only evaluates own position and opponents position once. This revisiting of own side's future position can lead to obscure bugs""" mm3 = minimax_engines[0] mm3.depth = 3 simulation = ChessPlayground(mm3, ScholarsMate()) simulation.fen = FEN_MAPS["easy_white_win"] simulation.play_game()
def setup_playground(): """ Sets up test playground with 3 games played Returns: (ChessPlaygound) """ playground = ChessPlayground(ScholarsMate(), ScholarsMate()) playground.play_multiple_games(3) return playground