Reputation: 141
I am barely starting to use netlogo, and I created a model in which my agents have a list referencing a unique value for all (so its length is equal to the number of agents present at time t and the item 1 in the list corresponds to the value of turtle 1). I don’t manage to update the list when a new agent is born. How can I do that?
Regards
Upvotes: 1
Views: 87
Reputation: 9610
It sounds like you want something like this:
turtles-own [listOfTurtleVals val]
to init-turtle
set val random-float 1 ;just for illustration
set listOfTurtleVals ([val] of other turtles)
end
Then just run init-turtle
on each turtle you create.
Alteratively you might have meant this:
globals [listOfInitialVals]
turtles-own [val]
to init-turtle
set val random-float 1 ;just for illustration
set listOfTurtleVals (lput val listOfInitialVals)
end
Upvotes: 1