mirror of
https://github.com/processing/processing4.git
synced 2026-06-08 08:31:28 +02:00
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user