A Go-based ant colony simulation that demonstrates emergent behavior and swarm intelligence through various scenarios. The simulation showcases how simple rules followed by individual ants can lead to complex, colony-level behaviors. This is a fun project to practice Golang and experiment with Raylib bindings.
Results
- Multiple simulation scenarios:
home
: Basic home navigation scenariowandering
: Ants wandering behavior demonstrationfood
: Food foraging simulationpheromone
: Pheromone-based path findingone_nest
: Single nest colony simulationtwo_nests
: Two competing coloniesfour_nests
: Four colony interactionsurrounding
: Environmental interaction scenario
Examples
https://github.com/user-attachments/assets/74aef395-ea84-4dee-a297-f2055b4a29a7
https://github.com/user-attachments/assets/00ada0db-f23e-486d-8008-5a3420412990
https://github.com/user-attachments/assets/d97918a6-d355-412b-a8e5-57fd11360636
Prerequisites
- Go 1.20 or higher
- raylib-go - Golang bindings for raylib, see how to properly install it depending on your os here
Try it locally
- Clone the repository:
git clone https://github.com/firasjaber/ant-sim.git
cd ant-sim
- Install dependencies:
go mod download
- Run a simulation scenario:
go run main.go [scenario_name]
For example:
go run main.go four_nests
Simulation Scenarios
home
: Demonstrates ants returning to their nestwandering
: Shows random exploration behaviorfood
: Simulates food foraging with pheromone trailspheromone
: Focuses on pheromone-based communicationone_nest
: Single colony behaviortwo_nests
: Competition between two coloniesfour_nests
: Complex interactions between four coloniessurrounding
: Environmental factors affecting ant behavior