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
33
34
35
36
37
38
39
|
use std::{env, path::PathBuf};
use planetwars_matchrunner::{docker_runner::DockerBotSpec, run_match, MatchConfig, MatchPlayer};
#[tokio::main]
async fn main() {
let args: Vec<String> = env::args().collect();
assert!(args.len() >= 2);
let map_path = args[1].clone();
_run_match(map_path).await;
}
const IMAGE: &'static str = "python:3.10-slim-buster";
async fn _run_match(map_path: String) {
let code_dir_path = PathBuf::from("../simplebot");
let bot_spec = DockerBotSpec {
image: IMAGE.to_string(),
code_path: code_dir_path,
argv: vec!["python".to_string(), "simplebot.py".to_string()],
};
run_match(MatchConfig {
map_path: PathBuf::from(map_path),
map_name: "hex".to_string(),
log_path: PathBuf::from("match.log"),
players: vec![
MatchPlayer {
name: "a".to_string(),
bot_spec: Box::new(bot_spec.clone()),
},
MatchPlayer {
name: "b".to_string(),
bot_spec: Box::new(bot_spec.clone()),
},
],
})
.await;
}
|