Guest User

Untitled

a guest
Jul 17th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. package Ex4;
  2.  
  3. import java.awt.event.*;
  4. import fyw.turtles.*;
  5.  
  6. public class RandomTurtleController implements ActionListener {
  7.  
  8. private Turtle t;
  9.  
  10. public RandomTurtleController(Turtle t) {
  11. t = new Turtle();
  12. }
  13.  
  14. public void actionPerformed(ActionEvent e) {
  15. t.move((Math.random() - 90) + (Math.random() * 180));
  16. t.turn((Math.random() * 10) + (Math.random() * 15));
  17. }
  18. }
Add Comment
Please, Sign In to add comment