Reputation: 418
What should I do to monitor the status of various flags assigned to all turtles? As a possibility, can we think to use the Behavior Space? But it didn't go well. Can someone who know it well?
Upvotes: 0
Views: 182
Reputation: 14972
If you want to record the value of individual turtle variables using BehaviorSpace, check out this answer:
https://stackoverflow.com/a/52406247/487946
But if you only want to monitor these values inside NetLogo while your model is running, you can use an output widget.
Here is a bit of example code:
turtles-own [ flag1? flag2? ]
to setup
clear-all
create-turtles 10 [
set flag1? one-of [ true false ]
set flag2? one-of [ true false ]
]
update-output
end
to go
; flip a couple of random flags
ask one-of turtles [ set flag1? not flag1? ]
ask one-of turtles [ set flag2? not flag2? ]
update-output
end
to update-output
clear-output
foreach sort turtles [ t ->
ask t [ output-show (list flag1? flag2?) ]
]
end
And the kind of result it would give you:
You can, of course be as fancy as like with formatting the output. You get a bit of flickering, but it does the job.
Note that it is also possible to plot values for individual turtles using dynamically created temporary plot pens. See this other answer for an example of something like that:
https://stackoverflow.com/a/41600187/487946
Upvotes: 3