0

If I select an agentset of patches, for example:

<observer> let myset patches with [abs pxcor < (grid-size / 2) and abs pycor < (grid-size / 2)]
<observer> ask myset [print self]
(patch 1 -1)
(patch -1 -1)
(patch 0 0)
(patch 1 0)
(patch 0 1)
(patch 0 -1)
(patch 1 1)
(patch -1 1)
(patch -1 0)

How can I move all my turtles (Which are as much as my selected patches, so 9) each one to a DIFFERENT patch?

I tried the following:

ask turtles [
    move-to one-of myset 
    ]

But now it is possible that different turtles are on the same patch. How can I avoid this?

Nelis
  • 91
  • 1
  • 11

1 Answers1

2

Assuming that there aren't any other turtles on the patches, then just get them to choose an empty patch (not sure the syntax is quite right, but something like):

ask turtles [
    move-to one-of myset with [not any? turtles-here]
    ]
JenB
  • 17,620
  • 2
  • 17
  • 45
  • Thanks a lot, this what I was looking for! Super simple, as you probably guessed I'm new to Netlogo ;-) – Nelis Mar 16 '20 at 10:10