X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=www%2Fjs%2Fbook.js;h=e4c3ce159dc238ff759e5711bfb989d07a7197ce;hb=d5eb7ba15c97e53ac1f2a72af402f9244b14e4ea;hp=30a5677d95b2aca3efa64627c0080631a1e0cb98;hpb=786409b677eacce79eeffe0c1265e7b2aba524b9;p=remoteglot-book diff --git a/www/js/book.js b/www/js/book.js index 30a5677..e4c3ce1 100644 --- a/www/js/book.js +++ b/www/js/book.js @@ -121,7 +121,7 @@ var find_last_move_score = function() { ";includetransp=0" }).done(function(data, textstatus, xhr) { var moves = data['moves']; - var root_move = sort_moves_by_common(moves, data); + var root_move = sort_move_by_frequency(moves, data); var your_move, your_index; for (var i = 0; i < moves.length; ++i) { @@ -131,7 +131,6 @@ var find_last_move_score = function() { your_index = i; } } - moves.sort(function(a, b) { return b['num'] - a['num'] }); if (your_move) { $("#yourfraction").text(format_fraction(your_move['fraction'])); @@ -167,7 +166,7 @@ var find_computer_move = function() { var candidate_moves = []; var moves = data['moves']; - var root_move = sort_moves_by_common(moves, data); + var root_move = sort_move_by_frequency(moves, data); var practice_minimum_move_fraction; if (move_override > 20) { @@ -201,7 +200,7 @@ var find_computer_move = function() { // Add deried data and then sort moves to get the most common ones (in-place). // Remove the root mode and return it. Currently usable for practice mode only! -var sort_moves_by_common = function(moves, data) +var sort_move_by_frequency = function(moves, data) { var total_num = find_total_games(moves); var root_move; @@ -473,6 +472,7 @@ var set_practice = function(value) { $("#stats").hide(); $("#practiceoutput").show(); document.getElementById("includetransp").checked = false; + set_includetransp(false); } else { $("#stats").show(); $("#practiceoutput").hide();