A neural network learns to play snakes in the terminal
Check out this for an older version of the AI that uses macroquad for GUI
- Clone the repo
git clone git@github.com:bones-ai/rust-snake-ai-ratatui.git
cd rust-snake-ai-ratatui
- Run the simulation
cargo run --release
- The project configs file is located at
src/configs.rs
- Update
IS_LOW_DETAIL_MODE
for a minimal UI, it runs faster - Set
IS_SAVE_BEST_NET
to train your own network. Networks are saved indata/net.json
, once saved you can use the trained network by settingIS_LOAD_SAVED_NET
- Use
data/net-100.json
to watch the AI complete the game for 15x15 board size - Set
USE_GAME_CANVAS
to true and updateVIZ_GAME_SCALE
to scale the game if needed.
- I mostly post about my projects on - Twitter - @BonesaiDev
- Video of snake completing the game
- More info on how it works and it's inputs. I'm planning on creating a blog post where I explain stuff in a bit more detail.
- Check out my other projects here - https://bones-ai.bearblog.dev/projects/
- More about me - https://bones-ai.bearblog.dev/