1

In my setup, I am using the following code to create agents called "darks", and these agents are assigned to a designated set of patches (free-patches).

I am trying to have each turtle assigned to a random patch within the designated area without any of the turtles sharing a patch.

I have stumbled across code that tells a patch to sprout a specific turtle, but can I accomplish my goal without resorting to the patch sprout?

  create-darks #-of-darks [
    set shape "person"
    set size 1
    set color black
    move-to one-of free-patches
    ]
Remi Guan
  • 21,506
  • 17
  • 64
  • 87
HS3
  • 25
  • 5

1 Answers1

2

You can just get a patch with no darks there.I would also only create a dark if there's enough space.

let n-or-remaining-spaces min (list n (count patches with [not any? darks-here]))
create-darks n-or-remaining-spaces
[
;;Your other setup code
move-to one-of patches with [not any? darks-here] 
]
Seth Tisue
  • 29,985
  • 11
  • 82
  • 149
mattsap
  • 3,790
  • 1
  • 15
  • 36
  • Mattsap, I decided to go with the second option you listed, and that seems to do the trick. It's a much clear start screen. Thank you! – HS3 Apr 16 '16 at 05:05