[자동차 경주] 홍상우 미션 제출합니다. #204
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
javascript-racingcar-precourse
자동차 이름 처리
[Input] 사용자에게 경주할 자동차 이름 입력을 받는다.
[Logic] 입력받은 문자열을 쉼표(,) 기준으로 분리한다. (e.g., "pobi,woni,jun" -> ['pobi', 'woni', 'jun'])
[Logic] 분리된 이름 배열이 5자 이하 등 유효한지 검사한다. ([ERROR] 발생)
시도 횟수 처리
[Input] 사용자에게 시도할 횟수 입력을 받는다. (App.js의 run 담당)
[Logic] 입력받은 횟수가 1 이상의 숫자인지 검사한다. ([ERROR] 발생)
경주 진행
[Data] 자동차 이름 목록으로 자동차 객체(또는 클래스) 목록을 생성한다. (e.g., [{ name: 'pobi', position: 0 }, ...])
[Logic] 자동차 한 대가 무작위 값(0~9)을 받아 4 이상일 경우 전진하는 기능을 구현한다.
(Random.pickNumberInRange가 4를 반환할 때, 3을 반환할 때를 각각 테스트)
[Logic] 모든 자동차에 대해 1라운드(1회 시도)를 실행한다.
[Output] 1라운드(차수)별 실행 결과를 형식에 맞게 출력한다. (e.g., pobi : -)
최종 결과
[Logic] 경주가 끝난 후, 가장 멀리 간 우승자를 찾는 기능.
(e.g., [{ name: 'pobi', position: 3 }, { name: 'woni', position: 5 }]을 넣으면 'woni'가 나오는지 테스트)
[Output] 최종 우승자를 형식에 맞게 출력한다. (공동 우승자 쉼표 구분)