Skip to content
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
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

welikeWatermelon
Copy link

No description provided.

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant