Less Basic Ant

No preview image

1 collaborator

Brewer-2011-gr Steven Brewer (Author)



Tagged by Steven Brewer almost 8 years ago

Child of model Basic Ant preview imageBasic Ant
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.1.0 • Viewed 304 times • Downloaded 15 times • Run 0 times
Download the 'Less Basic Ant' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This is an agent-based model of an ant trapped in a dish. An ant moves around the environment, changing direction when it encounters the boundary of the dish.

This is a child model of Basic Ant which has an elaborated model for turning at bariers, as shown in Hunt et al (2014) with a 35/19 preference for turning left.


I borrowed some code from the Circular Path Example (to draw the patches that represent the dish), adapted it a bit, and wrote a little code of my own.

A function called "setup" clears everything away, creates a ring of patches where the ant can't go, and then creates an ant.

There is just one function called "go". The "step" button calls this function once. The "go" button, calls it forever.

In the function, the turtle moves forward one step, checks to see if it's over a patch it can't go over. If it is, it backs up and turns right 20 degrees.


How is this model similar or dissimilar to an actual ant? How could you tell?

Can you improve the behavior of the existing model to make it more realistic?

What are some additional behaviors that could be programmed into the model?

Can you extend the model to account for additional behaviors?


Hunt ER, O'Shea-Wheller T, Albery GF, Bridger TH, Gumn M, Franks NR. Ants show a leftward turning bias when exploring unknown nest sites. Biology Letters [Internet]. 2014 ;102367228182062712322174247965272144312(124421541161115642):20140945 - 20140945. Available from: http://rsbl.royalsocietypublishing.org/cgi/doi/10.1098/rsbl.2014.0945

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [radius]

to setup
  set radius max-pxcor - 2
  ;; make a turtle to draw our boundary
  create-turtles 1 [
    ;; move to edge of circle
    fd radius
    ;; turn to face clockwise
    rt 90
    ;; go along the arc and make the patches blue
    repeat 360 [arc-forward-by-angle 1 set pcolor 84]
  ;; make a turtle to be our ant
  create-turtles 1 [
    set color red
    set size 3
    set shape "bug"

to go
  ask turtles [
    ;; go forward
    fd 1
    ;; check to see if we moved into the barrier
    if pcolor = 84 [
      ;; whoops! backup and turn
      bk 1
      ifelse random 54 > 35 [lt 20] [rt 20]

;; This is the procedure I borrowed.  It moves the turtle to the next point
;; on the circle, the given distance along the curve.

to arc-forward-by-angle [angle]
  ;; turn to face the next point we're going to
  rt angle / 2
  ;; calculate the distance we'll have to move forward
  ;; in order to stay on the circle. Go there.
  fd 2 * radius * sin (angle / 2)
  ;; turn to face tangent to the circle
  rt angle / 2

There is only one version of this model, created almost 8 years ago by Steven Brewer.

Attached files

No files

Parent: Basic Ant

This model does not have any descendants.

Graph of models related to 'Less Basic Ant'