Commits

Anonymous committed 7272dc8

Keeping score

Comments (0)

Files changed (4)

 * Give a way to rotate the borad
 * Find a better message than "Game Over"
 * Make the message div nicer (round, colors ...)
-* High score list 
     -moz-opacity: 0.70;
     opacity: 0.70;
 }
+
+h2.high_scores {
+    margin-bottom: 0px;
+}
                         <button id="restart">New Game</button>
                     </p>
                     <hr />
-                    <h2>High Scores:</h2>
+                    <h2 class="high_scores">High Scores:</h2>
                     <div id="high_scores">
                     </div>
                     <hr />
 
     if (is_end_of_game()) {
         show_message('Game Ended');
+        HIGH_SCORES.push(parseInt($('#score').text()));
+        HIGH_SCORES.sort();
+        HIGH_SCORES.reverse();
+        if (HIGH_SCORES.length == NUM_HIGH_SCORES) {
+            HIGH_SCORES.pop();
+        }
+        refresh_scores();
     }
 }
 
 }
 
 function refresh_scores() {
+    $('#high_scores').html(HIGH_SCORES.join('<br />'));
 }
 
-
 function on_ready()
 {
     $('#message').hide();