diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 18:22:40 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 18:22:40 +0100 |
| commit | b5a52fc0312afdf5d5fbe53275dc88d6d881c2ff (patch) | |
| tree | d12e3c7f6c23ae1698199d16ee763551edfd8c12 /docs | |
| parent | v2.1.2: ignore ANSI when measuring board height (diff) | |
| download | zagan-bet-b5a52fc0312afdf5d5fbe53275dc88d6d881c2ff.tar.gz zagan-bet-b5a52fc0312afdf5d5fbe53275dc88d6d881c2ff.zip | |
v2.2.0: add blackjack with reserved bets and hit/stand/double
Diffstat (limited to '')
| -rw-r--r-- | docs/GAMES.md | 42 | ||||
| -rw-r--r-- | docs/TESTING.md | 13 |
2 files changed, 46 insertions, 9 deletions
diff --git a/docs/GAMES.md b/docs/GAMES.md index 12b0e7c..4c42369 100644 --- a/docs/GAMES.md +++ b/docs/GAMES.md | |||
| @@ -6,17 +6,36 @@ | |||
| 6 | | --- | --- | --- | | 6 | | --- | --- | --- | |
| 7 | | Slots | Done | 5 reels x 3 rows, 5 paylines, 98.6% RTP | | 7 | | Slots | Done | 5 reels x 3 rows, 5 paylines, 98.6% RTP | |
| 8 | | Roulette | Done | European wheel, split bets, 97.3% RTP | | 8 | | Roulette | Done | European wheel, split bets, 97.3% RTP | |
| 9 | | Blackjack | Done | Six-deck shoe per hand, S17, 3:2, hit/stand/double | | ||
| 9 | 10 | ||
| 10 | ## Planned | 11 | ## Planned |
| 11 | 12 | ||
| 12 | | Game | Shape | Main open decisions | | 13 | | Game | Shape | Main open decisions | |
| 13 | | --- | --- | --- | | 14 | | --- | --- | --- | |
| 14 | | Blackjack | Multi-step hand | Dealer hits/stands soft 17; double/split/insurance; blackjack payout; shoe persistence | | ||
| 15 | | Crash | Real-time round | Crash-point distribution; cashout latency; provable fairness | | 15 | | Crash | Real-time round | Crash-point distribution; cashout latency; provable fairness | |
| 16 | 16 | ||
| 17 | Blackjack needs server-side hand state and player actions. Crash needs a timed | 17 | Crash needs a timed round loop and a cashout action, so it should be its own |
| 18 | round loop and a cashout action, so it should come after blackjack unless we | 18 | protocol/loop change. |
| 19 | redesign the loop first. | 19 | |
| 20 | ## Blackjack | ||
| 21 | |||
| 22 | - Six-deck shoe, shuffled fresh for every hand and discarded afterwards. | ||
| 23 | - Dealer stands on all 17s (including soft 17). | ||
| 24 | - Blackjack pays 3:2, rounded down to whole PLN. | ||
| 25 | - Hit, stand, and double; no split, insurance, or surrender. | ||
| 26 | - The bet is reserved when the hand starts. Cancel or disconnect refunds it. | ||
| 27 | - A natural or dealer blackjack settles immediately. | ||
| 28 | |||
| 29 | Client controls: | ||
| 30 | |||
| 31 | ``` | ||
| 32 | H hit | ||
| 33 | S stand | ||
| 34 | D double (on the first two cards) | ||
| 35 | SPACE deal the next hand | ||
| 36 | + or = / - change the next hand's bet | ||
| 37 | Q leave the table (active hand is cancelled and refunded) | ||
| 38 | ``` | ||
| 20 | 39 | ||
| 21 | ## Roulette | 40 | ## Roulette |
| 22 | 41 | ||
| @@ -68,6 +87,9 @@ plays ( | |||
| 68 | 87 | ||
| 69 | // roulette | 88 | // roulette |
| 70 | {"number":"17","color":"black","bets":"{\"red\":10,\"black\":10,\"even\":10,\"odd\":10,\"numbers\":[{\"number\":17,\"amount\":5}]}"} | 89 | {"number":"17","color":"black","bets":"{\"red\":10,\"black\":10,\"even\":10,\"odd\":10,\"numbers\":[{\"number\":17,\"amount\":5}]}"} |
| 90 | |||
| 91 | // blackjack | ||
| 92 | {"player":["10S","6H","5D"],"dealer":["9D","8C"],"player_total":21,"dealer_total":17,"bet":10,"result":"win","winnings":20} | ||
| 71 | ``` | 93 | ``` |
| 72 | 94 | ||
| 73 | The balance update and the `plays` insert happen in one transaction | 95 | The balance update and the `plays` insert happen in one transaction |
| @@ -89,12 +111,14 @@ PLAY_START roulette <total> <bets-json> | |||
| 89 | ROULETTE_RESULT <session> <winnings> <bet> <balance> <number> <color> <bets-json> | 111 | ROULETTE_RESULT <session> <winnings> <bet> <balance> <number> <color> <bets-json> |
| 90 | ``` | 112 | ``` |
| 91 | 113 | ||
| 92 | Blackjack and crash still need a generic state/action exchange, for example: | 114 | Blackjack is a multi-step session: |
| 93 | 115 | ||
| 94 | ``` | 116 | ``` |
| 95 | GAME_START <game> <bet> | 117 | PLAY_START blackjack <bet> |
| 96 | GAME_ACTION <action> [json] | 118 | BLACKJACK_STATE <json> |
| 97 | GAME_STATE <json> # cards, bets, multiplier, legal actions, result | 119 | BLACKJACK_ACTION <session> hit|stand|double|cancel |
| 120 | BLACKJACK_STATE <json> | ||
| 98 | ``` | 121 | ``` |
| 99 | 122 | ||
| 100 | That will be its own protocol change. | 123 | `BLACKJACK_STATE` carries the player/dealer cards, totals, actions, balance, |
| 124 | result and winnings. The dealer's hole card is `?` until the hand is done. | ||
diff --git a/docs/TESTING.md b/docs/TESTING.md index d944b42..ed2f746 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md | |||
| @@ -13,6 +13,7 @@ shared global database. Each test owns its state. | |||
| 13 | | --- | --- | | 13 | | --- | --- | |
| 14 | | `tests/client_core.rs` | Client command/game flows via a headless screen applying logical effects. | | 14 | | `tests/client_core.rs` | Client command/game flows via a headless screen applying logical effects. | |
| 15 | | `tests/client_ui.rs` | Help, history, completion, bet parsing, display width, cursor math. | | 15 | | `tests/client_ui.rs` | Help, history, completion, bet parsing, display width, cursor math. | |
| 16 | | `tests/blackjack.rs` | Card totals, naturals, hit/stand/double, dealer bust, S17, state parsing. | | ||
| 16 | | `tests/protocol.rs` | Newline buffering and timeout/error classification. | | 17 | | `tests/protocol.rs` | Newline buffering and timeout/error classification. | |
| 17 | | `tests/roulette.rs` | European wheel, split-bet payouts, zero handling, result parser. | | 18 | | `tests/roulette.rs` | European wheel, split-bet payouts, zero handling, result parser. | |
| 18 | | `tests/server_core.rs` | Handler, bcrypt migration, SQL injection, transaction rollback, `plays` audit, sessions. | | 19 | | `tests/server_core.rs` | Handler, bcrypt migration, SQL injection, transaction rollback, `plays` audit, sessions. | |
| @@ -79,6 +80,18 @@ Use an 80-column terminal because several output lines are width-sensitive. | |||
| 79 | 6. The result board shows the winning number/color/parity, the payout, and the | 80 | 6. The result board shows the winning number/color/parity, the payout, and the |
| 80 | new balance. The next spin reuses the placed bets. | 81 | new balance. The next spin reuses the placed bets. |
| 81 | 82 | ||
| 83 | ## Manual blackjack checklist | ||
| 84 | |||
| 85 | 1. `play blackjack` shows the ready board; Space deals. | ||
| 86 | 2. The dealer's hole card is hidden while it is the player's turn. H/S/D work; | ||
| 87 | D is only offered on the first two cards and reserves the extra bet. | ||
| 88 | 3. Stand and check the dealer stands on all 17s. Check a dealer bust pays the | ||
| 89 | player, and a natural blackjack pays 3:2. | ||
| 90 | 4. Q during a hand sends cancel and refunds the reserved bet; Q after a hand | ||
| 91 | just leaves. Disconnecting mid-hand also refunds it. | ||
| 92 | 5. Check the audit row: `game_type = blackjack`, the total bet (including a | ||
| 93 | double), winnings, and the final cards/result in `details`. | ||
| 94 | |||
| 82 | ## Manual server checks | 95 | ## Manual server checks |
| 83 | 96 | ||
| 84 | - Register, log out, log in again (bcrypt path). | 97 | - Register, log out, log in again (bcrypt path). |
