xxxxxxxxxx
32
let SPACING = 20;
let PROBABLILTY = 0.5;
// Intuitive implementation of
// the 10 print pattern
function setup() {
// The original Commodore 64
// character grid was only 40 x 25
createCanvas(500, 500);
// Approximation of the Commodore 64 style
background(62, 67, 209);
stroke(154, 156, 250);
strokeWeight(2);
noLoop(); // only draw once
}
function draw() {
// Go row by row
for (let y = 0; y < width; y += SPACING) {
for (let x = 0; x < height; x += SPACING) {
// Switch which "character"
if (random(1) < PROBABLILTY) {
line(x, y, x + SPACING, y + SPACING);
} else {
line(x, y + SPACING, x + SPACING, y);
}
}
}
}