Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 1 month 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 (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-27T23:14:18.000Z (about 1 year ago)
- Last Synced: 2024-07-30T17:18:21.120Z (5 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
```## Future Plans
- Refine the current strategies for better performance. (Cap being 500ms)
- Integrate reinforcement learning for adaptive gameplay.
- Experiment with other popular game algorithms and see their impact on performance.## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.