Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

FrankySavvy

macrumors 68000
Original poster
Mar 4, 2010
1,570
749
Long Island, NY
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?
 
Last edited:

gsmornot

macrumors 68040
Sep 29, 2014
3,572
3,624
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?
I have not made it to his level yet but have been playing through the levels. Love it so far.
 

ConnYoungy

Cancelled
Aug 14, 2010
535
201
Can you access Swift Playgrounds from the Public Beta? the Feedback app wants me to take a survey about it but is that a generic message to everyone, even if they cant access it yet?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.