csss-beedza/Source/bmodel.nls
2013-07-18 02:02:10 +02:00

48 lines
No EOL
1.6 KiB
Text

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-score > 0 [ set size 5 ]] ]
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 50
;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