Advertisement
mrzrashed

Touhid_Ai_lab1

May 24th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1.  
  2.  
  3. Label 1: moveForward();
  4. moveForward();
  5.  
  6.  
  7. Label 2 :
  8.  
  9. moveForward();
  10. turnLeft();
  11. moveForward();
  12. turnRight();
  13. moveForward();
  14.  
  15.  
  16. Label 3:
  17.  
  18. while (notDone()) {
  19. moveForward();
  20. }
  21.  
  22.  
  23. label 4:
  24.  
  25. while (notDone()) {
  26. moveForward();
  27. turnLeft();
  28. moveForward();
  29. turnRight();
  30. }
  31.  
  32.  
  33. label 5:
  34.  
  35. moveForward();
  36. moveForward();
  37. turnLeft();
  38. while (notDone()) {
  39. moveForward();
  40. }
  41.  
  42.  
  43. label 6:
  44.  
  45. while (notDone()) {
  46. moveForward();
  47. if (isPathLeft()) {
  48. turnLeft();
  49. }
  50. }
  51.  
  52.  
  53.  
  54.  
  55. label 7:
  56.  
  57.  
  58. while (notDone()) {
  59. moveForward();
  60. if (isPathRight()) {
  61. turnRight();
  62. }
  63. }
  64.  
  65.  
  66.  
  67. label 8:
  68.  
  69. while (notDone()) {
  70. moveForward();
  71. if (isPathLeft()) {
  72. turnLeft();
  73. }
  74. if (isPathRight()) {
  75. turnRight();
  76. }
  77. }
  78.  
  79.  
  80. label9:
  81.  
  82. while (notDone()) {
  83. moveForward();
  84. if (isPathForward()) {
  85. moveForward();
  86. } else {
  87. turnLeft();
  88. }
  89. }
  90.  
  91.  
  92. label 10:
  93.  
  94.  
  95. moveForward();
  96. moveForward();
  97. turnLeft();
  98. while (notDone()) {
  99. if (isPathForward()) {
  100. moveForward();
  101. if (isPathRight()) {
  102. turnRight();
  103. }
  104. } else {
  105. turnLeft();
  106. }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement