xxxxxxxxxx84
let grid = [];let cols = 50;let rows = 50;let cellWidth, cellHeight;function setup() {//ts runs once at the page load bsp;createCanvas(620, 620); bsp;cellWidth = width / cols; bsp;cellHeight = height / rows; bsp;for (let i = 0; i cols; i++) { ; grid[i] = []; ; for (let j = 0; j rows; j++) { nbsp; grid[i][j] = floor(random(0));//create a grid and all that nbsp; if (grid[i][j] === 1) { fill(0); } ; } else { fill(255); }p; } p; rect(i * cellWidth, j * cellHeight, cellWidth, cellHeight); }; } }}function draw() { bsp;if (mouseIsPressed){