Skip to content

The-Silent-One/Bouncing_ants

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Bouncing ants

It is a python app sort of game, that simulates a fundamental algorithm for ants. It uses the graphics.py module.

The algorithm consists of :

  • There are 4 jobs that each ant can perform and be, a soldier, a farmer (husbandry , they actually train certain types of insects for juices), a caretaker (taking care of the queen and eggs) and a forager (a scout for food away from the colony).
  • each start of the day (which is the start of the game in here) every ant picks randomly a job and assumes it.
  • each ant moves in a random direction and check it neighbours. It keeps a count on all of the jobs of the ants that it encountered (they do this with its antennas).
  • after a set of time (or steps in here) they evalute their counter and decide which job is needed most and assumes that role.

The realisation of this algorithm is made with this code with extra for human comprehension. There is a global count that keeps a record of jobs after each swap. Each ant looks for the min of all the jobs and assumes that role (not accurate in real situation but close enough). Each job is represented by a color. Each ant is represented by a circle filled with the color of its job.

  • nb_ants number of ants present in a colony.
  • mv fixed number of mvts each ant does ie hte length of the simultaion.
  • x and y size of the screen.
  • swap_t an interval of steps at which each ant swap its role.
  • speed speed multipilier of the simultaion.
  • space_x fixed length of each mvt.
  • j a list representing the name of the jobs.
  • job_colors a dictionary representing each job and its associated color.

future release:

  • excpetion handling.
  • revise code.
  • a gui for hte parameters.
  • checking if there are any overflows.
  • adding gifs to the documentation.

About

An Ant Behavior Simulator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages