From 80d9aa13251f7f5c3d3eeaa877bc79dac4435341 Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 23:08:25 +0100 Subject: PLN changed to Kromer --- docs/GAMES.md | 6 +- docs/SLOTS.md | 6 +- src/client/core.rs | 16 ++-- src/client/games/blackjack.rs | 10 +-- src/client/games/crash.rs | 6 +- src/client/games/roulette.rs | 25 +++--- src/client/games/slots.rs | 10 +-- src/client/ui.rs | 8 +- src/crash.rs | 2 +- tests/client_core.rs | 199 ++++++++++++++++++++++-------------------- tests/crash.rs | 8 +- 11 files changed, 153 insertions(+), 143 deletions(-) diff --git a/docs/GAMES.md b/docs/GAMES.md index 364cfef..8cc668f 100644 --- a/docs/GAMES.md +++ b/docs/GAMES.md @@ -37,8 +37,8 @@ and broadcast, which is a different product. - Because `P(crash = 1.00x) = 1%`, an instant cashout returns the stake 99% of the time and nothing 1% of the time. There is no risk-free window, which is why there is no cashout lockout. -- Payouts are `floor(bet * multiplier)` in whole PLN, so anything under 1.10x - on a 10 PLN bet returns 10. +- Payouts are `floor(bet * multiplier)` in whole Kr, so anything under 1.10x + on a 10 Kr bet returns 10. - When the crash time passes, the server pushes `CRASH_BUSTED` on the same connection without being asked. The client's event loop polls for keys and drains the socket every 25ms. @@ -58,7 +58,7 @@ Q forfeit an active round (bet is lost), or leave when idle - Six-deck shoe, shuffled fresh for every hand and discarded afterwards. - Dealer stands on all 17s (including soft 17). -- Blackjack pays 3:2, rounded down to whole PLN. +- Blackjack pays 3:2, rounded down to whole Kr. - Hit, stand, and double; no split, insurance, or surrender. - The bet is reserved when the hand starts. Leaving an active hand with Q, or disconnecting mid-hand, forfeits the reserved bet; it is not refunded. A diff --git a/docs/SLOTS.md b/docs/SLOTS.md index 1dbaba5..403f616 100644 --- a/docs/SLOTS.md +++ b/docs/SLOTS.md @@ -80,13 +80,13 @@ The board is ten lines: ``` === SLOTS === -Bet: 10 PLN Balance: 1000 PLN +Bet: 10 Kr Balance: 1000 Kr { G } [ L ] [ S ] [ O ] [ G ] [ D ] { G } [ L ] [ S ] [ C ] [ O ] [ O ] { G } [ L ] [ O ] Pays bet x symbol x shape Symbol C1 L2 O3 G4 D6 S10 Shape 3:1 4:3 5:14 -Won 40 PLN +Won 40 Kr Winning lines: 4 (V) [+/-] Bet [SPACE] Spin [Q] Quit ``` @@ -118,7 +118,7 @@ In the example above, line 4 (V) contains `G G G S G`: - reels 1-3 are `G`, so three `G` symbols pay; - reel 4 is `S`, which breaks the run, so the `G` on reel 5 does not count; - `G` has symbol multiplier 4 and 3-of-a-kind has shape multiplier 1, so the - win is `10 x 4 x 1 = 40 PLN`. + win is `10 x 4 x 1 = 40 Kr`. A diagonal of `L` symbols that is not one of the five paylines does not win, and a run must start on reel 1. That is why only the three `G` cells are diff --git a/src/client/core.rs b/src/client/core.rs index 95fa050..54a6434 100644 --- a/src/client/core.rs +++ b/src/client/core.rs @@ -2,12 +2,12 @@ use crate::client::games::manager::GameManager; use crate::client::games::response::{ parse_blackjack_response, parse_crash_response, parse_roulette_response, parse_spin_response, }; +use crate::client::games::roulette::Direction; use crate::client::ui::{ command_names, completion_lines, display_width, help_lines, input_cursor_column, parse_bet_arg, record_history, }; -use crate::crash::{multiplier_at, CrashState}; -use crate::client::games::roulette::Direction; +use crate::crash::{CrashState, multiplier_at}; use crate::roulette::Bets; use std::time::{Duration, Instant}; @@ -240,7 +240,7 @@ impl ClientCore { Ok(state) => { self.game.end_game(); let message = format!( - "Game exited. Active hand forfeited ({} PLN lost).", + "Game exited. Active hand forfeited ({} Kr lost).", state.bet ); vec![Effect::ClearRegion, Effect::Print(vec![message])] @@ -273,7 +273,7 @@ impl ClientCore { Ok(state) => { self.crash_started = None; self.game.end_game(); - let message = format!("Game exited. Round forfeited ({} PLN lost).", state.bet); + let message = format!("Game exited. Round forfeited ({} Kr lost).", state.bet); vec![Effect::ClearRegion, Effect::Print(vec![message])] } Err(_) if self.game.crash_status() != "running" => { @@ -865,9 +865,9 @@ impl ClientCore { Some(fingerprint) => { effects.push(Effect::Print(vec![format!("Fingerprint: {fingerprint}")])) } - None => effects.push(Effect::Print( - vec!["Fingerprint: (not trusted)".to_string()], - )), + None => effects.push(Effect::Print(vec![ + "Fingerprint: (not trusted)".to_string(), + ])), } self.pending = Some(Pending::Info); @@ -953,7 +953,7 @@ fn info_lines(reply: &str) -> Vec { vec![ format!("User: {}", parts[1]), format!("Account: {}", parts[2]), - format!("Balance: {} PLN", parts[3]), + format!("Balance: {} Kr", parts[3]), ] } else { vec![reply.trim().to_string()] diff --git a/src/client/games/blackjack.rs b/src/client/games/blackjack.rs index d5f45b3..8fa5693 100644 --- a/src/client/games/blackjack.rs +++ b/src/client/games/blackjack.rs @@ -1,5 +1,5 @@ use super::traits::{Game, GameState}; -use crate::blackjack::{card_label, BlackjackState}; +use crate::blackjack::{BlackjackState, card_label}; pub const BLACKJACK_BOARD_LINES: usize = 6; @@ -33,8 +33,8 @@ impl BlackjackGame { fn result_text(result: &str, winnings: u64) -> String { match result { - "blackjack" => format!("BLACKJACK! Won {winnings} PLN"), - "win" => format!("Win! Won {winnings} PLN"), + "blackjack" => format!("BLACKJACK! Won {winnings} Kr"), + "win" => format!("Win! Won {winnings} Kr"), "push" => "Push. Bet returned.".to_string(), "lose" => "Dealer wins.".to_string(), "bust" => "Bust.".to_string(), @@ -65,7 +65,7 @@ impl Game for BlackjackGame { .map(|hand| hand.bet) .unwrap_or(state.bet_amount); return format!( - "=== BLACKJACK ===\r\nBalance: {balance} PLN Bet: {bet} PLN\r\n\r\n\r\nERROR: {error}\r\n[Q] Quit" + "=== BLACKJACK ===\r\nBalance: {balance} Kr Bet: {bet} Kr\r\n\r\n\r\nERROR: {error}\r\n[Q] Quit" ); } @@ -120,7 +120,7 @@ impl Game for BlackjackGame { }; format!( - "=== BLACKJACK ===\r\nBalance: {} PLN Bet: {} PLN\r\nDealer: {} {}\r\nYou: {} {}\r\n{}\r\n{}", + "=== BLACKJACK ===\r\nBalance: {} Kr Bet: {} Kr\r\nDealer: {} {}\r\nYou: {} {}\r\n{}\r\n{}", balance, bet, dealer, dealer_total, player, player_total, text, controls ) } diff --git a/src/client/games/crash.rs b/src/client/games/crash.rs index 19733f2..383e807 100644 --- a/src/client/games/crash.rs +++ b/src/client/games/crash.rs @@ -19,7 +19,7 @@ impl CrashGame { "starting" => "Starting...".to_string(), "running" => "Rising... cash out before it crashes.".to_string(), "cashed" => format!( - "Cashed out at {}x Won {} PLN", + "Cashed out at {}x Won {} Kr", Self::value(state, "multiplier").unwrap_or("1.00"), Self::value(state, "payout").unwrap_or("0") ), @@ -55,13 +55,13 @@ impl Game for CrashGame { if let Some(error) = Self::value(state, "error") { return format!( - "=== CRASH ===\r\nBalance: {balance} PLN Bet: {} PLN\r\n\r\nERROR: {error}\r\n\r\n[SPACE] Play [+/=/-] Bet [Q] Quit", + "=== CRASH ===\r\nBalance: {balance} Kr Bet: {} Kr\r\n\r\nERROR: {error}\r\n\r\n[SPACE] Play [+/=/-] Bet [Q] Quit", state.bet_amount ); } format!( - "=== CRASH ===\r\nBalance: {} PLN Bet: {} PLN\r\nMultiplier: {}x\r\nPotential: {} PLN\r\n{}\r\n{}", + "=== CRASH ===\r\nBalance: {} Kr Bet: {} Kr\r\nMultiplier: {}x\r\nPotential: {} Kr\r\n{}\r\n{}", balance, state.bet_amount, multiplier, diff --git a/src/client/games/roulette.rs b/src/client/games/roulette.rs index 3cb1c58..96f8791 100644 --- a/src/client/games/roulette.rs +++ b/src/client/games/roulette.rs @@ -1,5 +1,5 @@ use super::traits::{Game, GameState}; -use crate::roulette::{is_even, is_odd, BetTarget, Bets, Outside}; +use crate::roulette::{BetTarget, Bets, Outside, is_even, is_odd}; pub const ROULETTE_BOARD_LINES: usize = 12; @@ -96,7 +96,9 @@ impl Cursor { /// Numbers the cursor would cover, for highlighting the felt. pub fn numbers(&self) -> Vec { - self.target().map(|target| target.numbers()).unwrap_or_default() + self.target() + .map(|target| target.numbers()) + .unwrap_or_default() } pub fn moved(&self, direction: Direction) -> Cursor { @@ -130,9 +132,7 @@ impl Cursor { (Cursor::Column(index), Direction::Up) => Cursor::Dozen(index), (Cursor::Column(index), Direction::Down) => Cursor::Outside(index * 2), - (Cursor::Outside(index), Direction::Left) => { - Cursor::Outside(index.saturating_sub(1)) - } + (Cursor::Outside(index), Direction::Left) => Cursor::Outside(index.saturating_sub(1)), (Cursor::Outside(index), Direction::Right) => { Cursor::Outside((index + 1).min(OUTSIDE_ORDER.len() - 1)) } @@ -249,7 +249,11 @@ impl RouletteGame { .iter() .enumerate() .map(|(index, kind)| { - Self::wide_cell(kind.label(), OUTSIDE_WIDTH, cursor == Cursor::Outside(index)) + Self::wide_cell( + kind.label(), + OUTSIDE_WIDTH, + cursor == Cursor::Outside(index), + ) }) .collect() } @@ -268,7 +272,7 @@ impl RouletteGame { if list.chars().count() > 40 { list = list.chars().take(39).collect::() + "…"; } - format!("Bets: {list} Total: {} PLN", bets.total()) + format!("Bets: {list} Total: {} Kr", bets.total()) } fn status_line(state: &GameState) -> String { @@ -309,7 +313,7 @@ impl RouletteGame { format!("No win at {number} {color}{parity}") } else { let profit = winnings.parse::().unwrap_or(0).saturating_sub(stake); - format!("Won {winnings} PLN at {number} {color}{parity} (+{profit})") + format!("Won {winnings} Kr at {number} {color}{parity} (+{profit})") } } Some("spinning") => "Spinning...".to_string(), @@ -332,7 +336,7 @@ impl Game for RouletteGame { let lines = [ "=== ROULETTE ===".to_string(), - format!("Balance: {balance} PLN Chip: {chip} PLN"), + format!("Balance: {balance} Kr Chip: {chip} Kr"), Self::zero_cell(cursor), Self::number_row(0, &covered), Self::number_row(1, &covered), @@ -342,8 +346,7 @@ impl Game for RouletteGame { Self::outside_row(cursor), Self::bets_line(&bets), Self::status_line(state), - "[ARROWS] Move [ENTER] Bet [C]lear [+/-] Chip [SPACE] Spin [Q] Quit" - .to_string(), + "[ARROWS] Move [ENTER] Bet [C]lear [+/-] Chip [SPACE] Spin [Q] Quit".to_string(), ]; lines.join("\r\n") } diff --git a/src/client/games/slots.rs b/src/client/games/slots.rs index 2ec354e..5bffc4c 100644 --- a/src/client/games/slots.rs +++ b/src/client/games/slots.rs @@ -1,5 +1,5 @@ use super::traits::{Game, GamePhase, GameState}; -use crate::slots::{paytable_lines, LINE_NAMES, REELS, ROWS}; +use crate::slots::{LINE_NAMES, REELS, ROWS, paytable_lines}; /// Height of the game board. It must never depend on the spin result. pub const SLOT_BOARD_LINES: usize = 10; @@ -65,9 +65,9 @@ impl SlotsGame { .unwrap_or("0"); if winnings != "0" { return match state.data.get("win_type").map(String::as_str) { - Some("mega") => format!("MEGA WIN! {winnings} PLN"), - Some("big") => format!("BIG WIN! {winnings} PLN"), - _ => format!("Won {winnings} PLN"), + Some("mega") => format!("MEGA WIN! {winnings} Kr"), + Some("big") => format!("BIG WIN! {winnings} Kr"), + _ => format!("Won {winnings} Kr"), }; } return "No win.".to_string(); @@ -115,7 +115,7 @@ impl Game for SlotsGame { let paytable = paytable_lines(); format!( - "=== SLOTS ===\r\nBet: {} PLN Balance: {} PLN\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n[+/-] Bet [SPACE] Spin [Q] Quit", + "=== SLOTS ===\r\nBet: {} Kr Balance: {} Kr\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n{}\r\n[+/-] Bet [SPACE] Spin [Q] Quit", state.bet_amount, balance, grid[0], diff --git a/src/client/ui.rs b/src/client/ui.rs index ca001c2..e7f510b 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs @@ -145,7 +145,7 @@ pub fn parse_bet_arg(raw: &str) -> Result { .parse::() .map_err(|_| format!("Invalid bet: {raw}"))?; if bet < 10 { - return Err("Bet must be at least 10 PLN".to_string()); + return Err("Bet must be at least 10 Kr".to_string()); } Ok(bet) } @@ -189,11 +189,7 @@ fn char_width(c: char) -> usize { if is_zero_width(cp) || is_combining(cp) { return 0; } - if is_wide(cp) { - 2 - } else { - 1 - } + if is_wide(cp) { 2 } else { 1 } } fn is_zero_width(cp: u32) -> bool { diff --git a/src/crash.rs b/src/crash.rs index 2936b99..9d6e98c 100644 --- a/src/crash.rs +++ b/src/crash.rs @@ -47,7 +47,7 @@ pub fn crash_point_from_uniform(u: f64) -> f64 { ((1.0 - HOUSE_EDGE) / (1.0 - u)).clamp(1.0, MAX_MULTIPLIER) } -/// Whole-PLN cashout value. Balances are integers, so the payout is floored. +/// Whole-Kr cashout value. Balances are integers, so the payout is floored. pub fn payout(bet: u64, multiplier: f64) -> u64 { if bet == 0 || !multiplier.is_finite() || multiplier <= 0.0 { return 0; diff --git a/tests/client_core.rs b/tests/client_core.rs index a7c5716..bb8772e 100644 --- a/tests/client_core.rs +++ b/tests/client_core.rs @@ -173,7 +173,7 @@ fn play_shows_a_ten_line_board_and_fetches_the_balance() { h.line("play slots 50"); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 50 PLN")); + assert!(h.board()[1].contains("Bet: 50 Kr")); assert!(!h.board()[1].contains("Lines:")); assert!(h.board()[5].contains("Pays bet x symbol x shape")); assert!(h.board()[6].contains("Symbol C1 L2 O3 G4 D6 S10")); @@ -182,7 +182,7 @@ fn play_shows_a_ten_line_board_and_fetches_the_balance() { h.reply("INFO alice 1 1000"); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Balance: 1000 PLN")); + assert!(h.board()[1].contains("Balance: 1000 Kr")); } #[test] @@ -200,13 +200,14 @@ fn spin_replaces_the_board_and_keeps_the_controls_line() { h.reply("GAME_RESULT session-1 50 50 1000 CCCCLLCLODGSDGS win 1 0,3,6"); assert_eq!(h.board().len(), 10); - assert!(h - .board() - .get(2) - .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); - assert!(h.board()[7].contains("Won 50 PLN")); + assert!( + h.board() + .get(2) + .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]")) + ); + assert!(h.board()[7].contains("Won 50 Kr")); assert!(h.board()[8].contains("Winning lines: 1 (top)")); - assert!(h.board()[1].contains("Balance: 1000 PLN")); + assert!(h.board()[1].contains("Balance: 1000 Kr")); assert!(h.board()[9].contains("[Q] Quit")); assert_eq!(h.screen.lines.len(), lines_before_spin); } @@ -219,7 +220,7 @@ fn equals_increases_the_bet_like_plus() { h.key(Key::Char('=')); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 20 PLN")); + assert!(h.board()[1].contains("Bet: 20 Kr")); } #[test] @@ -233,11 +234,12 @@ fn changing_the_bet_after_a_spin_does_not_leave_stale_lines() { h.key(Key::Char('+')); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 60 PLN")); - assert!(h - .board() - .get(2) - .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]"))); + assert!(h.board()[1].contains("Bet: 60 Kr")); + assert!( + h.board() + .get(2) + .is_some_and(|line| line.contains("{ C } { C } { C } [ D ] [ D ]")) + ); assert_eq!(h.screen.lines.len(), lines_before_bet); assert_eq!( h.screen @@ -272,9 +274,11 @@ fn a_mega_win_shows_all_winning_lines() { h.reply(&format!("GAME_RESULT session-1 700 10 1690 {ALL_C} mega 1,2,3,4,5 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14")); assert_eq!(h.board().len(), 10); - assert!(h.board()[7].contains("MEGA WIN! 700 PLN")); - assert!(h.board()[8] - .contains("Winning lines: 1 (top), 2 (middle), 3 (bottom), 4 (V), 5 (inverted V)")); + assert!(h.board()[7].contains("MEGA WIN! 700 Kr")); + assert!( + h.board()[8] + .contains("Winning lines: 1 (top), 2 (middle), 3 (bottom), 4 (V), 5 (inverted V)") + ); assert_eq!(h.board()[2].matches("{ C }").count(), 5); } @@ -371,11 +375,12 @@ fn tab_completion_list_wraps() { h.key(Key::Tab); - assert!(h - .screen - .lines - .iter() - .any(|line| line == "Possible completions:")); + assert!( + h.screen + .lines + .iter() + .any(|line| line == "Possible completions:") + ); for line in h .screen .lines @@ -398,7 +403,7 @@ fn play_without_a_bet_uses_the_default() { h.line("play slots"); assert_eq!(h.board().len(), 10); - assert!(h.board()[1].contains("Bet: 10 PLN")); + assert!(h.board()[1].contains("Bet: 10 Kr")); } #[test] @@ -407,11 +412,12 @@ fn an_invalid_bet_does_not_start_a_game() { h.line("play slots 5"); assert!(h.board().is_empty()); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Bet must be at least 10 PLN"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Bet must be at least 10 Kr")) + ); } #[test] @@ -438,20 +444,22 @@ fn play_requires_a_connection_and_a_login() { let mut h = Harness::new(); h.core.set_connected(false); h.line("play slots"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not connected"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not connected")) + ); let mut h = Harness::new(); h.core.set_logged_in(None); h.line("play slots"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not logged in"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not logged in")) + ); } #[test] @@ -489,26 +497,24 @@ fn info_shows_the_host_and_the_server_fields() { ); h.line("info"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Connected to: 127.0.0.1:11525"))); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Fingerprint: deadbeef"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Connected to: 127.0.0.1:11525")) + ); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Fingerprint: deadbeef")) + ); h.reply("INFO alice 42 1234"); assert!(h.screen.lines.iter().any(|line| line == "User: alice")); assert!(h.screen.lines.iter().any(|line| line == "Account: 42")); - assert!(h - .screen - .lines - .iter() - .any(|line| line == "Balance: 1234 PLN")); + assert!(h.screen.lines.iter().any(|line| line == "Balance: 1234 Kr")); } #[test] @@ -518,11 +524,12 @@ fn info_without_a_connection_does_not_send() { h.line("info"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not connected to any host"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not connected to any host")) + ); assert!(h.sent.is_empty()); } @@ -554,11 +561,12 @@ fn disconnect_clears_connection_state() { assert!(h.screen.lines.iter().any(|line| line == "Disconnected")); h.line("play slots"); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Not connected"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Not connected")) + ); } #[test] @@ -597,8 +605,8 @@ fn roulette_cursor_places_bets_and_spins() { assert_eq!(h.board().len(), 12); assert_eq!(h.board()[0], "=== ROULETTE ==="); - assert!(h.board()[1].contains("Balance: 1000 PLN")); - assert!(h.board()[1].contains("Chip: 10 PLN")); + assert!(h.board()[1].contains("Balance: 1000 Kr")); + assert!(h.board()[1].contains("Chip: 10 Kr")); assert!(h.board()[9].contains("Bets: (none)")); // The cursor starts on number 1, the bottom-left corner. assert!(h.board()[5].contains("[ 1 ]")); @@ -611,14 +619,14 @@ fn roulette_cursor_places_bets_and_spins() { h.key(Key::Enter); assert!(h.board()[9].contains("2/3 10")); - assert!(h.board()[9].contains("Total: 10 PLN")); + assert!(h.board()[9].contains("Total: 10 Kr")); // Back down to number 1 and place a straight. h.key(Key::Down); h.key(Key::Down); h.key(Key::Enter); assert!(h.board()[9].contains("1 10")); - assert!(h.board()[9].contains("Total: 20 PLN")); + assert!(h.board()[9].contains("Total: 20 Kr")); h.key(Key::Char(' ')); let request = h @@ -637,8 +645,8 @@ fn roulette_cursor_places_bets_and_spins() { )); assert_eq!(h.board().len(), 12); - assert!(h.board()[1].contains("Balance: 1160 PLN")); - assert!(h.board()[10].contains("Won 180 PLN at 3 RED ODD")); + assert!(h.board()[1].contains("Balance: 1160 Kr")); + assert!(h.board()[10].contains("Won 180 Kr at 3 RED ODD")); assert!(h.board()[10].contains("+160")); } @@ -672,16 +680,17 @@ fn roulette_rejects_an_empty_spin_and_accepts_the_equals_chip_key() { h.key(Key::Char(' ')); assert!(h.board()[10].contains("ERROR: Place at least one bet")); - assert!(!h - .sent - .iter() - .any(|line| line.starts_with("PLAY_START roulette"))); + assert!( + !h.sent + .iter() + .any(|line| line.starts_with("PLAY_START roulette")) + ); h.key(Key::Char('=')); - assert!(h.board()[1].contains("Chip: 20 PLN")); + assert!(h.board()[1].contains("Chip: 20 Kr")); h.key(Key::Enter); assert!(h.board()[9].contains("1 20")); - assert!(h.board()[9].contains("Total: 20 PLN")); + assert!(h.board()[9].contains("Total: 20 Kr")); } fn bj_state( @@ -776,7 +785,7 @@ fn blackjack_deals_hits_and_settles() { serde_json::to_string(&done).unwrap() )); - assert!(h.board()[4].contains("Win! Won 20 PLN")); + assert!(h.board()[4].contains("Win! Won 20 Kr")); assert!(h.board()[5].contains("[SPACE] New hand")); h.key(Key::Char('q')); @@ -835,11 +844,12 @@ fn blackjack_forfeit_is_sent_when_leaving_an_active_hand() { )); assert!(h.board().is_empty()); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("forfeited (10 PLN lost)"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("forfeited (10 Kr lost)")) + ); } #[test] @@ -848,7 +858,7 @@ fn blackjack_ready_board_can_change_the_next_bet() { h.enter_blackjack(); h.key(Key::Char('=')); - assert!(h.board()[1].contains("Bet: 20 PLN")); + assert!(h.board()[1].contains("Bet: 20 Kr")); h.key(Key::Char(' ')); assert!(h.sent.iter().any(|line| line == "PLAY_START blackjack 20")); @@ -917,14 +927,14 @@ fn crash_starts_a_round_and_draws_the_multiplier_locally() { assert_eq!(h.board().len(), 6); assert!(h.board()[2].contains("Multiplier: 1.00x")); - assert!(h.board()[3].contains("Potential: 10 PLN")); + assert!(h.board()[3].contains("Potential: 10 Kr")); assert!(h.board()[4].contains("Rising")); assert!(h.board()[5].contains("[C] Cash out")); // The multiplier is drawn from the local clock, with no server round trip. h.tick(Duration::from_secs(5)); assert!(h.board()[2].contains("Multiplier: 2.00x")); - assert!(h.board()[3].contains("Potential: 20 PLN")); + assert!(h.board()[3].contains("Potential: 20 Kr")); h.key(Key::Char('c')); assert_eq!(h.sent.last().map(String::as_str), Some("CRASH_CASHOUT cr1")); @@ -932,9 +942,9 @@ fn crash_starts_a_round_and_draws_the_multiplier_locally() { let cashed = crash_state("cashed", 2.0, Some(3.0), 20, 1010); h.reply(&crash_line("CRASH_STATE", &cashed)); - assert!(h.board()[4].contains("Cashed out at 2.00x Won 20 PLN")); + assert!(h.board()[4].contains("Cashed out at 2.00x Won 20 Kr")); assert!(h.board()[5].contains("[SPACE] Play")); - assert_eq!(h.board()[1], "Balance: 1010 PLN Bet: 10 PLN"); + assert_eq!(h.board()[1], "Balance: 1010 Kr Bet: 10 Kr"); } #[test] @@ -977,11 +987,12 @@ fn crash_q_forfeits_an_active_round() { h.reply(&crash_line("CRASH_STATE", &forfeited)); assert!(h.board().is_empty()); - assert!(h - .screen - .lines - .iter() - .any(|line| line.contains("Round forfeited (10 PLN lost)"))); + assert!( + h.screen + .lines + .iter() + .any(|line| line.contains("Round forfeited (10 Kr lost)")) + ); } #[test] @@ -990,8 +1001,8 @@ fn crash_ready_board_changes_the_next_bet() { h.enter_crash(); h.key(Key::Char('=')); - assert!(h.board()[1].contains("Bet: 20 PLN")); - assert!(h.board()[3].contains("Potential: 20 PLN")); + assert!(h.board()[1].contains("Bet: 20 Kr")); + assert!(h.board()[3].contains("Potential: 20 Kr")); h.key(Key::Char(' ')); assert!(h.sent.iter().any(|line| line == "PLAY_START crash 20")); @@ -1058,7 +1069,7 @@ fn a_forfeit_that_arrives_after_the_bust_still_leaves_cleanly() { assert!(h.board().is_empty()); assert!(h.screen.lines.iter().any(|line| line == "Game exited.")); - assert!(!h.screen.lines.iter().any(|line| line.contains("PLN lost"))); + assert!(!h.screen.lines.iter().any(|line| line.contains("Kr lost"))); } #[test] diff --git a/tests/crash.rs b/tests/crash.rs index 49eaf89..c985ebe 100644 --- a/tests/crash.rs +++ b/tests/crash.rs @@ -2,8 +2,8 @@ use std::time::Duration; use zagan_bet::crash::{ - crash_point_from_uniform, multiplier_at, multiplier_at_secs, payout, time_for_multiplier, - HOUSE_EDGE, MAX_MULTIPLIER, + HOUSE_EDGE, MAX_MULTIPLIER, crash_point_from_uniform, multiplier_at, multiplier_at_secs, + payout, time_for_multiplier, }; fn close(a: f64, b: f64, tolerance: f64) { @@ -38,9 +38,9 @@ fn the_time_for_a_multiplier_is_the_inverse_of_the_curve() { } #[test] -fn cashout_value_is_floored_to_whole_pln() { +fn cashout_value_is_floored_to_whole_Kr() { assert_eq!(payout(10, 1.0), 10); - assert_eq!(payout(10, 1.05), 10, "half a PLN is not paid out"); + assert_eq!(payout(10, 1.05), 10, "half a Kr is not paid out"); assert_eq!(payout(10, 1.10), 11); assert_eq!(payout(10, 2.47), 24); assert_eq!(payout(7, 3.0), 21); -- cgit v1.2.3