-
Notifications
You must be signed in to change notification settings - Fork 206
[자동차 경주] 김예림 미션 제출합니다. #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yerimming
wants to merge
31
commits into
woowacourse-precourse:main
Choose a base branch
from
yerimming:yerimming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 입력값을 쉼표 기준으로 분리 및 공백 제거
- 입력값이 배열인지, 비어있지 않은지 검증하는 checkSeparated 메서드 추가 - 최소 자동차 수 이상인지 검증하는 checkMinimumCars 메서드 추가 - 빈 이름이 존재하는지 검증하는 checkEmptyNames 메서드 추가 - 자동차 이름 길이 제한을 검증하는 checkNameLength 메서드 추가
- ConsoleView를 통해 자동차 이름 입력 받기 - Validator를 이용해 입력값 검증 - try-catch 블록으로 예외 처리 준비
- 입력값이 숫자인지, 1 이상인지 확인하는 validateTryCount 메서드 추가
- export default가 잘못되어 있던 부분(RacingController -> ConsoleView) 수정
- ConsoleView로 시도 횟수 입력 받기 - Validator를 이용해 입력값 검증 - try-catch 블록으로 에러 발생 시 printError() 호출
- 자동차 이름으로 초기 상태 설정하는 iniCars 메서드 추가 - 랜덤 값에 따라 전진 처리하는 palyRound 메서드 추가 - 현재 자동차 상태 반환하는 getCars 메서드 추가
- 게임 시작 메시지를 출력하는 printStart 메서드 추가 - 각 자동차의 전진 상태를 출력하는 printRound 메서드 추가
- carRace를 이용해 자동차 초기화 및 라운드 진행 - printStart로 게임 시작 메시지 출력 - 시도 횟수만큼 playRound 반복 후 printRound로 라운드 결과 출력
- 클래스 인스턴스 생성 없이 Validator 클래스에서 바로 호출할 수 있도록 수정
- winners 배열의 길이가 0인 경우 우승자가 없으므로 에러 발생 - 우승자가 여러명인 경우 join()을 사용하여 ,로 연결
- 게임 종료 후 우승자 정보(winners) 획득 및 출력 로직 추가
- checkSeparated, checkMinimumCars, checkEmptyNames, checkNameLength, validateTryCount 메서드 테스트 작성 - 잘못된 입력값에 예외 발생 여부 검증 - ERROR_MESSAGES 상수의 일관된 메시지 사용 확인 - Validator의 검증 로직 안정성 확보
- initCars: 자동차 초기화 시 각 이름의 이동 거리가 0으로 설정되는지 검증 - playRound: 랜덤 이동 값이 유효한 범위 내에서 갱신되는지 확인 - getWinners: 가장 많이 이동한 자동차 이름을 올바르게 반환하는지 확인 - getWinners: 이동거리가 동일한 경우(공동 우승자) 처리 확인
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
자동차 경주
구현 기능 목록
controller/RacingController.js
model/CarRace.js
model/Validator.js
view/ConsoleView.js
constants/message.js
constants/GameNumbers.js
###test/ValidatorTest.js
test/CarRaceTest.js