]> git.sesse.net Git - remoteglot/blobdiff - www/js/remoteglot.js
Show low-depth scores.
[remoteglot] / www / js / remoteglot.js
index 353d7b14b7dc6136b6650c8390b5a5e7ed94852c..b72f4c426119082512ba43af50bec53fe68a3019 100644 (file)
@@ -7,7 +7,7 @@
  * @type {Number}
  * @const
  * @private */
-var SCRIPT_VERSION = 2021010201;
+var SCRIPT_VERSION = 2021021300;
 
 /**
  * The current backend URL.
@@ -664,7 +664,8 @@ var add_pv = function(start_fen, pv, move_num, toplay, scores, start_display_mov
        if (scores !== null && scores.length >= 1 &&
            scores[scores.length - 1].score !== undefined &&
            scores[scores.length - 1].score !== null &&
-           scores[scores.length - 1].score[0] === 'T') {
+           (scores[scores.length - 1].score[0] === 'T' ||
+            scores[scores.length - 1].score[0] === 't')) {
                splicepos = scores[scores.length - 1].score[1];
        }
        return print_pv(display_lines.length - 1, splicepos, opt_limit, opt_showlast);
@@ -1212,6 +1213,24 @@ var update_board = function() {
                $("#score").text(format_long_score(data['score']));
        }
 
+       // Low depth.
+       var lowdepth = '';
+       if (data['lowdepth']) {
+               lowdepth = 'Quick look: ';
+               var lds = [];
+               Object.keys(data['lowdepth']).forEach(function(depth) {
+                       lds.push([parseInt(depth), format_short_score(data['lowdepth'][depth])]);
+               });
+               lds.sort(function(a, b) { return a[0] - b[0]; });
+               for (var i = 0; i < lds.length; ++i) {
+                       lowdepth += '<span class="depth">d' + lds[i][0] + ':</span> ' + lds[i][1];
+                       if (i != lds.length - 1) {
+                               lowdepth += ', ';
+                       }
+               }
+       }
+       $("#lowdepth").html(lowdepth);
+
        // The search stats.
        if (data['searchstats']) {
                $("#searchstats").html(data['searchstats']);
@@ -2129,7 +2148,7 @@ var format_short_score = function(score) {
                if (score[0] === 'T') {
                        return ret + Math.ceil(score[1] / 2);
                } else {
-                       return ret + "-" + Math.ceil(-score[1] / 2);
+                       return ret + "-" + Math.ceil(score[1] / 2);
                }
        } else if (score[0] === 'M' || score[0] === 'm') {
                var sign = (score[0] === 'm') ? '-' : '';