feat(blackjack): make the blackjack game playable end-to-end#57
Merged
Conversation
Wire classic blackjack through the native provably-fair engine, completing the games card. BlackjackViewModel -> startBlackjack draws the shuffled 52-card deck on the C++/JNI engine (committed via the hash); the opening cards are dealt one at a time with a delay (player/dealer alternating, the dealer hole card face down). Hit / Stand / Double run on BlackjackMath (soft-ace totals, dealer stands on 17, natural blackjack pays 3:2), and the dealer reveals and draws card by card. The bet settles net at the end (WalletRepository.applyRoundResult, so Double doubles cleanly) and the round is recorded in game_round with the player/dealer totals; the round detail branches by game to show the hands and the real seeds. Split is intentionally out of scope. Covered by BlackjackMathTest, BlackjackViewModelTest and the startBlackjack/settleBlackjack 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 classic blackjack (CU-06) end-to-end - the fifth and final game, completing the games card. Deal, then Hit / Stand / Double against a dealer that draws to 17, with the opening cards and the dealer's draws animated one at a time.
Rationale
Same round pattern as the other games, with the most hand logic:
BlackjackMathis a pure, unit-tested scorer over the engine's card indices (soft-ace totals, bust, natural blackjack, dealer-hits rule).GameRepository.startBlackjackvalidates the stake (no debit) and draws the shuffled deck on the C++/JNI engine (committed via the hash).settleBlackjackapplies the net in one write and records the round with the player/dealer totals - settling net at the end is what makes Double a single doubled settle rather than a second debit.BlackjackViewModelowns the hands and deals card by card with a delay (player/dealer alternating, hole card hidden); the dealer reveals and draws with delays too. Hit / Stand / Double; Split is intentionally out of scope.RoundDetailViewModelbranches by game to show "Your Hand" vs "Dealer" with the real seeds.Verification
./gradlew testDebugUnitTest detekt ktlintCheck assembleDebug compileDebugAndroidTestKotlingreen locally (JDK 17).BlackjackMathTest,BlackjackViewModelTest(stand win, hit bust, natural blackjack 3:2, invalid bet),startBlackjack/settleBlackjackcases inGameRepositoryImplTest.Test plan
Related issues
Refs the games-card work for the final entrega (Blackjack is the 5th of 5 games; the games card is now complete).
Checklist
feat/,fix/,chore/, etc.).[Unreleased].