-
Survival Ants is an evolutionary simulation where steering agents disguised as ants eat food and avoid rotten eggs (poison). The concept is based on Steering Behaviors For Autonomous Characters by Craig Reynolds, and its implementation is through genetic algorithms and artificial intelligence.
- Vanilla JavaScript
- HTML5 Canvas and CSS
- P5 JavaScript
- JQuery
- HTTP-SERVER
-
Ants
:Attributes
:- Each ant searches for food
streeing behaviors
using their antennasperception
. - The ant
seeks
the closest food in their food rangeperception
. - The ant has a health level, which they need to maintain in order to survive
- The ant has a
current velocity(vector)
and theiracceleration
(vector), and it's limited by themaximum speed
(number). - The ant has a
desired
velocity:- desired velocity = food location - the ant's location
- The
steering behaviors
determines how they rotate and approach the food, and it's limited by themaximum force
(number):steering
=desired
-current velocity
- Each ant searches for food
- Death:
- The ant will die if they eat rotten eggs
- The ant will die if their health reaches 0
- The ant turns into food for other ants if they die
Clone
:- The ant has its own
DNA
which is the unit that determines theirfood attraction
levels - There is 0.1% chance that the ant will
clone
themselves. Thenew clones
DNA
is slightly different than the original.
- The ant has its own
-
Food
andRotten Eggs
:Food
is randomly generated by a 10% chance of every draw frameRotten eggs
are randomly generated by a 1% chance of every draw frame- The
ants
health levels increase after eating food - The
ants
will die if they hit the poison.
-
User interaction / Mouse functionality
User
has the ability to dropfood
and feed theants
by clicking on thefood
and pressing or dragging on the image.
-
Debug Mode
:- The triangle represents the ant.
- The triangle color represents the ant health between green and red
- green means the ant is healthy
- red means the ant is in low health, and may die soon
- The
green circle
is the ant's food rangeperception
. - The
green line
is the ant's desiredmagnitute
.
-
Auto-Restart:
- The app is automatically restarted if there are no more ants.