summaryrefslogtreecommitdiffstats
path: root/src/bin/client/games/traits.rs
diff options
context:
space:
mode:
authorsalmonik <salmonik@tuta.io>2026-08-24 14:48:12 +0200
committersalmonik <salmonik@tuta.io>2026-08-24 14:48:12 +0200
commit5d6b5049c2a34a3f8abe725d4a871ba84a0dd714 (patch)
tree57cb03bf59b3358a96742f455d38c21f4f645396 /src/bin/client/games/traits.rs
parentstable and working, both platforms (diff)
downloadzagan-bet-5d6b5049c2a34a3f8abe725d4a871ba84a0dd714.tar.gz
zagan-bet-5d6b5049c2a34a3f8abe725d4a871ba84a0dd714.zip
TLS transport and games framework on client and server
Diffstat (limited to '')
-rw-r--r--src/bin/client/games/traits.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bin/client/games/traits.rs b/src/bin/client/games/traits.rs
new file mode 100644
index 0000000..19f2638
--- /dev/null
+++ b/src/bin/client/games/traits.rs
@@ -0,0 +1,30 @@
1use std::collections::HashMap;
2
3#[derive(Debug, Clone)]
4pub enum GameError {
5 InvalidAction,
6 NetworkError,
7}
8
9#[derive(Debug, Clone, PartialEq)]
10pub enum GamePhase {
11 WaitingToStart,
12}
13
14#[derive(Debug, Clone)]
15pub struct GameState {
16 pub game_type: String,
17 pub bet_amount: u64,
18 pub phase: GamePhase,
19 pub data: HashMap<String, String>,
20}
21
22pub trait Game: Send + Sync {
23 fn get_name(&self) -> &'static str;
24
25 fn render(&self, state: &GameState) -> String;
26
27 fn render_lines(&self, state: &GameState) -> usize;
28
29 fn get_help(&self) -> String;
30}