With the use of a genetic algorithm 🧬 ants 🐜 will find their way to a lemon 🍋 while avoiding viruses 🦠
Population.Size >> the number of ants per generation
Population.Lifespan >> how long does a generation last
dna >> specifies the moves this ant will make
fitness >> specifies how well this ant performed
We start by creating a world and populate it with ants. Each ant starts with random dna
and can only live a certain amount of time. When the time is over we will evaluate
all the ants in the population and give them a fitness
score. Based on this population we create a new population
through mating
. When creating a new population based on the previous generation
there is also some mutation
that takes place.
The most important part of the application lives in /game/sketch.ts
. It is in charge of creating our population and displaying them on the canvas.
Make sure node is installed on your system. Use package manager yarn to install the application.
yarn install
You can start the development server by running:
yarn dev
There are various libraries and tools used to make this application work.
next.js >> creates the website with React
p5.js >> creates the visualization