AI Ants

Just BASIC Games
Post Reply
NJames
Posts: 43
Joined: Tue Jul 14, 2009 2:55 pm

AI Ants

Post by NJames »

Artificial Intelligence Ant Colony

This version has ants that move simultaneously. If two or more ants attempt to move to same square, none will move.

The ants see only the themselves and the eight squares around them. Each ant has a behavior that may change and a memory that indicates the location of the colony.

Behaviors:
new ant - remember nest location, choose random direction to search
searching - pickup food if found and head for nest, otherwise keep searching
return to nest - take direct route to nest
panic - (if running out of food) return to nest but stop and get food from nearby ants

I avoid permanent traffic jams by making the ants move randomly every once in a while.

The cells that have been traveled are colored. No pheromones are used.
Attachments
antsRememberHome.zip
(2.65 KiB) Downloaded 455 times
Last edited by NJames on Sat Mar 10, 2012 5:35 pm, edited 1 time in total.
NJames
Posts: 43
Joined: Tue Jul 14, 2009 2:55 pm

Re: AI Ants

Post by NJames »

This version does not use simultaneous movement. Each ant is asked in turn, where he wants to go. This seems to cause MORE traffic jams!

These ants still only see the area around them, but they do not remember the nest location. Instead, they leave pheromone trails.

Click on the map to cycle view through "nest trail", "food trail" and "no trail"

Behaviors:
find unexplored area
get food
go to nest
Attachments
ants with phero1.zip
(3.42 KiB) Downloaded 375 times
Post Reply