/LuckyDucks

A genetic algorithm simulation using Unity

Primary LanguageShaderLab

LuckyDucks

A genetic algorithm simulation using Unity.

This is a simple and small simulation of genetic algorithms. There are ducks that are spawned in the scene, which have to figure out a way to reach the target, which is the bread. While doing so, it also has to avoid obstacles along the way (the black circles). A number of generations will be simulated, and we can see how the ducks evolve to go to the target in certain number of generations. Increase the lifespan of the entire simulation using the slider at the bottom of the screen, and restarting by pressing the button - "Restart". The number of total ducks will be 200, which can be changed in the code - Controller.cs file. Other parameters are self-explanatory, and the code is sufficiently commented to get through various genetic algorithm phases.

It is also uploaded on itch.io - https://keerthan657.itch.io/lucky-ducks, go check it out. It might be slow because its running on some global off-location server. To run it quickly, I recommend you downloading this repository and run it on unity itself (webGL).

Credits to: Coding Train's explanation in this YT video(https://www.youtube.com/watch?v=bGz7mv2vD6g). This Unity project is an attempt to learn how genetic algorithm works.