From 49df948de25d28601469e9ca993f33530989ebd0 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 22:55:49 +0100 Subject: v3.0.0: cursor-driven roulette felt with splits and corners; drop schema migrations; require 80x24 --- docs/GAMES.md | 43 ++++++++++++++++++++++++++++++++----------- docs/SERVER_SETUP.md | 5 ++--- docs/TESTING.md | 37 +++++++++++++++++++++++++------------ 3 files changed, 59 insertions(+), 26 deletions(-) (limited to 'docs') diff --git a/docs/GAMES.md b/docs/GAMES.md index 2b8adf5..364cfef 100644 --- a/docs/GAMES.md +++ b/docs/GAMES.md @@ -79,19 +79,32 @@ Q forfeit an active hand (bet is lost), or leave when no hand is active ## Roulette - European wheel: 0-36, one green zero. -- Bets: red, black, even, odd, and straight numbers. -- Bets can be split across all of those; every winning bet is added together. -- Straight pays 35:1 (36x returned), outside bets pay 1:1 (2x returned). -- 0 loses all outside bets. RTP is 36/37 = 97.30%. -- Numbers are color-coded in the TUI: red numbers are red, 0 is green, and - black numbers stay at the default terminal color. Bet amounts and balances - are not colored. +- The felt is drawn in full and bet with a cursor. Over the numbers the cursor + sits on a *lattice point*, the way a chip sits between numbers on a real + felt: an inner point covers four numbers (corner), an edge point covers two + (split), and an outer corner is a straight. +- Bet types and returns (per unit staked, stake included): + + | Bet | Covers | Return | + | --- | --- | --- | + | Straight | one number | 36x | + | Split | two adjacent numbers | 18x | + | Corner | four numbers | 9x | + | Dozen | 1-12, 13-24, 25-36 | 3x | + | Column | 1,4,...,34 / 2,5,...,35 / 3,6,...,36 | 3x | + | Outside | 1-18, 19-36, EVEN, ODD, RED, BLACK | 2x | + +- 0 loses every outside bet, both dozens and every column. It pays a straight, + and split/corner bets containing 0 are not offered. +- Every chip is settled independently and added together. RTP is 36/37 = + 97.30% because every bet uses the same European odds. +- Bet amounts and balances are not colored in the TUI. Client controls inside roulette: ``` -R / B / E / O add the current chip to red/black/even/odd -digits + Enter add the current chip to that number +arrows move the cursor over the felt, including between numbers +ENTER place the current chip on the cursor C clear all bets + or = / - change the chip size SPACE spin @@ -125,7 +138,7 @@ plays ( {"reels":"CCCCLLCLODGSDGS","win_type":"win","win_lines":"1","win_cells":"0,3,6"} // roulette -{"number":"17","color":"black","bets":"{\"red\":10,\"black\":10,\"even\":10,\"odd\":10,\"numbers\":[{\"number\":17,\"amount\":5}]}"} +{"number":"17","color":"black","bets":"{\"chips\":[{\"target\":{\"bet\":\"outside\",\"kind\":\"red\"},\"amount\":10}]}"} // blackjack {"player":["10S","6H","5D"],"dealer":["9D","8C"],"player_total":21,"dealer_total":17,"bet":10,"result":"win","winnings":20} @@ -174,13 +187,21 @@ PLAY_START slots GAME_RESULT ``` -Roulette adds a compact bets payload and a roulette-specific result: +Roulette sends the chips and gets a roulette-specific result: ``` PLAY_START roulette ROULETTE_RESULT ``` +`bets-json` is `{"chips":[{"target":{...},"amount":N}]}`. A target is one of +`{"bet":"straight","number":17}`, `{"bet":"split","a":1,"b":2}`, +`{"bet":"corner","numbers":[1,2,4,5]}`, `{"bet":"dozen","index":1}`, +`{"bet":"column","index":0}` or +`{"bet":"outside","kind":"red"}` (`low`, `high`, `even`, `odd`, `red`, +`black`). The server rejects unknown, out-of-range or duplicate-number +targets, and requires the total to equal the sum of the chips. + Blackjack is a multi-step session: ``` diff --git a/docs/SERVER_SETUP.md b/docs/SERVER_SETUP.md index 37d55b1..9eac7a7 100644 --- a/docs/SERVER_SETUP.md +++ b/docs/SERVER_SETUP.md @@ -79,9 +79,8 @@ last address for that key is forgotten. The server creates `server.db` in the current directory on first use. It holds users, balances, and the per-game `plays` audit. The client keeps its own -`client.db` for host fingerprints and stored credentials. Databases from before -the fingerprint-keyed credentials are migrated on startup; rows whose host was -already forgotten cannot be re-keyed and require one fresh login. +`client.db` for host fingerprints and stored credentials. There are no schema +migrations while the app is in alpha: a schema change means deleting both files. During development, delete both files to reset users, balances, history, and trust: diff --git a/docs/TESTING.md b/docs/TESTING.md index fe302a9..7ec5b60 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -16,7 +16,7 @@ shared global database. Each test owns its state. | `tests/blackjack.rs` | Card totals, naturals, hit/stand/double, dealer bust, S17, state parsing. | | `tests/crash.rs` | Multiplier curve, payout floor, crash-point distribution, house edge, cap. | | `tests/protocol.rs` | Newline buffering and timeout/error classification. | -| `tests/roulette.rs` | European wheel, split-bet payouts, zero handling, result parser. | +| `tests/roulette.rs` | Wheel, every bet type and payout, zero handling, cursor lattice, result parser. | | `tests/server_core.rs` | Handler, bcrypt migration, SQL injection, transaction rollback, `plays` audit, sessions. | | `tests/server_setup.rs` | `--init` identity generation, PKCS#12 loadability, overwrite refusal. | | `tests/slots.rs` | Server slots payout rules and overflow handling. | @@ -71,18 +71,31 @@ Use an 80-column terminal because several output lines are width-sensitive. ## Manual roulette checklist -1. `play roulette` shows the balance, chip size, empty bets, and controls. -2. `R`/`B`/`E`/`O` add one chip; digits + Enter add a number; `C` clears; - `+`/`=`/`-` change the chip size. -3. Space scrolls the wheel under a fixed ball marker and ends on the winning +1. `play roulette` draws the full felt: 0, the 3x12 numbers, dozens, columns, + and the six outside cells, with the cursor on number 1. +2. Arrows move the cursor. On the numbers the highlighted cells show the bet: + one number (straight), two (split), four (corner). Down leaves the felt into + the dozens, then columns, then outside; Up walks back. +3. ENTER places the chip where the cursor is; `C` clears; `+`/`=`/`-` change the + chip size. The bets line lists every chip and the total. +4. Space scrolls the wheel under a fixed ball marker and ends on the winning number. -4. Check a split result: - - `17 black odd`: black+odd pay, red+even lose, straight 17 pays 36x. - - `0`: all outside bets lose; a straight 0 pays 36x. -5. Numbers are color-coded: red numbers red, 0 green, black default. Check the - bets line, the rolling strip, and the winning number. -6. The result board shows the winning number/color/parity, the payout, and the - new balance. The next spin reuses the placed bets. +5. Check the payouts: + - a straight pays 36x, a split 18x, a corner 9x; + - a dozen or column pays 3x; + - an outside bet pays 2x; + - `0` loses every outside bet, both dozens and every column, and pays a + straight 0. +6. The result line names the number, color and parity, the total returned and + the profit. The next spin reuses the placed chips. + +## Manual terminal size check + +1. Start the client in a terminal smaller than 80x24: it must print + `zagan.bet needs a terminal of at least 80x24 cells` and exit without + switching to the alternate screen or raw mode. +2. At 80x24 every game board (slots 10 lines, roulette 12, blackjack 6, crash 6) + must fit without wrapping. ## Manual blackjack checklist -- cgit v1.2.3