Skip to content

feat(mines): make the mines game playable end-to-end#54

Merged
netqo merged 1 commit into
devfrom
feat/mines-game
Jun 23, 2026
Merged

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

Conversation

@netqo

@netqo netqo commented Jun 23, 2026

Copy link
Copy Markdown
Owner

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.startMines validates + debits the stake, draws the mine positions on the C++/JNI engine (committed via the hash) and returns the board as a MinesRound. settleMines credits the payout on cash out and records the round in game_round. The stake debit / payout credit reuse WalletRepository.applyRoundResult, so the wallet keeps sole ownership of the balance.
  • MinesMath is a pure, unit-tested payout curve (fair odds x 0.99 house edge), kept out of the engine and repository.
  • MinesViewModel owns 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.
  • RoundDetailViewModel now branches by game so Mines rounds map correctly (setup, multiplier, real seeds) instead of being read as coinflip.
  • The controls swap by phase (setup / live / result). The finished board shows a compact result panel (Result + Multiplier + New Bet) rather than reverting to the full setup, so the weighted grid keeps enough room and the layout stays stable on a win or loss (this was a layout bug caught on device and fixed here).

Verification

  • ./gradlew testDebugUnitTest detekt ktlintCheck assembleDebug compileDebugAndroidTestKotlin green locally (JDK 17).
  • New tests: MinesMathTest, MinesViewModelTest, startMines/settleMines cases in GameRepositoryImplTest.
  • Installed the debug APK on a physical device: placed bets (stake debited), revealed safe tiles (multiplier climbs), cashed out (payout credited), hit mines (stake lost, board revealed). Confirmed the round shows in History and Round Detail with real seeds, the Profile P&L includes Mines, and the layout stays stable across win/loss after the compact-result fix.

Test plan

  • Place Bet debits the stake and unlocks the grid.
  • Revealing safe tiles raises the multiplier and enables Cash Out.
  • Cash Out credits stake x multiplier and reveals the board.
  • Hitting a mine loses the stake and reveals all mines.
  • The round lands in History / Round Detail (with real seeds) and the Profile P&L.
  • The layout stays stable on win and loss; New Bet returns to setup.

Related issues

Refs the games-card work for the final entrega (Mines is the 2nd 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 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.
@netqo netqo merged commit 620cb85 into dev Jun 23, 2026
3 checks passed
@netqo netqo deleted the feat/mines-game branch June 23, 2026 22:09
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