user399466
user399466

Reputation: 117

netlogo checking patch color

in simple words what I am struggling to do is:

if (colour of any patch = red) then execute some code

Upvotes: 1

Views: 3222

Answers (2)

Seth Tisue
Seth Tisue

Reputation: 30453

if any? patches with [pcolor = red] [
  print "yes, there is at least one red patch"
]

Upvotes: 3

Jose M Vidal
Jose M Vidal

Reputation: 9152

Only a turtle can check the pcolor. So this works:

ask turtles [show pcolor]

But this does not work (typed in on the Observer> prompt):

show pcolor

Upvotes: 0

Related Questions