Prioritize the current display line in move selection.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 22 Mar 2016 17:20:32 +0000 (18:20 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 22 Mar 2016 17:20:32 +0000 (18:20 +0100)
www/js/remoteglot.js

index e478fb8..b6076f4 100644 (file)
@@ -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];