Adding yearly seasons

This commit is contained in:
EEva 2013-07-17 17:17:09 +02:00
parent 31265af4fb
commit f65708f28e
3 changed files with 40 additions and 12 deletions

View File

@ -26,29 +26,37 @@ to-report honey-quant [ ha hi ]
end
to-report harv-index [ hi ]
if hi = "AC" and acacia-season [ report 0.0000135 ] ; Acacia
if hi = "LM" and lime-season [ report 0.000018 ] ; Lime
if hi = "SF" and sunflower-season [ report 0.000006 ] ; Sunflower
report 0.000004 ; Polyflower
ifelse flower-season
[ if hi = "AC" and acacia-season [ report 0.0000135 ] ; Acacia
if hi = "LM" and lime-season [ report 0.000018 ] ; Lime
if hi = "SF" and sunflower-season [ report 0.000006 ] ; Sunflower
report 0.000004 ; Polyflower
]
[ report 0.0 ]
; the following shouldn't happen
error 1
end
to-report acacia-season
if ticks > 30 + abegin-uncertainty and ticks < 61 + aend-uncertainty
if yearly-ticks > 119 + abegin-uncertainty and yearly-ticks < 150 + aend-uncertainty
[ report true ]
report false
end
to-report lime-season
if ticks > 61 + lbegin-uncertainty and ticks < 91 + lend-uncertainty
if yearly-ticks > 150 + lbegin-uncertainty and yearly-ticks < 180 + lend-uncertainty
[ report true ]
report false
end
to-report sunflower-season
if ticks > 91 + sbegin-uncertainty and ticks < 122 + send-uncertainty
if yearly-ticks > 180 + sbegin-uncertainty and yearly-ticks < 211 + send-uncertainty
[ report true ]
report false
end
to-report flower-season
if yearly-ticks > 89 and yearly-ticks < 241
[ report true ]
report false
end

View File

@ -3,6 +3,7 @@ extensions [ gis ]
globals [
romanian-county-borders-dataset
county-names
yearly-ticks
abegin-uncertainty
aend-uncertainty
sbegin-uncertainty
@ -40,13 +41,17 @@ to go
; move to a better spot (with different strategies)
ask beekeepers
[ move-to with-strategy-maximize-profit ]
[ let s with-strategy-maximize-profit
if any? spots with [s = self]
[ move-to s]]
; collect honey and make money
if ticks > 153 [ stop ]
tick
set yearly-ticks ticks mod 365
if yearly-ticks = 0 [ setup-seasons-uncertainty ]
end
@#$#@#$#@
GRAPHICS-WINDOW
@ -217,7 +222,7 @@ PENS
"Accacia" 1.0 0 -2674135 true "" "plot count beekeepers-on spots with [ flower-type = \"AC\" and acacia-season ]"
"Sunflower" 1.0 0 -1184463 true "" "plot count beekeepers-on spots with [ flower-type = \"SF\" and sunflower-season ]"
"Lime" 1.0 0 -13840069 true "" "plot count beekeepers-on spots with [ flower-type = \"LM\" and lime-season ]"
"Polyflower" 1.0 0 -8630108 true "" "plot count beekeepers-on spots with [ flower-type = \"PF\" ]"
"Polyflower" 1.0 0 -8630108 true "" "plot count beekeepers-on spots with [ flower-type = \"PF\" and flower-season]"
PLOT
364
@ -255,6 +260,21 @@ season-uncertainty
NIL
VERTICAL
SLIDER
215
50
253
246
d-max
d-max
0
30
30
1
1
NIL
VERTICAL
@#$#@#$#@
## WHAT IS IT?

View File

@ -1,4 +1,4 @@
to-report with-strategy-maximize-profit
;; to explode. beekeeper do not know in advance
report max-one-of spots with [ not any? beekeepers-on self] [ beekeep-utility 5 flower-type (distance myself) ]
report max-one-of spots in-radius d-max with [ not any? beekeepers-on self] [ beekeep-utility 5 flower-type (distance myself) ]
end