I’m running swift playground and on the Code 1 under “Treasure Hunt” I’m stuck I fallowed the instructions in the hints section and still couldn’t get the guy to move forward. I went to the apple store for help and the guy who tried to help couldn’t so I’m reaching out to someone here to help me out.
Stuck on code 1 treasure hunt need help please
I dont exactly know what you mean by "couldn't get the guy to move forward" but this is the way I found to solve it:
func moveThenToggle() {
moveForward()
moveForward()
toggleSwitch()
}
func turnAroundAndReturn(distance: Int) {
turnLeft()
turnLeft()
for _ in 1...distance {
moveForward()
}
}
////////////////
moveThenToggle()
turnAroundAndReturn(distance: 2)
moveThenToggle()
turnAroundAndReturn(distance: 2)
turnRight()
moveThenToggle()
moveThenToggle()
turnAroundAndReturn(distance: 4)
moveThenToggle()
moveThenToggle()
Maby this helps you!
I am having the same issue, did you ever get this resolved?