2048.html
changeset 72 0d1e5bbcde82
parent 71 aa0240db128a
child 73 a50828ac954d
--- a/2048.html	Wed Sep 17 22:46:35 2014 +0300
+++ b/2048.html	Wed Sep 17 23:05:39 2014 +0300
@@ -640,7 +640,7 @@
         tsLimit = 1000 * tsLimit;
       var safeBdr = board.create();
       var tsLimitFrom = new Date().getTime();
-      for (var gameCnt = 0; gameCnt < cnt; gameCnt++) {
+      for (var gameCnt = 0; gameCnt++ < cnt; void(0)) {
         var turn = 0;
         var brd = board.create();
         board.putRandom(brd);
@@ -720,7 +720,7 @@
       thDom.appendChild(document.createTextNode('max score'));
       trDom.appendChild(thDom);
       tableDom.appendChild(trDom);
-      var maxVals = Object.keys(histo).sort();
+      var maxVals = Object.keys(histo).sort(function(a,b){return a - b});
       for (var i = maxVals.length-1; i >= 0; i--) {
         var maxVal = maxVals[i];
         var row = histo[maxVals[i]];