]> git.sesse.net Git - remoteglot-book/blobdiff - www/js/book.js
Show an adjusted human index instead of the raw percentage of computer games.
[remoteglot-book] / www / js / book.js
index 8300be61da3391a1d4c517ab07f2d41c7a7524e1..c6290f17cd13ff6dcaea29928a59834a8e995fe5 100644 (file)
@@ -92,6 +92,8 @@ var headings = [
        [ "Move", TYPE_MOVE ],
        [ "Games", TYPE_INTEGER ],
        [ "%", TYPE_RATIO ],
+       [ "CGames", TYPE_INTEGER ],
+       [ "Hum", TYPE_RATIO ],
        [ "Win%", TYPE_RATIO ],
        [ "WWin", TYPE_INTEGER ],
        [ "%WW", TYPE_RATIO ],
@@ -167,12 +169,18 @@ var show_lines = function(data, game) {
                var white = parseInt(move['white']);
                var draw = parseInt(move['draw']);
                var black = parseInt(move['black']);
+               var computer = parseInt(move['computer']);
 
                line.push(move['move']);  // Move.
                transpose_only.push(move['transpose_only']);
                var num = white + draw + black;
                line.push(num);  // N.
                line.push(num / total_num);  // %.
+               line.push(computer);  // CGames.
+
+               // Adjust so that the human index is 50% overall.
+               var exp = Math.log(0.5) / Math.log(data['computer_games'] / data['total_games']);
+               line.push(1.0 - Math.pow(computer / num, exp));  // Hum.
 
                // Win%.
                var white_win_ratio = (white + 0.5 * draw) / num;