summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/GAMES.md63
-rw-r--r--docs/TESTING.md14
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
17Roulette fits the current one-request-settle model most easily. Blackjack needs 17Blackjack needs server-side hand state and player actions. Crash needs a timed
18server-side hand state and player actions. Crash needs a timed round loop and a 18round loop and a cashout action, so it should come after blackjack unless we
19cashout action, so it should come last unless we redesign the loop first. 19redesign 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
29Client controls inside roulette:
30
31```
32R / B / E / O add the current chip to red/black/even/odd
33digits + Enter add the current chip to that number
34C clear all bets
35+ or = / - change the chip size
36SPACE spin
37Q leave the table
38```
39
40The result is shown as a CS:GO-style horizontal strip: the ball marker stays
41fixed 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:
39depends 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
51The balance updates and the `plays` insert happen in one transaction 70The 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
54them.
55 72
56## Protocol gap 73## Wire protocol
57 74
58The current exchange is slots-shaped: 75Slots keeps its original exchange:
59 76
60``` 77```
61PLAY_START <game> <bet> 78PLAY_START slots <bet>
62GAME_RESULT <session> <winnings> <bet> <balance> <reels> <win_type> <win_lines> <win_cells> 79GAME_RESULT <session> <winnings> <bet> <balance> <reels> <win_type> <win_lines> <win_cells>
63``` 80```
64 81
65Before blackjack, roulette, or crash can be added, the game session needs a 82Roulette adds a compact bets payload and a roulette-specific result:
66generic state/action protocol. A possible shape: 83
84```
85PLAY_START roulette <total> <bets-json>
86ROULETTE_RESULT <session> <winnings> <bet> <balance> <number> <color> <bets-json>
87```
88
89Blackjack and crash still need a generic state/action exchange, for example:
67 90
68``` 91```
69GAME_START <game> <bet> 92GAME_START <game> <bet>
@@ -71,4 +94,4 @@ GAME_ACTION <action> [json]
71GAME_STATE <json> # cards, bets, multiplier, legal actions, result 94GAME_STATE <json> # cards, bets, multiplier, legal actions, result
72``` 95```
73 96
74That is a wire-protocol change and will be its own major version. 97That 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.
6410. Windows: repeat 2-9 and confirm keys are not duplicated or printed twice. 6510. Windows: repeat 2-9 and confirm keys are not duplicated or printed twice.
65 66
67## Manual roulette checklist
68
691. `play roulette` shows the balance, chip size, empty bets, and controls.
702. `R`/`B`/`E`/`O` add one chip; digits + Enter add a number; `C` clears;
71 `+`/`=`/`-` change the chip size.
723. Space scrolls the wheel under a fixed ball marker and ends on the winning
73 number.
744. 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.
775. 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).