rs_poker 2.0.0-beta.2

A library to help with any Rust code dealing with poker. This includes card values, suits, hands, hand ranks, 5 card hand strength calculation, 7 card hand strength calulcation, and monte carlo game simulation helpers.
Documentation
use super::action::Action;
use super::game_state::GameState;

pub trait Agent {
    fn act(&self, game_state: &GameState) -> Action;
}

pub struct FoldingAgent {}

impl Agent for FoldingAgent {
    fn act(&self, game_state: &GameState) -> Action {
        match (
            game_state.current_round_data(),
            game_state.num_active_players(),
        ) {
            (Some(round), 1) => Action::Bet(round.bet),
            _ => Action::Fold,
        }
    }
}

pub struct CallingAgent {}

impl Agent for CallingAgent {
    fn act(&self, game_state: &GameState) -> Action {
        game_state
            .current_round_data()
            .map_or_else(|| Action::Fold, |round| Action::Bet(round.bet))
    }
}