Interactive reinforcement learning sandbox for experimenting with AI agents in a classic Snake Game environment.
Project description
Introduction
AI Snake Lab is an interactive reinforcement learning sandbox for experimenting with AI agents in a classic Snake Game environment — featuring a live Textual TUI interface, flexible replay memory database, and modular model definitions.
🚀 Features
- 🐍 Classic Snake environment with customizable grid and rules
- 🧠 AI agent interface supporting multiple architectures (Linear, RNN, CNN)
- 🎮 Textual-based simulator for live visualization and metrics
- 💾 SQLite-backed replay memory for storing frames, episodes, and runs
- 🧩 Experiment metadata tracking — models, hyperparameters, state-map versions
- 📊 Built-in plotting for hashrate, scores, and learning progress
🧰 Tech Stack
| Component | Description |
|---|---|
| Python 3.11+ | Core language |
| Textual | Terminal UI framework |
| SQLite3 | Lightweight replay memory + experiment store |
| PyTorch (optional) | Deep learning backend for models |
| Plotext / Matplotlib | Visualization tools |
Installation
This project is on PyPI. You can install the AI Snake Lab software using pip.
Create a Sandbox
python3 -m venv snake_venv
. snake_venv/bin/activate
Install the AI Snake Lab
After you have activated your venv environment:
pip install ai-snake-lab
Running the AI Snake Lab
From within your venv environment:
ai-snake-lab
Links and Acknowledgements
This code is based on a YouTube tutorial, Python + PyTorch + Pygame Reinforcement Learning – Train an AI to Play Snake by Patrick Loeber. You can access his original code here on GitHub. Thank you Patrick!!! You are amazing!!!!
Thanks also go out to Will McGugan and the Textual team. Textual is an amazing framework. Talk about rapid Application Development. Porting this took less than a day.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_snake_lab-0.4.8.tar.gz.
File metadata
- Download URL: ai_snake_lab-0.4.8.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.13 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cd1cf1ae301a3ac12118e7b5e7fec17693b96066d008049140712f5b8a3f64f
|
|
| MD5 |
69045e13c89fd0801920f4238d0e196d
|
|
| BLAKE2b-256 |
f9d372b6e5cef730985c7f06934d737845fe3cd3d5e606b9ee765ca870b775da
|
File details
Details for the file ai_snake_lab-0.4.8-py3-none-any.whl.
File metadata
- Download URL: ai_snake_lab-0.4.8-py3-none-any.whl
- Upload date:
- Size: 39.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.13 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ad2d9ced5bcf49844855f9f5acb616bc0d13bcb45f21a5ab679dcc332a36d98
|
|
| MD5 |
d6c1880100206b769f0d0c9df27b7064
|
|
| BLAKE2b-256 |
0af4045457203f92c0b25d8775b8038cf887144fac34f044a5d5db22759a6239
|