xxxxxxxxxx
24
/* A random maze generation sketch
uses the concept of Probability
*/
let x = 0, y = 0, sp = 10;
function setup() {
createCanvas(400, 400);
background(0);
}
function draw() {
stroke(255);
if(random(1) < 0.5) {
line(x, y, x + sp, y + sp);
}
else {
line(x, y + sp, x + sp, y);
}
x = x + sp;
if(x > width) {
x = 0;
y = y + sp;
}
}