Skip to content
HHackerTube.videoSurprise me

ants simulation

ants simulation on HackerTube: recommended by 1 Hacker News commenter across 1 month, 2014–2022.

Hugh Lomas

demo · evergreen

Open on YouTube

A one-minute visualization of a simulated ant colony in which ants follow pheromone trails, with the source code on GitHub. It shows emergent behavior arising from simple rules.

Why Hacker News recommends it

Linked in ant-simulation threads as a compact, open-source example of emergent behavior.

people recommended it
1
separate months
1
strong recommendations
0
discussed on HN
2014–2022
“Take a look at this visualization”
— newman8r, Dec 2018, in “Ant Colonies Retain Memories That Outlast the Lifespans of Individuals”

What HN commenters said

3 Hacker News comments link this video. Each one links back to its thread.

newman8rDec 2018Recommends

Take a look at this visualization ▶ this video There's a repo in the description. Might not be specifically relevant to your project though

in “Ant Colonies Retain Memories That Outlast the Lifespans of Individuals” · View on HN

hughrlomasJul 2022Cites it

This is great to see. Years ago I created a basic simulation using the same principles of pheromone gradients, one for the nest and one for food. ▶ this video It a fascinating example of emergent behavior from simple rules. I've been wanting to find time to revisit the concept and produce an updated version, your simulation seems to include everything I wanted to do and more.

in “Show HN: Ants Sandbox - an ants simulator” · View on HN

hughlomasOct 2014Cites it

I loved reading this because I made something exceedingly similar a few years ago, and I'm similarly fascinated with how complex behavior can emerge from such simple rules. ▶ this video My ants also had no conception of where their home was located, their behavior is entirely pheromone driven. They can "read" pheromones from any adjacent cell. They leave a pheromone every movement depending on which state they are in, either "find food" or "return food". In my system, the pheromones have a strength. Whenever an ant touches the nest, his "nest pheromone" is at full strength (255). Each movement decreases the strength by 1. This sets up a natural gradient of nest strength for ants to follow. They also "deteriorate" each round as yours do. A similar setup is used with food, such that a high food scent is created when they pick up food, and decreases in strength as they return to the nest. So to find food, they try to move up a food gradient or down the nest gradient (away from the nest), while to return food they move up the nest gradient (towards the nest). Their searching consists of a random walking into cells that have no nest scent, or following a food trail. They have an energy cost for moving, and if it's too low they have to eat a piece of food. Returning a piece of food to the hill spawns a new ant. The lines on the right side show the population of each colony and the total food on the board. From these extremely basic rules, they are very efficient at clearing the "world"

in “Simulating the emergent behavior of ant colonies” · View on HN

Topics & tags

Creative coding & generative artComputer graphics & renderingantspheromonesemergent behaviorcellular automatonsimulation