Search code examples
netlogoagentset

Print the elements in an agentset


I want to find the patches which satisfy certain conditions, using the following command:

print patches with [ (closest-party = turtle 1) and (distance < 10)]

give this as the result: (agentset, 7 patches)

how do i find those 7 patches inside that agentset


Solution

  • If myset is an agentset, then [self] of myset will be a list of the agents.

    let myset patches with [ (closest-party = turtle 1) and (distance < 10)] print [self] of myset
    

    But usually you can just work with myset. E.g.,

    ask myset [print self]