I would like to know that the number of all turtles died in my pseudo-model. How can i do this? I would really appreciate a simple and quick solution to this problem, for example count dead turtles.
I thought about such a procedure (but I donβt know how to implement it):
if turtle is dead % checking all turtles if dead or alive
set death_count death_count + 1 % set counter
tick % go one step ahead in model
This is my sample code (without checking so far):
breed [ humans human ]
humans-own [ age ]
to setup
ca
create-humans(random 100)
[
setxy random-xcor random-ycor
set age (random 51)
]
reset-ticks
end
to death
ask humans [
if floor (ticks mod 1) = 0 [
set age age + 1 ]
if age > 85 [ die ]
]
end
to go
death
tick
if ticks > 20 [ stop ]
end
source
share