From 2a2905dab006707832faf48ed505e9b0056c6ae1 Mon Sep 17 00:00:00 2001 From: Dylan Lloyd Date: Sun, 16 Dec 2012 13:10:25 -0500 Subject: [PATCH] merged 1d and 2d automaton into one page --- 1d.js | 6 +++--- 2d.js | 2 +- index.php | 20 +++++++++++++++----- style.css | 6 +++--- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/1d.js b/1d.js index bff03cb..ed76608 100644 --- a/1d.js +++ b/1d.js @@ -14,11 +14,11 @@ $(document).ready(function(){ '111' : '0', } - var canvas = document.getElementById('canvas') + var canvas = document.getElementById('1d-automaton') var c = canvas.getContext('2d'); - var cellWidth = Math.floor(canvas.width / cells); - var cellHeight = Math.floor(canvas.height / generations); + var cellWidth = canvas.width / cells; + var cellHeight = canvas.height / generations; var generation = 0; function cell(x, y, h, l) { diff --git a/2d.js b/2d.js index b919ec8..46ccc75 100644 --- a/2d.js +++ b/2d.js @@ -1,6 +1,6 @@ $(document).ready(function(){ - var canvas = document.getElementById('canvas') + var canvas = document.getElementById('2d-automaton') var c = canvas.getContext('2d'); var rows = 50; diff --git a/index.php b/index.php index c95cf4c..43d4837 100644 --- a/index.php +++ b/index.php @@ -3,20 +3,30 @@ cellular automaton + -
- +
+

2D

+ Generation: 0 + 2500 cells +

Start automaton Stop automaton Reset automaton Highlight seed -

- 2500 cells
- Generation: 0 +
+
+
+ +
+

1D

+
+ 100 Generations
+ 100 Cells
diff --git a/style.css b/style.css index 6663281..08b7991 100644 --- a/style.css +++ b/style.css @@ -8,10 +8,10 @@ canvas { } #controls .control, #controls .label { font-weight: bold; -} + } #controls .control { cursor: pointer; -} + } #highlight-seed, #stop-automaton { display: none; -} + } -- 2.30.2