Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func solveRightSide() {
- turnRight()
- for i in 1 ... 9 {
- if isOnGem {
- collectGem()
- }
- if i < 6 {
- for i in 1 ... 2 {
- if isBlocked {
- turnLeft()
- }
- }
- } else if isBlocked {
- turnRight()
- }
- if i < 9 {
- moveForward()
- }
- }
- }
- func solveLeftSide() {
- turnLeft()
- for i in 1 ... 3 {
- if isOnClosedSwitch {
- toggleSwitch()
- } else if isOnGem {
- collectGem()
- }
- if i < 3 {
- for i in 1 ... 2 {
- if isBlocked {
- turnLeft()
- }
- }
- moveForward()
- } else {
- turnLeft()
- }
- }
- }
- for i in 1 ... 5 {
- moveForward()
- if isOnGem {
- solveRightSide()
- } else if isOnClosedSwitch {
- solveLeftSide()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement