1 use clap::{Parser, Subcommand, ValueEnum};
2 use pluta_lesnura::{momentum_player, play, random_player, Game, Player};
5 #[command(author, version, about, long_about = None, arg_required_else_help = true)]
8 command: Option<Commands>,
11 #[derive(Clone, Debug, ValueEnum)]
21 /// For momentum play, draw how often? 0-1
22 #[arg(short = 'p', long, default_value_t = 0.5)]
25 #[arg(short = 'g', long, default_value_t = 1)]
28 #[arg(short = 'p', long)]
30 /// What strategy should players use?
31 #[arg(short = 's', long, value_enum)]
36 fn main() -> Result<(), &'static str> {
37 let cli = Cli::parse();
46 let player = || match strategy {
47 Strategy::Random => Player::new(random_player(*draw_chance)),
48 Strategy::Momentum => Player::new(momentum_player(*draw_chance)),
50 for _ in 0..*num_games {
51 let players: Vec<_> = std::iter::from_fn(|| Some(player()))
54 let mut game = Game::default();
55 for _ in 0..*num_players {
58 let result = play(game, players)?;
59 println!("Result: {result:?}");
63 None => unreachable!(),