Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements basic gameplay logic for an UNO card game by centralizing card play logic, updating game state management, and enhancing the main game loop with proper user interaction.
Key changes:
- Consolidated card play logic into the base Card class with penalty handling and game state updates
- Enhanced game state management with winner detection and penalty processing
- Improved main game loop with interactive prompts and input validation
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/tech/mabunda/card/Card.java | Centralized play() method implementation with game logic |
| src/main/java/tech/mabunda/card/ActionCard.java | Removed individual play() method, now uses base class implementation |
| src/main/java/tech/mabunda/card/NumberCard.java | Removed individual play() method, now uses base class implementation |
| src/main/java/tech/mabunda/card/WildCard.java | Removed individual play() method, now uses base class implementation |
| src/main/java/tech/mabunda/game/Game.java | Enhanced with interactive gameplay loop and input handling |
| src/main/java/tech/mabunda/game/GameState.java | Added winner detection and penalty handling logic |
| src/test/java/tech/mabunda/game/GameTest.java | Updated test to use renamed createPlayers() method |
| src/test/java/tech/mabunda/game/GameStateTest.java | Updated test to expect empty string instead of null for penalty |
| src/test/java/tech/mabunda/card/WildCardTest.java | Added card to player hand before testing play() |
| src/test/java/tech/mabunda/card/NumberCardTest.java | Added card to player hand before testing play() |
| src/test/java/tech/mabunda/card/ActionCardTest.java | Added cards to player hand before testing play() |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Comment on lines
+110
to
+118
| if (value.equals("SKIP") || value.equals("DRAW_TWO") || value.equals("WILD_DRAW_FOUR")) { | ||
| state.setPenalty(value); | ||
| } else if (value.equals("REVERSE")) { | ||
| state.updateDirection(); | ||
| } else if (value.equals("WILD")) { | ||
| // TODO: implement input handling for this | ||
| // RED is just a placeholder | ||
| state.setColor(Color.RED); | ||
| } |
There was a problem hiding this comment.
Using hardcoded string comparisons makes the code fragile and error-prone. Consider using enum constants or defining these as static final String constants to improve maintainability and reduce the risk of typos.
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
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.