Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netlogo count patches with neighbors of specific color

Tags:

netlogo

How can I code to know how many patches are in my world that have yellow neighbors? I'm using the following line:

ask patches [ show count neighbors with [pcolor = yellow] ]

The result is a long list of each patch answering the question, but all that I need is the number of patches that fulfill the mentioned condition. Thanks for any help.

like image 371
Javier Sandoval Avatar asked Mar 07 '23 14:03

Javier Sandoval


1 Answers

I think you want

print count patches with [ any? neighbors with [ pcolor = yellow ] ]
like image 195
Luke C Avatar answered May 16 '23 07:05

Luke C