feat: ai strategy (wip)

This commit is contained in:
Henri Bourcereau 2025-03-02 15:20:24 +01:00
parent 899a690869
commit ab770f3a34
14 changed files with 421 additions and 57 deletions

View file

@ -1,4 +1,4 @@
use bot::{BotStrategy, DefaultStrategy};
use bot::{BotStrategy, DefaultStrategy, StableBaselines3Strategy};
use itertools::Itertools;
use crate::game_runner::GameRunner;
@ -32,6 +32,13 @@ impl App {
"dummy" => {
Some(Box::new(DefaultStrategy::default()) as Box<dyn BotStrategy>)
}
"ai" => {
Some(Box::new(StableBaselines3Strategy::default()) as Box<dyn BotStrategy>)
}
s if s.starts_with("ai:") => {
let path = s.trim_start_matches("ai:");
Some(Box::new(StableBaselines3Strategy::new(path)) as Box<dyn BotStrategy>)
}
_ => None,
})
.collect()

View file

@ -19,6 +19,10 @@ FLAGS:
OPTIONS:
--seed SEED Sets the random generator seed
--bot STRATEGY_BOT Add a bot player with strategy STRATEGY, a second bot may be added to play against the first : --bot STRATEGY_BOT1,STRATEGY_BOT2
Available strategies:
- dummy: Default strategy selecting the first valid move
- ai: AI strategy using the default model at models/trictrac_ppo.zip
- ai:/path/to/model.zip: AI strategy using a custom model
ARGS:
<INPUT>