Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class drunkTutle here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class drunkTutle extends Turtle
- {
- public void moveForward(double size)
- {
- super.moveForward(Math.random()*size);
- double rand = Math.random();
- if(rand<=0.3)
- turnLeft(90);
- rand = Math.random();
- if(rand<=0.2)
- {
- super.moveForward(Math.random()*(-size));
- }
- else
- {
- super.moveForward(Math.random()*(size));
- }
- }
- public void turnL(int y)
- {
- y = (int)(y*2*Math.random());
- turnLeft(y);
- }
- public void turnR(int y)
- {
- y = (int)(y*2*Math.random());
- turnRight(y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement