Hunting-and-Poaching
Model was written in NetLogo 6.4.0
•
Viewed 5 times
•
Downloaded 0 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
; Boar, protected species (wolves), hunters, gatekeepers and poachers are breeds of turtles breed [ boars boar ] breed [ hunters hunter ] breed [ wolves wolf ] breed [ poachers poacher ] breed [ gatekeepers gatekeeper ] patches-own [trap?] ; Define some variable for boars and wolves boars-own [gender age b_gestation carrying? b_longevity] wolves-own [gender age w_gestation carrying? w_longevity] to setup clear-all ask patches [ set pcolor lime - 3 ] ; set default background color create-hunters initial-hunters ; initialize hunters [set shape "hunter" ;set size 1.5 set color white setxy random-xcor random-ycor] create-boars initial-boars ; initialize boars [set shape "boar" set color black setxy random-xcor random-ycor ifelse (random 100 < 50) [set gender "M"] [set gender "F"] set carrying? false set b_gestation 0 set age random mean-b_longevity set b_longevity mean-b_longevity ] if enable-poaching [ ; initialize wolves, poachers and gatekeepers if variation 2 is activated create-wolves initial-wolves [set shape "wolf" set color black setxy random-xcor random-ycor ifelse (random 100 < 50) [set gender "M"] [set gender "F"] set carrying? false set w_gestation 0 set age random mean-w_longevity set w_longevity mean-w_longevity ] create-poachers initial-poachers [set shape "poacher" ;set size 1.5 ;set color red setxy random-xcor random-ycor] create-gatekeepers initial-gatekeepers [set shape "person police" ;set size 1.5 ;set color white setxy random-xcor random-ycor] ] reset-ticks ;display-labels end to go ifelse (enable-poaching and not any? wolves) ; stop if boars population is going to high or if there is no more wolves or boars [ stop ] [if (not any? boars) or count boars > 800 [ stop ]] ask hunters [move shot-hunters] ask boars [move check-if-dead-b reproduce-boars-males reproduce-boars-females ] if enable-poaching [ ask wolves [move check-if-dead-w reproduce-wolves-males reproduce-wolves-females] ask poachers [move shot-poachers put-trap] ask gatekeepers [move arrest-poachers] ] update-patches tick ;display-labels end to move ; turtle procedure rt random 50 lt random 50 fd 1 end to shot-hunters ; hunters are shooting boars with a certain accuracy let found-boar one-of boars-here if (found-boar != nobody) [ if (random 100 < shot-accuracy)[ ask found-boar [ die ] ] ] end to shot-poachers ; priority to kill wolves with a certain accuracy let found-wolf one-of wolves-here ifelse (found-wolf != nobody) [if (random 100 < shot-accuracy)[ask found-wolf [ die ]]] [let found-boar one-of boars-here if (found-boar != nobody) [if (random 100 < shot-accuracy)[ask found-boar [ die ]]]] end to put-trap ; poachers are putting some traps on their walk if (random 100 < ratio-trap) [ set trap? true ask patch-here [set pcolor red] ] end to arrest-poachers ; if gatekeeper encounters a poacher, he arrests him let found-poacher one-of poachers-here if (found-poacher != nobody) [ask found-poacher [ die ]] end to reproduce-boars-males ; if encounter a female not carrying, then we apply the reproduction rate and the female is carrying or not depending to this if (count boars in-radius 1 with [not carrying? and gender = "F"]) = 1 and (count other boars in-radius 1 with [gender = "M"]) = 0 and (random 100 < boar-reproduction-rate) [ ;start b_gestation ask one-of boars in-radius 1 with [not carrying? and gender = "F"] [set carrying? true] ] end to reproduce-wolves-males ; if encounter a female not carrying, then we apply the reproduction rate and the female is carrying or not depending to this if (count wolves in-radius 1 with [not carrying? and gender = "F"]) = 1 and (count other wolves in-radius 1 with [gender = "M"]) = 0 and (random 100 < wolf-reproduction-rate) [ ;start w_gestation ask one-of wolves in-radius 1 with [not carrying? and gender = "F"] [set carrying? true] ] end to reproduce-boars-females ; if carrying and end of gestation, get birth and reset the gestation, else if carrying, then increment the gestation if carrying? and b_gestation = b_gestation-period [ set b_gestation 0 set carrying? false hatch 1 [ rt random-float 360 fd 1 set age 0 ;set color orange ifelse (random 100 < 50) [set gender "M"] [set gender "F"] ] ] ; end get birth if carrying? [set b_gestation b_gestation + 1] end to reproduce-wolves-females ; if carrying and end of gestation, get birth and reset the gestation, else if carrying, then increment the gestation if carrying? and w_gestation = w_gestation-period [ set w_gestation 0 set carrying? false hatch 1 [ rt random-float 360 fd 1 set age 0 ;set color orange ifelse (random 100 < 50) [set gender "M"] [set gender "F"] ] ] ; end get birth if carrying? [set w_gestation w_gestation + 1] end to check-if-dead-b ; die if too old ifelse age > b_longevity [ die ][ set age age + 1 ] end to check-if-dead-w ; die if too old ifelse age > w_longevity [ die ][ set age age + 1 ] end to update-patches ; interaction between agents and patches ask patches with [pcolor = red] [ ask gatekeepers-here [ set pcolor lime - 3 ] ask hunters-here [ set pcolor lime - 3 ] ask wolves-here [ set pcolor lime - 3 die ] ask boars-here [ ;set pcolor lime - 3 ;die ] ] end ;to display-labels ; ask boars [ set label "" ] ; ask boars [ set label gender ] ;end ; Copyright 2024 Clément COSTE. ; See Info tab for full copyright and license.
There is only one version of this model, created 2 days ago by Clément COSTE.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Hunting-and-Poaching.png | preview | Preview for 'Hunting-and-Poaching' | 2 days ago, by Clément COSTE | Download |
This model does not have any ancestors.
This model does not have any descendants.