Bug Hunt Speeds with Bird and Spider Predators

Bug Hunt Speeds with Bird and Spider Predators preview image

1 collaborator

Default-person Vishwanath Varma (Author)


(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.0 • Viewed 216 times • Downloaded 13 times • Run 0 times
Download the 'Bug Hunt Speeds with Bird and Spider Predators' 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 natural/artificial selection model that shows the result of two competing forces on natural selection of the speed of prey. Which force dominates depends on the behavior of predators.

One force is that predators that chase prey, tend to catch slower moving prey more often, thereby selecting for prey that are faster over many generations of offspring.

Another force is that predators who wait for their prey without moving, tend to catch prey that are moving faster more often, thereby selecting for prey that are slower over many generations of offspring.

By also adjusting whether bugs try to avoid the predator and the predictability of their motion, a different one of these competing forces will tend to dominate the selective pressure on the population.


You assume the role of a predator amongst a population of bugs. To begin your pursuit of bugs as a predator, press SETUP to create a population of bugs, determined by six times the INITIAL-BUGS-EACH-SPEED slider. These bugs that are created are randomly distributed around the world and assigned a speed.

When you press GO the bugs begin to move at their designated speeds. As they move around, try to eat as many bugs as fast as you can by clicking on them. Alternatively, you may hold the mouse button down and move the predator over the bugs.

The six different speeds that a bug might move at are distributed amongst six different sub-populations of the bugs. These speeds are inherited. With each bug you eat, a new bug is randomly chosen from the population to produce one offspring. The offspring is an exact duplicate of the parent (in its speed and location). The creation of new offspring keeps the overall population of the bugs constant.

Initially there are equal numbers of each sub-population of bug (e.g. ten bugs at each of the 6 speeds). Over time, however, as you eat bugs, the distribution of the bugs will change as shown in the "Number of bugs" histogram. In the histogram, you might see the distribution shift to the left (showing that more slow bugs are surviving) or to the right (showing that more fast bugs are surviving). Sometimes one sub-population of a single speed of bug will be exterminated. At this point, no other bugs of this speed can be created in the population.


INITIAL-BUGS-EACH-SPEED is the number of bugs you start with in each of the six sub-populations. The overall population of bugs is determined by multiplying this value by 6.

SHOW-COLORS? helps you apply or remove color visualization based on the speed of the bugs. When turned on, it shows 6 distinct colors for the 6 different speeds a bug might have. These color settings correspond to the plot pen colors in the graphs. When turned off, each bug is colored gray. This prevents the predator (the model player) from unintentionally selecting bugs based on color.

NUMBER OF BUGS is a histogram showing the distribution of bugs at different speeds.

BUGS CAUGHT is a histogram showing the historical record of the distribution of bugs caught at different speeds.

WIGGLE?, when set to "on" adds a small amount of random twist in the motion of the bugs as they move forward each time step.

FLEE?, when set to "on" has bugs turn around (to face in the opposite direction) when they detect your mouse click (as a predator) in their detection cone (an arc of 120 degrees that has a range of 2 units). Bugs can detect the predator only in this arc in front of them, and so will not react when caught from behind.


The CURRENT BUGS histogram tends to shift right (increasing average speed) if you assume the role of chasing easy prey.

The CURRENT BUGS histogram tends to shift left (decreasing average speed) if you assume the role of waiting for prey come to you. The same effect can also be achieved by moving the predator around the world randomly.


Set the model up with INITIAL-BUGS-EACH-SPEED set to 1. Slow the model down and watch where new bugs come from when you eat a bug. You should see a new bug hatch from one of the five remaining and it should be moving at the same speed as its parent.

Wait in one location for the bugs to come to you by placing the predator in one location and holding down the mouse button. All bugs that run into you will be eaten.

Chase bugs around trying to catch the bug nearest you at any one time by holding the mouse button down and moving the predator around the view after the nearest bug.


A HubNet version of the model with adjustable starting populations of bugs would help show what happens when two or more competitors assume similar vs. different hunting strategies on the same population at the same time.


Bug Hunt Camouflage


Inspired by EvoDots software: https://faculty.washington.edu/herronjc/SoftwareFolder/EvoDots.html


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 2005 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

Comments and Questions

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

Click to Run Model

breed [ predators predator ]

breed [ bugs bug ]

bugs-own [
  speed             ;; either 1, 2, 3, 4, 5, or 6

predators-own [

globals [
  catches-by-speed  ;; a list of total bugs caught, where the list index is the speed minus one

to setup
  set-default-shape bugs "bug"

  ask patches [ set pcolor white ]   ;; white background
  set catches-by-speed n-values 6 [ 0 ]
  foreach [ 1 2 3 4 5 6 ] [ the-speed ->
    create-bugs initial-bugs-each-speed [ set speed the-speed ]
  ask bugs [
    setxy random-xcor random-ycor
  ;; the predator breed contains one turtle that is used to represent
  ;; a predator of the bugs (a bird)
  create-predators 5 [
    ifelse predator-type = "Bird" [
      set shape "bird"
      [ set shape "spider"
    setxy random-xcor random-ycor
    set color black
    set size 2

to go
  ;; use EVERY to limit the overall speed of the model

    if predator-type = "Bird" [
    ask predators [ move-predator ] ]
    ;; recolor the bugs in case the user changed SPEED-COLOR-MAP
    ask bugs [

    ;; advance the clock without plotting

    ;; plotting takes time, so only plot every 10 ticks
    if ticks mod 10 = 0 [ update-plots ]

to move-bug
  let candidate-predator nobody
  let target-heading 0

  if wiggle? [ right (random-float 45 - random-float 45) ]
  fd speed * 0.06

  ifelse predator-type = "Bird" [
    let predators-in-view predators in-cone 2 120
    ifelse any? predators-in-view [
      set candidate-predator one-of predators-in-view
      set target-heading 180 + towards candidate-predator
      set heading target-heading
      set label "!"
    [ set label "" ]
  [ set label "" ]

to move-predator
  rt random 20
  lt random 20
  set heading towards nearest-bug
  fd 0.12

to find-nearest-bug
  set nearest-bug min-one-of bugs [distance myself]

to check-caught
  let prey [ bugs in-radius (size / 2) ] of one-of predators
  ;; no prey here? oh well
  if not any? prey [ stop ]
  ;; eat only one of the bugs at the mouse location
  ask one-of prey [
    let n item (speed - 1) catches-by-speed
    set catches-by-speed replace-item (speed - 1) catches-by-speed (n + 1)
  ;; replace the eaten bug with a random offspring from the remaining population
  ask one-of bugs [ hatch 1 [ rt random 360 ] ]

to-report colors-by-speed
  ;; report a list of bug colors by speed
  report [ violet blue green brown orange red ]

to set-color  ;; turtle procedure
  set color item (speed - 1) colors-by-speed

; Copyright 2005 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created over 4 years ago by Vishwanath Varma.

Attached files

File Type Description Last updated
Bug Hunt Speeds with Bird and Spider Predators.png preview Preview for 'Bug Hunt Speeds with Bird and Spider Predators' over 4 years ago, by Vishwanath Varma Download

This model does not have any ancestors.

This model does not have any descendants.