Termites 3D

Termites 3D preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)



Tagged by Reuven M. Lerner over 10 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 3D 4.1pre7 • Viewed 474 times • Downloaded 34 times • Run 0 times
Download the 'Termites 3D' 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 a 3D version of the Termites model. This project is inspired by the behavior of termites gathering wood chips into piles. The termites follow a set of simple rules. Each termite starts wandering randomly. If it bumps into a wood chip, it picks the chip up, and continues to wander randomly. When it bumps into another wood chip, it finds a nearby empty space and puts its wood chip down. With these simple rules, the wood chips eventually end up in a single pile.


Click the SETUP button to set up the termites (white) and wood chips (yellow). Click the GO button to start the simulation. The termites turn orange when they are carrying a wood chip.

The NUMBER slider controls the number of termites. (Note: Changes in the NUMBER slider do not take effect until the next setup.) The DENSITY slider controls the initial density of wood chips.


As piles of wood chips begin to form, the piles are not "protected" in any way. That is, termites sometimes take chips away from existing piles. That strategy might seem counter-productive. But if the piles were "protected", you would end up with lots of little piles, not one big one.

The final piles are roughly round. Why is this? What other physical situations also produce round things?

In general, the number of piles decreases with time. Why? Some piles disappear, when termites carry away all of the chips. And there is no way to start a new pile from scratch, since termites always put their wood chips near other wood chips. So the number of piles must decrease over time. (The only way a "new" pile starts is when an existing pile splits into two.)

This project is a good example of a DECENTRALIZED strategy. There is no termite in charge, and no special pre-designated site for the piles. Each termite follows a set of simple rules, but the colony as a whole accomplishes a rather sophisticated task.


Do the results change if you use just a single termite? What if you use several thousand termites?

When there are just two piles left, which of them is most likely to "win" as the single, final pile? How often does the larger of the two piles win? If one pile has only a single wood chip, and the other pile has the rest of the wood chips, what are the chances that the first pile will win?


Can you extend the model to have the termites sort several colors of wood?

Plot the number of piles, or their average size, or the number of termites carrying wood chips, as the model runs.


Notice that the wood chips do not exist as objects. They are just represented as colors in the patches. The termites update the patch colors as they pick up and put down the wood chips. In effect, the patches are being used as the data structure. This strategy is useful in many NetLogo programs.

Note than when you stop the GO forever button, the termites keep moving for a little while. This is because they are each finishing the commands in the GO procedure. To do this, they must finish their current cycle of finding a chip, finding a pile, and then finding an empty spot near the pile. In most models, the GO function only moves the model forward one step, but in this model, the GO function is written to advance the turtles through a full cycle of activity. See the "Buttons" section of the Programming Guide in the User Manual for more information on turtle forever buttons.


Shepherds, Painted Desert Challenge


If you mention this model in an academic publication, we ask that you include these citations for the model itself and for the NetLogo software:

- Wilensky, U. (2002). NetLogo Termites 3D model. http://ccl.northwestern.edu/netlogo/models/Termites3D. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use:

- Copyright 2002 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/Termites3D for terms of use.


Copyright 2002 Uri Wilensky. All rights reserved.

Permission to use, modify or redistribute this model is hereby granted, provided that both of the following requirements are followed:

a) this copyright notice is included.

b) this model will not be redistributed for profit without permission from Uri Wilensky. Contact Uri Wilensky for appropriate licenses for redistribution for profit.

This is a 3D version of the 2D model Termites.

This model was created as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227.

Comments and Questions

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

Click to Run Model

turtles-own [task steps]

to setup
  ask patches [   ;;randomly distributes wood chips
    if random-float 100 < density
      [ set pcolor yellow ]
  crt number  [   ;;randomly distributes termites
    set color white
    setxyz random-xcor
    tilt-up random 360
    right random 360
    set task 0
    set steps 0
  ask turtle 0
    [ set size 2 ]

to go
  ask turtles
    [ wiggle
      ifelse steps > 0
        [ set steps steps - 1 ]
        [ do-task ] ]

to wiggle  ;; turtle procedure
  fd 1
  right random 20
  left random 20
  tilt-up random 20
  tilt-down random 20

to do-task  ;; turtle procedure
  ifelse task = 0
    [ search-for-chip ]
  [ ifelse task = 1
    [ find-new-pile ]
  [ ifelse task = 2
    [ put-down-chip ]
    ;; task = 3
    [ get-away ] ] ]

to search-for-chip   ;; turtle procedure -- "picks up chip" by turning orange
  if pcolor = yellow
    [ set pcolor black
      set color orange
      set steps 20
      set task 1 ]

to find-new-pile  ;; turtle procedure -- look for yellow patches
  if pcolor = yellow
    [ set task 2 ]

to put-down-chip  ;; turtle procedure -- finds empty spot & drops chip
  if pcolor = black
   [ set pcolor yellow
     set color white
     set steps 20
     set task 3 ]

to get-away  ;; turtle procedure -- get out of yellow pile
  if pcolor = black
    [ set task 0 ]

; Copyright 2002 Uri Wilensky. All rights reserved.
; The full copyright notice is in the Information tab.

There are 3 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 13 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 13 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 13 years ago Termites 3D Download this version

Attached files

File Type Description Last updated
Termites 3D.png preview Preview for 'Termites 3D' over 10 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.