Skip to content

feat(roulette): make the roulette game playable end-to-end#56

Merged
netqo merged 1 commit into
devfrom
feat/roulette-game
Jun 24, 2026
Merged

feat(roulette): make the roulette game playable end-to-end#56
netqo merged 1 commit into
devfrom
feat/roulette-game

Conversation

@netqo

@netqo netqo commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Wires European roulette (CU-05) end-to-end: the fourth playable game and the first with a full betting table. Drop chips on the table zones, Spin, watch the reel land on the drawn pocket and get paid.

Rationale

Same round pattern as the other games, with a richer betting model:

  • RouletteBet + RouletteSpot model the table (straight numbers and the outside zones); RouletteMath is a pure, unit-tested settlement function (straight 35:1, even-money 1:1, dozens/columns 2:1, zero loses every outside bet).
  • GameRepository.startRouletteSpin validates + debits the total stake and draws the pocket on the C++/JNI engine (committed via the hash); settleRouletteSpin credits the total return and records the round. Reuses WalletRepository.applyRoundResult.
  • RouletteViewModel owns the placed chips and the spin lifecycle; the screen animates the reel and reports back through onReelSettled, which settles the bets - so the stake is debited at Spin and the winnings credited when the reel lands.
  • RoundDetailViewModel branches by game to show the winning pocket with the real seeds.
  • The reel uses an Animatable driven by a LaunchedEffect (reliable start/finish) and its strip Row is measured unbounded so it stays rendered while scrolling. Controls swap by phase (table / spinning / result).

Game logic note: a single round summarizes all the chips on the table (total stake / total return); the round detail shows the winning pocket. Blackjack is the last remaining game.

Verification

  • ./gradlew testDebugUnitTest detekt ktlintCheck assembleDebug compileDebugAndroidTestKotlin green locally (JDK 17).
  • New tests: RouletteMathTest, RouletteViewModelTest, startRouletteSpin/settleRouletteSpin cases in GameRepositoryImplTest.
  • Installed the debug APK on a physical device: placed chips across straight/outside zones (On Table accumulates), spun (stake debited, reel scrolls and decelerates onto the drawn pocket, winner highlighted), got paid on wins. Confirmed the round shows in History and Round Detail with the pocket + real seeds, and the Profile P&L includes Roulette. Fixed a reel-rendering bug (unbounded Row) and tuned the spin duration on device.

Test plan

  • Placing chips accumulates the stake per zone and updates On Table.
  • Clear empties the table.
  • Spin debits the total, animates the reel, and lands on the drawn pocket.
  • Winning bets are paid (straight 35:1, even-money 1:1, dozens/columns 2:1).
  • The round lands in History / Round Detail (pocket + real seeds) and the Profile P&L.
  • New Bet returns to a fresh table.

Related issues

Refs the games-card work for the final entrega (Roulette is the 4th of 5 games).

Checklist

  • Commit messages follow Conventional Commits (see CONTRIBUTING.md).
  • Branch name follows the naming convention (feat/, fix/, chore/, etc.).
  • The change is scoped: no unrelated edits sneaked into this PR.
  • If user-visible behavior changed, CHANGELOG.md has been updated under [Unreleased].
  • If a new dependency was added, it is justified in the PR description. (No new dependencies.)

Wire European roulette through the native provably-fair engine with the
full betting table. Chips drop on the table zones (straight 35:1,
even-money 1:1, dozens/columns 2:1), accumulating the stake per cell.
RouletteViewModel -> GameRepository.startRouletteSpin validates and
debits the total stake and draws the 0-36 pocket on the C++/JNI engine
(committed via the hash). The reel animates to the pocket and on landing
(onReelSettled) every bet is settled via RouletteMath and credited
(WalletRepository.applyRoundResult), with the round recorded in
game_round. The winning number is highlighted; the round detail branches
by game to show the pocket and the real seeds.

The reel uses an Animatable driven by a LaunchedEffect so the spin runs
reliably, and its Row is measured unbounded so the strip stays rendered
while it scrolls. Controls swap by phase (table / spinning / result).

Covered by RouletteMathTest, RouletteViewModelTest and the
startRouletteSpin/settleRouletteSpin cases in GameRepositoryImplTest.
@netqo netqo merged commit 6c5b312 into dev Jun 24, 2026
3 checks passed
@netqo netqo deleted the feat/roulette-game branch June 24, 2026 02:24
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