Issuing Commands
Beginner solution
moveForward()
moveForward()
moveForward()
collectGem()
Advanced solution
while !isOnGem {
moveForward()
}
collectGem()
Adding a New Command
Beginner solution
moveForward()
moveForward()
turnLeft()
moveForward()
moveForward()
collectGem()
Advanced solution
while !isOnGem {
if isBlocked {
turnLeft()
}
moveForward()
}
collectGem()