If you want to use who numbers, you'll need to hide the turtles instead of killing them. If that makes things awkward because you find yourself needing to refer to e.g. turtles with [not hidden?]
, then consider making two breeds, call them actives
and inactives
or something like that, and then when hiding a turtle do hide-turtle set breed inactives
. Then you can always refer to the set of active turtles just as actives
. When someone joins the simulation, give them an inactive turtle if there is one, and have it do show-turtle set breed actives
.
Or, if you decide not to use who numbers, you'll need a new turtle variable, say you call it id
. When you make a new turtle, do set id count turtles - 1
. When a turtle dies, you'll need to reassign new id numbers so there aren't gaps anymore. Does it matter exactly what scheme you use for that? Do you need there to be any particular relationship between a turtle's old number and its new number? I can think of several possible different approaches to this. Here's one that assigns the id numbers in ascending order by who number:
let whos sort [who] of turtles
ask turtles [ set id position who whos ]
P.S. But I have to wonder, is all this numbering really necessary? In a normal NetLogo model, it's almost never necessary to use who numbers for anything. There's almost always a simpler way. Why do you feel you need to use numbering in this model? Perhaps you do need it, but I'm at least a little skeptical.