forked from JaeHongDev/java-baseball
-
Notifications
You must be signed in to change notification settings - Fork 0
[어정윤] 야구 게임 미션 #3
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
jeongyuneo
wants to merge
75
commits into
main
Choose a base branch
from
jeongyuneo
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.
Open
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
65fcc51
docs: 기능 요구사항 정리 추가
jeongyuneo 5733af7
feat: 게임 시작 문구 출력 기능 추가
jeongyuneo 1e07540
feat: 랜덤 숫자 생성 기능 추가
jeongyuneo 110b5ed
feat: 숫자 입력 기능 추가
jeongyuneo 022bd03
feat: 입력 값 공백 제거 기능 추가
jeongyuneo 65e128b
feat: 입력 값 3자리 검증 기능 추가
jeongyuneo 43d48ad
feat: 입력 값 정수 검증 기능 추가
jeongyuneo 424022c
feat: 입력 값 정수 범위 검증 기능 추가
jeongyuneo a09154e
feat: 랜덤 숫자와 입력 숫자 비교 기능 추가
jeongyuneo 056bf9f
feat: 비교 결과 출력 기능 추가
jeongyuneo 25852e9
feat: 게임 이어하기 및 종료 기능 추가
jeongyuneo 322bce9
feat: 게임 재진행 여부 질문 기능 추가
jeongyuneo 1b60b38
feat: 게임 재진행 여부 입력 기능 추가
jeongyuneo 61db2df
feat: 게임 재진행 여부 입력 값 공백 제거 기능 추가
jeongyuneo ba2a2b2
feat: 게임 재진행 여부 입력 값 1자리 검증 기능 추가
jeongyuneo d0db6d4
feat: 게임 재진행 여부 입력 값 정수 검증 기능 추가
jeongyuneo 26475e3
feat: 게임 재진행 여부 입력 값 정수 범위 검증 기능 추가
jeongyuneo 34f7849
docs: 기능 요구사항 정리 수정
jeongyuneo 24702fe
feat: 게임 재진행 및 종료 기능 추가
jeongyuneo ee3b873
feat: 숫자 입력 메시지 추가
jeongyuneo 9165d5e
refactor: 게임 시작 문구 출력 책임 분리
jeongyuneo 3e2e256
refactor: 게임 실행 책임 분리
jeongyuneo b8180de
refactor: io 패키지 네이밍 수정
jeongyuneo b70d664
refactor: 랜덤 숫자 생성 책임 분리
jeongyuneo 345cde2
refactor: RandomNumberGenerator - 랜덤 숫자 개수 상수화
jeongyuneo fc343db
refactor: 게임 재진행 질문 책임 분리
jeongyuneo ca2f204
refactor: 숫자 입력 책임 분리
jeongyuneo 5b50396
refactor: Input - 공백 및 대체문자 상수화
jeongyuneo dd2c2fa
refactor: 게임 숫자 생성 책임 분리
jeongyuneo 48cb7f7
refactor: 게임 숫자 비교 책임 분리
jeongyuneo 24bc5c2
style: GameNumbers - 오타 수정
jeongyuneo 7515fda
refactor: 게임 결과 생성 책임 분리
jeongyuneo 0200634
refactor: GameNumberGenerator - 메소드 네이밍 수정
jeongyuneo 0e98bb9
refactor: 게임 결과 출력 책임 분리
jeongyuneo 2fdf749
refactor: 게임 재진행 여부 입력 책임 분리
jeongyuneo 9cd8ad3
refactor: 게임 재진행 책임 분리
jeongyuneo f4d067e
refactor: GameResultGenerator - 생성 반환 타입 수정
jeongyuneo 7d22f2b
refactor: GameNumberGenerator - 생성 반환 타입 수정
jeongyuneo 8a2c5ba
refactor: GameNumberGenerator - 게임 숫자 상수로 수정
jeongyuneo aca6e8c
fix: 게임 종료 시 재진행 여부 질문 에러 수정
jeongyuneo 80eedc1
refactor: 정수 전환 책임 분리
jeongyuneo daf96a5
test: GameNumberGeneratorTest 추가
jeongyuneo 97fb0d5
test: GameResultGeneratorTest 추가
jeongyuneo 0e21ff4
test: GameStatusGeneratorTest 추가
jeongyuneo cf98bb7
refactor: GameStatus - 검증 로직 추가
jeongyuneo c7b0548
test: GameStatusGeneratorTest 삭제
jeongyuneo 4734106
refactor: GameNumbers - 검증 로직 추가
jeongyuneo d25a2d5
refactor: GameNumber - 검증 로직 추가
jeongyuneo fa66a55
refactor: GameResult - 정적 팩토리 메소드 추가
jeongyuneo 3377e54
test: GameResultGeneratorTest - GameResult 생성 로직 수정
jeongyuneo 415979e
test: GameNumberGeneratorTest - @ParameterizedTest 적용
jeongyuneo 4a0d896
docs: 기능 요구사항 정리 수정
jeongyuneo 2cbce96
feat: 입력 값 중복 검증 기능 추가
jeongyuneo a6520b4
test: GameNumberGeneratorTest - 입력 값 중복 검증 테스트 케이스 추가
jeongyuneo 262cf0a
test: GameResultTest - 클래스 네이밍 수정 및 패키지 이동
jeongyuneo 486f562
refactor: GameNumber - 예외 발생 메시지 포매팅
jeongyuneo db89377
refactor: GameNumbers - 예외 발생 메시지 포매팅
jeongyuneo d8a9fed
refactor: GameNumberGenerator 삭제
jeongyuneo d77ff08
refactor: GameNumberGenerator 추가
jeongyuneo 19fa2c1
refactor: RandomNumberGenerator - 패키지 및 로직 수정
jeongyuneo f671738
refactor: UserNumberGenerator - 클래스 네이밍, 패키지 및 로직 수정
jeongyuneo d0b3745
refactor: GameResult - 비교 로직 수정
jeongyuneo 88647bf
refactor: GameResult - 게임 종료 여부 필드 추가
jeongyuneo c470951
refactor: GameStatus - 정적 팩토리 메소드 추가
jeongyuneo 885f156
style: RandomNumberGenerator - 오타 삭제
jeongyuneo 8ae7d10
refactor: GameNumber - 정적 팩토리 메소드 추가
jeongyuneo c8713d9
refactor: GameNumbers - 비교 로직 수정
jeongyuneo 12ae9c8
refactor: NumberBaseballGame - 로직 수정
jeongyuneo eee7e78
test: UserNumberGeneratorTest 클래스 네이밍 수정
jeongyuneo 38b3ef8
refactor: GameNumbers - 중복 검증 로직 수정
jeongyuneo aaa90c8
test: UserNumberGeneratorTest - 패키지 이동 및 테스트 코드 수정
jeongyuneo 88990f2
test: GameResultTest - 테스트 코드 수정
jeongyuneo ef38005
test: GameNumbersTest 추가
jeongyuneo 39731ce
test: GameStatusTest 추가
jeongyuneo 7e2d57d
refactor: GameNumber - 미사용 메소드 삭제
jeongyuneo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # 숫자 야구 | ||
|
|
||
| ## 기능 요구사항 정리 | ||
|
|
||
| - [x] 게임 시작 문구 출력한다. | ||
| - [x] 랜덤 숫자를 생성한다. | ||
| - 숫자는 3자리다. | ||
| - 숫자는 중복되지 않아야 한다. | ||
| - [x] 숫자를 입력받는다. | ||
| - 숫자는 1~9 사이의 3자리 정수다. | ||
| - [x] 입력 값에서 공백을 제거한다. | ||
| - [x] 3자리가 아니면 에러가 발생한다. => `IllegalArgumentException` | ||
| - [x] 정수가 아닌 값을 포함하면 에러가 발생한다. => `IllegalArgumentException` | ||
| - [x] 1~9 범위를 벗어나면 에러가 발생한다. => `IllegalArgumentException` | ||
| - [x] 숫자는 중복되지 않아야 한다. => `IllegalArgumentException` | ||
| - [x] 랜덤 숫자와 입력받은 숫자를 비교한다. | ||
| - 같은 수가 같은 자리에 있으면 스트라이크, 같은 수가 다른 자리에 있으면 볼, 같은 수가 전혀 없으면 낫싱 | ||
| - [x] 비교 결과를 출력한다. | ||
| - 결과는 볼, 스트라이크 개수로 표시한다. | ||
| - [x] 3스트라이크이면 게임을 종료한다. | ||
| - [x] 3스트라이크가 아니면 게임으로 돌아간다. | ||
| - [x] 게임이 종료되면 재진행 여부를 묻는다. | ||
| - [x] 재진행 여부를 입력받는다. | ||
| - 재진행 여부는 1 또는 2인 정수다. | ||
| - [x] 입력 값에서 공백을 제거한다. | ||
| - [x] 정수가 아닌 값을 포함하면 에러가 발생한다. => `IllegalArgumentException` | ||
| - [x] 1~2 범위를 벗어나면 에러가 발생한다. => `IllegalArgumentException` | ||
| - [x] 게임을 재진행 또는 종료한다. | ||
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 |
|---|---|---|
| @@ -1,7 +1,12 @@ | ||
| package baseball; | ||
|
|
||
| import baseball.service.Game; | ||
| import baseball.service.NumberBaseballGame; | ||
|
|
||
| public class Application { | ||
|
|
||
| public static void main(String[] args) { | ||
| // TODO: 프로그램 구현 | ||
| Game game = new NumberBaseballGame(); | ||
| game.run(); | ||
| } | ||
| } |
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.domain; | ||
|
|
||
| import camp.nextstep.edu.missionutils.Randoms; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| public class GameNumber { | ||
|
|
||
| private static final int MIN_VALUE = 1; | ||
| private static final int MAX_VALUE = 9; | ||
|
|
||
| private final int value; | ||
|
|
||
| private GameNumber(int value) { | ||
| validateRange(value); | ||
| this.value = value; | ||
| } | ||
|
|
||
| public static GameNumber from(int input) { | ||
| return new GameNumber(input); | ||
| } | ||
|
|
||
| public static GameNumber create() { | ||
| return new GameNumber(Randoms.pickNumberInRange(MIN_VALUE, MAX_VALUE)); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object o) { | ||
| if (this == o) return true; | ||
| if (o == null || getClass() != o.getClass()) return false; | ||
| GameNumber that = (GameNumber) o; | ||
| return value == that.value; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(value); | ||
| } | ||
|
|
||
| private static void validateRange(int value) { | ||
| if (value < MIN_VALUE || value > MAX_VALUE) { | ||
| throw new IllegalArgumentException(String.format("%d~%d 범위를 벗어나는 숫자가 포함되어 있습니다.", MIN_VALUE, MAX_VALUE)); | ||
| } | ||
| } | ||
| } |
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.domain; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface GameNumberGenerator { | ||
|
|
||
| List<GameNumber> generate(int limit); | ||
| } |
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,55 @@ | ||
| package baseball.domain; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
|
|
||
| public class GameNumbers { | ||
|
|
||
| private static final int THE_NUMBER_OF_GAME_NUMBER = 3; | ||
|
|
||
| private final List<GameNumber> gameNumbers; | ||
|
|
||
| private GameNumbers(List<GameNumber> gameNumbers) { | ||
| validateTheNumberOf(gameNumbers); | ||
| validateDuplication(gameNumbers); | ||
| this.gameNumbers = new ArrayList<>(gameNumbers); | ||
| } | ||
|
|
||
| public static GameNumbers from(GameNumberGenerator gameNumberGenerator) { | ||
| return new GameNumbers(gameNumberGenerator.generate(THE_NUMBER_OF_GAME_NUMBER)); | ||
| } | ||
|
|
||
| public GameResult compare(GameNumbers other) { | ||
| int strike = 0; | ||
| int ball = 0; | ||
| for (int order = 0; order < THE_NUMBER_OF_GAME_NUMBER; order++) { | ||
| if (isStrike(other, order)) { | ||
| strike++; | ||
| } else if (isBall(other, gameNumbers.get(order))) { | ||
| ball++; | ||
| } | ||
| } | ||
| return GameResult.from(strike, ball, THE_NUMBER_OF_GAME_NUMBER); | ||
| } | ||
|
|
||
| private static void validateTheNumberOf(List<GameNumber> gameNumbers) { | ||
| if (gameNumbers.size() != THE_NUMBER_OF_GAME_NUMBER) { | ||
| throw new IllegalArgumentException(String.format("%d자리 값이 아닙니다.", THE_NUMBER_OF_GAME_NUMBER)); | ||
| } | ||
| } | ||
|
|
||
| private void validateDuplication(List<GameNumber> gameNumbers) { | ||
| if (new HashSet<>(gameNumbers).size() != THE_NUMBER_OF_GAME_NUMBER) { | ||
| throw new IllegalArgumentException("중복되는 값이 포함되어 있습니다."); | ||
| } | ||
| } | ||
|
|
||
| private boolean isStrike(GameNumbers other, int order) { | ||
| return this.gameNumbers.get(order).equals(other.gameNumbers.get(order)); | ||
| } | ||
|
|
||
| private boolean isBall(GameNumbers computer, GameNumber gameNumber) { | ||
| return computer.gameNumbers.contains(gameNumber); | ||
| } | ||
| } |
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,39 @@ | ||
| package baseball.domain; | ||
|
|
||
| public class GameResult { | ||
|
|
||
| private static final int THE_NUMBER_OF_GAME_NUMBER = 3; | ||
|
|
||
| private final String value; | ||
| private final boolean isEnd; | ||
|
|
||
| private GameResult(String value, boolean isEnd) { | ||
| this.value = value; | ||
| this.isEnd = isEnd; | ||
| } | ||
|
|
||
| public static GameResult from(int strike, int ball, int theNumberOfGameNumber) { | ||
| if (strike == 0 && ball == 0) { | ||
| return new GameResult("낫싱", false); | ||
| } | ||
| StringBuilder result = new StringBuilder(); | ||
| if (ball != 0) { | ||
| result.append(ball).append("볼 "); | ||
| } | ||
| if (strike != 0) { | ||
| result.append(strike).append("스트라이크"); | ||
| } | ||
| if (strike == theNumberOfGameNumber) { | ||
| result.append("\n").append(theNumberOfGameNumber).append("개의 숫자를 모두 맞히셨습니다! 게임 종료"); | ||
| } | ||
| return new GameResult(result.toString(), strike == THE_NUMBER_OF_GAME_NUMBER); | ||
| } | ||
|
|
||
| public String getValue() { | ||
| return value; | ||
| } | ||
|
|
||
| public boolean isEnd() { | ||
| return isEnd; | ||
| } | ||
| } |
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,30 @@ | ||
| package baseball.domain; | ||
|
|
||
| import baseball.util.Convertor; | ||
|
|
||
| public class GameStatus { | ||
|
|
||
| private static final int RESTART = 1; | ||
| private static final int END = 2; | ||
|
|
||
| private final int status; | ||
|
|
||
| private GameStatus(int status) { | ||
| validateRange(status); | ||
| this.status = status; | ||
| } | ||
|
|
||
| public static GameStatus from(String input) { | ||
| return new GameStatus(Convertor.toInteger(input)); | ||
| } | ||
|
|
||
| public boolean isRestart() { | ||
| return status == RESTART; | ||
| } | ||
|
|
||
| private static void validateRange(int status) { | ||
| if (status != RESTART && status != END) { | ||
| throw new IllegalArgumentException("1 또는 2 이외의 숫자가 포함되어 있습니다."); | ||
| } | ||
| } | ||
| } |
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,15 @@ | ||
| package baseball.domain; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
| import java.util.stream.Stream; | ||
|
|
||
| public class RandomNumberGenerator implements GameNumberGenerator { | ||
|
|
||
| public List<GameNumber> generate(int limit) { | ||
| return Stream.generate(GameNumber::create) | ||
| .distinct() | ||
| .limit(limit) | ||
| .collect(Collectors.toList()); | ||
| } | ||
| } |
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.domain; | ||
|
|
||
| import baseball.util.Convertor; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public class UserNumberGenerator implements GameNumberGenerator { | ||
|
|
||
| private static final String DELIMITER = ""; | ||
|
|
||
| private final String input; | ||
|
|
||
| public UserNumberGenerator(String input) { | ||
| this.input = input; | ||
| } | ||
|
|
||
| public List<GameNumber> generate(int limit) { | ||
| String[] inputNumbers = input.split(DELIMITER); | ||
| validateTheNumberOf(inputNumbers, limit); | ||
| return Arrays.stream(inputNumbers) | ||
| .map(Convertor::toInteger) | ||
| .map(GameNumber::from) | ||
| .collect(Collectors.toList()); | ||
| } | ||
|
|
||
| private void validateTheNumberOf(String[] inputNumbers, int limit) { | ||
| if (inputNumbers.length != limit) { | ||
| throw new IllegalArgumentException(String.format("%d자리 값이 아닙니다.", limit)); | ||
| } | ||
| } | ||
| } |
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,6 @@ | ||
| package baseball.service; | ||
|
|
||
| public interface Game { | ||
|
|
||
| void run(); | ||
| } |
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,38 @@ | ||
| package baseball.service; | ||
|
|
||
| import baseball.domain.*; | ||
| import baseball.util.Input; | ||
| import baseball.util.Output; | ||
|
|
||
| public class NumberBaseballGame implements Game { | ||
|
|
||
| private static final GameNumberGenerator randomNumberGenerator = new RandomNumberGenerator(); | ||
|
|
||
| public void run() { | ||
| Output.printStartMessage(); | ||
| start(); | ||
| } | ||
|
|
||
| private void start() { | ||
| play(GameNumbers.from(randomNumberGenerator)); | ||
| askPlayAgain(); | ||
| } | ||
|
|
||
| private void play(GameNumbers computer) { | ||
| while (true) { | ||
| GameNumberGenerator userNumberGenerator = new UserNumberGenerator(Input.readGameNumber()); | ||
| GameNumbers user = GameNumbers.from(userNumberGenerator); | ||
| GameResult gameResult = user.compare(computer); | ||
| Output.printResult(gameResult.getValue()); | ||
| if (gameResult.isEnd()) { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private void askPlayAgain() { | ||
| if (GameStatus.from(Input.readGameStatus()).isRestart()) { | ||
| start(); | ||
| } | ||
| } | ||
| } |
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,15 @@ | ||
| package baseball.util; | ||
|
|
||
| public class Convertor { | ||
|
|
||
| private Convertor() { | ||
| } | ||
|
|
||
| public static int toInteger(String value) { | ||
| try { | ||
| return Integer.parseInt(value); | ||
| } catch (NumberFormatException e) { | ||
| throw new IllegalArgumentException("정수가 아닌 값이 포함되어 있습니다."); | ||
| } | ||
| } | ||
| } |
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,26 @@ | ||
| package baseball.util; | ||
|
|
||
| import camp.nextstep.edu.missionutils.Console; | ||
|
|
||
| public class Input { | ||
|
|
||
| private static final String BLANK = " "; | ||
| private static final String DELETE = ""; | ||
|
|
||
| private Input() { | ||
| } | ||
|
|
||
| public static String readGameNumber() { | ||
| System.out.print("숫자를 입력해주세요 : "); | ||
| return removeBlank(Console.readLine()); | ||
| } | ||
|
|
||
| public static String readGameStatus() { | ||
| System.out.println("게임을 새로 시작하려면 1, 종료하려면 2를 입력하세요."); | ||
| return removeBlank(Console.readLine()); | ||
| } | ||
|
|
||
| private static String removeBlank(String input) { | ||
| return input.replaceAll(BLANK, DELETE); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오 사용자가 1 23 이런식으로도 입력하는 경우를 방지하셨네요 |
||
| } | ||
| } | ||
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,15 @@ | ||
| package baseball.util; | ||
|
|
||
| public class Output { | ||
|
|
||
| private Output() { | ||
| } | ||
|
|
||
| public static void printStartMessage() { | ||
| System.out.println("숫자 야구 게임을 시작합니다."); | ||
| } | ||
|
|
||
| public static void printResult(String result) { | ||
| System.out.println(result); | ||
| } | ||
| } |
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.
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.
이거 안 지켜지고 있는 것 같아요
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.
해당 조건은 랜덤으로 생성되는 숫자에만 적용했던 조건입니다.
사용자 입력 숫자는 중복체크를 안하고 있었는데, 필요할 것 같아 추가 구현했습니다!