Reputation: 117
I am trying to apply the following condition:
if ( the color of patch -2 -1 is red ) [ some commands ]
Could someone please tell me how to write this in NetLogo?
Upvotes: 1
Views: 2609
Reputation: 313
You could do it with a with to get the agentset like Jose M Vidal has suggested.
1) Using AgentSet
ask patches with [pcolor = black] [ commands here ]
2) If you want to use an if condition specifically, write it as such:
ask patches [ if [pcolor] of self = black [ commands here ] ]
Upvotes: 1
Reputation: 9142
If you mean the patch at coordinates (-2 1) then its:
ask (patch -2 1) with [pcolor = red] [commands]
or
ask (patch -2 1) [ if (pcolor = red) [commands]]
Upvotes: 2