user6487966
user6487966

Reputation: 51

Netlogo add the average distance information on patches from the patch 3 -3

I would like to know how to design this.

All patches will compare their own distance from the patch [3 -3] with the average distance. So they realize that they are closer or far from the average distance.

Upvotes: 1

Views: 53

Answers (2)

Arthur Hjorth
Arthur Hjorth

Reputation: 889

I think I would put everything in a patch reporter like this:

to-report closer-than-average? report distance patch 3 -3 < mean [distance patch -3] of patches end

Then you can

ask one-of patches [show closer-than-average?]

or

ask patches with [closer-than-average?] [set pcolor blue]

etc.

Upvotes: 0

Alan
Alan

Reputation: 9610

globals [ref-patch av-dist]

to setup
  ca
  set av-dist mean [distance patch 3 -3] of patches
  demo
end

to demo
  ask patches [
    if distance patch 3 -3 < av-dist [
      set pcolor red
    ]
  ]
end

Upvotes: 2

Related Questions