Skip to content

Implement basic gameplay logic#89

Merged
ejmabunda merged 11 commits intomainfrom
feature/basic-gameplay
Aug 24, 2025
Merged

Implement basic gameplay logic#89
ejmabunda merged 11 commits intomainfrom
feature/basic-gameplay

Conversation

@ejmabunda
Copy link
Owner

No description provided.

@ejmabunda ejmabunda requested a review from Copilot August 24, 2025 02:40

This comment was marked as outdated.

@ejmabunda ejmabunda requested a review from Copilot August 24, 2025 17:17

This comment was marked as outdated.

@ejmabunda ejmabunda requested a review from Copilot August 24, 2025 17:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}
Copy link

Copilot AI Aug 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@ejmabunda ejmabunda merged commit 2137339 into main Aug 24, 2025
2 checks passed
@ejmabunda ejmabunda deleted the feature/basic-gameplay branch August 24, 2025 17:26
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.

2 participants