]> git.sesse.net Git - remoteglot/commitdiff
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 486ca8de6c1bb45c755de95a6de78d62ff38d831..5f3223dc5b8db45357e6c61f80fb4c75ee9d35bb 100644 (file)
@@ -1773,6 +1773,15 @@ var get_best_move = function(game, source, target) {
                move_hash[moves[i].san] = moves[i];
        }
 
                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;
 
        var best_move = null;
        var best_move_score = null;