xxxxxxxxxx
37
// Daniel Shiffman
// http://codingtra.in
// https://youtu.be/l__fEY1xanY
// https://thecodingtrain.com/CodingChallenges/052-random-walk.html
let x;
let y;
function setup() {
createCanvas(400, 400);
x = width / 2;
y = height / 2;
background(51);
}
function draw() {
stroke(255, 100);
strokeWeight(2);
point(x, y);
x = x + random(-1,3);
y = y + random(-1,1);
// const r = floor(random(4));
// switch (r) {
// case 0:
// x = x + 1;
// break;
// case 1:
// x = x - 1;
// break;
// case 2:
// y = y + 1;
// break;
// case 3:
// y = y - 1;
// break;
// }
}