Skip to content

Instantly share code, notes, and snippets.

@imbradmiller
Created October 9, 2016 20:26
Show Gist options
  • Save imbradmiller/ca1f038d292643fc17940bff9451b28b to your computer and use it in GitHub Desktop.
Save imbradmiller/ca1f038d292643fc17940bff9451b28b to your computer and use it in GitHub Desktop.
Portal On and Off
var gemCon = 0
var swCon = 0
func portalCheck() {
if gemCon == 0 {
purplePortal.isActive = false
} else if gemCon == 4 {
purplePortal.isActive = true
}
if swCon == 1 {
purplePortal.isActive = false
}
}
while gemCon < 7 || swCon < 1 {
moveForward()
portalCheck()
if isOnGem {
collectGem()
gemCon = gemCon + 1
} else if isOnClosedSwitch {
toggleSwitch()
swCon = swCon + 1
}
if isBlocked {
turnLeft()
turnLeft()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment