// Write your code here
// - `context` is the canvas context
// - `persistent` is an empty object which is preserved between frames
context.fillStyle = "rgba(0,0,0,0.05)";
context.fillRect(0, 0, 32, 32);
const x = Math.floor(Math.random() * 32);
const y = Math.floor(Math.random() * 32);
context.fillStyle = [
"rgba(255,255,255,1)",
"rgba(255,0,0,1)",
"rgba(0,222,48,1)"
][Math.floor(Math.random() * 3)];
if (Math.floor(Math.random() * 2) === 0) {
switch (Math.floor(Math.random() * 3)) {
case 0:
context.fillRect(x, y, 1, 1);
break;
case 1:
context.fillRect(x, y, 1, 1);
context.fillRect(x - 1, y, 1, 1);
context.fillRect(x + 1, y, 1, 1);
context.fillRect(x, y - 1, 1, 1);
context.fillRect(x, y + 1, 1, 1);
break;
case 2:
context.fillRect(x, y, 1, 1);
context.fillRect(x - 1, y - 1, 1, 1);
context.fillRect(x + 1, y + 1, 1, 1);
context.fillRect(x + 1, y - 1, 1, 1);
context.fillRect(x - 1, y + 1, 1, 1);
break;
}
}