Coder Social home page Coder Social logo

battle-snake-rust's Introduction

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

battle-snake-rust's People

Contributors

dependabot[bot] avatar zachatoo avatar

Watchers

 avatar

battle-snake-rust's Issues

Smarter food pathfinding

Currently, snake is finding closest food using BFS and attempting to go in that direction if safe.

Ideas for improvement:

  • Fix scan not continuously scanning outwards until finds food.
  • Find multiple paths and select a random safe path.
  • Find closest food in safe area, then ideal path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.