Natural Selection Game

Natural Selection Game preview image

1 collaborator

Default-person Michael Zito (Author)

Tags

biology 

Tagged by Michael Zito almost 11 years ago

coevolution 

Tagged by Michael Zito almost 11 years ago

education 

Tagged by Michael Zito almost 11 years ago

evolution 

Tagged by Michael Zito almost 11 years ago

natural selection 

Tagged by Michael Zito almost 11 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.0.5 • Viewed 8581 times • Downloaded 424 times • Run 0 times
Download the 'Natural Selection Game' modelDownload this modelEmbed this model

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


WHAT IS IT?

This simulation models coevolution of a predator-prey system. It is based on the board game SIMULATING NATURAL SELECTION by Robert P. Gendron from Indiana University of Pennsylvania. The model incorporates the following elements of a natural system: Variability, heritability, competition, predation, and differential reproduction. Users can set the intial values for adaptation scores, variability of adaptation scores and population size. Users can also set whether a trait is inherited as a dominant or recessive allele. The simulation produces behaviors that demonstrate directional selection, the coevolution of traits, genetic drift, carrying capacity and predator-prey population cycles.

HOW IT WORKS

The two populations in the model are hawks and mice. Hawks have a vision score and mice have a camouflage score. Populations are intialized with user specified number, mean score and score variation. Individual mice and hawks are assigned a random genotype and phenotype on setup. Each population is then randomly distributed in the world.

Each tick in the model represents a discrete set of events that occur in the following order:

  1. PREDATION: If a hawk and mouse are on the same patch and the hawk's vision score is greater than the mouse's camouflage score then the hawk eats the mouse, reproduces and dies (See 2 below). If there is a tie in the scores a coin flip determines if the mouse is eaten or survives. If there are many mice on a patch, the mouse with the minimum camouflage score is eaten.
  2. HAWK REPRODUCTION: Each hawk that successfully eats produces two offspring as follows: > If hawks-coevolve? is ON: Hawk vision is affected by mouse camouflage. Each hawk reproduces with another random hawk. Each child's genotype is determined by their parents' genotypes based on simple Mendelian probabilites. Hawk vision scores (phenotypes) are determined from their genotypes as described below: If vision-dominant? is ON: Homozygous dominant and hetrozygous children are assigned a vision score equal to the parent score plus a random value which is calculated as a function of the initial variation in the vision scores. Homozygous recessive children are assigned a vision score equal to the parent score minus the random value calculated as described above. If vision-dominant? is OFF: Homozygous recessive children are assigned a vision score equal to the parent score plus a random value which is calculated as a function of the intial variation in the vision scores. Homozygous dominant and hetrozygous children children are assigned a vision score equal to the parent score minus the random value calculated as described above. > If hawks-coevolve? is OFF: Hawk vision is not affected by mouse camouflage. Each hawk reproduces with another random hawk. Each child's genotype is determined by their parents' genotypes based on simple Mendelian probabilites. Both children are assigned vision scores (phenotypes) drawn randomly from the normal distribution defined by the init-mean-vision and init-SD-vision sliders. >Both Conditions: Each new hawk is assigned an age equal to the tick count when it is hatched.
    The parent hawk dies immediately after reproducing. If there are still mice on the patch where the new hawks are hatched, the newly hatched hawks get a chance to hunt and reproduce until all mice on a given patch with camouflage scores lower than hawk vision scores are eaten.
  3. HAWK STARVATION:
    If a hawk does not eat within 2 ticks of being hatched it dies.
  4. MOUSE REPRODUCTION: Mice that survive and are alone on a patch (i.e., no competition for resources from other mice) reproduce two offpring as follows: > If mice-coevolve? is ON: Mouse camouflage is affected by hawk vision. Each mouse reproduces with another random mouse. Each child's genotype is determined by their parents' genotypes based on simple Mendelian probabilites. Mouse caouflage scores (phenotypes) are determined from their genotypes as described below: If camo-dominant? is ON: Homozygous dominant and hetrozygous children are assigned a camouflage score equal to the parent score plus a random value which is calculated as a function of the initial variation in the camouflage scores. Homozygous recessive children are assigned a camouflage score equal to the parent score minus the random value calculated as described above. If camo-dominant? is OFF: Homozygous recessive children are assigned a camouflage score equal to the parent score plus a random value which is calculated as a function of the intial variation in the camouflage scores. Homozygous dominant and hetrozygous children children are assigned a camouflage score equal to the parent score minus the random value calculated as described above. > If mice-coevolve? is OFF: Mouse camouflage is not affected by hawk vision. Each mouse reproduces with another random mouse. Each child's genotype is determined by their parents' genotypes based on simple Mendelian probabilites. Both children are assigned camouflage scores (phenotypes) drawn randomly from the normal distribution defined by the init-mean-camo and init-SD-camo sliders. >Both Conditions: The parent mouse dies immediately after reproducing.
  5. RANDOM DISTRIBUTION:
    All surviving hawks and mice are randomly redistributed in the world and the the above steps are repeated.

