added reseed function to 2d automaton
authorDylan Lloyd <dylan@dylansserver.com>
Mon, 17 Dec 2012 03:20:47 +0000 (22:20 -0500)
committerDylan Lloyd <dylan@dylansserver.com>
Mon, 17 Dec 2012 03:20:47 +0000 (22:20 -0500)
2d.js
index.php

diff --git a/2d.js b/2d.js
index f0e5f1e..8669d2e 100644 (file)
--- a/2d.js
+++ b/2d.js
@@ -124,6 +124,14 @@ $(document).ready(function(){
         running = 0;
     });
 
+    $('#controls #reseed-automaton').click(function(e){
+        if (running) clearInterval(tickID);
+        $('#controls #stop-automaton').hide();
+        $('#controls #start-automaton').show();
+        running = 0;
+        automaton = new universe;
+    });
+
     $('#2d-automaton').click(function(e) {
         if (!running) {
             var x = e.pageX - $('#2d-automaton').offset().left;
index 06878e3..d8cd22d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -17,6 +17,7 @@
         <br><br>
         <span id='start-automaton' class='control'>Start automaton</span>
         <span id='stop-automaton' class='control'>Stop automaton</span>
+        <span id='reseed-automaton' class='control'>Reseed automaton</span>
       </div>
     </div>
     <div id='1d-container'>