+ running = 0;
+ });
+
+ $('#controls #reseed-automaton').click(function(e){
+ if (running) clearInterval(tickID);
+ $('#controls #stop-automaton').hide();
+ $('#controls #start-automaton').show();
+ automaton = new universe();
+ running = 0;
+ });
+
+ $('#controls #custom-seed-automaton').click(function(e){
+ if (running) clearInterval(tickID);
+ $('#controls #stop-automaton').hide();
+ $('#controls #start-automaton').show();
+ automaton = new universe(1);
+ running = 0;
+ });
+
+ $('#2d-automaton').click(function(e) {
+ if (!running) {
+ var x = e.pageX - $('#2d-automaton').offset().left;
+ var y = e.pageY - $('#2d-automaton').offset().top;
+ var row = Math.floor(y / cellHeight);
+ var column = Math.floor(x / cellWidth);
+ automaton.population[row][column].toggle();
+ }