HOW TO USE IT

  1. The mice-coevolve? and hawks-coevolve? switches determine if the mouse and hawk populations evlove in response to environmental pressures (On) or randomly (Off)
  2. The vision-dominant? and camo-dominant? switches determine if improvements in each trait are dominant (On) or recessive (Off)
  3. The init-?, init-mean-? and init-SD-? sliders set the initial population size (mice or hawks), the intial mean value of the adpatations (camouflage or vision) and the variation within the population for each adaptation (camouflage or vision), respectively.
  4. The Reset button returns all settings to their default values.
  5. Use the Setup button to initalize the simulation to the values you set using the sliders and switches described above. Press the Run button to run the simulation continuously or use the 5 Gens button to advance the simulation 5 generations at a time.

THINGS TO TRY

Use the model to experiment. Start by making changes to only one setting at a time. Run each experiment several times as the results may differ. Make note of these different outcomes and the frequency with which they occur. For each experiment be sure to explain what you think might be causing the results you observe.

Some suggested experiments are listed below

  1. Run the model using the default settings. Use the 5 Gens button to advance the simulation 5 generations at a time. Try to predict what will happen in the next 5 generations. Press the button again to see if your predictions were accurate.
  2. Set the init-hawks slider to zero.
  3. Set camo, vision or both adapt? switches to off.
  4. Change the mean and variation (SD) values of the mouse camouflage value.
  5. Change the mean and variation (SD) values of the hawk vision value.
  6. Increase or decrease the intial sizes of the mouse, hawk or both populations.
  7. Try to get both populations to survive most of the time when mice-coevolve? is off.
  8. Change the mode of inheritance combinations for vision and camouflage (i.e., both dominant, both recessive, one dominant and the other recessive)

THINGS TO NOTICE

  1. What happens to the vision and camouflage scores under different settings?
  2. How do these scores change relative to one another?
  3. What happens to the vision and camouflage variation under different settings?
  4. How do the populations change relative to one another?
  5. Does either population go extinct? reach a carrying capacity?
  6. Are there any notable trends in the allele frequencies?
  7. Is change allele frequency affected by population size?
  8. Do any alleles become fixed / extinct?
  9. Does recessiveness or dominance affect the rate at which alleles spread through the population and / or become fixed?

EXTENSIONS

Play the board game (see link below) and explore the code to see how it works. Use the difference between patch color and mouse color to determine camouflage scores.

RELATED MODELS

In the NetLogo Library:

  1. Bug Hunt Camouflage
  2. Bug Hunt Coevolution
  3. Bug Hunt Drift
  4. Red Queen
  5. Wolf Sheep Predation
  6. Wolf Sheep Stride Inheritance

CREDITS AND REFERENCES

Dr Robert Gendron's Faculty Page at IUP: http://www.iup.edu/page.aspx?id=85437

A copy of the original board game directions: http://evolution.berkeley.edu/evolibrary/search/lessonsummary.php?source=Gendron,%20Robert&thisaudience=13-16&resource_id=47

COPYRIGHT AND LICENSE

Copyright 2013 Michael Zito.

CC BY-NC-SA 3.0

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

Comments and Questions

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

Click to Run Model

;;;;;;;;;;   Declarations   ;;;;;;;;;;

