Skip to content
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

[숫자 야구] 이새힘 미션 제출합니다. #4

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Conversation

new-pow
Copy link

@new-pow new-pow commented Nov 26, 2022

No description provided.

- 문자열 입력시 숫자 파싱
- 파싱된 숫자를 3개의 숫자 파싱
- 파싱된 숫자로 야구 반환
- 숫자로 파싱 불가능한 문자열 예외처리
- 스트라이크 판단
- 볼 판단
- 낫싱 판단
- 스트라이크 판단 메서드
- 볼 판단 메서드
- 낫싱 판단 메서드
- 정답 판단 메서드
- 시작 메시지 출력
- endFlag 초기화
- 정답 숫자배열(computer) 생성
- 판정 유틸 초기화
- 숫자입력
- 판정
- 출력
Comment on lines +23 to +41
private int getStrike(List<Integer> userNumbers, List<Integer> computerNumbers) {
int result = 0;
for (int i =0; i<userNumbers.size(); i++) {
if (userNumbers.get(i)==computerNumbers.get(i)) {
result ++;
}
}
return result;
}

private int getBall(List<Integer> userNumbers, List<Integer> computerNumbers) {
int result = 0;
for (int userNumber : userNumbers) {
if (computerNumbers.contains(userNumber)) {
result ++;
}
}
return result;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getter setter의 네이밍는 객체 외부에서 요청하는 형식일때 쓰는게 좋아보입니다

Comment on lines +17 to +22
public boolean isHomerun() {
if(strike==3) {
homerun = true;
}
return homerun;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3스트라이크면 아웃입니다


private void playRound() {
Baseball userBaseball = userInput.askInputBaseball();
JudgementType judgement = baseballJudge.judgement(userBaseball);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

judgement의 메소드명은 동사형으로 시작하시는게 좋아보입니다

BaseballJudge baseballJudge;
NumberGenerator numberGenerator;
InputView userInput;
Boolean endFlag;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

되도록이면 private 붙여서 하시는게 좋은 거 같아요 3주차의 피드백 메일에 나와있습니다!

return result;
}

public boolean checkAnswer(JudgementType judgement) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check answer 라고 네이밍하셨는데 메소드명만 보고는 의미를 모르겠습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants