https://github.com/mcjkula/battlesnake-python
Python-based Battlesnake bot using A* pathfinding, collision detection, and adaptive strategies for competitive gameplay.
https://github.com/mcjkula/battlesnake-python
battlesnake bot pathfinding reinforcement-learning
Last synced: 2 months ago
JSON representation
Python-based Battlesnake bot using A* pathfinding, collision detection, and adaptive strategies for competitive gameplay.
- Host: GitHub
- URL: https://github.com/mcjkula/battlesnake-python
- Owner: mcjkula
- Created: 2023-10-21T21:19:27.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-27T23:14:18.000Z (over 2 years ago)
- Last Synced: 2026-03-31T13:42:30.530Z (3 months ago)
- Topics: battlesnake, bot, pathfinding, reinforcement-learning
- Language: Python
- Homepage:
- Size: 170 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Battlesnake Bots/AI in Python
This repository contains algorithms and bots developed for [Battlesnake](https://play.battlesnake.com/).
## Technologies Used
- Libraries: `dataset`, `fastapi`
## Features
- **A* Algorithm (Pathfinding)**: Efficiently finds the shortest path to food/objectives.
- **Collision Detection**: Ensures the snake avoids collisions with other snakes or itself.
- **Head-to-Head Prevention**: Logic to prevent head-to-head collisions.
- **Out-of-Bounds Detection**: Keeps the snake within the game board boundaries.
## Motivation/Reason
Driven by an interest in competitive programming and game strategies, Battlesnake caught my attention. This project started as a hobby, with the goal of continuously refining the algorithm and bot to climb the Battlesnake rankings.
## Usage
1. Clone this repository.
2. Install necessary libraries.
3. Modify the code to remove database logic:
- Navigate to the "start" and "end" methods in the main script.
- Remove the lines involving the DATABASE object.
4. Run the main script.
```bash
python main.py
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.