So I'm playing Swift Playgrounds and I love it, I really feel like I'm learning some swift!. However I get to the level Decision Tree in 'Conditional Code' and when Byte goes to use the toggleSwitch() command it doesn't open the switch and there seems to be a graphical error. Anyone else?
Here's the code I am using:
func solverightside() {
collectGem()
turnRight()
moveForward()
moveForward()
moveForward()
turnLeft()
moveForward()
collectGem()
turnLeft()
turnLeft()
moveForward()
turnRight()
moveForward()
moveForward()
moveForward()
turnRight()
}
func solveleftside() {
toggleSwitch()
turnLeft()
moveForward()
collectGem()
turnLeft()
turnLeft()
moveForward()
turnLeft()
}
for i in 1 ... 5 {
moveForward()
if isOnGem {
solverightside()
} else if isOnClosedSwitch {
solveleftside()
}
}
By the way the hint code is wrong, I tried copying that and it's missing a collectgem() command in the solverightside() function
EDIT; I emailed CRAIG FEDERIGHI think I'll get a response?
Here's the code I am using:
func solverightside() {
collectGem()
turnRight()
moveForward()
moveForward()
moveForward()
turnLeft()
moveForward()
collectGem()
turnLeft()
turnLeft()
moveForward()
turnRight()
moveForward()
moveForward()
moveForward()
turnRight()
}
func solveleftside() {
toggleSwitch()
turnLeft()
moveForward()
collectGem()
turnLeft()
turnLeft()
moveForward()
turnLeft()
}
for i in 1 ... 5 {
moveForward()
if isOnGem {
solverightside()
} else if isOnClosedSwitch {
solveleftside()
}
}
By the way the hint code is wrong, I tried copying that and it's missing a collectgem() command in the solverightside() function
EDIT; I emailed CRAIG FEDERIGHI think I'll get a response?
Last edited: