Evolution and patchy resources GERMAN

Evolution and patchy resources GERMAN preview image

This model is seeking new collaborators — would you please help?

1 collaborator

Default-person Susan Hanisch (Author)

Tags

evolution 

Tagged by Susan Hanisch almost 3 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 177 times • Downloaded 21 times • Run 0 times
Download the 'Evolution and patchy resources GERMAN' 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

breed [plants plant]
breed [foragers forager]

foragers-own
[eattype
 energy
 mypatch]

patches-own [
  seedpatch?
  seedpatchnum
  foodpatch?
  foodpatchnum
  assortindex
  resource]

globals
[patch-width
 gap
 foodpatchlist
 Wachstumsrate
 Tragfähigkeit
 ;;maxpop
 costchild
]

to setup
  clear-all

  set patch-width Size-Inseln
  set gap Abstand-Inseln
  set Wachstumsrate 0.2
  set Tragfähigkeit 10
  ;;set maxpop 400

  setup-plants
  setup-frgs
  set costchild 10

  reset-ticks
end 

to setup-plants
 foreach [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13]
  [ x  ->
      foreach [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13] [ y  ->
  ask patches with [ pxcor = ( gap / 2 ) + (x * ( gap + (patch-width )))  and pycor =  ( gap / 2 ) + (y * (gap + (patch-width))) ]
  [set seedpatch? true
        sprout-plants 1 [set hidden? true]
        set seedpatchnum [who] of plants-here
   ]
  ]
  ]

  ask patches with [seedpatch? = true]
  [ let localpatch (patch-set self patches in-radius patch-width)
    ask localpatch
     [ set resource Tragfähigkeit

       ;;if resource = 0 [set resource 0.1]
        set pcolor scale-color brown resource 0 (Tragfähigkeit + 10)
        set foodpatch? true
        set foodpatchnum [seedpatchnum] of localpatch with [seedpatch? = true]
    ]
  ]

  set foodpatchlist (  [who] of plants )
end 

to setup-frgs
  ask n-of (Anzahl-Agenten * Prozent-Nachhaltige / 100) patches with [foodpatch? = true]
  [sprout-foragers 1
    [
      set eattype "low"

    set color green
    set mypatch [foodpatchnum] of patch-here ]
  ]

   ask n-of (Anzahl-Agenten * ( 100 - Prozent-Nachhaltige) / 100) patches with [foodpatch? = true]
  [sprout-foragers 1
    [
      set eattype "high"

      set color red
      set mypatch [foodpatchnum] of patch-here
    ]
  ]

  ask foragers [
    if Agenten = "Menschen" [ set shape "person"]
    if Agenten = "Bakterien" [ set shape "bacteria" ]
    if Agenten = "Kühe" [ set shape "cow"]
    if Agenten = "Zellen" [ set shape "cell"]
  set size 2
  set energy Lebenshaltungskosten]
end 

to go

   ask foragers [
    if Agenten = "Menschen" [ set shape "person"]
    if Agenten = "Bakterien" [ set shape "bacteria" ]
    if Agenten = "Kühe" [ set shape "cow"]
    if Agenten = "Zellen" [ set shape "cell"]]

  move
  eat
  if Evolution? [reproduce]
  expend-energy
  if Evolution? [death]

  ask patches with [foodpatch? = true]
  [regrow
    recolor]

  tick
end 

to move
  ask foragers
  [let local ( patch-set patch-here ( patches in-radius 2 with [not any? foragers-here] ))
   if local != nobody
    [let local-max  ( max-one-of local [resource]  )
    ifelse local-max != nobody and [resource] of local-max >= Lebenshaltungskosten
      [face local-max
        move-to local-max
        set mypatch [foodpatchnum] of patch-here
      ]
      [if any? ( patches in-radius 2 with [not any? foragers-here] )
        [move-to one-of ( patches in-radius 2 with [not any? foragers-here] )]]
  ]
  ]
end 

to eat
  ask foragers
  [ifelse eattype = "low"
    [ set  energy energy + ([resource] of patch-here * 0.5)
      ask patch-here [set resource resource / 2]]
    [ set  energy energy + ([resource] of patch-here * 0.99)
      ask patch-here [set resource resource - (0.99 * resource) ]]
  ]
end 

to reproduce
 ask foragers
  [ let birthrate 0.0005 * energy
  if energy > costchild and random-float 1 < birthrate [
     let destination one-of neighbors with [not any? turtles-here]
     if destination != nobody [
        hatch 1 [
          move-to destination
          mutate
          set energy costchild ]
        set energy (energy - costchild)
       ]
      ]
      ]
end 

to mutate
  if random-float 1 < Mutationsrate
  [ifelse eattype = "low"
    [set eattype "high"]
    [set eattype "low"]
    update-color
  ]
end 

to expend-energy
  ask foragers [set energy energy - Lebenshaltungskosten]
end 

to death
  ask foragers
  [if energy <= 0 [die]
  ]
end 

to regrow
  ifelse resource >= 0.1
  [set resource precision (resource + ((Wachstumsrate * resource) * (1 - (resource / Tragfähigkeit )))) 3]
  [set resource 0.1]
end 

to recolor ;; patch
  set pcolor scale-color brown resource 0 (Tragfähigkeit + 10)
end 

to update-color
  ifelse eattype = "low"
    [set color green]
    [set color red]
end 

to calcassort
  foreach (foodpatchlist) [ x ->
    let foodpatch patches with [foodpatchnum = x]
    let lowfrgs count foragers with [eattype = "low" and mypatch = x]
    let frgs count foragers with [ mypatch = x]
    ask patches with [seedpatch? = true and seedpatchnum = x]
      [ set assortindex (lowfrgs / frgs) ]
    ]
end 

;;;;;;;;;;;;;;;;;;reporters;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to-report avenhigh
  report sum [energy] of foragers with [eattype = "high"] / count foragers with [eattype = "high"]
end 

to-report avenlow
  report sum [energy] of foragers with [eattype = "low"] / count foragers with [eattype = "low"]
end 

to-report gensim-pop
  report ( count patches with [seedpatch? = true] - 1) / (count foragers - 1)
end 

to-report avassort
  report sum [assortindex] of patches with [seedpatch? = true] / count patches with [seedpatch? = true]
end 

There are 2 versions of this model.

Uploaded by When Description Download
Susan Hanisch almost 3 years ago German characters created error Download this version
Susan Hanisch almost 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Evolution and patchy resources GERMAN.png preview Preview for 'Evolution and patchy resources GERMAN' almost 3 years ago, by Susan Hanisch Download

This model does not have any ancestors.

This model does not have any descendants.