-
Notifications
You must be signed in to change notification settings - Fork 2
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
[이영진] 자동차게임 재구현 #9
base: youngreal
Are you sure you want to change the base?
[이영진] 자동차게임 재구현 #9
Conversation
private void calculateMaxValue(CarStorage carStorage, int i) { | ||
if (isOverMaxLocation(carStorage, i)) { | ||
max= carStorage.getNotAdvanceCar(i).length(); | ||
} | ||
} | ||
|
||
private boolean isOverMaxLocation(CarStorage carStorage, int i) { | ||
return carStorage.getNotAdvanceCar(i).length() > max; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 구현체에서 carStorage.getNotAdvanceCar(i)의 length() 값을 가져오는 방식보다 carStorage 안에엇 특정한 자동차의 length를 제공하는 메서드를 만드는 방식이 더 좋아보입니다.
for (int i = 0; i < answer.length(); i++) { | ||
System.out.print(answer.charAt(i)); | ||
if (isNotFinalSequence(i)) { | ||
System.out.print(","); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한 메서드에 오직 한 단계의 들여쓰기만 한다
라는 객체 지향 생활 원칙을 지켜보는건 어떨까요?
} | ||
|
||
public static int generateRandomNumber() { | ||
return (int) (Math.random() * 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요구사항에는 전진하는 조건은 0에서 9 사이에서 random 값을 구한 후 random 값이 4이상일 경우이다.
이라 적혀있지만, 해당 난수 생성은 0 ~ 10 사이의 정수를 반환하고 있어 요구 사항과 달라보입니다. 🥺
No description provided.