Tuskless elephants

Tuskless elephants preview image

1 collaborator

Default-person Humble Ai (Author)

Tags

biology 

Tagged by Humble Ai about 8 years ago

population dynamics 

Tagged by Humble Ai about 8 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.3.1 • Viewed 692 times • Downloaded 34 times • Run 0 times
Download the 'Tuskless elephants' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

globals [ max-age circle-size]

turtles-own [ age gender tusk? ]

to setup
  ca

  set max-age 60 ;; agents can live up to max-age
  set circle-size 10 ;; bigger means smaller circles
  ask patches [ set pcolor brown + 4.9 ]

  crt total-population [


    ;; some initial values for every agent.

    set gender "male"
    set color red
    set shape "circle"
    set xcor random-xcor set ycor random-ycor
    set tusk? true
    set age random max-age
    set size age / circle-size ;; circle size grows with age.


    ;; initial gender distribution is 50%.
    ;; So we make half of the agents female.
    ;; Some of females are tuskless.

    if random 2 = 1
      [
        set gender "female"
        set color green
        if random 100 < ( initial-tusklessness * 2 ) [
          set tusk? false
          set color blue
        ]  ;; only females can be tuskless
      ]
  ]


  ;; check if we have any tuskless elephants

  if count turtles with [ tusk? = false ] < 1 and initial-tusklessness > 0
    [ setup ]

  reset-ticks
end 

to go
  ask turtles [
    ;; give birth in every 6 years after certain age
    if count turtles < max-allowed-population and gender = "female" and age > female-maturation-age and age mod 6 = 0 [

      ;; some default values
      let offspring-gender "male"
      let offspring-color red
      let offspring-tusk true

        if random 2 = 1      ;; initial gender distribution is 50%
          [
            set offspring-gender "female"
            set offspring-color green

            ;; if mother is tuskless, child's chance of being tuskless is 50%.
            ;; because father is tusky.

            if tusk? = false and random 2 = 1 [
              set offspring-tusk false
              set offspring-color blue
            ]
          ]

      ;; hello world
      hatch 1 [
        set age 1
        set xcor random-xcor set ycor random-ycor
        set tusk? offspring-tusk
        set gender offspring-gender
        set color offspring-color
        ] ;; /hatch
    ] ;; / if
  ] ;; / give birth


  ;; increase age and adjust size accordingly
  ask turtles [
    set age age + 1
    set size age / circle-size
  ]


  ;; grown ones will be hunted for tusks

  ask turtles [
    if tusk? and age >= tusk-maturation-age and ( random 100 <= kill-rate ) [ die ]
  ]


  ;; die naturally from old age

  ask turtles [
    if age > max-age [ die ]
  ]

  tick


  ;; stop execution. extinction case.
  if count turtles with [ gender = "male" ] = 0 or count turtles with [ gender = "female" ] = 0 [ stop ]
end 




;; Reset to initial values

to reset-to-defaults
  set initial-tusklessness 2
  set total-population 500
  set kill-rate 15
  set female-maturation-age 16
  set tusk-maturation-age 18
  set max-allowed-population 1000
end 




;; for plotting. checks against errors such as division by zero.

to-report mean-age-tusky
  ifelse count turtles with [ tusk? ] > 0 [
    report mean [ age ] of turtles with [ tusk? ]
  ]
  [ report 0 ]
end 

to-report mean-age-tuskless
  ifelse count turtles with [ tusk? = false ] > 0 [
    report mean [ age ] of turtles with [ tusk? = false ]
  ]
  [ report 0 ]
end 

to-report mean-age-females
  ifelse count turtles with [ gender = "female" ] > 0 [
    report mean [ age ] of turtles with [ gender = "female" ]
  ]
  [ report 0 ]
end 

to-report mean-age-males
  ifelse count turtles with [ gender = "male" ] > 0 [
    report mean [ age ] of turtles with [ gender = "male" ]
  ]
  [ report 0 ]
end 

to-report tusklessness-ratio
  ifelse count turtles with [ tusk? = false ] > 0 [
    report count turtles with [ tusk? = false ] / count turtles * 100
  ]
  [ report 0 ]
end 

to-report tusklessness-ratio-female-only
  ifelse count turtles with [ tusk? = false ] > 0 [
    report count turtles with [ tusk? = false ] / count turtles with [ gender = "female" ] * 100
  ]
  [ report 0 ]
end 

to-report count-tuskless
  ifelse count turtles with [ tusk? = false ] > 0 [
    report count turtles with [ tusk? = false ]
  ]
  [ report 0 ]
end 

to-report count-females
  ifelse count turtles with [ gender = "female" ] > 0 [
    report count turtles with [ gender = "female" ]
  ]
  [ report 0 ]
end 

to-report count-males
  ifelse count turtles with [ gender = "male" ] > 0 [
    report count turtles with [ gender = "male" ]
  ]
  [ report 0 ]
end 

There are 2 versions of this model.

Uploaded by When Description Download
Humble Ai about 8 years ago plot name changed Download this version
Humble Ai about 8 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Tuskless elephants.png preview Preview for 'Tuskless elephants' about 8 years ago, by Humble Ai Download

This model does not have any ancestors.

This model does not have any descendants.