Child of Simple Birth Rates

No preview image

1 collaborator

Default-person Matjaž Jeruc (Author)

Tags

(This model has yet to be categorized with any tags)
Child of model Simple Birth Rates preview imageSimple Birth Rates
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.5 • Viewed 485 times • Downloaded 32 times • Run 0 times
Download the 'Child of Simple Birth Rates' 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
[
  red-count            ; populacija rdecih
  blue-count           ; populacija modrih
]

turtles-own
[
  fertility            ; rodnost
  fertility-remainder  ; ostanek (za decimalno piko)
]

to setup
  clear-output
  setup-experiment
end 

to setup-experiment
  cp ct
  clear-all-plots
  reset-ticks
  crt steviloPrebivalstva
  [
    setxy random-xcor random-ycor         ; postavi osebe na nakljucna mesta
    ifelse who < (steviloPrebivalstva / 2)  ; zacni z enakim stevilom rdecih in modrih
      [ set color blue ]
      [ set color red ]
    set size 2                            ; boljsa preglednost
  ]
  reset-ticks
end 

to go
  reproduce
  grim-reaper
  tick
end 

;; omogoci vec ponavljanj

to go-experiment
  go
  if red-count = 0
  [
    output-print (word "Rdeči izumrejo po " ticks " generacijah.")
    setup-experiment
  ]
  if blue-count = 0
  [
    output-print (word "Modri izumrejo po " ticks " generacijah.")
    setup-experiment
  ]
end 

to wander  ;; premikanje zelv
  rt random-float 30 - random-float 30
  fd 1
end 

to reproduce
  ask turtles
  [
    ifelse color = red
    [
      set fertility floor rdeci-rodnost
      set fertility-remainder rdeci-rodnost - (floor rdeci-rodnost)
    ]
    [
      set fertility floor modri-rodnost
      set fertility-remainder modri-rodnost - (floor modri-rodnost)
    ]
    ifelse (random-float 100) < (100 * fertility-remainder)
      [ hatch fertility + 1 [ wander ]]
      [ hatch fertility     [ wander ]]
  ]
end 

;; unici visek oseb
;; rdeci in modri imajo enak odstotek smrtnosti

to grim-reaper
  let num-turtles count turtles
  if num-turtles <= steviloPrebivalstva
    [ stop ]
  let chance-to-die (num-turtles - steviloPrebivalstva) / num-turtles
  ask turtles
  [
    if random-float 1.0 < chance-to-die
      [ die ]
  ]
end 


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

There is only one version of this model, created over 10 years ago by Matjaž Jeruc.

Attached files

No files

Parent: Simple Birth Rates

This model does not have any descendants.

Graph of models related to 'Child of Simple Birth Rates'