Peacock Mating

No preview image

1 collaborator

Default-person Kristyn McCullom (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 4.1.2 • Viewed 516 times • Downloaded 26 times • Run 2 times
Download the 'Peacock Mating' 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 section could give a general understanding of what the model is trying to show or explain.

HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.

HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.

THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.

THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.

EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.

NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.

RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.

CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.

Comments and Questions

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

Click to Run Model

extensions [gogo]

globals [
  serial-port   ;; different on different operating systems
]
breed [peacocks peacock]  
breed [peahens peahen]
turtles-own [point]

to setupgogo
  set serial-port user-one-of "Select a port:" gogo:ports
  gogo:open serial-port
  ;gogo:open "/dev/tty.KeySerial1"
end     

to setup
  clear-all
  set-default-shape peacocks "bird"
  create-peacocks initial-number-peacocks  ;; create the peacocks, then initialize their variables
  [set point random 100
  set size 1.5
  setxy random-xcor random-ycor
  ]
  ask peacocks
  [ ifelse point > mean [point] of peacocks
      [ set color yellow ]
      [ set color blue ] ] 
  
   set-default-shape peahens "bird"
   create-peahens initial-number-peahens   ;; create the peahens, then initialize their variables
    [set point random 100
    set size 1.5
    setxy random-xcor random-ycor
  ]
  ask peahens
  [ ifelse point > mean [point] of peahens
      [ set color brown ]
      [ set color gray ] ] 
end 
  
;; temperature sensor: 0-341 (stop mating if temp. too high), 342-682 (appropriate temp. for mating), 683-1023 (stop mating if temp. too low)

to go
  if not any? turtles [ stop ]
  ifelse (gogo:sensor 1 > 342) and (gogo:sensor 1 < 682)
  [ ask peacocks [
    move
    eat
    strong-mate
    weak-mate
    death]
  ask peahens [
  move
  eat
  death]
  ]
  [ ask peacocks [
    move
    eat
    death]
  ask peahens [
  move
  eat
  death]
  ]
  update-plots
  tick
end 

to death
   if point <= 0 [die] 
end 

to eat
   set point point + gain-from-food
end 

to move
      rt random 50
      lt random 50
      fd point
      set point point - 0.5
end 

to strong-mate
  if point > mean [point] of peacocks 
  [let partner1 one-of peahens-on neighbors
    if partner1 != nobody
    [ask partner1 [reproduce1]]]
end 

to reproduce1
  hatch 1
  [set point point + 2
    ifelse point > mean [point] of turtles 
      [ set color one-of [yellow brown]]
      [ set color one-of [blue gray]] ]
end 

to weak-mate
    if point <= mean [point] of peacocks 
  [let partner2 one-of peahens-on neighbors4
    if partner2 != nobody
    [ask partner2 [reproduce2]]]
end 

to reproduce2
  hatch 1
  [set point point - 2
    ifelse point > mean [point] of turtles 
      [ set color one-of [yellow brown]]
      [ set color one-of [blue gray]] ]
end 

to update-plots
  set-current-plot "Peacock Reproduction"
  set-current-plot-pen "Peacock-Strong"
  plot count turtles with [color = yellow] 
  set-current-plot-pen "Peacock-Weak"
  plot count turtles with [color = blue]
  set-current-plot-pen "Peahen-Strong"
  plot count turtles with [color = brown] 
  set-current-plot-pen "Peahen-Weak"
  plot count turtles with [color = gray]
end 



There is only one version of this model, created about 13 years ago by Kristyn McCullom.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.