Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. function start() {
  2.  
  3. if (facingEast()){
  4. makeRightSquare();
  5. }
  6.  
  7. if (facingNorth()){
  8. makeLeftSquare();
  9. }
  10.  
  11.  
  12. }
  13.  
  14. function makeRightSquare(){
  15. if (noBallsPresent()){
  16. putBall();
  17. }
  18.  
  19. move();
  20. turnLeft();
  21. if (noBallsPresent()){
  22. putBall();
  23. }
  24. move();
  25. if (noBallsPresent()){
  26. putBall();
  27. }
  28. turnLeft();
  29. if (noBallsPresent()){
  30. putBall();
  31. }
  32. move();
  33. if (noBallsPresent()){
  34. putBall();
  35. }
  36. turnLeft();
  37. move();
  38. turnLeft();
  39.  
  40. if (noBallsPresent()){
  41. putBall();
  42. }
  43. }
  44.  
  45. function makeLeftSquare(){
  46. if (noBallsPresent()){
  47. putBall();
  48. move();
  49.  
  50. turnRight();
  51. putBall();
  52. move();
  53. putBall();
  54. turnRight();
  55. move();
  56. putBall();
  57. turnRight();
  58. move();
  59. turnRight();
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement