Sure!

```
const segmentSize = 3;
let cells;
class Organism {
constructor(column, row) {
this.column = column * segmentSize;
this.row = row * segmentSize;
this.status = true;
this.activate();
}
deactivate() {
this.status = false;
fill(0);
quad(
this.column - segmentSize, this.row - segmentSize,
this.column , this.row - segmentSize,
this.column , this.row ,
this.column - segmentSize, this.row
);
}
activate() {
this.status = true;
fill(255);
quad(
this.column - segmentSize, this.row - segmentSize,
this.column , this.row - segmentSize,
this.column , this.row ,
this.column - segmentSize, this.row
);
}
}
function grid() {
for (let i = segmentSize; i < width + segmentSize; i += segmentSize) {
for (let j = segmentSize; j < height + segmentSize; j+= segmentSize) {
fill(0);
quad(
i - segmentSize, j - segmentSize,
i , j - segmentSize,
i , j ,
i - segmentSize, j
);
}
}
}
function setup() {
createCanvas(300, 300);
background(0);
fill(0)
stroke(200, 255, 255);
strokeWeight(1);
frameRate(5);
cells = new Array(width / segmentSize);
for (let i = 0; i < cells.length; i += 1) {
cells[i] = new Array(height / segmentSize);
}
}
function draw() {
grid();
for (let i = 1; i <= (width / segmentSize); i += 1) {
for (let j = 1; j <= (height / segmentSize); j += 1) {
cells[i - 1][j - 1] = new Organism(i, j);
}
}
for (let i = 0; i < cells.length; i += 1) {
for (let j = 0; j < i.length; j += 1) {
let organism = cells[i][j];
let countOfNeighbours = 0;
for (let k = -1; k < 2; k += 1) {
for (let l = -1; l < 2; l += 1) {
if ((k === 1) && (l === 1)) {
continue;
}
let neighbour = cells[i + k][j + l];
if (neighbour.status) {
countOfNeighbours += 1;
}
}
}
if ((countOfNeighbours === 2) || (countOfNeighbours === 3)) {
organism.deactivate();
}
else {
organism.deactivate();
}
}
}
}
```