Zachatoo / battle-snake-rust

https://play.battlesnake.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Battlesnake Rust Project

A set of Battlesnakes written in Rust. Get started at play.battlesnake.com.

Technologies Used

This project uses Rust and Rocket. It also comes with an optional Dockerfile to help with deployment.

Run Your Battlesnakes

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 Battlesnake

  1. Create a new .rs file under /snakes that matches the name of your battlesnake.
  2. In the /snakes/mod.rs file, add a line to include your battlesnake.
  3. 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.
  4. Update the configuration in the info method to match how you want your battlesnake to be configured.
  5. Update the MOVE_URI variable to include the name of your battlesnake instead of righty.
  6. In the main.rs file, add four routes for your battlesnake: /, /start, /move, and /end. Mount them in the rocket::build() method.

Test Your Battlesnakes

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

About

https://play.battlesnake.com

License:Other


Languages

Language:Rust 99.9%Language:Dockerfile 0.1%