Skip to content

Neural network learns to play snake in a terminal, built in Rust with Ratatui

License

Notifications You must be signed in to change notification settings

loclv/rust-snake-ai-ratatui

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI learns to play Snake!

A neural network learns to play snakes in the terminal

Built with Rust and Ratatui

Check out this for an older version of the AI that uses macroquad for GUI

screenshot

Usage

  • 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

Configurations

  • 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 in data/net.json, once saved you can use the trained network by setting IS_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 update VIZ_GAME_SCALE to scale the game if needed.

Others

About

Neural network learns to play snake in a terminal, built in Rust with Ratatui

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%