globals [
  dom                                             ; homozygous dominant (AA)
  rec                                             ; homozygous recessive (aa)
  hetero                                          ; hetrozygous (Aa)
  ]

breed [hawks hawk]
breed [mice mouse]

hawks-own [
  vision 
  age 
  hawk-geno
  ]

mice-own [
  camo 
  mouse-geno
  ]

;;;;;;;;;;   Setup and Go Procedures   ;;;;;;;;;;

to setup  
  ca
  
  set dom 1                                       ; so code is easier to read and
  set hetero 2                                    ; values are used to calculate 
  set rec 3                                       ; ifelse logical tests
    
  ask patches [
    set pcolor 63 + random-float 4                ; its a patchwork world!
    ]
  
  create-hawks init-hawks [
    set shape "hawk" 
    set color 36
    set age 0
    set hawk-geno random 3 + 1                    ; random initial geno & pheno freqs 
    set vision random-normal init-mean-vision init-SD-vision
    ]

  create-mice init-mice [
    set shape "mouse top"
    set size .2
    set color 32
    set mouse-geno random 3 + 1                   ; random initial geno & pheno freqs
    set camo random-normal init-mean-camo init-SD-camo
    ] 
  
  distribute                                      ; randomly place hawks and mice
  
  reset-ticks  
end 

to go
  if ticks = 50 [stop]
  ask hawks [hunt]
  ask hawks [starve]  
  ask mice [reproduce]
  distribute 
  tick
end 

;;;;;;;;;;  Hawk Procedures   ;;;;;;;;;;

to hunt
  if any? mice-here and vision >= min [camo] of mice-here [ ; visible mice here?
    if-else vision > min [camo] of mice-here
      [eat-and-reproduce]                         ; if vision > camo eat and reproduce
      [if random 2 = 0 [eat-and-reproduce]]       ; else vision = camo so flip a coin
    hunt                                          ; recurse to continue eating until all possible mice are eaten
  ]             
end 

to eat-and-reproduce
  ask min-one-of mice-here [camo] [die]           ; eat the mouse
  hatch 2 [                                       ; reproduce with 
    set age ticks                                 ; genotype determined by random mating
    set hawk-geno child-geno [hawk-geno] of self [hawk-geno] of one-of other hawks 
    set vision child-vision                       ; phenotype determined by genotype
    ]
  die                                             ; die after reproducing
end 

to starve
  if (ticks - age >= 2) [die]                     ; if a hawk hasn't eaten in 2 ticks it dies    
end 

;;;;;;;;;;  Mouse Procedures   ;;;;;;;;;;

to reproduce
  if not any? other mice-here [                   ; if there is no competition reproduce with
  hatch 2 [                                       ; genotype determined by random mating
    set mouse-geno child-geno [mouse-geno] of self [mouse-geno] of one-of other mice
    set camo child-camo                           ; phenotype determined by genotype
    ]
    die                                           ; die after reproducing
  ]
end 

;;;;;;;;;;  General Procedures   ;;;;;;;;;;

to distribute                                     ; randomly distribute hawks and mice
  ask mice [setxy random-xcor random-ycor set heading random 359]
  ask hawks [setxy random-xcor random-ycor set heading random 359] 
end 

to reset                                          ; load default values
  set mice-coevolve? true
  set camo-dominant? true
  set init-mice 50
  set init-mean-camo 5
  set init-SD-camo 1.5
  set hawks-coevolve? true
  set vision-dominant? true
  set init-hawks 25  
  set init-mean-vision 5
  set init-SD-vision 1.5
end 

;;;;;;;;;;   Reporters   ;;;;;;;;;; 

to-report child-vision
  ;returns a new vision score based on current vision score, hawk genotype  
  ;and a random factor which is a f(StdDev) of the vision scores
  
  ; set a random change factor as a f(StdDev)
  let x random-float (init-SD-vision + standard-deviation [vision] of hawks) / 2                    
  ;let x 1 
    
  ifelse hawks-coevolve?                          ; if vision is an advantage
    [ifelse vision-dominant?                      ; and                    
      [ifelse hawk-geno < 3                       ; vision is dominant
        [set vision vision + x]                   ; increase score for AA and Aa
        [set vision vision - x]                   ; decrease score for aa
      ]                                           ; else
      [ifelse hawk-geno < 3                       ; vision is recessive so
        [set vision vision - x]                   ; decrease score for AA and Aa
        [set vision vision + x]                   ; increase score for aa
      ]
    ]                                             ; else vision is not an advantage   
    [set vision random-normal init-mean-vision init-SD-vision] ; do random draw      
  if vision < 0 [set vision 0]                    ; keep scores non-negative
  report vision  
end 

to-report child-camo
  ;returns a new camo score based on current camouflage score, mouse genotype 
  ;and a random factor which is a f(StdDev) of the camo scores
  
  ; set a random change factor as a f(StdDev)
  let x random-float (init-SD-camo + standard-deviation [camo] of mice) / 2
  ;let x 1
        
  ifelse mice-coevolve?                           ; if camouflage is an advantage    
    [ifelse camo-dominant?                        ; and
      [ifelse mouse-geno < 3                      ; vision is dominant
        [set camo camo + x]                       ; increase score for AA and Aa 
        [set camo camo - x]                       ; decrease score for aa
      ]                                           ; else
      [ifelse mouse-geno < 3                      ; vision is recessive so
        [set camo camo - x]                       ; decrease score for AA and Aa
        [set camo camo + x]                       ; increase score for aa
      ] 
    ]                                             ; else camouflage is not an advantage                                                
    [set camo random-normal init-mean-camo init-SD-camo]     ; do random draw    
  if camo < 0 [set camo 0]                        ; keep scores non-negative
  report camo    
end 

to-report child-geno [geno1 geno2]
  ; reports a child's genotype given both parents' genotypes
  ; parents are a survivor and a random other turtle of the same breed

  let x  0
  let y 0
  let geno 0
  set x geno1 * geno2                             ; produces an unique ifelse criterion
  ifelse x = 1                                    ; AA x AA
         [set geno dom]   
    [ifelse x = 2                                 ; AA x Aa
         [ifelse random 2 = 0
           [set geno dom]                         ; 0.5 prob AA
           [set geno hetero]                      ; 0.5 prob Aa
           ]
    [ifelse x = 3                                 ; AA x aa
         [set geno hetero]
    [ifelse x = 4                                 ; Aa x Aa 
         [set y random-float 1
           ifelse y < 0.25                        ; 0.25 prob AA
             [set geno dom]
             [ifelse y > 0.75                     ; 0.25 prob aa
               [set geno rec]
             [set geno hetero                     ; else must be Aa
             ]]]
    [ifelse x = 6                                 ; Aa x aa
         [ifelse random 2 = 0
           [set geno rec]                         ; 0.5 prob aa
           [set geno hetero]                      ; 0.5 prob Aa
           ]
    [set geno rec                                 ; aa x aa
    ]]]]]  

  report geno
end   

There are 8 versions of this model.

Uploaded by When Description Download
Michael Zito over 10 years ago Optimized hunt recursion & changed random genetic drift parameters Download this version
Michael Zito almost 11 years ago Small optimization in child procedures Download this version
Michael Zito almost 11 years ago Uses Average of Initial and Actual SD as base of random phenotype flucuation Download this version
Michael Zito almost 11 years ago Modified Histogram X Range Code Download this version
Michael Zito almost 11 years ago changes in phenotype now a f(Initial SD) Download this version
Michael Zito almost 11 years ago Changed initial conditions (Again!) Download this version
Michael Zito almost 11 years ago Changed default initial conditions Download this version
Michael Zito almost 11 years ago Initial upload Download this version

Attached files

File Type Description Last updated
NatSelGameLab.DOC word A Classroom Activity using Natural Selection Game almost 11 years ago, by Michael Zito Download
NatSelGameLab_DataSheet.DOC word Data Sheet for Classroom Activity almost 11 years ago, by Michael Zito Download
Natural Selection Game.png preview Preview for 'Natural Selection Game' almost 11 years ago, by Michael Zito Download

This model does not have any ancestors.

This model does not have any descendants.