-
Notifications
You must be signed in to change notification settings - Fork 14
1단계 미션 제출합니다. #9
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
mincheolkk
wants to merge
26
commits into
Meet-Coder-Study:mincheolkk
Choose a base branch
from
mincheolkk:step1
base: mincheolkk
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.
Open
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
a6345e8
init
mincheolkk aad83fc
feat : 스텝-1 시나리오 구현
mincheolkk ea6470d
feat : 입출력값 담당 클래스 추가
mincheolkk 85ea404
feat : int 타입을 한 자리 숫자 리스트로 변환하는 메서드 구현
mincheolkk c4fa261
feat : baseballGame 실행하기
mincheolkk 4c52e11
feat : 게임 결과를 담당하는 심판 클래스 구현
mincheolkk 64cc8fa
refactor : 메서드 이름 수정
mincheolkk e7526c4
feat : 컴퓨터 숫자 생성 로직 및 테스트 코드 추가
mincheolkk 0b10737
test : Referee 테스트 코드 추가
mincheolkk 0256386
refactor : do-while문으로 변경
mincheolkk 3ed2f72
refactor : Game상태 관련 enum으로 변경
mincheolkk 189da59
refactor : 무한 루프 방지
mincheolkk e32f1f8
refactor : 에러 클래스 안에서 에러 메세지 담당하게 변경
mincheolkk 066d729
refactor : 변수명 변경
mincheolkk 9aa0f71
docs : 메서드 관련 주석 추가
mincheolkk 5cfce43
move : 패키지 구조 변경
mincheolkk fb44709
move : 패키지 구조 변경
mincheolkk 13c5f8c
test : GameStatus enum 클래스 테스트 코드 추가
mincheolkk 0c273a8
test : util 메서드 테스트 코드 추가
mincheolkk 8e581ff
refactor : Input 입력 테스트를 위한 리팩토링
mincheolkk a925baf
refactor : 지역변수로 변경
mincheolkk 350d717
refactor : 컴퓨터 숫자 생성 책임 분리
mincheolkk e6bc155
test : 숫자 생성이 정상적으로 이루어지는지 비교
mincheolkk 2bb3fa9
refactor : enum으로 변경
mincheolkk 3460db3
refactor : 숫자 저장용 객체 생성
mincheolkk e3f942c
refactor : 판정 메서드 리팩토링
mincheolkk 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
| plugins { | ||
| id 'java' | ||
| } | ||
|
|
||
| group 'org.example' | ||
| version '1.0-SNAPSHOT' | ||
|
|
||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| dependencies { | ||
| testImplementation platform('org.junit:junit-bom:5.9.1') | ||
| testImplementation 'org.junit.jupiter:junit-jupiter' | ||
| testImplementation "org.assertj:assertj-core:3.25.3" | ||
| } | ||
|
|
||
| test { | ||
| useJUnitPlatform() | ||
| } |
Binary file not shown.
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,5 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 @@ | ||
| rootProject.name = 'java-baseball' | ||
|
|
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,8 @@ | ||
| package baseball; | ||
|
|
||
|
|
||
| public class Application { | ||
| public static void main(String[] args) { | ||
| BaseballGame.launch(); | ||
| } | ||
| } |
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,45 @@ | ||
| package baseball; | ||
|
|
||
| import baseball.domain.Computer; | ||
| import baseball.presentation.GameManager; | ||
| import baseball.domain.Referee; | ||
| import baseball.presentation.GameStatus; | ||
| import baseball.presentation.MessagePrinter; | ||
| import baseball.presentation.input.Input; | ||
| import baseball.presentation.input.InputProvider; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Scanner; | ||
|
|
||
| public class BaseballGame { | ||
|
|
||
| private static final Computer computer = new Computer(); | ||
| private static final Referee referee = new Referee(); | ||
| private static final InputProvider inputProvider = new Input(new Scanner(System.in)); | ||
| private static final GameManager gameManager = new GameManager(new MessagePrinter(), inputProvider); | ||
|
|
||
| public static void launch() { | ||
|
|
||
| boolean isApplicationOver = false; | ||
| while (!isApplicationOver) { | ||
| GameStatus gameStatus = gameManager.init(); | ||
|
|
||
| if (gameStatus.equals(GameStatus.START)) { | ||
| List<Integer> computerDigits = gameManager.getComputerDigits(computer); | ||
| referee.keepComputerDigits(computerDigits); | ||
| } else if (gameStatus.equals(GameStatus.QUIT)) { | ||
| gameManager.applicationOver(); | ||
| } | ||
|
|
||
| boolean isOut = false; | ||
| while (!isOut) { | ||
| List<Integer> userDigits = gameManager.getUserDigits(); | ||
| isOut = referee.judge(userDigits); | ||
| String callMessage = referee.getCallMessage(); | ||
| gameManager.call(callMessage); | ||
| } | ||
|
|
||
| gameManager.gameOver(); | ||
| } | ||
| } | ||
| } | ||
10 changes: 10 additions & 0 deletions
10
src/main/java/baseball/common/exception/InvalidGameStatusException.java
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,10 @@ | ||
| package baseball.common.exception; | ||
|
|
||
| public class InvalidGameStatusException extends Exception{ | ||
|
|
||
| private static final String MESSAGE = "1(시작) 또는 9(종료)를 눌러주세요."; | ||
|
|
||
| public InvalidGameStatusException() { | ||
| super(MESSAGE); | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/baseball/common/exception/InvalidLengthException.java
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,10 @@ | ||
| package baseball.common.exception; | ||
|
|
||
| public class InvalidLengthException extends Exception{ | ||
|
|
||
| private static final String MESSAGE = "자리 숫자만 가능합니다."; | ||
|
|
||
| public InvalidLengthException(int length) { | ||
| super(String.valueOf(length) + MESSAGE); | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.