Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Learning to play Snake with Genetic Algorithm.

License

Notifications You must be signed in to change notification settings

totorigolo/genetic-snake-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

genetic-snake-rs

Teaching a bot to play Snake, without telling it anything about the rules, using a genetic algorithm.

The bot that the genetic algorithm tries to train is based on heuristic values: at each step it computes a set of values for each move. Then, it computes a weighted sum for each action and executes the one with the highest value.

I choose "good weights" as default values for the HeuristicBot, which serves as a reference. Then, the genetic algorithm tries to learn weights which beat my good weights.

To see/tune the genetic algorithm parameters and methods, go to src/learning.rs.

To see what are the heuristic values and how they are computed, go to src/heuristic_bot.rs.

asciicast

Usage

To run genetic-snake-rs, a recent stable Rust should work.

The easiest way to get Rust is via rustup.

Then, simply run:

cargo run --release

License & Contributing

This repository is licensed under the permissive MIT license, meaning that you can and are encouraged to hack this code!

Any PR is welcomed! 🐍

About

Learning to play Snake with Genetic Algorithm.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages