Use PV and history information for better move selection.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 20 Mar 2016 22:06:14 +0000 (23:06 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 20 Mar 2016 22:06:14 +0000 (23:06 +0100)
www/js/remoteglot.js

index 486ca8d..5f3223d 100644 (file)
@@ -1773,6 +1773,15 @@ var get_best_move = function(game, source, target) {
                move_hash[moves[i].san] = moves[i];
        }
 
+       // History and PV take priority over the display lines.
+       for (var i = 0; i < 2; ++i) {
+               var line = display_lines[i];
+               var first_move = line.pretty_pv[line.start_display_move_num];
+               if (move_hash[first_move]) {
+                       return move_hash[first_move];
+               }
+       }
+
        var best_move = null;
        var best_move_score = null;