diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-29 17:18:34 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-29 17:18:34 +0100 |
| commit | d9f1fe513e6f7696809d3a9b4d44ca485fe99c97 (patch) | |
| tree | 9da99200fdfe004a47056d10340b3f59c7ccc52e /docs | |
| parent | v2.0.0: reset plays audit to a generic per-game schema (diff) | |
| download | zagan-bet-d9f1fe513e6f7696809d3a9b4d44ca485fe99c97.tar.gz zagan-bet-d9f1fe513e6f7696809d3a9b4d44ca485fe99c97.zip | |
v2.1.0: add European roulette with split bets and wheel animation
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/GAMES.md | 63 | ||||
| -rw-r--r-- | docs/TESTING.md | 14 |
2 files changed, 57 insertions, 20 deletions
diff --git a/docs/GAMES.md b/docs/GAMES.md index cbe355e..52ab1bf 100644 --- a/docs/GAMES.md +++ b/docs/GAMES.md | |||
| @@ -5,18 +5,40 @@ | |||
| 5 | | Game | Status | Notes | | 5 | | Game | Status | Notes | |
| 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 | 9 | ||
| 9 | ## Planned | 10 | ## Planned |
| 10 | 11 | ||
| 11 | | Game | Shape | Main open decisions | | 12 | | Game | Shape | Main open decisions | |
| 12 | | --- | --- | --- | | 13 | | --- | --- | --- | |
| 13 | | Roulette | One spin, many bets | European/French/American wheel; which bet types; 35:1 straight and other payouts | | ||
| 14 | | Blackjack | Multi-step hand | Dealer hits/stands soft 17; double/split/insurance; blackjack payout; shoe persistence | | 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 | Roulette fits the current one-request-settle model most easily. Blackjack needs | 17 | Blackjack needs server-side hand state and player actions. Crash needs a timed |
| 18 | server-side hand state and player actions. Crash needs a timed round loop and a | 18 | round loop and a cashout action, so it should come after blackjack unless we |
| 19 | cashout action, so it should come last unless we redesign the loop first. | 19 | redesign the loop first. |
| 20 | |||
| 21 | ## Roulette | ||
| 22 | |||
| 23 | - European wheel: 0-36, one green zero. | ||
| 24 | - Bets: red, black, even, odd, and straight numbers. | ||
| 25 | - Bets can be split across all of those; every winning bet is added together. | ||
| 26 | - Straight pays 35:1 (36x returned), outside bets pay 1:1 (2x returned). | ||
| 27 | - 0 loses all outside bets. RTP is 36/37 = 97.30%. | ||
| 28 | |||
| 29 | Client controls inside roulette: | ||
| 30 | |||
| 31 | ``` | ||
| 32 | R / B / E / O add the current chip to red/black/even/odd | ||
| 33 | digits + Enter add the current chip to that number | ||
| 34 | C clear all bets | ||
| 35 | + or = / - change the chip size | ||
| 36 | SPACE spin | ||
| 37 | Q leave the table | ||
| 38 | ``` | ||
| 39 | |||
| 40 | The result is shown as a CS:GO-style horizontal strip: the ball marker stays | ||
| 41 | fixed and the wheel numbers scroll beneath it, ending on the winning number. | ||
| 20 | 42 | ||
| 21 | ## Audit schema | 43 | ## Audit schema |
| 22 | 44 | ||
| @@ -35,35 +57,36 @@ plays ( | |||
| 35 | ) | 57 | ) |
| 36 | ``` | 58 | ``` |
| 37 | 59 | ||
| 38 | `game_type` is the game that was played. `details` is a JSON object whose shape | 60 | `details` is game-specific JSON: |
| 39 | depends on the game: | ||
| 40 | 61 | ||
| 41 | ```json | 62 | ```json |
| 42 | // slots | 63 | // slots |
| 43 | {"reels":"CCCCLLCLODGSDGS","win_type":"win","win_lines":"1","win_cells":"0,3,6"} | 64 | {"reels":"CCCCLLCLODGSDGS","win_type":"win","win_lines":"1","win_cells":"0,3,6"} |
| 44 | 65 | ||
| 45 | // rumoured future examples | 66 | // roulette |
| 46 | {"player":["AS","10H"],"dealer":["9D","7C"],"outcome":"blackjack"} | 67 | {"number":"17","color":"black","bets":"{\"red\":10,\"black\":10,\"even\":10,\"odd\":10,\"numbers\":[{\"number\":17,\"amount\":5}]}"} |
| 47 | {"bets":[{"kind":"straight","number":17,"amount":10}],"winning":17} | ||
| 48 | {"crash_point":2.41,"cashout":1.80} | ||
| 49 | ``` | 68 | ``` |
| 50 | 69 | ||
| 51 | The balance updates and the `plays` insert happen in one transaction | 70 | The balance update and the `plays` insert happen in one transaction |
| 52 | (`database::apply_play`). The slots-specific wire fields (`reels`, `win_lines`, | 71 | (`database::apply_play`). |
| 53 | `win_cells`) are still in `GAME_RESULT`, but the database no longer assumes | ||
| 54 | them. | ||
| 55 | 72 | ||
| 56 | ## Protocol gap | 73 | ## Wire protocol |
| 57 | 74 | ||
| 58 | The current exchange is slots-shaped: | 75 | Slots keeps its original exchange: |
| 59 | 76 | ||
| 60 | ``` | 77 | ``` |
| 61 | PLAY_START <game> <bet> | 78 | PLAY_START slots <bet> |
| 62 | GAME_RESULT <session> <winnings> <bet> <balance> <reels> <win_type> <win_lines> <win_cells> | 79 | GAME_RESULT <session> <winnings> <bet> <balance> <reels> <win_type> <win_lines> <win_cells> |
| 63 | ``` | 80 | ``` |
| 64 | 81 | ||
| 65 | Before blackjack, roulette, or crash can be added, the game session needs a | 82 | Roulette adds a compact bets payload and a roulette-specific result: |
| 66 | generic state/action protocol. A possible shape: | 83 | |
| 84 | ``` | ||
| 85 | PLAY_START roulette <total> <bets-json> | ||
| 86 | ROULETTE_RESULT <session> <winnings> <bet> <balance> <number> <color> <bets-json> | ||
| 87 | ``` | ||
| 88 | |||
| 89 | Blackjack and crash still need a generic state/action exchange, for example: | ||
| 67 | 90 | ||
| 68 | ``` | 91 | ``` |
| 69 | GAME_START <game> <bet> | 92 | GAME_START <game> <bet> |
| @@ -71,4 +94,4 @@ GAME_ACTION <action> [json] | |||
| 71 | GAME_STATE <json> # cards, bets, multiplier, legal actions, result | 94 | GAME_STATE <json> # cards, bets, multiplier, legal actions, result |
| 72 | ``` | 95 | ``` |
| 73 | 96 | ||
| 74 | That is a wire-protocol change and will be its own major version. | 97 | That will be its own protocol change. |
diff --git a/docs/TESTING.md b/docs/TESTING.md index 4d46855..2dcb01f 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md | |||
| @@ -14,6 +14,7 @@ shared global database. Each test owns its state. | |||
| 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/protocol.rs` | Newline buffering and timeout/error classification. | | 16 | | `tests/protocol.rs` | Newline buffering and timeout/error classification. | |
| 17 | | `tests/roulette.rs` | European wheel, split-bet payouts, zero handling, result parser. | | ||
| 17 | | `tests/server_core.rs` | Handler, bcrypt migration, SQL injection, transaction rollback, `plays` audit, sessions. | | 18 | | `tests/server_core.rs` | Handler, bcrypt migration, SQL injection, transaction rollback, `plays` audit, sessions. | |
| 18 | | `tests/server_setup.rs` | `--init` identity generation, PKCS#12 loadability, overwrite refusal. | | 19 | | `tests/server_setup.rs` | `--init` identity generation, PKCS#12 loadability, overwrite refusal. | |
| 19 | | `tests/slots.rs` | Server slots payout rules and overflow handling. | | 20 | | `tests/slots.rs` | Server slots payout rules and overflow handling. | |
| @@ -63,6 +64,19 @@ Use an 80-column terminal because several output lines are width-sensitive. | |||
| 63 | fingerprint fits 80 columns. | 64 | fingerprint fits 80 columns. |
| 64 | 10. Windows: repeat 2-9 and confirm keys are not duplicated or printed twice. | 65 | 10. Windows: repeat 2-9 and confirm keys are not duplicated or printed twice. |
| 65 | 66 | ||
| 67 | ## Manual roulette checklist | ||
| 68 | |||
| 69 | 1. `play roulette` shows the balance, chip size, empty bets, and controls. | ||
| 70 | 2. `R`/`B`/`E`/`O` add one chip; digits + Enter add a number; `C` clears; | ||
| 71 | `+`/`=`/`-` change the chip size. | ||
| 72 | 3. Space scrolls the wheel under a fixed ball marker and ends on the winning | ||
| 73 | number. | ||
| 74 | 4. Check a split result: | ||
| 75 | - `17 black odd`: black+odd pay, red+even lose, straight 17 pays 36x. | ||
| 76 | - `0`: all outside bets lose; a straight 0 pays 36x. | ||
| 77 | 5. The result board shows the winning number/color/parity, the payout, and the | ||
| 78 | new balance. The next spin reuses the placed bets. | ||
| 79 | |||
| 66 | ## Manual server checks | 80 | ## Manual server checks |
| 67 | 81 | ||
| 68 | - Register, log out, log in again (bcrypt path). | 82 | - Register, log out, log in again (bcrypt path). |
