2017-04-04

Swift Playgrounds - Boxed in (Eingesperrt)

func goAndDo() {
  moveForward()
  if isOnClosedSwitch {
    toggleSwitch()
  } else if isOnGem {
    collectGem()
  }
}

for i in 1 ... 8 {
  if isBlocked {
    turnLeft()
  }
  goAndDo()
}

Keine Kommentare: