Inspiration
We built SlitherSnake for BattleSnake 2026 because we wanted to create a snake that feels smart, strategic, and fun to watch. Instead of making a bot that only reacts to immediate danger, we wanted one that could think ahead, adapt to changing board conditions, and make more intentional decisions in real time. The challenge of turning a simple snake game into a live web-based strategy system is what made this project exciting for us
What it does
SlitherSnake is a BattleSnake bot that receives the live game state through API endpoints and returns the best move on every turn. It tries to survive longer by avoiding unsafe moves, staying in open space, chasing food when health is low, reacting to hazard zones, and being careful around enemy snakes. Instead of following one simple rule, it balances multiple factors to choose the strongest move available
How we built it
We built SlitherSnake as a Flask-based web application that implements the standard BattleSnake endpoints, including the move endpoint where all decision-making happens. The core of the project is a minimax algorithm with alpha-beta pruning, which helps the snake evaluate future board states and choose stronger long-term moves instead of just reacting to the current turn. We paired this with a custom GameState model to simulate movement, food consumption, health updates, and hazard damage. On top of that, we used heuristic scoring based on flood-fill space, food distance, aggression opportunities, center control, and health pressure to rank positions more intelligently
Challenges we ran into
One of the biggest challenges was balancing smarter strategy with fast response time. A deeper search makes the snake stronger, but it also slows decision-making, so we had to keep the minimax depth practical for real-time play. Another challenge was accurately identifying whether a move was truly safe, because a move that looks fine now can still lead to a trap a few turns later. We also had to carefully handle opponent interactions, especially risky head-to-head collisions with equal or larger snakes, hazard damage, and low-health situations where food becomes urgent
Accomplishments that we're proud of
One of the biggest challenges was balancing smarter strategy with fast response time. A deeper search makes the snake stronger, but it also slows decision-making, so we had to keep the minimax depth practical for real-time play. Another challenge was accurately identifying whether a move was truly safe, because a move that looks fine now can still lead to a trap a few turns later. We also had to carefully handle opponent interactions, especially risky head-to-head collisions with equal or larger snakes, hazard damage, and low-health situations where food becomes urgent
What we learned
This project taught us a lot about building a real-time game AI under hackathon constraints. We learned that even simple ideas become much stronger when combined well, like search, heuristics, and board simulation. We also learned how important it is to model the game state correctly, since details like tail movement, hazard damage, health, and opponent size can completely change the best decision. Most importantly, we learned that a strong BattleSnake is not just about surviving the current turn, but about protecting future options as well
What's next for SlitherSnake
Next, we would like to make SlitherSnake even smarter by improving multi-opponent reasoning, adding better escape and trap detection, tuning our heuristic weights more carefully, and creating match analytics or replay visualizations to understand why certain moves succeed or fail. The goal is to keep the snake fast and reliable while making its strategy deeper and more competitive over time
Log in or sign up for Devpost to join the conversation.