csss-beedza/Source/bmodel.nls

47 lines
1.5 KiB
Plaintext

spots-own [ flower-type pollinisation-score amount-of-wild-hives ]
to setup-wild-bees
ask spots
[ set amount-of-wild-hives random max-wild-hives ]
end
to go-pollinate
if flower-season [
ask spots
[ ifelse any? beekeepers-here
[ set pollinisation-score amount-of-wild-hives + item 0 [amount-of-hives] of beekeepers-here ]
[ set pollinisation-score amount-of-wild-hives ] ] ]
if pollinisation-map-on
[ clear-drawing
ask turtles [ hide-turtle ]
let max-pollinisation-score max [ pollinisation-score ] of spots
;show max-pollinisation-score
ask patches with [ any? spots-here ]
[ let local-pollinisation-score (item 0 [ pollinisation-score ] of spots-here)
set pcolor scale-color RED local-pollinisation-score 0 60
;set pcolor WHITE
;if local-pollinisation-score > 0 [ show local-pollinisation-score ]
] ]
;diffuse pcolor 0.1
end
to eleminate-and-germinate
let max-pollinisation-score max [ pollinisation-score ] of spots
;show max-pollinisation-score
; find low pollinated spots
ask spots with [ pollinisation-score / max-pollinisation-score <= elimination-threshold ]
[ die ]
let lucky-spots spots with [ pollinisation-score / max-pollinisation-score > elimination-threshold ]
; populate neighborhood of lucky spots
ask lucky-spots
[ hatch random-normal mean-new-spots 5
[ move-to one-of patches with [ distance myself < population-radius ] ] ]
; and reset pollinisation score
ask spots [ set pollinisation-score 0 ]
end