forked from JaeHongDev/java-baseball
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Phjppo0918 #2
Open
phjppo0918
wants to merge
17
commits into
C-B-U:main
Choose a base branch
from
phjppo0918:phjppo0918
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
Phjppo0918 #2
Conversation
This file contains 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
Add new contents to README - feature list - exception list - enum list
Add an enum specifying the following message - starting game - guess value input request - restart request after game is finished
Add message enum needed to show result for guesses - strike - ball - nothing
Add regex enum for input - 1 or 2 single digit - 3-digit number from 1 to 9
Add exception handling for user input - not suitable regex - overlap number
Validate inputs for - game restart or not response message - guess value input message
Add ability to create element - generate 3 non-overlapping, ordered random numbers - generate list of 3 numbers based on user input
add detail features - compare target and guess values - determining whether nothing - return whether out
Outputs console messages to proceed with the game. Asks for guess value until user exits. After checking the user's ball count, the game ends when out.
Request whether to restart after playing one game. The game continues until the end request is made.
Generate unit tests for validating user console input messages. 1. restart request message - enter strange characters - enter numbers other than 1 and 2 - enter 2 or more digits 2. guess value input message - enter strange characters - input with 0 - duplicate number entry - enter more than 3 digits
Create unit tests with response messages for the user's predictions. - unit test for all possible ball count cases - out if 3 strikes
In the past, it requested to change the argument as it is. So, if an immutable object is received as an argument, an exception is raised, which can cause problems due to shallow copying even if no exception is raised. So, change the caller to copy and use the argument. Before: public StrikeAndBallCount(List<Integer> target, List<Integer> guessValue) { digitNumber = target.size(); setStrikeCountAndCheckIfStrike(copyTarget, copyGuessValue); setBallCount(copyTarget, copyGuessValue); } After: public StrikeAndBallCount(List<Integer> target, List<Integer> guessValue) { List<Integer> copyTarget = new ArrayList<>(target); List<Integer> copyGuessValue = new ArrayList<>(guessValue); digitNumber = target.size(); setStrikeCountAndCheckIfStrike(copyTarget, copyGuessValue); setBallCount(copyTarget, copyGuessValue); }
…alues to a first class collection Changed the random value set and guess value list previously generated by BallGenerator to the first class collection. DIGIT_NUMBER from BallGenerator moved to GamePlayer class. Modify StrikeAndBallCount to use the changed first class collection, and change the unit tests accordingly.
…ives the parameter to private Although the access modifier was provided as public for the unit test, it is okay to change it to private while the unit test creates a mock object. before : public Target(List<Integer> targetValue) { this.targetValue = new ArrayList<>(targetValue); } after : private Target(List<Integer> targetValue) { this.targetValue = new ArrayList<>(targetValue); }
For the ease of testing, the part that generates random values of the target is changed so that the target element can be configured with a random value through a mock object.
Update to reflect created/modified/deleted classes. In addition, access modifier are displayed for each detailed function.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.