createCanvas(1080, 2400);
colorMode(HSB, 360, 100, 100, 100);
cellAutomaton = new CellAutomaton(int(random(1, 2) * 15));
if (cellAutomaton.generation < height / cellAutomaton.size) {
cellAutomaton.generate();
cellAutomaton = new CellAutomaton(int(random(1, 2) * 15));
for (let i = 0; i < width / this.size; i++) {
this.cells[int(this.cells.length / 2)] = 1;
this.ruleset = this.setRule();
for (let i = 0; i < 8; i++) {
arr.push(random() < 0.5 ? 0 : 1);
for (let i = 0; i < this.cells.length; i++) {
for (let i = 1; i < this.cells.length - 1; i++) {
let left = this.cells[i - 1];
let center = this.cells[i];
let right = this.cells[i + 1];
nextgen[i] = this.rules(left, center, right);
this.ruleset = this.setRule();
for (let i = 0; i < this.cells.length; i++) {
if (this.cells[i] == 1) {
i * this.size + this.size / 2,
height - this.generation * this.size + this.size / 2
rotate((int(random(4)) * 360) / 4);
arc(-this.size / 2, -this.size / 2, this.size * 2, this.size * 2, 0, 90);
if (a == 1 && b == 1 && c == 1) return this.ruleset[0];
if (a == 1 && b == 1 && c === 0) return this.ruleset[1];
if (a == 1 && b === 0 && c == 1) return this.ruleset[2];
if (a == 1 && b === 0 && c === 0) return this.ruleset[3];
if (a === 0 && b == 1 && c == 1) return this.ruleset[4];
if (a === 0 && b == 1 && c === 0) return this.ruleset[5];
if (a === 0 && b === 0 && c == 1) return this.ruleset[6];
if (a === 0 && b === 0 && c === 0) return this.ruleset[7];