Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.
/ evolution Public archive

2D genetic algorithm simulation written in Rust

License

Notifications You must be signed in to change notification settings

aubaugh/evolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evolution

Copyright (c) 2019 Austin Baugh

Evolution is a 2D simulation based on Daniel Shiffman's coding challenge of implementing Evolutionary Steering Behaviors.

  • This simulation is written in the Rust programming language, and uses the ggez crate.
  • This simulation consists of fish who improve their survival behaviors through the use of a genetic algorithm.
    • The fish should be inclined to be attracted to food/prey and repelled by predators
    • The fish should also develop perception radii for prey and predators respectively that works mostly optimally.
  • The fish reproduce asexually by cloning themselves, with the possibility of their gene's mutating (mutation rate).
  • The speed of the fish is inversely proportional to their size.
    • Therefore larger fish will be slower, while smaller fish will be faster.
  • Since there are predators in this simulation, their are different groups of fish, depending on their link in the food chain.
    • Different fish groups have different ranges of sizes/speeds.
    • E.g. The highest-levelled group in the food chain (the group of predators that can't don't have predators) will have the largest size options and smallest speed options.
    • E.g. The lowest-levelled group in the food chain (the group of fish that isn't predators) will have the smallest size options and largest speed options.

Build and Run

This program requires cargo, which can be installed here. I advise using the --release argument when building or running to achieve a higher FPS.

  • Build: cargo build --release
  • Run: cargo run --release

Features

  • Animate fish in a throughful way
  • Add seek behavior to fish
  • Add a declining health attribute to fish
  • Add food entities
    • Have fish seek food
    • Have eating food replenish lost health
  • Implement predators
    • Have fish avoid predators
    • Have fish seek prey
    • Have eating prey replenish lost health
  • Incorperate cloning
    • Apply a mutation rate in the cloning function

License

This program is licensed under the MIT License

Additional References

About

2D genetic algorithm simulation written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages