Advertisement
Guest User

Untitled

a guest
Apr 5th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.97 KB | None | 0 0
  1. func solveRightSide() {
  2.     turnRight()
  3.     for i in 1 ... 9 {
  4.         if isOnGem {
  5.             collectGem()
  6.         }
  7.         if i < 6 {
  8.             for i in 1 ... 2 {
  9.                 if isBlocked {
  10.                     turnLeft()
  11.                 }
  12.             }
  13.         } else if isBlocked {
  14.             turnRight()
  15.         }
  16.         if i < 9 {
  17.             moveForward()
  18.         }
  19.     }
  20. }
  21.  
  22. func solveLeftSide() {
  23.     turnLeft()
  24.     for i in 1 ... 3 {
  25.         if isOnClosedSwitch {
  26.             toggleSwitch()
  27.         } else if isOnGem {
  28.             collectGem()
  29.         }
  30.         if i < 3 {
  31.             for i in 1 ... 2 {
  32.                 if isBlocked {
  33.                     turnLeft()
  34.                 }
  35.             }
  36.             moveForward()
  37.         } else {
  38.             turnLeft()
  39.         }
  40.     }
  41. }
  42.  
  43. for i in 1 ... 5 {
  44.     moveForward()
  45.     if isOnGem {
  46.         solveRightSide()
  47.     } else if isOnClosedSwitch {
  48.         solveLeftSide()
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement