I am trying to stop my simulation when most of the population of agents have the same own variable value but I really don´t know ho to do it. Here is my code for the creation and the procedure of my model:
breed [birds bird]
birds-own [high]
to setup
create-turtles birds
[
set color blue
set shape "circle 2"
set xcor (-40 + random 25 )
set ycor (-40 + random 12)]
end
to go
ask birds
[
let Si4 [high] of one-of birds in-radius 1
let conc (( 4 * Si4) + ( 2 * Ai4 ) )
set high conc
]
end
I try to modulate the "high" variable using different values for the operations but I need to stop the simulation when at least 70-80% of the population of birds have the same value of "high" . I tried to use the command "modes"and "max" like this:
if max modes [high] of cells > 55 [stop]
but this stops the simulation even if 1 bird have that value not if most of the population has it so, any suggestions to do this properly?