fix crash

This commit is contained in:
Nemo D'ACREMONT 2025-05-18 22:04:22 +02:00
parent b83e65a52f
commit c4358b19e3

View File

@ -1,4 +1,4 @@
from sys import stderr
from sys import stderr
import time
import math
from typing import Any, Callable
@ -17,8 +17,8 @@ def _alphabeta(
if board.is_game_over() or depth == 0:
return heuristic(board, color), None
wantMax = board.next_player() == color
best_move = None
wantMax = (board.next_player() == color)
best_move = -1
if wantMax:
acc = -math.inf
@ -92,7 +92,7 @@ def IDDFS(
max_depth: int = 10,
duration: float = 5.0, # Duration in seconds
):
best_move = None
best_move = -1
start_time = time.time()
shouldStop = lambda: (time.time() - start_time) >= duration