diff --git a/js/main.js b/js/main.js index ab2f16e..73d567b 100644 --- a/js/main.js +++ b/js/main.js @@ -159,4 +159,14 @@ function evaluateBoard(game, move, prevSum, color) { if (game.in_draw() || game.in_threefold_repetition() || game.in_stalemate()) { return 0; } + if (game.in_check()) { + // Opponent is in check (good for us) + if (move.color === color) { + prevSum += 50; + } + // Our king's in check (bad for us) + else { + prevSum -= 50; + } + } }