From 2d4f4f954452ac81d729c1e63f308998d04636c1 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Thu, 30 Aug 2018 00:30:27 -0500 Subject: [PATCH] Update ChessEngine.js --- ChessEngine/js/ChessEngine.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ChessEngine/js/ChessEngine.js b/ChessEngine/js/ChessEngine.js index c42f454..8a0d483 100644 --- a/ChessEngine/js/ChessEngine.js +++ b/ChessEngine/js/ChessEngine.js @@ -120,7 +120,12 @@ class ChessBot{ bestValue = currentValue; } } - return bestMove; + + if (bestValue === 0) { + return this.determineSimplestBotMove(game, source, target); + } else { + return bestMove; + } } mini_max_AB(depth, game, alpha, beta, isMaximizingPlayer){