Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Turtle.*;
- public class DrunkTurtle extends SimpleTurtle {
- public DrunkTurtle(){
- super();
- }
- public void moveForward(double d){
- double n=Math.random()*(2*d);
- for(int i=0 ; i < 3 ; i++){
- int k = ((int)(Math.random()*61)-30);
- if(k%2 == 0)
- {
- if(k > 0)
- {
- this.turnLeft(k);
- }
- else
- {
- this.turnLeft(k);
- }
- }
- else
- {
- if(k > 0)
- {
- this.turnRight(k);
- }
- else
- {
- this.turnRight(k);
- }
- }
- super.moveForward(n/3);
- }
- }
- }
Add Comment
Please, Sign In to add comment