//! Shared slots rules used by both the server engine and the client board. pub const REELS: usize = 5; pub const ROWS: usize = 3; pub const SYMBOLS: [char; 6] = ['C', 'L', 'O', 'G', 'D', 'S']; /// Five paylines, each entry is the row used on reel 0..4. pub const PAYLINES: [[usize; REELS]; 5] = [ [0, 0, 0, 0, 0], // line 1: top [1, 1, 1, 1, 1], // line 2: middle [2, 2, 2, 2, 2], // line 3: bottom [0, 1, 2, 1, 0], // line 4: V [2, 1, 0, 1, 2], // line 5: inverted V ]; 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)]; /// (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 symbols = SYMBOL_MULTIPLIERS .iter() .map(|(symbol, multiplier)| format!("{symbol}{multiplier}")) .collect::>() .join(" "); let shapes = SHAPE_MULTIPLIERS .iter() .map(|(length, multiplier)| format!("{length}:{multiplier}")) .collect::>() .join(" "); vec![ "Pays bet x symbol x shape".to_string(), format!("Symbol {symbols} Shape {shapes}"), ] }