From ea5e7d336719571e51ef14478ab603e71126e3d8 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 28 Oct 2026 22:28:05 +0100 Subject: v0.2.2: split client/server logic into the library --- src/bin/client/games/slots.rs | 61 ------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/bin/client/games/slots.rs (limited to 'src/bin/client/games/slots.rs') 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 @@ -use crate::games::traits::{Game, GameState}; - -pub struct SlotsGame; - -impl SlotsGame { - pub fn new() -> Self { - Self - } - - fn render_reels(&self, reels: &str) -> String { - if reels.is_empty() { - "[ ? ] [ ? ] [ ? ]".to_string() - } else { - let chars: Vec = reels.chars().collect(); - format!( - "[ {} ] [ {} ] [ {} ]\r", - chars.get(0).unwrap_or(&'?'), - chars.get(1).unwrap_or(&'?'), - chars.get(2).unwrap_or(&'?') - ) - } - } -} - -impl Game for SlotsGame { - fn get_name(&self) -> &'static str { - "Slots" - } - - fn render(&self, state: &GameState) -> String { - let reels = state.data.get("reels").cloned().unwrap_or_default(); - - format!( - "=== SLOTS ===\r\nBet: {} PLN\r\n{}\r\n\r\nPress [SPACE] to spin!\r\n\r\nControls: [+/-] Adjust Bet [Q] Quit", - state.bet_amount, - self.render_reels(&reels) - ) - } - - fn render_lines(&self, _state: &GameState) -> usize { - 6 - } - - fn get_help(&self) -> String { - "SLOTS GAME\n\ - =========\n\ - Match symbols to win!\n\ - \n\ - Payouts:\n\ - Three of a kind: 2x-28x bet\n\ - Two of a kind: 1x-3x bet\n\ - \n\ - Symbols: C=Cherry, L=Lemon, O=Orange, G=Grapes, D=Diamond, S=Seven\n\ - \n\ - Controls:\n\ - SPACE - Spin the reels\n\ - +/- - Adjust bet amount\n\ - Q - Exit the game" - .to_string() - } -} -- cgit v1.2.3