Reputation: 33
I am new to Netlogo and am progressing pretty well with programming. However, I am currently stuck on an issue.
I am using turtles as fish super-individuals (see Railsback and Grimm 2005) which means each turtle has arguments for abundance, sex, age and size. At the end of a year cycle, I would like to find turtles with the same characteristics of sex, age and size and then combine their abundances into one turtle of the same characteristics (then all will be die except the newly combined turtle). Does anyone know how to do this? Any advice would be greatly appreciated.
Upvotes: 0
Views: 44
Reputation: 3806
I didn't test my solution, but this should work. Essentially, for each turtle figure out who are the turtles with the same properties and add it to a running total of abundances, then ask them to die.
ask turtles [
let others-abundance 0 ;; accumulate other's abundances
ask other turtles with [ sex = [sex] of myself and abundance = [abundance] of myself and age = [age] of myself] and size = [size] of myself] ;;determine who are the others with same properties
[
set others-abundance other-abundance + abundance
die
]
set abundance abundance + other-abundance
]
Upvotes: 2