6 lines of code

Originally 6 lines of code in processing by u/mecobi at Reddit: reddit.com/r/generat…kpg/6_lines_of_code/

Log in to post a comment.

Canvas.setpenopacity(-.7);
const turtle = new Turtle(), w = 200, rnd = (lower, upper) => lower + Math.random() * (upper - lower);
function walk(i) {
    turtle.jump((x = rnd(-w/8, w+w/8))-w/2, (y=rnd(-w/8, w+w/8))-w/2);
    for(let j = 0; j < w * 2; j++) turtle.goto((x += Math.cos(5*y/w*10)+Math.cos(3*y/w*10))-w/2, (y += Math.sin(3*x/w*10)-Math.cos(5*x/w*10))-w/2);
    return i < 2000; }