Open
Conversation
glucosei
reviewed
Apr 8, 2025
glucosei
left a comment
There was a problem hiding this comment.
다 나름의 규칙으로 책임을 가지고 있는 것 같아서 좋은 객체지향프로그램인 것 같습니다. 수고하셨어요!
There was a problem hiding this comment.
개인적인 의견으로는 Car이나 Cars의 프린트하는 부분이나 비지니스로직 실행하는 부분이 다른 부분에서 값을 받아서 처리하는게 확장성이 더 좋을 것 같다는 생각이 있어요!
|
자동차 이름 입력에 대한 예외처리를 따로 구현해 놓은 것이 굉장히 인상적이었습니다. |
hyungin0505
reviewed
Apr 8, 2025
Member
There was a problem hiding this comment.
어차피 strip(',') 하면서 공백으로 저장되서 isEmptry에서 걸러지니까 불필요할 것 같습니다
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
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.
Racing Car Game
주요 변경 사항
Cars클래스를 통해List<Car>직접 접근을 제한하고 책임을 위임.MovingStrategy인터페이스와RandomMovingStrategy구현체를 통해 이동 조건을 유연하게 처리.Validator클래스에서 전담.클래스 및 메소드
Application.javaCar.javaname: 자동차 이름 (final)position: 현재 위치strategyMove(MovingStrategy strategy): 전략 객체에 따라 조건을 만족하면 이동.getName(),getPosition(),setPosition(): 속성 접근용 getter/setter.PrintInfo(): 이름과 현재 위치를 출력 (디버깅용)Cars.javaCar객체를 관리하는 일급 컬렉션.Cars(List<Car> cars)Cars(String[] carNames): 이름 배열로부터 자동차 리스트를 생성하며 유효성 검사를 수행.getCars(): 자동차 리스트 반환printInfo(): 각 자동차의 위치를-로 시각화하여 출력getWinners(): 최종 우승자 리스트 반환 (최고 위치를 가진 자동차들)MovingStrategy.javaboolean canMove(): 이동 가능 여부 판단RandomMovingStrategy.javaRacingGame.javaplayGame(Cars cars, int count, MovingStrategy strategy): 정해진 횟수만큼 자동차들을 전략에 따라 이동시키고 매 턴 상태 출력printWinners(Cars cars): 최고 위치의 자동차 이름들을 출력Validator.javatryCountValidator(String tryCountInput): 시도 횟수의 유효성을 검사하고 정수로 반환carNameValidator(String name): 자동차 이름 유효성 검사 (빈값, 길이, 금지 문자 검사)