-
Notifications
You must be signed in to change notification settings - Fork 0
숫자 야구 게임 [sjiwon] #1
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
sjiwon
wants to merge
26
commits into
main
Choose a base branch
from
sjiwon
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.
+975
−3
Open
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
67acfb9
docs: 기본 기능 및 모델링에 대한 README.md 작성
sjiwon d1eef0e
feat: Baseballs 관련 상수 인터페이스 구현
sjiwon 7077cce
feat: Baseballs 모델 구현 및 예외 케이스 검증
sjiwon bd0fecc
test: Baseballs 테스트 케이스 작성
sjiwon 2da9bf0
feat: Computer 모델 구현 및 테스트 케이스 작성
sjiwon 312f766
feat: User 모델 구현 및 테스트 케이스 작성
sjiwon 55bee8e
feat: 게임 결과 명세를 위한 Result 모델 구현
sjiwon 6ffb501
feat: 게임 결과 도출을 위한 Referee 모델 구현 및 테스트 케이스 작성
sjiwon 1dde87d
feat: 게임 진행 상태 Tracking을 위한 GameStatus 구현 및 테스트 케이스 작성
sjiwon 7a3481e
feat: 게임 재시작 관련 GameProcessDecider 구현 및 테스트 케이스 작성
sjiwon ed74d6e
feat: 사용자 Input을 위한 InputView 구현
sjiwon cb910f1
feat: 콘솔 출력을 위한 OutputView 구현
sjiwon 7150851
feat: 게임 프로세싱을 위한 GameController 및 Application 동작 처리
sjiwon f28211a
test: Controller 테스트 케이스 추가
sjiwon 7f0707b
refactor: 사용자 숫자 Input시 Baseballs 수만큼 입력했는지 검증 추가
sjiwon b0dabea
refactor: 사용자 Input에 대한 Length 검증 -> 공백 존재 검증 케이스로 수정
sjiwon ba99c7e
refactor: SPACE -> SEPARATOR 네이밍 수정
sjiwon 36107ff
fix: 컴퓨터 Baseballs 랜덤 생성 관련 not equal -> less 조건으로 수정
sjiwon 10961ce
test: Computer Baseballs 랜덤 생성 관련 테스트 케이스 추가
sjiwon e619cf8
refactor: readUserBaseballInput 접근제어자 public -> private
sjiwon 95f69e0
refactor: Computer baseballs 생성 간 내부 로직 메소드화
sjiwon 0e47d89
refactor: Referee strikeCount 계산 로직 간 filter comparing method 분리
sjiwon d71a429
refactor: ExceptionConstants class -> interface
sjiwon 56cf0e5
refactor: 사용자 Input I/O간 검증 순서 수정
sjiwon 991a5d9
refactor: hasSpace 메소드 위치 수정
sjiwon bdb2346
fix: UserTest간 new Baseball -> new User로 수정
sjiwon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package baseball.model; | ||
|
|
||
| import camp.nextstep.edu.missionutils.Randoms; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| import static baseball.utils.BaseballConstants.*; | ||
|
|
||
| public class Computer { | ||
| private final Baseballs baseballs; | ||
|
|
||
| public Computer() { | ||
| this.baseballs = generateRandomBaseballs(); | ||
| } | ||
|
|
||
| private Baseballs generateRandomBaseballs() { | ||
| List<Integer> baseballs = new ArrayList<>(); | ||
|
|
||
| while (baseballs.size() != BASEBALL_SIZE) { | ||
| int randomNumber = Randoms.pickNumberInRange(MIN_BASEBALL, MAX_BASEBALL); | ||
| if (!baseballs.contains(randomNumber)) { | ||
| baseballs.add(randomNumber); | ||
| } | ||
| } | ||
|
|
||
| return new Baseballs(baseballs); | ||
| } | ||
|
|
||
| public List<Integer> getBaseballs() { | ||
| return baseballs.getBaseballs(); | ||
| } | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package baseball.model; | ||
|
|
||
| import org.junit.jupiter.api.DisplayName; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| class ComputerTest { | ||
| @Test | ||
| @DisplayName("Baseballs 랜덤 제공을 통해서 Computer를 생성한다") | ||
| void construct() { | ||
| // when | ||
| final Computer computer = new Computer(); | ||
|
|
||
| // then | ||
| assertThat(computer.getBaseballs()).hasSize(3); | ||
| } | ||
| } |
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.
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.
while 조건으로 size가 3을 초과하는 경우를 생각해서 less를 쓰는 게 좋지 않을까요?
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.
not equal보다는 less가 더 적절하겠네요