engine.py
def minimax(game_state, depth):
    """This function uses the minimax algorithm to analyze a game state.
    White is the maximizing player and black the minimizing.
    """
    # If max depth is reached or if king is captured.
    if depth == 0 or abs(game_state.value) > 500:
        return game_state.value

    # Test child nodes.
    moves = game_state.pseudo_legal_moves_no_castlings()
    value_list = []

    # If no moves were found.
    if moves == []:
        return 0

    for move in moves:
        game_state.make_move(move)
        value_list.append(minimax(game_state, depth-1))
        game_state.undo_move(move)

    # If maximizing player.
    if game_state.white_to_play:
        return max(value_list)

    # If minimizing player.
    else:
        return min(value_list)
This function uses the minimax algorithm to analyze a game state.
    White is the maximizing player and black the minimizing.
    
This function uses the minimax algorithm to analyze a game state.
White is the maximizing player and black the minimizing.
This function uses the minimax algorithm to analyze a game state . White is the maximizing player and black the minimizing .
def minimax(game_state, depth):
    if depth == 0 or abs(game_state.value) > 500:
        return game_state.value
    moves = game_state.pseudo_legal_moves_no_castlings()
    value_list = []
    if moves == []:
        return 0
    for move in moves:
        game_state.make_move(move)
        value_list.append(minimax(game_state, depth-1))
        game_state.undo_move(move)
    if game_state.white_to_play:
        return max(value_list)
    else:
        return min(value_list)
def minimax ( game_state , depth ) : if depth == 0 or abs ( game_state . value ) > 500 : return game_state . value moves = game_state . pseudo_legal_moves_no_castlings ( ) value_list = [ ] if moves == [ ] : return 0 for move in moves : game_state . make_move ( move ) value_list . append ( minimax ( game_state , depth - 1 ) ) game_state . undo_move ( move ) if game_state . white_to_play : return max ( value_list ) else : return min ( value_list )
This function uses the minimax algorithm to analyze a game state.
This function uses the minimax algorithm to analyze a game state .
"""This function uses the minimax algorithm to analyze a game state.
    White is the maximizing player and black the minimizing.
    """ # If max depth is reached or if king is captured. # Test child nodes. # If no moves were found. # If maximizing player. # If minimizing player.
game_state
depth