From: Steinar H. Gunderson Date: Tue, 22 Mar 2016 17:20:32 +0000 (+0100) Subject: Prioritize the current display line in move selection. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=d34683e228fef0efe646611ae42032bea22c583a Prioritize the current display line in move selection. --- diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index e478fb8..b6076f4 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -1806,6 +1806,15 @@ var get_best_move = function(game, source, target, invert) { move_hash[moves[i].san] = moves[i]; } + // See if we're already exploring some line. + if (current_display_line && + current_display_move < current_display_line.pretty_pv.length - 1) { + var first_move = current_display_line.pretty_pv[current_display_move + 1]; + if (move_hash[first_move]) { + return move_hash[first_move]; + } + } + // History and PV take priority over the display lines. for (var i = 0; i < 2; ++i) { var line = display_lines[i];