fix crash
This commit is contained in:
parent
b83e65a52f
commit
c4358b19e3
@ -1,4 +1,4 @@
|
|||||||
from sys import stderr
|
from sys import stderr
|
||||||
import time
|
import time
|
||||||
import math
|
import math
|
||||||
from typing import Any, Callable
|
from typing import Any, Callable
|
||||||
@ -17,8 +17,8 @@ def _alphabeta(
|
|||||||
if board.is_game_over() or depth == 0:
|
if board.is_game_over() or depth == 0:
|
||||||
return heuristic(board, color), None
|
return heuristic(board, color), None
|
||||||
|
|
||||||
wantMax = board.next_player() == color
|
wantMax = (board.next_player() == color)
|
||||||
best_move = None
|
best_move = -1
|
||||||
|
|
||||||
if wantMax:
|
if wantMax:
|
||||||
acc = -math.inf
|
acc = -math.inf
|
||||||
@ -92,7 +92,7 @@ def IDDFS(
|
|||||||
max_depth: int = 10,
|
max_depth: int = 10,
|
||||||
duration: float = 5.0, # Duration in seconds
|
duration: float = 5.0, # Duration in seconds
|
||||||
):
|
):
|
||||||
best_move = None
|
best_move = -1
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
shouldStop = lambda: (time.time() - start_time) >= duration
|
shouldStop = lambda: (time.time() - start_time) >= duration
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user