Skip to content

Comments

[BE] 이근표 👆업다운#9

Open
rootTiket wants to merge 13 commits intoLeets-Official:rootTiketfrom
rootTiket:main
Open

[BE] 이근표 👆업다운#9
rootTiket wants to merge 13 commits intoLeets-Official:rootTiketfrom
rootTiket:main

Conversation

@rootTiket
Copy link
Member

미션 실행 결과

스크린샷 2024-04-18 오후 2 28 00

기능 명세서

InputView

  • 모드를 입력 받을 때 지정된 모드가 아닌 경우 예외처리
  • 범위 이외의 숫자가 입력되었을 때 예외 처리
  • 범위 이외의 문자가 입력 되었을 때 예외처리
  • 다른 타입의 입력이 들어왔을 때 예외 처리

Contoller

  • 무작위 문자를 생성하여 랜덤문자가 해당 문자보다 작을경우 DOWN, 클 경우 UP을 출력하는 기능 구현
  • 오답 일 때 마다 범위를 갱신하는 기능 구현

회고

  • 클래스 나누어서 구현하는 것이 처음이어서 얼마나 세세하게 나누고 나눌 때 마다 데이터를 어떻게 전달해야 할지 막막했습니다.
    이에 관련하여 피드백 해주시면 좋겠습니다
  • 재귀를 이용한 메뉴 출력에 대해 고민했는데 첫 출력 이후 범위를 전달하여 처리하는 부분에 어려움을 겪었습니다. ✔️ 해결 완료

rootTiket and others added 13 commits April 13, 2024 16:49
1. 버전을 입력하는 기능 구현
2. 입력타입이 맞지 않을경우 예외처리 구현
1. 랜덤으로 숫자를 뽑는 기능 추가
2. 올바르지 않은 타입의 입력일 때 예외를 출력
1. 랜덤 알파벳을 뽑고 사용자의 입력과 일치한지 확인하는 기능 추가
2. 사용자의 입력에 따라 입력 문구 변경하는 기능 추가
1. 출력범위가 정상적으로 출력되도록 수정
2. 범위를 관리하는 range 클래스 분리
1. 영어버전에서 소문자가 범위에 포함되지 않은 현상 수정
2. 영어버전 range 클래스 분리
1. 예외 처리 함수의 방식을 예외 던지기로 변경
2. 숫자 범위를 range 클래스에서 데이터를 가져오는 대신 isInRange 함수를 사용하도록 변경
1. 입력시 예외처리에 대한 테스크코드 작성
2. 알파벳 두개 입력 예외처리에 대한 테스트코드 작성
@rootTiket rootTiket self-assigned this Apr 18, 2024
Comment on lines +78 to +82
public void validCharLength(String s) {
if (s.length() >= 2) {
throw new IllegalArgumentException("[ERROR] 알파벳 한 글자만 입력해주세요 ");
}
}
Copy link
Member

Choose a reason for hiding this comment

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

알파벳을 여러개를 입력하는 예외처리는 생각못했는데 좋은거 같습니다!

double randomValue = Math.random();
int randomNumber = (int)(randomValue *100) +1;
int cnt = 0;
int correct = -1;
Copy link
Member

Choose a reason for hiding this comment

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

correct를 -1로 둔 이유가 무엇인가요?
의도를 파악하기 힘든 것 같아요

Copy link
Member Author

Choose a reason for hiding this comment

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

correct는 정답이라는 의미의 변수입니다.
1로 두었다가 한번에 정답이 되는 현상을 방지하기 위함이었습니다!

int cnt = 0;
int correct = -1;
Range range = new Range(1, 100);
while (correct != randomNumber) {
Copy link
Member

Choose a reason for hiding this comment

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

정답과 비교하는 게 Controller의 역할인가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

contoller 에서 분리하려고 하는데 새로운 클래스를 만들어서 따로 검증하는 것이 더 좋은 방향일까요?

Comment on lines +20 to +26
public void setMin(char min) {
this.min = min;
}

public void setMax(char max) {
this.max = max;
}
Copy link
Member

Choose a reason for hiding this comment

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

객체가 일하게 하는 것이 어떨까요?

Comment on lines +28 to +30
public boolean isInRange(char value) {
return value >= min && value <= max;
}
Copy link
Member

Choose a reason for hiding this comment

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

객체가 일하고 있네요 ! 좋아요👍

range.setMin((char)(correct + 1));
} else if (correct > randomAlpha) {
System.out.println("DOWN");
range.setMax((char)(correct - 1));
Copy link

Choose a reason for hiding this comment

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

a->Z가 되는 경우도 아스키 코드를 생각해서 해주셔야될거같아요

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.

4 participants