Adding pollinisation

This commit is contained in:
EEva 2013-07-12 22:33:23 +02:00
parent e19d8fae3a
commit c32c353b01

View file

@ -13,7 +13,11 @@ to init-simulation
move-to one-of patches move-to one-of patches
set color red set color red
] ]
create-fields nb-fields add-n-fields nb-fields
end
to add-n-fields [n]
create-fields n
[ [
set shape "flower" set shape "flower"
setxy random-xcor random-ycor setxy random-xcor random-ycor
@ -25,16 +29,40 @@ end
to go-pollinate to go-pollinate
ask hives ask hives
[ [
ask min-n-of 3 fields [distance myself] ask min-n-of fields-to-check fields [distance myself]
[ [
set color blue set color blue
create-link-from myself
] ]
] ]
end end
to disseminate
ask fields with [color = blue]
[
set size size + 1
]
ask fields with [color != blue]
[
ifelse size < 1
[die]
[set size size - 1]
]
add-n-fields (count fields with [color = blue])
end
to end-the-day
ask fields [ set color yellow ]
clear-links
end
to go to go
go-pollinate go-pollinate
;tick ; a tick a day disseminate
display
end-the-day
tick ; a tick a day
end end
@#$#@#$#@ @#$#@#$#@
GRAPHICS-WINDOW GRAPHICS-WINDOW
@ -67,9 +95,9 @@ ticks
BUTTON BUTTON
17 17
17 17
149 83
50 50
NIL setup
init-simulation init-simulation
NIL NIL
1 1
@ -84,13 +112,13 @@ NIL
SLIDER SLIDER
816 816
10 10
853 849
160 160
nb-hives nb-hives
nb-hives nb-hives
0 0
100 100
10 3
1 1
1 1
NIL NIL
@ -99,7 +127,7 @@ VERTICAL
SLIDER SLIDER
854 854
10 10
891 887
160 160
nb-fields nb-fields
nb-fields nb-fields
@ -128,6 +156,21 @@ NIL
NIL NIL
1 1
SLIDER
892
10
925
160
fields-to-check
fields-to-check
1
10
3
1
1
NIL
VERTICAL
@#$#@#$#@ @#$#@#$#@
## WHAT IS IT? ## WHAT IS IT?