summaryrefslogtreecommitdiffstats
path: root/src/bin/client/games/slots.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-10-28 22:28:05 +0100
committersalmonik <salmonik@tuta.io>2026-10-28 22:28:05 +0100
commitea5e7d336719571e51ef14478ab603e71126e3d8 (patch)
tree4fb59337501f798e6591701e52b9e785307efd63 /src/bin/client/games/slots.rs
parentFix TUI: render_lines 6 for correct MoveUp, drain buffered events before clea... (diff)
downloadzagan-bet-ea5e7d336719571e51ef14478ab603e71126e3d8.tar.gz
zagan-bet-ea5e7d336719571e51ef14478ab603e71126e3d8.zip
v0.2.2: split client/server logic into the library
Diffstat (limited to 'src/bin/client/games/slots.rs')
-rw-r--r--src/bin/client/games/slots.rs61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/bin/client/games/slots.rs b/src/bin/client/games/slots.rs
deleted file mode 100644
index ff55274..0000000
--- a/src/bin/client/games/slots.rs
+++ /dev/null
@@ -1,61 +0,0 @@
1use crate::games::traits::{Game, GameState};
2
3pub struct SlotsGame;
4
5impl SlotsGame {
6 pub fn new() -> Self {
7 Self
8 }
9
10 fn render_reels(&self, reels: &str) -> String {
11 if reels.is_empty() {
12 "[ ? ] [ ? ] [ ? ]".to_string()
13 } else {
14 let chars: Vec<char> = reels.chars().collect();
15 format!(
16 "[ {} ] [ {} ] [ {} ]\r",
17 chars.get(0).unwrap_or(&'?'),
18 chars.get(1).unwrap_or(&'?'),
19 chars.get(2).unwrap_or(&'?')
20 )
21 }
22 }
23}
24
25impl Game for SlotsGame {
26 fn get_name(&self) -> &'static str {
27 "Slots"
28 }
29
30 fn render(&self, state: &GameState) -> String {
31 let reels = state.data.get("reels").cloned().unwrap_or_default();
32
33 format!(
34 "=== SLOTS ===\r\nBet: {} PLN\r\n{}\r\n\r\nPress [SPACE] to spin!\r\n\r\nControls: [+/-] Adjust Bet [Q] Quit",
35 state.bet_amount,
36 self.render_reels(&reels)
37 )
38 }
39
40 fn render_lines(&self, _state: &GameState) -> usize {
41 6
42 }
43
44 fn get_help(&self) -> String {
45 "SLOTS GAME\n\
46 =========\n\
47 Match symbols to win!\n\
48 \n\
49 Payouts:\n\
50 Three of a kind: 2x-28x bet\n\
51 Two of a kind: 1x-3x bet\n\
52 \n\
53 Symbols: C=Cherry, L=Lemon, O=Orange, G=Grapes, D=Diamond, S=Seven\n\
54 \n\
55 Controls:\n\
56 SPACE - Spin the reels\n\
57 +/- - Adjust bet amount\n\
58 Q - Exit the game"
59 .to_string()
60 }
61}