feat(roulette): make the roulette game playable end-to-end#56
Merged
Conversation
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.
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.
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+RouletteSpotmodel the table (straight numbers and the outside zones);RouletteMathis a pure, unit-tested settlement function (straight 35:1, even-money 1:1, dozens/columns 2:1, zero loses every outside bet).GameRepository.startRouletteSpinvalidates + debits the total stake and draws the pocket on the C++/JNI engine (committed via the hash);settleRouletteSpincredits the total return and records the round. ReusesWalletRepository.applyRoundResult.RouletteViewModelowns the placed chips and the spin lifecycle; the screen animates the reel and reports back throughonReelSettled, which settles the bets - so the stake is debited at Spin and the winnings credited when the reel lands.RoundDetailViewModelbranches by game to show the winning pocket with the real seeds.Animatabledriven by aLaunchedEffect(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 compileDebugAndroidTestKotlingreen locally (JDK 17).RouletteMathTest,RouletteViewModelTest,startRouletteSpin/settleRouletteSpincases inGameRepositoryImplTest.Test plan
Related issues
Refs the games-card work for the final entrega (Roulette is the 4th of 5 games).
Checklist
feat/,fix/,chore/, etc.).[Unreleased].