Count number of different values of a variable in NetLogo

Viewed 449

I am building a simulation of the epidermal cells in NetLogo. I have two type of cells, progenitors and post mitotic cells. The progenitors are the cells which can divide into either progenitor or post mitotic. Each run begins with a number of 239 progenitor cells with each their own identity (from 1 to 239) which is a turtles-own. Each time a progenitor divides, the identity is given to the offspring.

I want to count the number of different identities after a certain amount of ticks. I tried it with a monitor and with a list but it did not work.

Here is a small part of the code I have made:

turtles-own [ identity]
globals [ id-count]

to setup
ask patches [sprout-postmitotic 1]

ask n-of (( 22 / 100) * count postmitotic) patches [ 

ask postmitotic-here [
hatch-progenitor 1
[
    set identity id-count
  set id-count id-count + 1 ]
   die ] 
]
end


to go
ask progenitor[
if random-float 1 < l [
      hatch-postmitotic 1
    ]
end
1 Answers
Related