feat(mines): make the mines game playable end-to-end#54
Merged
Conversation
Wire Mines through the native provably-fair engine with interactive multi-tile play. MinesViewModel -> GameRepository.startMines validates and debits the stake, draws the mine positions on the C++/JNI engine (committed via the hash) and hands back the board. The player reveals tiles: each safe tile raises the multiplier (MinesMath, RTP 99%) and hitting a mine loses the stake. Cash out credits stake x the multiplier (WalletRepository.applyRoundResult) and records the round in game_round. Balance, session profit and the recent strip read from Room. The round detail maps Mines rounds (setup, multiplier, the real seeds), so the provably-fair block stays verifiable across games. The controls swap by phase (setup / live / result) and the finished board shows a compact result panel so the grid keeps its room and the layout stays stable on a win or loss. Covered by MinesMathTest, MinesViewModelTest and the startMines/ settleMines 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 Mines (CU-08) end-to-end through the native provably-fair engine: the second playable game and the first with interactive, multi-step play (place bet -> reveal tiles -> cash out or hit a mine).
Rationale
Reuses the round pattern Coinflip established, extended for an interactive round:
GameRepository.startMinesvalidates + debits the stake, draws the mine positions on the C++/JNI engine (committed via the hash) and returns the board as aMinesRound.settleMinescredits the payout on cash out and records the round ingame_round. The stake debit / payout credit reuseWalletRepository.applyRoundResult, so the wallet keeps sole ownership of the balance.MinesMathis a pure, unit-tested payout curve (fair odds x 0.99 house edge), kept out of the engine and repository.MinesViewModelowns the live round (committed board, revealed tiles, running multiplier). The mine positions live client-side so reveals resolve locally - the same trust model as Coinflip, with the provably-fair hash recorded for verification.RoundDetailViewModelnow branches by game so Mines rounds map correctly (setup, multiplier, real seeds) instead of being read as coinflip.Verification
./gradlew testDebugUnitTest detekt ktlintCheck assembleDebug compileDebugAndroidTestKotlingreen locally (JDK 17).MinesMathTest,MinesViewModelTest,startMines/settleMinescases inGameRepositoryImplTest.Test plan
Related issues
Refs the games-card work for the final entrega (Mines is the 2nd of 5 games).
Checklist
feat/,fix/,chore/, etc.).[Unreleased].