-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[자동차 경주] 김영준 미션 제출합니다. #11
Open
welikeWatermelon
wants to merge
13
commits into
woowacourse-precourse:main
Choose a base branch
from
welikeWatermelon:welikeWatermelon
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
[자동차 경주] 김영준 미션 제출합니다. #11
welikeWatermelon
wants to merge
13
commits into
woowacourse-precourse:main
from
welikeWatermelon:welikeWatermelon
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
Implemented the input functionality to accept the names of racing cars, separated by commas, and the number of attempts for the race. The car names are stored in an array, and the number of cars is determined based on the input. Additionally, a Car class will be created in a future update.
Added the Car class to represent each car in the racing game. The class includes methods to determine whether the car advances based on a random number and updates the progress accordingly. The maximum wins are tracked to identify the car with the most progress.
Implemented a method to identify the final winners after all attempts have been completed. The method determines the car(s) with the most progress, and if multiple cars have the same maximum progress, they are all treated as winners.
Implemented a method to print the race progress for each car at every attempt. The method displays the name of each car and its current progress after each attempt, with results separated by a blank line for better readability.
Implemented a method to print the final winners. If there are multiple winners, their names are displayed separated by commas.
Added code to the main method to display the race progress and the final winners. The race progress is shown for each attempt, and the final winners are displayed after all attempts are completed.
Replaced `random.nextInt(10)` with `Randoms.pickNumberInRange(0, 9)` for improved readability and code consistency.
…input validation - Moved car input and attempt count input from `main` to a new class for better encapsulation and modularity. - Added exception handling to ensure input validation, improving robustness and preventing invalid data entry.
- Move game-related logic to `PlayGame` and `GameResultCalculator` classes to enhance modularity and separation of concerns. - Encapsulate car and attempt count processing for improved readability and maintainability. - Adjust `Car` class to support the new structure with movement and track display methods.
- Catch `NumberFormatException` and throw `IllegalArgumentException` with a clear message when tryCount input is non-numeric. - Ensures that users receive a clear error message when input is invalid, improving user experience and robustness.
- Renamed ambiguous variables and methods to enhance code readability. - Improved maintainability by making the purpose of variables and methods clearer.
- Updated code formatting to improve consistency and readability across the project.
…ve input validation Added validation to ensure car names are 5 characters or less, throwing IllegalArgumentException for invalid names. Updated InputHandler to validate input car names, ensuring they meet the required length.
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.