From f685ff89a6c7ef7f6d937dd45cf948884703f590 Mon Sep 17 00:00:00 2001 From: EEva Date: Wed, 17 Jul 2013 23:58:24 +0200 Subject: [PATCH] Adding zmap --- Source/bmodel.nls | 20 +++++++++++++++++--- Source/main.nlogo | 29 +++++++++++++++++++++-------- Source/vmodel-strategies.nls | 5 ++++- Source/vmodel.nls | 2 +- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/Source/bmodel.nls b/Source/bmodel.nls index 0b46028..ddf0476 100644 --- a/Source/bmodel.nls +++ b/Source/bmodel.nls @@ -5,8 +5,22 @@ to setup-wild-bees [ set amount-of-wild-hives random max-wild-hives ] end -to pollinate +to go-pollinate if flower-season [ - ask spots - [ set pollinisation-score amount-of-wild-hives + [amount-of-hives] of beekeepers-here ] ] + ask spots with [any? beekeepers-here] + [ set pollinisation-score amount-of-wild-hives + item 0 [amount-of-hives] of beekeepers-here + ;show pollinisation-score + 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 + 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.2 end \ No newline at end of file diff --git a/Source/main.nlogo b/Source/main.nlogo index 17b21af..1c010ff 100644 --- a/Source/main.nlogo +++ b/Source/main.nlogo @@ -52,6 +52,8 @@ to go ; tick! tick + go-pollinate + set yearly-ticks ticks mod 365 if yearly-ticks = 0 [ setup-seasons-uncertainty ] @@ -110,7 +112,7 @@ harvesting-uncertainty harvesting-uncertainty 0 10 -0 +1.9 0.1 1 NIL @@ -124,8 +126,8 @@ SLIDER travel-cost travel-cost 0 -5 -5 +10 +7.5 0.1 1 NIL @@ -264,10 +266,10 @@ NIL VERTICAL CHOOSER -37 -288 -275 -333 +8 +249 +246 +294 strategy strategy "with-collective-strategy" "with-blind-strategy" @@ -282,12 +284,23 @@ max-wild-hives max-wild-hives 0 100 -90 +52 1 1 NIL VERTICAL +SWITCH +4 +455 +206 +488 +pollinisation-map-on +pollinisation-map-on +0 +1 +-1000 + @#$#@#$#@ ## WHAT IS IT? diff --git a/Source/vmodel-strategies.nls b/Source/vmodel-strategies.nls index aef3cf9..cb0d2e7 100644 --- a/Source/vmodel-strategies.nls +++ b/Source/vmodel-strategies.nls @@ -1,6 +1,9 @@ to-report with-collective-strategy ;; to explode. beekeeper do not know in advance - report max-one-of spots in-radius d-max with [ not any? beekeepers-here or member? myself beekeepers-here ] [ beekeep-utility flower-type ([amount-of-hives] of myself) (distance myself) ] + ;let potential-empty-spots spots with [ not any? beekeepers-here or member? myself beekeepers-here ] + ;let pes-radius-limited potential-empty-spots in-radius d-max + ;report max-one-of pes-radius-limited [ beekeep-utility flower-type ([amount-of-hives] of myself) (distance myself) ] + report max-one-of (spots in-radius d-max) with [ not any? beekeepers-here or member? myself beekeepers-here ] [ beekeep-utility flower-type [amount-of-hives] of myself (distance myself) ] end to-report with-blind-strategy diff --git a/Source/vmodel.nls b/Source/vmodel.nls index f2c9ec4..e98e350 100644 --- a/Source/vmodel.nls +++ b/Source/vmodel.nls @@ -13,7 +13,7 @@ to setup-spots set shape "star" set flower-type one-of (list "PF" "AC" "LM" "SF") set color color-flower flower-type - move-to one-of patches with [ county-name = ? ] ] ] + move-to one-of patches with [ county-name = ? and not any? centroids-here ] ] ] end to setup-beekeepers