]> git.sesse.net Git - remoteglot/commitdiff
Deal with lines that have no search, just static eval.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 21 Mar 2016 23:25:20 +0000 (00:25 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 21 Mar 2016 23:25:20 +0000 (00:25 +0100)
www/js/hash-lookup.js

index 8fe12970bb0e5ac5f75dc8b730a3a6586fa0d882..654a3f9b9202ea9a1e16b2c324a77fc7a72f68d4 100644 (file)
@@ -86,12 +86,13 @@ var translate_line = function(board, fen, line) {
        }
        r['pv_pretty'] = pv;
 
-       // Convert the score.
+       // Convert the score. Use the static eval if no search.
+       var value = line['value'] || line['eval'];
        var score = null;
-       if (line['value']['score_type'] === 'SCORE_CP') {
-               score = ['cp', line['value']['score_cp']];
-       } else if (line['value']['score_type'] === 'SCORE_MATE') {
-               score = ['m', line['value']['score_mate']];
+       if (value['score_type'] === 'SCORE_CP') {
+               score = ['cp', value['score_cp']];
+       } else if (value['score_type'] === 'SCORE_MATE') {
+               score = ['m', value['score_mate']];
        }
        if (score) {
                if (line['bound'] === 'BOUND_UPPER') {