This commit is contained in:
Casey Reas
2011-09-05 23:20:15 +00:00
parent 5a1c9d8bab
commit b99624cdb4
6 changed files with 30 additions and 30 deletions
@@ -37,7 +37,8 @@ class CA {
for (int i = 0; i < cells.length; i++) {
cells[i] = 0;
}
cells[cells.length/2] = 1; // We arbitrarily start with just the middle cell having a state of "1"
// We arbitrarily start with just the middle cell having a state of "1"
cells[cells.length/2] = 1;
generation = 0;
}
@@ -69,7 +70,8 @@ class CA {
}
// Implementing the Wolfram rules
// Could be improved and made more concise, but here we can explicitly see what is going on for each case
// Could be improved and made more concise, but here we can
// explicitly see what is going on for each case
int rules (int a, int b, int c) {
if (a == 1 && b == 1 && c == 1) return rules[0];
if (a == 1 && b == 1 && c == 0) return rules[1];
@@ -33,6 +33,3 @@ void mousePressed() {
ca.randomize();
ca.restart();
}
@@ -10,10 +10,9 @@ float x, y; // X and Y coordinates of text
float hr, vr; // horizontal and vertical radius of the text
void setup() {
size(200, 200);
PFont font = loadFont("AmericanTypewriter-24.vlw");
textFont(font);
size(640, 360);
textAlign(CENTER, CENTER);
textSize(48);
hr = textWidth(message) / 2;
vr = (textAscent() + textDescent()) / 2;
noStroke();
@@ -22,7 +21,7 @@ void setup() {
}
void draw() {
// instead of clearing the background, fade it by drawing
// Instead of clearing the background, fade it by drawing
// a semi-transparent rectangle on top
fill(204, 120);
rect(0, 0, width, height);