var switchCounter = 0
var gemCounter = 0
for i in 1 ... 3 {
moveForward()
if isOnGem {
collectGem()
gemCounter += 1
}
}
while switchCounter < gemCounter{
if isOnGem {
collectGem()
gemCounter += 1
}
else if isOnClosedSwitch {
toggleSwitch()
switchCounter += 1
}else if isBlocked {
turnRight()
}
moveForward()
}
WORKED , still open to inprovment
Topic:
Developer Tools & Services
SubTopic:
Swift Playground
Tags: