0

With regards to this question MOVE-TO expected input to be an agent but got NOBODY instead, I regularly encounter the same issue, however, even if I write a move-to that is protected by an if any?.

Imagine the following scenario, I have two breed, and one is ask to approach a member of the other breed if conditions are met. This is what breed1 executes:

if any? breed2 [
    ifelse var >= 5 [
      move-to one-of breed2 in-radius 2
    ]
    [ ... ] 
  ]

If, breed2 is not in-radius or no member of breed1 has a var above 5, I get the above mentioned error message. How can I avoid it?

Til Hund
  • 1,543
  • 5
  • 21
  • 37

1 Answers1

3

your move-to is NOT protected by an if any? clause. The if checks whether there are any turtles of breed2, regardless of their distance, but your move-to requires there to be one within a certain distance.

JenB
  • 17,620
  • 2
  • 17
  • 45