--- a/2048.html Thu Sep 25 00:54:13 2014 +0300
+++ b/2048.html Thu Sep 25 01:10:01 2014 +0300
@@ -163,6 +163,7 @@
<button id="step">Step</button>
<button id="visual-finish">Visual</button>
<button id="finish">Finish</button>
+ <div class="option"><input type="checkbox" id="profile"> profile</div>
</div>
<br>
<div class="control">
@@ -636,6 +637,9 @@
document.getElementById("visual-finish").addEventListener("click", ui.action.visualFinish, false);
ui.action.finish = function() {
+ var isProfile = document.getElementById("profile").checked;
+ if (isProfile)
+ console.profile();
if ( ! ui.ai.current) {
ui.game.setMessage('Select AI!');
return;
@@ -668,6 +672,8 @@
ui.score.speed(parseFloat((step*1000.0/(tsTo-tsFrom)).toPrecision(3)));
ui.game.setMessage("Game over!");
ui.ai.current.cleanup();
+ if (isProfile)
+ console.profileEnd();
}
document.getElementById("finish").addEventListener("click", ui.action.finish, false);