diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-28 23:31:54 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-28 23:31:54 +0100 |
| commit | 7d18a268547734daf19a740b6533e9c1697baf1a (patch) | |
| tree | 789f519a19b053b8ad0ff41d2828fe22c06fb21a /src/slots.rs | |
| parent | v1.2.0: show the symbol paytable on the slots board (diff) | |
| download | zagan-bet-7d18a268547734daf19a740b6533e9c1697baf1a.tar.gz zagan-bet-7d18a268547734daf19a740b6533e9c1697baf1a.zip | |
v1.2.1: track wrapped board lines and split the paytable
Diffstat (limited to 'src/slots.rs')
| -rw-r--r-- | src/slots.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/slots.rs b/src/slots.rs index 561c449..a3b4ef4 100644 --- a/src/slots.rs +++ b/src/slots.rs | |||
| @@ -23,11 +23,23 @@ pub const PAYTABLE: [(char, u64, u64, u64); 6] = [ | |||
| 23 | ('S', 9, 30, 150), | 23 | ('S', 9, 30, 150), |
| 24 | ]; | 24 | ]; |
| 25 | 25 | ||
| 26 | /// One-line paytable rendered under the reels. | 26 | /// Paytable rendered under the reels, split so it fits a narrow terminal. |
| 27 | pub fn paytable_line() -> String { | 27 | pub fn paytable_lines() -> Vec<String> { |
| 28 | let entries: Vec<String> = PAYTABLE | 28 | let entries: Vec<String> = PAYTABLE |
| 29 | .iter() | 29 | .iter() |
| 30 | .map(|(symbol, three, four, five)| format!("{symbol} {three}/{four}/{five}")) | 30 | .map(|(symbol, three, four, five)| format!("{symbol} {three}/{four}/{five}")) |
| 31 | .collect(); | 31 | .collect(); |
| 32 | format!("Pays 3/4/5 x bet: {}", entries.join(" ")) | 32 | |
| 33 | entries | ||
| 34 | .chunks(3) | ||
| 35 | .enumerate() | ||
| 36 | .map(|(index, chunk)| { | ||
| 37 | let prefix = if index == 0 { | ||
| 38 | "Pays 3/4/5 x bet: " | ||
| 39 | } else { | ||
| 40 | "" | ||
| 41 | }; | ||
| 42 | format!("{}{}", prefix, chunk.join(" ")) | ||
| 43 | }) | ||
| 44 | .collect() | ||
| 33 | } | 45 | } |
