A set of Battlesnakes written in Rust. Get started at play.battlesnake.com.
This project uses Rust and Rocket. It also comes with an optional Dockerfile to help with deployment.
cargo run
You should see the following output once it is running
๐ Rocket has launched from http://0.0.0.0:8000
You can then make a request to your battlesnake's url using the URI <snake>/<action>
, where <snake>
is the name of your snake and <action>
is the action you'd like to perform, one of /
, start
, move
, or end
.
- Create a new
.rs
file under/snakes
that matches the name of your battlesnake. - In the
/snakes/mod.rs
file, add a line to include your battlesnake. - Copy/paste the code from
/snakes/righty.rs
into your/snakes/<snake>.rs
file. This battlesnake is very simple, works well for a template battlesnake. - Update the configuration in the
info
method to match how you want your battlesnake to be configured. - Update the
MOVE_URI
variable to include the name of your battlesnake instead of righty. - In the
main.rs
file, add four routes for your battlesnake:/
,/start
,/move
, and/end
. Mount them in therocket::build()
method.
cargo test
You should see the following output once it is done running
test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s