// Daniel Shiffman, edited by Kate Bauer // The Nature of Code // ITP, Spring 2006 // http://www.shiffman.net/ // A random walker object! class Ivy2 { int x,y; Ivy2() { x = width/3; y = height/2; } void render() { stroke (79,122,18); point(x,y); } // Randomly move up, down, left, right, or stay in one place void grow() { int vx = int(random(3))-1; int vy = int(random(3))-1; x += vx; y += vy; x = constrain(x,0,width); y = constrain(y,0,height); } }