Herbivory and Animal Interspecific Competition
Model was written in NetLogo 6.2.2
•
Viewed 171 times
•
Downloaded 28 times
•
Run 0 times
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
; Coded in 2022 by Lin Xiang; Last revised in 2022 by Lin Xiang (lxiang75@gmail.com; lin.xiang@uky.edu) ;; ;; If you mention this model in a publication, we ask that you include the citations below. ;; ;; Xiang, L. (2022). Herbivory and Animal Interspecific Competition. Department of STEM Education, University of Kentucky, Lexington, KY. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; breed [plant1s plant1] breed [plant2s plant2] breed [animal1s animal1 ] breed [animal2s animal2 ] breed [legends legend] plant1s-own [ num-seed-1 erg-0] plant2s-own [ num-seed-2 erg-00] animal1s-own [erg-1 life-1] animal2s-own [erg-2 life-2] patches-own [] Globals [ running-avg-list1 running-avg-list2 running-avg-lista1 running-avg-lista2 mean-total-1 mean-total-2 mean-total-a1 mean-total-a2 ] to-report empty-patches report patches with [pcolor >= 79 and pcolor <= 79.5 and not any? plant1s-here and not any? plant2s-here] end to setup clear-all setup-patches setup-legends add-plants add-mice1 add-mice2 set running-avg-list1 [] set running-avg-list2 [] set running-avg-lista1 [] set running-avg-lista2 [] reset-ticks end to setup-patches ask patches [set pcolor 79 + random-float 0.5] ask patches with [pycor = max-pycor or pycor < 2] [set pcolor white] end to add-plants ask up-to-n-of number-of-plants empty-patches [sprout-plant2s 1 [set shape "plant-1" set size 0.6 + random-float 0.4 set erg-00 10]] end to add-mice1 create-animal1s number-of-mice1 [set color 34 set size 0.65 set erg-1 5 + random 10 set shape "mouse" setxy 1 + random (max-pxcor - 1) 2 + random (max-pycor - 2) ] end to add-mice2 create-animal2s number-of-mice2 [set color 37 set size 0.75 set erg-2 5 + random 10 set shape "mouse" setxy 1 + random (max-pxcor - 1) 2 + random (max-pycor - 2) ] end ;;;;;;;;;;;;;;;;;;;;; ;; GO PROCEDURE ;; ;;;;;;;;;;;;;;;;;;;;; to go every 0.05[ if ticks >= Years [stop] move feeding reproduce-2 death find-running-avg tick ] end to move if any? animal1s [ask animal1s [ifelse life-1 >= 2 + mouse1-lifespan * 3 [die] [set life-1 life-1 + 1] right random 360 if [pcolor] of patch-at dx dy <= 79.5 and [pcolor] of patch-at dx dy >= 79 [fd 1 if ycor < 2 [set ycor 2] set erg-1 erg-1 - 1] if erg-1 <= 0 [die]]] if any? animal2s [ask animal2s [ifelse life-2 >= 2 + mouse2-lifespan * 3 [die] [set life-2 life-2 + 1] right random 360 if [pcolor] of patch-at dx dy <= 79.5 and [pcolor] of patch-at dx dy >= 79 [fd 1 if ycor < 2 [set ycor 2] set erg-2 erg-2 - 1] if erg-2 <= 0 [die]]] end to feeding (ifelse any? animal1s and not any? animal2s [feeding-1] any? animal2s and not any? animal1s [feeding-2] any? animal1s and any? animal2s [ifelse random 2 = 0 [feeding-1 feeding-2] [feeding-2 feeding-1]] ) end to feeding-1 ask animal1s [ if any? plant2s-here [ let food one-of plant2s-here set erg-1 erg-1 + [erg-00] of food ask food [die]]] ask animal1s [ if erg-1 > 20 [if random 100 < 20 [hatch 1 [set erg-1 5 set life-1 0] set erg-1 erg-1 - 10]]] end to feeding-2 ask animal2s [ if any? plant2s-here [ let food one-of plant2s-here set erg-2 erg-2 + [erg-00] of food ask food [die]]] ask animal2s [ if erg-2 > 20 [if random 100 < 20 [hatch 1 [set erg-2 5 set life-2 0] set erg-2 erg-2 - 10]]] end to reproduce-2 if any? plant2s [ask plant2s [set num-seed-2 1 + random 2 ask up-to-n-of num-seed-2 neighbors with [pcolor <= 79.5 and pcolor >= 79 and not any? plant1s-here and not any? plant2s-here] [sprout-plant2s 1 [set shape "plant-1" set size 0.6 + random-float 0.4 set erg-00 10]] ]] end to death ask plant2s [if random 100 < 30 [die]] ;a mortality of 30%-50% is optimal end to find-running-avg ;find the 5-year running averages (ifelse ticks < 10 [set running-avg-list1 lput (count plant1s) running-avg-list1 set mean-total-1 mean running-avg-list1 set running-avg-list2 lput (count plant2s) running-avg-list2 set mean-total-2 mean running-avg-list2 set running-avg-lista1 lput (count animal1s) running-avg-lista1 set mean-total-a1 mean running-avg-lista1 set running-avg-lista2 lput (count animal2s) running-avg-lista2 set mean-total-a2 mean running-avg-lista2] [set running-avg-list1 lput count plant1s running-avg-list1 set running-avg-list1 remove-item 0 running-avg-list1 set mean-total-1 mean running-avg-list1 set running-avg-list2 lput count plant2s running-avg-list2 set running-avg-list2 remove-item 0 running-avg-list2 set mean-total-2 mean running-avg-list2 set running-avg-lista1 lput count animal1s running-avg-lista1 set running-avg-lista1 remove-item 0 running-avg-lista1 set mean-total-a1 mean running-avg-lista1 set running-avg-lista2 lput count animal2s running-avg-lista2 set running-avg-lista2 remove-item 0 running-avg-lista2 set mean-total-a2 mean running-avg-lista2]) end to setup-legends create-legends 9 ask legend 0 [set shape "plant-1" set size 1 setxy 6 0.6] ask legend 1 [set shape "mouse" set color 34 set size 0.9 setxy 3 1] ask legend 2 [set shape "mouse" set color 36 set size 1 setxy 9 1] ask legend 3 [set shape "line" set color 8 set size 12 set heading 90 setxy 6 1.5] ask legend 4 [set shape "arrow-1" set color 136 set size 1.5 set heading -75 setxy 4.5 0.75] ask legend 5 [set shape "arrow-1" set color 136 set size 1.5 set heading 75 setxy 7.5 0.75] ask legend 6 [set shape "blank" set color 136 set size 1.5 set label "Mouse-2" set label-color 35 set heading 75 setxy 9 1] ask legend 7 [set shape "blank" set color 136 set size 1.5 set label "Mouse-1" set label-color 33 set heading 75 setxy 3 1] ask legend 8 [set shape "blank" set color 136 set size 1 set label "Both mouse species feed on the same type of plants." set label-color 0 set heading 75 setxy 10 0.2] end
There are 5 versions of this model.
This model does not have any ancestors.
This model does not have any descendants.