i want change turtle's behavior.
first 6 ticks, turtles using foraging map move. after foraging, turtles using resting map rest in 6 ticks.
i tried use count-down, failed it.
this code used
go move-turtles tick if ticks >= 4320 [stop] end move-turtles ask turtles [ foraging resting ] end foraging uphill food if food >= [food] of one-of neighbors [move-to one-of neighbors] set count-down count-down - 1 set label count-down set label-color red if count-down = 0 [resting set label "6" reset-count-down ] end resting uphill rplace if rplace >= [rplace] of one-of neighbors [move-to one-of neighbors] set count-down count-down - 1 set label count-down set label-color blue if count-down = 0 [foraging set label "6" reset-count-down ] end reset-count-down set count-down 6 end
you need add turtle attribute tracks state turtle in. example, add resting?
attribute, set true
when foraging count down hits 0
, , set false
when resting countdown hits 0
. condition behavior (foraging or resting) on attribute.
btw, should name command procedures verb (here, forage
, rest
).