[자동차 경주] 장아현 미션 제출합니다. #200
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.
🏎️ 자동차 경주
🗒️ 기능 구현 사항
기본 기능
,를 기준으로 구분하며 5자 이하이다.0 ~ 9사이의 무작위 값을 구한 뒤 4 이상일 경우,를 이용해 구분한다.입력 예외 처리
[ERROR]로 시작하는 메시지와 함께Error를 발생시킨다.process.exit()를 사용하지 않는다.:
[ERROR] 자동차 이름은 1자 이상이어야 합니다.출력 후 종료:
[ERROR] 자동차 이름은 5자 이하이어야 합니다.출력 후 종료:
[ERROR] 중복된 자동차 이름은 작성할 수 없습니다.출력 후 종료:
[ERROR] 숫자가 아닌 값은 입력할 수 없습니다. 1 이상의 정수를 입력해주세요.출력 후 종료:
[ERROR] 시도할 횟수는 음수가 될 수 없습니다. 1 이상의 정수를 입력해주세요.출력 후 종료:
[ERROR] 시도할 횟수는 소수가 될 수 없습니다. 1 이상의 정수를 입력해주세요.출력 후 종료함수 및 파일 정리
model / Car.js
자동차 경주에 활용할 자동차 객체를 생성합니다.
utils / input.js
사용자에게 입력받는 자동차 이름(getCarName)과 시도 횟수(getRounds)를 관리하는 파일입니다.
utils / validate.js
사용자에게 입력받은 자동차 이름(validateCarName(input))과 시도 횟수(validateRounds(input))가 유효한지 검증하는 파일입니다.
utils / race.js
자동차 경주를 진행(race(cars, rounds))하고 출력하는 함수(printRaceStatus(cars))를 관리하는 파일입니다.
utils / winner.js
최종적으로 우승자를 결정(getWinner(cars))하고 출력하는 함수(printWinners(winners))를 관리하는 파일입니다.
utils / constants.js
에러메시지 상수를 관리하는 파일입니다.
출력 예시
👀 리뷰어가 무엇을 주목해야할까요