1
Fork 0
mirror of https://github.com/Steffo99/turtle007.git synced 2024-11-24 22:14:19 +00:00

Importa progetto dal vecchio repository

This commit is contained in:
Lorenzo Balugani 2020-05-05 17:51:24 +02:00 committed by Stefano Pigozzi
parent fe95a54598
commit 7cda2d1ae7

View file

@ -2,7 +2,7 @@ breed [ants ant]
patches-own [pheromone food nest distance-from-nest] patches-own [pheromone food nest distance-from-nest]
ants-own [carrying-food hunger] ants-own [carrying-food hunger]
globals [food-in-nest] globals [food-in-nest born]
to setup to setup
clear-all clear-all
@ -45,6 +45,7 @@ to setup-nest
p-setup-nest p-setup-nest
] ]
set food-in-nest 0 set food-in-nest 0
set born 0
end end
to p-setup-nest to p-setup-nest
@ -223,6 +224,16 @@ to p-respawn-food
] ]
end end
to birth
create-ants 1 [set color ant-color
set carrying-food 0
set hunger 0
setxy nest-x nest-y
fd nest-size]
set food-in-nest food-in-nest - ant-food-cost
set born born + 1
end
to go to go
tick tick
ask ants [t-work] ask ants [t-work]
@ -233,6 +244,9 @@ to go
if enable-food-respawn and ticks mod food-ticks = 0[ if enable-food-respawn and ticks mod food-ticks = 0[
p-respawn-food p-respawn-food
] ]
if enable-birth and (food-in-nest - ant-food-cost) >= food-surplus-threshold[
birth
]
end end
@#$#@#$#@ @#$#@#$#@
GRAPHICS-WINDOW GRAPHICS-WINDOW
@ -735,35 +749,35 @@ enable-food-respawn
-1000 -1000
INPUTBOX INPUTBOX
1195 1240
90 90
1280 1325
150 150
food-ticks food-ticks
1500.0 200.0
1 1
0 0
Number Number
SLIDER SLIDER
1285 1330
90 90
1322 1367
280 280
food-respawn-pct food-respawn-pct
food-respawn-pct food-respawn-pct
0 0
100 100
0.0 48.0
1 1
1 1
% %
VERTICAL VERTICAL
INPUTBOX INPUTBOX
1195 1240
155 155
1280 1325
215 215
hunger-per-tick hunger-per-tick
0.1 0.1
@ -772,9 +786,9 @@ hunger-per-tick
Number Number
INPUTBOX INPUTBOX
1195 1240
220 220
1280 1325
280 280
hunger-threshold hunger-threshold
30.0 30.0
@ -783,9 +797,9 @@ hunger-threshold
Number Number
INPUTBOX INPUTBOX
1195 1240
285 285
1280 1325
345 345
hunger-max hunger-max
35.0 35.0
@ -828,14 +842,14 @@ true
"" "" "" ""
PENS PENS
"Alive" 1.0 0 -2674135 true "" "plot count turtles" "Alive" 1.0 0 -2674135 true "" "plot count turtles"
"Dead" 1.0 0 -16777216 true "" "plot (ants-qty - count turtles)" "Dead" 1.0 0 -16777216 true "" "plot ((ants-qty + born) - count turtles)"
"Starving" 1.0 0 -817084 true "" "plot count turtles with [hunger > hunger-threshold]" "Starving" 1.0 0 -817084 true "" "plot count turtles with [hunger > hunger-threshold]"
SLIDER SLIDER
1325 1370
91 90
1362 1407
281 280
hunger-increase-pct hunger-increase-pct
hunger-increase-pct hunger-increase-pct
0 0
@ -846,6 +860,39 @@ hunger-increase-pct
% %
VERTICAL VERTICAL
SWITCH
360
775
530
808
enable-birth
enable-birth
0
1
-1000
INPUTBOX
1240
350
1410
410
food-surplus-threshold
1000.0
1
0
Number
INPUTBOX
1330
285
1410
345
ant-food-cost
10.0
1
0
Number
@#$#@#$#@ @#$#@#$#@
## WHAT IS IT? ## WHAT IS IT?