summaryrefslogtreecommitdiffstats
path: root/src/bin/client/games/traits.rs
blob: aed0c24932a5d55f51c873384e01e4d53a2d8757 (plain) (blame)
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
use std::collections::HashMap;

#[derive(Debug, Clone)]
pub enum GameError {
    InvalidAction,
    NetworkError,
}

#[derive(Debug, Clone, PartialEq)]
pub enum GamePhase {
    WaitingToStart,
    Playing,
    Finished,
}

#[derive(Debug, Clone)]
pub struct GameState {
    pub game_type: String,
    pub bet_amount: u64,
    pub phase: GamePhase,
    pub data: HashMap<String, String>,
}

pub trait Game: Send + Sync {
    fn get_name(&self) -> &'static str;

    fn render(&self, state: &GameState) -> String;

    fn render_lines(&self, state: &GameState) -> usize;

    fn get_help(&self) -> String;
}