Skip to content

Instantly share code, notes, and snippets.

@KolemanIreland
Created December 13, 2018 06:00
Show Gist options
  • Save KolemanIreland/5ebd9a8e5b1fecfc5f736d68d584904d to your computer and use it in GitHub Desktop.
Save KolemanIreland/5ebd9a8e5b1fecfc5f736d68d584904d to your computer and use it in GitHub Desktop.
Which Way to Turn Swift Playgrounds Learn to Code 1
while isBlockedRight{ //while blocked on the right move forward.
moveForward()
if isOnClosedSwitch && !isBlocked{ //while moving forward, if lands on a closed switch and is NOT blocked..
toggleSwitch() // flip the switch...
turnRight() //turn right...
moveForward() //move forward...
}
while isBlocked{ //until you're blocked from the front and...
turnLeft()
if isOnClosedSwitch{
toggleSwitch()
} //gotta get the gem somehow.
}
while isOnGem{ //got the gem.
collectGem()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment