1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
//! 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
];
/// (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),
];
/// Paytable rendered under the reels, split so it fits a narrow terminal.
pub fn paytable_lines() -> Vec<String> {
let entries: Vec<String> = PAYTABLE
.iter()
.map(|(symbol, three, four, five)| format!("{symbol} {three}/{four}/{five}"))
.collect();
entries
.chunks(3)
.enumerate()
.map(|(index, chunk)| {
let prefix = if index == 0 {
"Pays 3/4/5 x bet: "
} else {
""
};
format!("{}{}", prefix, chunk.join(" "))
})
.collect()
}
|