This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let expert = Expert() | |
| let character = Character() | |
| var gemCon = 0 | |
| var switchCon = 0 | |
| var steps = 0 | |
| func lockSmith() { | |
| if steps == 5 { | |
| expert.turnRight() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let expert = Expert() | |
| let character = Character() | |
| var gemCon = 0 | |
| var switchCon = 0 | |
| func expertNav() { | |
| expert.turnLeft() | |
| expert.moveForward() | |
| expert.moveForward() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let expert = Expert() | |
| var gemCon = 0 | |
| var steps = 0 | |
| func blocked() { | |
| if !expert.isBlockedRight { | |
| expert.turnRight() | |
| } else if expert.isBlocked { | |
| expert.turnLeft() | |
| expert.turnLeft() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let totalGems = randomNumberOfGems | |
| var gemCon = 0 | |
| func navigate () { | |
| while !isBlocked { | |
| moveForward() | |
| if isOnGem { | |
| collectGem() | |
| gemCon += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gemCon = 0 | |
| var swCon = 0 | |
| func portalCheck() { | |
| if gemCon == 0 { | |
| purplePortal.isActive = false | |
| } else if gemCon == 4 { | |
| purplePortal.isActive = true | |
| } | |
| if swCon == 1 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var gemCollector = 0 | |
| while gemCollector < 7 { | |
| moveForward() | |
| if isBlocked { | |
| turnLeft() | |
| turnLeft() | |
| moveForward() | |
| else if isOnGem() { | |
| collectGem() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while !isBlocked { | |
| moveForward() | |
| if isOnGem { | |
| collectGem() | |
| turnRight() | |
| moveForward() | |
| collectGem() | |
| } else if isOnClosedSwitch && isBlockedLeft { | |
| toggleSwitch() | |
| turnRight() |