Skip to content

Feature/player elimination#30

Merged
MartinStenhagen merged 2 commits into
mainfrom
feature/playerElimination
Jan 14, 2026
Merged

Feature/player elimination#30
MartinStenhagen merged 2 commits into
mainfrom
feature/playerElimination

Conversation

@MartinStenhagen

@MartinStenhagen MartinStenhagen commented Jan 14, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Added a demo travel journey animation feature to showcase sample travel paths.
  • Bug Fixes

    • Improved error handling to prevent crashes when players cannot afford moves.
    • Automatically eliminates players lacking sufficient resources to continue.
    • Enhanced turn management to properly handle edge cases.

✏️ Tip: You can customize this high-level summary in your review settings.

…pelare inte har råd att fortsätta. Nya metoden eliminatePlayer() tar bort den spelare och övriga kan spela klart.
# Conflicts:
#	src/main/java/org/example/TravelGameController.java
@coderabbitai

coderabbitai Bot commented Jan 14, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

TravelGameController enhanced with improved error handling in game moves, supporting player elimination when affordability issues arise. Added guard clauses for edge cases in onRoll. New public method startMockJourney() provides demo travel path animation. Introduced helper methods for eliminating players and deduplicating locations.

Changes

Cohort / File(s) Summary
Game Controller Enhancements
src/main/java/org/example/TravelGameController.java
Added guard clauses in onRoll for empty player list, game-won state, and currentPlayerIndex wrap-around. Enhanced doMove error handling with IllegalStateException catching, transaction rollback, and conditional player elimination for affordability issues. New public method startMockJourney() for demo path animation. New private helpers: eliminatePlayer() for traveler removal with UI reset, and distinctLocationsById() for location deduplication. Minor structural updates in doContinueJourney.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • fixed the gui part after merge #21: Modifies onRoll, startMockJourney, and HUD/map synchronization logic in the same controller class.
  • player moves with line #26: Affects player rendering and journey-related flows with interpolated position handling tied to the new journey functionality.
  • Feature/UI #20: Introduces or refines demo-journey features and related game-flow logic in TravelGameController.

Poem

🐰 A journey demo now takes flight,
With safety guards to catch what's not quite right,
When coins run short, a traveler must depart,
The game flows on—a masterful restart!

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9d98842 and 599cad1.

📒 Files selected for processing (1)
  • src/main/java/org/example/TravelGameController.java

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MartinStenhagen
MartinStenhagen merged commit d0dc857 into main Jan 14, 2026
1 of 2 checks passed
@MartinStenhagen
MartinStenhagen deleted the feature/playerElimination branch January 14, 2026 16:44
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