A custom, lightweight implementation of a Slither-like environment designed specifically for training autonomous agents using Reinforcement Learning.
This repository provides a sandbox environment where a snake agent must navigate a field, consume food to grow, and avoid colliding with other snakes. It is built to be highly configurable, supporting both rendered play for visualization and "headless" modes for accelerated RL training.
src/slithbot: The engine of the game. Contains the core logic (game.py), helper functions (utils.py), and entrypoint code (main.py).config/: YAML files to easily tweak game parameters like world size, snake count, and rendering options.tests/: Testing code for the various functions in the project.pyproject.toml: Configuration file for appropriate installation. Just runpip install .to install.docs/: Some images etc. used in the project.
Clone the repository, create a fresh conda env, and install the necessary packages:
git clone https://github.com/shashkat/slithbot.git
cd slithbot
conda create -n slithbot_env python=3.12
conda activate slithbot_env
pip install . # for editable install, use: pip install -e .
To see the environment in action using the default configuration, run from the cloned repo's root location:
slithbot-run config/base.yaml
Similarly, you can execute with other configurations. See the base configurations present in slithbot/config. Feel free to create your own configurations.
This project is licensed under the MIT License - see the LICENSE file for details.

