add some xtasks

This commit is contained in:
Max Känner 2024-10-14 19:23:48 +02:00
parent 7227f1776f
commit b2364a1ade

View File

@ -24,6 +24,8 @@ fn try_main() -> Result<(), DynError> {
match task.as_deref() {
Some("local") => local()?,
Some("local2") => local2()?,
Some("local4") => local4()?,
Some("constrictor4") => constrictor4()?,
Some("vs_production" | "vs_prod") => vs_production()?,
Some("regression") => regression()?,
Some("docker") => docker()?,
@ -38,6 +40,8 @@ fn print_help() {
local runs the snake on a local game
local2 runs the snake twice on a local game
local4 runs the snake on a local standard game
constrictor4 runs the snake on a local constrictor game
vs_production | vs_prod runs the snake against the active server
regression runs the snake against the active server multiple times
@ -100,6 +104,80 @@ fn local2() -> Result<(), DynError> {
Ok(())
}
fn local4() -> Result<(), DynError> {
let mut snake = run_snake(8000, None)?;
let game = Command::new("./battlesnake-cli")
.current_dir(project_root())
.args([
"play",
"-W",
"11",
"-H",
"11",
"--name",
"local test1",
"--url",
"http://localhost:8000",
"--name",
"local test2",
"--url",
"http://localhost:8000",
"--name",
"local test3",
"--url",
"http://localhost:8000",
"--name",
"local test4",
"--url",
"http://localhost:8000",
"-g",
"standard",
"--browser",
])
.status();
game.and(snake.kill())?;
Ok(())
}
fn constrictor4() -> Result<(), DynError> {
let mut snake = run_snake(8000, None)?;
let game = Command::new("./battlesnake-cli")
.current_dir(project_root())
.args([
"play",
"-W",
"11",
"-H",
"11",
"--name",
"local test1",
"--url",
"http://localhost:8000",
"--name",
"local test2",
"--url",
"http://localhost:8000",
"--name",
"local test3",
"--url",
"http://localhost:8000",
"--name",
"local test4",
"--url",
"http://localhost:8000",
"-g",
"constrictor",
"--browser",
])
.status();
game.and(snake.kill())?;
Ok(())
}
fn vs_production() -> Result<(), DynError> {
let mut snake = run_snake(8000, None)?;