From 9951e2d5afbcabb4bd8016b6d160653c1ec5ed8e Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 28 Oct 2026 23:45:43 +0100 Subject: v1.3.0: simplify payouts to bet x symbol x shape --- src/slots.rs | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) (limited to 'src/slots.rs') diff --git a/src/slots.rs b/src/slots.rs index a3b4ef4..9e41f05 100644 --- a/src/slots.rs +++ b/src/slots.rs @@ -13,33 +13,38 @@ pub const PAYLINES: [[usize; REELS]; 5] = [ [2, 1, 0, 1, 2], // line 5: inverted V ]; -/// (symbol, 3-of-a-kind, 4-of-a-kind, 5-of-a-kind) multipliers of total bet. -pub const PAYTABLE: [(char, u64, u64, u64); 6] = [ - ('C', 2, 5, 15), - ('L', 3, 7, 20), - ('O', 3, 8, 25), - ('G', 4, 12, 40), - ('D', 6, 18, 70), - ('S', 9, 30, 150), +pub const LINE_NAMES: [&str; 5] = ["top", "middle", "bottom", "V", "inverted V"]; + +/// Symbol value multipliers. +pub const SYMBOL_MULTIPLIERS: [(char, u64); 6] = [ + ('C', 1), + ('L', 2), + ('O', 3), + ('G', 4), + ('D', 6), + ('S', 10), ]; -/// Paytable rendered under the reels, split so it fits a narrow terminal. +/// (match length, shape multiplier): 3, 4 or 5 of a kind. +pub const SHAPE_MULTIPLIERS: [(usize, u64); 3] = [(3, 1), (4, 3), (5, 14)]; + +/// Paytable rendered under the reels. +/// +/// `payout = bet * symbol_multiplier * shape_multiplier`. pub fn paytable_lines() -> Vec { - let entries: Vec = PAYTABLE + let symbols = SYMBOL_MULTIPLIERS + .iter() + .map(|(symbol, multiplier)| format!("{symbol}{multiplier}")) + .collect::>() + .join(" "); + let shapes = SHAPE_MULTIPLIERS .iter() - .map(|(symbol, three, four, five)| format!("{symbol} {three}/{four}/{five}")) - .collect(); + .map(|(length, multiplier)| format!("{length}:{multiplier}")) + .collect::>() + .join(" "); - entries - .chunks(3) - .enumerate() - .map(|(index, chunk)| { - let prefix = if index == 0 { - "Pays 3/4/5 x bet: " - } else { - "" - }; - format!("{}{}", prefix, chunk.join(" ")) - }) - .collect() + vec![ + "Pays bet x symbol x shape".to_string(), + format!("Symbol {symbols} Shape {shapes}"), + ] } -- cgit v1.2.3