user1140233
user1140233

Reputation: 55

how to change the pcolor of neighboring patches?

I'm a netlogo beginner and hope to get some help.

I'm trying to create a patch at coordinates 0,0 and then set the color to red, including all 8 surrounding patches.

How can i do so?

I tried something like,

ask patch 0 0 [set pcolor red of neighbors]

I know it's wrong, 'cos i'm stuck. Hope someone can give me a tip!

Upvotes: 2

Views: 842

Answers (1)

Nicolas Payette
Nicolas Payette

Reputation: 14972

You can simply do:

ask patch 0 0 [
  set pcolor red
  ask neighbors [
    set pcolor red
  ]
]

Upvotes: 3

Related Questions