일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- playgrounds
- 이노베이션아카데미
- binary operator
- 추적하기
- 프로그래머스
- ios개발자
- string from
- 42ecole
- 프로그래머스 문제 풀이
- ===
- 스위프트공부
- 스위프트
- ==
- swiftlanguage
- Swift
- c언어
- unary operator
- html
- 값올리기
- 짝수와 홀수
- 플레이그라운드
- 두 정수 사이의 합
- ternary operator
- string(from)
- 플레이그라운드 문제풀이
- !==
- 라피신
- ios
- 42에꼴
- 맥
Archives
- Today
- Total
minError
PlayGrounds [ 스위치 모으기 ] 본문
//1. 보석과 스위치의 갯수 세아리는 변수 생성.
var swithchCounter = 0
var gemCounter = 0
while switchCounter < gemCounter || switchCounter == 0 {
while !isBlocked {
//2. 첫번째, 발판 보석 수집하고, 수량 세아리기
if isOnGem {
collectGem()
gemCounter += 1
}
moveForward()
}
//3. 두번째, 수집한 보석의 갯수만큼 스위치 작동
if isOnClosedSwitch && switchCounter < gemCounter {
toggleSwitch()
switchCounter += 1
}
turnRight()
}
'PlayGround > 코딩배우기 2' 카테고리의 다른 글
PlayGrounds [ 포털 비활성화 하기 ] (0) | 2020.03.04 |
---|---|
PlayGrounds [ 총 개수 모으기 ] (0) | 2020.02.27 |
PlayGrounds [ 동일한 값 확인하기 ] (0) | 2020.02.27 |
PlayGrounds [ 3개의 보석, 4개의 스위치 ] (0) | 2020.02.27 |
Playgrounds [ 7개의 보석 찾기 ] (0) | 2020.02.26 |
Comments