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