> On Jun 16, 2017, at 4:23 PM, kws908 [hidden email] [netlogo-users] <[hidden email]> wrote:
> I am struggling to count links with specific type of agent..
> For examples, there are three different types of agents with three different
> Basically, I want to count of links connected with red colored agents.
> Intuitively, the code,
> count links of [self] with turtles [color = red],
> looks okay, but it does not work.
> Would you help me to figure out this?
Look up `link-neighbors’ in the NL dictionary. That is the key to this problem. Here is a test to show how it could be used. Paste this into a new model and enter ’test’ in the command center. Repeat to see that it works for different numbers of red turtles.
create-ordered-turtles 10 [
set color one-of [red green blue]
create-turtles 1 [
create-links-with other turtles
print word "Number of links with red turtles is "
count link-neighbors with [color = red]