diff --git a/engines/alphabeta.go b/engines/alphabeta.go index 7852307..139fc2d 100644 --- a/engines/alphabeta.go +++ b/engines/alphabeta.go @@ -26,16 +26,15 @@ func (e *AlphaBetaEngine) alphabeta(pos *chess.Position, depth int, maxPlayer bo value: e.evaluatePosition(pos), } } - pos.Hash() bestScore := &positionScore{} var comparator func(float64, float64) float64 if maxPlayer { - bestScore.value = -9999 + bestScore.value = math.Inf(-1) comparator = math.Max } else { - bestScore.value = 9999 + bestScore.value = math.Inf(1) comparator = math.Min } diff --git a/engines/minimax.go b/engines/minimax.go index 1e36bdb..050f8d5 100644 --- a/engines/minimax.go +++ b/engines/minimax.go @@ -26,16 +26,15 @@ func (e *MinimaxEngine) minimax(pos *chess.Position, depth int, maxPlayer bool) value: e.evaluatePosition(pos), } } - pos.Hash() bestScore := &positionScore{} var comparator func(float64, float64) float64 if maxPlayer { - bestScore.value = -9999 + bestScore.value = math.Inf(-1) comparator = math.Max } else { - bestScore.value = 9999 + bestScore.value = math.Inf(1) comparator = math.Min }