]> git.sesse.net Git - remoteglot/commitdiff
Unbreak sorting, which was broken at some point in December. master
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 16 Feb 2024 11:52:11 +0000 (12:52 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 16 Feb 2024 11:52:11 +0000 (12:52 +0100)
www/js/remoteglot.js

index d36bf9e5117bed15911ea36263ed5084fc6f0c48..899a26ca23b1af97cca1e27094e5f2ec9d6f545a 100644 (file)
@@ -702,7 +702,7 @@ function find_nonstupid_moves(data, margin, invert) {
                }
        }
        let toplay = find_toplay(data['position']['fen']);
-       moves = moves.sort(function(a, b) { return compare_by_score(data['refutation_lines'], toplay, a, b) });
+       moves = moves.sort(function(a, b) { return compare_by_score(data['refutation_lines'], invert, a, b) });
        moves.unshift(data['pv'][0]);
 
        return moves;
@@ -2459,7 +2459,7 @@ function compute_score_sort_key(score, depth, invert) {
        } else if (score[0] === 'cp') {
                s = score[1];
        }
-       if (s) {
+       if (s !== null) {
                if (invert) s = -s;
                return s;
        } else {