Skip to content

mstruve/untimely-neglected-wearable

 
 

Repository files navigation

A Simple Battlesnake Written in Python

This is an implementation of the Battlesnake API.

It is designed to be:

  • Stateless - a decision is made based on the board state provided on request.
  • Reusable - all game modes are accounted for in one code base.
  • Performant - enough to run on a low-power device. It could be much better!

It has code to:

  • Avoid the edges of the map.
  • Avoid collisions with other snakes on the board.
  • Avoid entering spaces too small to fit, unless space would be vacated by exiting snake bodies.
  • Avoid hazard spaces unless it's where our food is.
  • Seek food when other snakes are larger, and avoid it when we don't need it.
  • Blindly find food when very low in health.
  • Take a certain winning move if the other snake has one available move.
  • Take a drafting larger snake to a wall, just to see what happens.
  • Avoid paths that could be closed due to other snake movement.
  • Accept a board state and return debugging output for a single move.

Next steps

  • Improve hazard code to reduce time spent in hazards.
  • Improve tail chasing code to chase enemy tails.
  • Proper, repeatable test suites!

Possible refactoring

  • A better idling strategy than choosing a random move.
  • Improve pathfinder code to use a multi-node tree, to collect more info as we seek a 'best' path.
  • Optimize to run better on the Raspberry Pi.

Technologies Used

Resources

Battlesnake documentation is available at docs.battlesnake.com, including detailed Guides, API References, and Tips.

You can also join the Battlesnake Developer Community on Slack and Discord. We have a growing community of Battlesnake developers of all skill levels wanting to help everyone succeed and have fun with Battlesnake :)

About

A simple Battlesnake written in Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%