h3ky1
h3ky1

Reputation: 61

Netlogo - spacing resources across world

I am trying to distribute resources in a way that I can specify the number of resources and make sure that they have at least one patch between them.

In this example, the resources are being distributed across a set of hex tile turtles built on the underlying patch framework and tied together by links.

set-default-shape resources "resource stone" [
  ask n-of 10 tiles with [not any? resources in-radius 2] [
   hatch-resources 1 [
    set color brown
]]]

I cannot seem to get this to work and I think it is because the resources are not yet created in order to calculate the "not any?" bit.

enter image description here

Upvotes: 1

Views: 90

Answers (1)

Seth Tisue
Seth Tisue

Reputation: 30453

I concur with "I think it is because the resources are not yet created in order to calculate the "not any?" bit". So how about:

repeat 10 [
  ask one-of patches with [not any? resources in-radius 2] [
    ...
  ]
]

Upvotes: 0

Related Questions