summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-29 18:22:40 +0100
committersalmonik <salmonik@tuta.io>2026-10-29 18:22:40 +0100
commitb5a52fc0312afdf5d5fbe53275dc88d6d881c2ff (patch)
treed12e3c7f6c23ae1698199d16ee763551edfd8c12 /docs
parentv2.1.2: ignore ANSI when measuring board height (diff)
downloadzagan-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.md42
-rw-r--r--docs/TESTING.md13
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
17Blackjack needs server-side hand state and player actions. Crash needs a timed 17Crash needs a timed round loop and a cashout action, so it should be its own
18round loop and a cashout action, so it should come after blackjack unless we 18protocol/loop change.
19redesign 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
29Client controls:
30
31```
32H hit
33S stand
34D double (on the first two cards)
35SPACE deal the next hand
36+ or = / - change the next hand's bet
37Q 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
73The balance update and the `plays` insert happen in one transaction 95The balance update and the `plays` insert happen in one transaction
@@ -89,12 +111,14 @@ PLAY_START roulette <total> <bets-json>
89ROULETTE_RESULT <session> <winnings> <bet> <balance> <number> <color> <bets-json> 111ROULETTE_RESULT <session> <winnings> <bet> <balance> <number> <color> <bets-json>
90``` 112```
91 113
92Blackjack and crash still need a generic state/action exchange, for example: 114Blackjack is a multi-step session:
93 115
94``` 116```
95GAME_START <game> <bet> 117PLAY_START blackjack <bet>
96GAME_ACTION <action> [json] 118BLACKJACK_STATE <json>
97GAME_STATE <json> # cards, bets, multiplier, legal actions, result 119BLACKJACK_ACTION <session> hit|stand|double|cancel
120BLACKJACK_STATE <json>
98``` 121```
99 122
100That will be its own protocol change. 123`BLACKJACK_STATE` carries the player/dealer cards, totals, actions, balance,
124result 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.
796. The result board shows the winning number/color/parity, the payout, and the 806. 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
851. `play blackjack` shows the ready board; Space deals.
862. 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.
883. Stand and check the dealer stands on all 17s. Check a dealer bust pays the
89 player, and a natural blackjack pays 3:2.
904. Q during a hand sends cancel and refunds the reserved bet; Q after a hand
91 just leaves. Disconnecting mid-hand also refunds it.
925. 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).