]> git.sesse.net Git - remoteglot/commitdiff
Turn off the depth secondary key sorting for the purpose of arrows.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 23 Mar 2016 11:11:04 +0000 (12:11 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 23 Mar 2016 11:11:04 +0000 (12:11 +0100)
www/js/remoteglot.js

index 5cd1a97e1a1dbcf14c4ed1bc5fabe9e1cbff887e..26abd4ae14a382fe293975cdf3a757b087b2b793 100644 (file)
@@ -584,7 +584,7 @@ var find_nonstupid_moves = function(data, margin, invert) {
        var pv_score = undefined;
        for (var move in data['refutation_lines']) {
                var line = data['refutation_lines'][move];
-               var score = compute_score_sort_key(line['score'], line['depth'], invert);
+               var score = compute_score_sort_key(line['score'], line['depth'], invert, false);
                if (move == data['pv'][0]) {
                        pv_score = score;
                }
@@ -2061,9 +2061,10 @@ var compute_plot_score = function(score) {
  * @param score The score digest tuple.
  * @param {?number} depth Depth the move has been computed to, or null.
  * @param {boolean} invert Whether black is to play.
+ * @param {boolean=} depth_secondary_key
  * @return {number}
  */
-var compute_score_sort_key = function(score, depth, invert) {
+var compute_score_sort_key = function(score, depth, invert, depth_secondary_key) {
        var s;
        if (!score) {
                return -10000000;
@@ -2083,7 +2084,11 @@ var compute_score_sort_key = function(score, depth, invert) {
        }
        if (s) {
                if (invert) s = -s;
-               return s * 200 + (depth || 0);
+               if (depth_secondary_key) {
+                       return s * 200 + (depth || 0);
+               } else {
+                       return s;
+               }
        } else {
                return null;
        }