Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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.