Skip to content

shashkat/slithbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slithbot

A custom, lightweight implementation of a Slither-like environment designed specifically for training autonomous agents using Reinforcement Learning.

Overview

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.

Project structure

  • 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 run pip install . to install.
  • docs/: Some images etc. used in the project.

Getting started

Installation

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 .

Running the game

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.

Gameplay demo

Slither game loop

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Attempt at developing a bot of the slither.io game

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages