본문 바로가기

Apple

(9)
Playgrounds '플레이그라운드' 13. '코드' 각 포털의 상태를 변경하여 보석을 수집해 보세요.bluePortal.isActive = falsebluePortal.isActive = truepinkPortal.isActive = falsepinkPortal.isActive = truebluePortal.isActive = falsepinkPortal.isActive = falsefor i in 1 ...3 {moveForward()}collectGem()pinkPortal.isActive =trueturnRight()turnRight()moveForward()turnRight()turnRight()moveForward()collectGem()turnRight()turnRight()bluePortal.isActive = truefor i in..
Playgrounds '플레이그라운드' 12. '코드'포털을 비활성화하여 스위치에 도달해 보세요.greenPortal.isActive = truegreenPortal.isActive = falsegreenPortal.isActive = falsefor i in 1 ... 6 {moveForward()}toggleSwitch()turnRight()turnRight()for i in 1 ... 3 {moveForward()}toggleSwitch()turnRight()turnRight()for i in 1 ... 6 {moveForward()}toggleSwitch()
Playgrounds '플레이그라운드' 8. '코드'for = 반복문 사용하여 실행할 횟수를 조정합니다.if ~ else = 조건문if isOnGem {collectGem()} elses {collectGem()사용하여 코드를 완성 합니다. for i in 1 ... 3 {moveForward()}if isOnGem {collectGem()} else {collectGem()for i in 1 ... 4 {moveForward()}if isOnGem {collectGem()}turnLeft()for i in 1 ... 2 {moveForward()}if isOnGem {collectGem()}turnLeft()for i in 1 ... 3 {moveForward()}if isOnGem {collectGem()} else {collectGem()}
Playgrounds '플레이그라운드' 7. '코드'if {} else {}moveForward()if isOnClosedSwitch {toggleSwitch()} else if isOnGem {collectGem()}moveForward()if isOnClosedSwitch {toggleSwitch()} else if isOnGem {collectGem()}
Playgrounds '플레이그라운드' 6. '코드'if 구문을 사용하여 여러 가지 조건에 대비 합니다.신호등이 초록색이면 캐릭터가 앞으로 걸어가 길을 건넙니다.for i in 1 ... 2 {moveForward()}if isOnClosedSwitch {toggleSwitch()}moveForward()if isOnClosedSwitch {toggleSwitch()}moveForward()if isOnClosedSwitch {toggleSwitch()}
Playgrounds ‘플레이그라운드’ 3. '코드'보석이나 스위치가 있는 곳으로 캐릭터를 이동시킨 후 버튼을 누르세요. moveForward() = 앞으로 한 칸씩 움직이다.moveForward() = 앞으로 한 칸씩 움직이다.turnLeft() = 왼쪽 '방향'moveForward() = 앞으로 한 칸씩 움직이다.collectGem() = 보석수집 합니다.moveForward() = 앞으로 한 칸씩 움직이다.toggleSwitch() = 점프하다.
Playgrounds '플레이그라운드' 2. '코드'캐릭터를 보석이 있는 곳까지 움직이고 보석을 수집하게 하는 명령을 입력합니다. 캐릭터를 스위치가 있는 곳까지 움직이고 스위치를 전원을 오픈합니다. moveForward() = 앞으로 한 칸씩 움직이다.moveForward() = 앞으로 한 칸씩 움직이다.turnLeft() = 왼쪽으로 돌다.moveForward() = 앞으로 한 칸씩 움직이다.collectGem() = 점프 보석을 수집하다.moveForward() = 앞으로 한 칸씩 움직이다.turnLeft() = 왼쪽으로 돌다.moveForward() = 앞으로 한 칸씩 움직이다.moveForward() = 앞으로 한 칸씩 움직이다.toggleSwitch() = 점프하다.
Playgrounds '플레이그라운드' 1. '코드'Swift 명령 보석을 수집하도록 캐릭터를 움직입니다.Swift 명령을 작성하여 캐릭터 보석을 수집하도록 해야 합니다.moveForward() = 앞으로 한 칸씩 움직이다.collectGem() =  점프 보석을 수집하다.3칸,보석1개코드moveForward() = 한칸moveForward() = 한칸moveForward() = 한칸collectGem() = 점프,보석수집