boolean straight = false, curve = false, rightAngleFork = true;
lines = new ArrayList<Line>();
text("mouse click to start", width/2, height/2);
} else if (choose != 0) {
lines.add(new Line(width/2, height/2, radians(random(120))));
lines.add(new Line(width/2, height/2, radians(random(125, 240))));
lines.add(new Line(width/2, height/2, radians(random(245, 350))));
lines.add(new Line(random(200, width-200), random(200, height-200), radians(random(360))));
lines.add(new Line(random(200, width-200), random(200, height-200), radians(random(360))));
lines.add(new Line(random(200, width-200), random(200, height-200), radians(random(360))));
lines.add(new Line(random(200, width-200), random(200, height-200), radians(random(360))));
lines.add(new Line(random(200, width-200), random(200, height-200), radians(random(360))));
for (int i = 0; i < lines.size (); i++) {
if (l.isDead)lines.remove(i);
text(round(frameRate), 50, 50);
if (choose > 5) choose = 1;
curve = rightAngleFork = true;
if (choose == 2 || choose == 4 || choose == 5) {
straight = rightAngleFork = true;
if (choose == 4 || choose == 5) rightAngleFork = false;
straight = curve = false;
float x, y, dx, dy, oldX, oldY, dir, threshold, vel, val;
Line(float xIn, float yIn, float dirIn) {
else if (curve == false && straight == false ) {
if (val < .1) dir -= .09;
else if (val > .9) dir += .09;
if (get(int(x), int(y)) != -16777216) isDead = true;
else if (random(.85) < threshold)
if (rightAngleFork)lines.add(new Line(x, y, dir + ((round(random(1))*2-1) * PI/2)));
else lines.add(new Line(x, y, dir + random(-1, 1) * PI/2));