大宮盆栽デイズ - Omiya Bonsai Days -

パイロットになれなかった人の「それから」。

上げたり下げたり@コードを学ぼう2

//上げたり下げたり@コードを学ぼう2
let expert = Expert()
let character = Character()

func expertTurnAround() {
    expert.turnLeft()
    expert.turnLeft()
}
func characterTurnAround() {
    character.turnLeft()
    character.turnLeft()
}
character.move(distance: 2)
character.collectGem()
expert.turnLock(up: true, numberOfTimes: 4)
character.turnRight()
character.move(distance: 2)
character.collectGem()
characterTurnAround()
character.move(distance: 1)
expert.turnLock(up: false, numberOfTimes: 3)
character.turnRight()
character.moveForward()
character.collectGem()
characterTurnAround()
for i in 1 ... 3 {
    expert.turnRight()
    expert.turnLock(up: true, numberOfTimes: 1)
}
for i in 1 ... 2 {
    character.move(distance: 2)
    character.turnLeft()
    character.move(distance: 2)
    character.collectGem()
    characterTurnAround()
    character.move(distance: 2)
    character.turnLeft()
}
character.move(distance: 2)
character.collectGem()

characterTurnAround()
character.moveForward()
expert.turnLock(up: true, numberOfTimes: 3)
character.turnRight()
character.moveForward()
character.collectGem()