Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 718
Raj Avatar asked Feb 04 '16 19:02

Raj


People also ask

What is an Agentset in NetLogo?

Agents are beings that can follow instructions. In NetLogo, there are four types of agents: turtles, patches, links, and the observer. Turtles are agents that move around in the world. The world is two dimensional and is divided up into a grid of patches.

What code does NetLogo use?

What programming language was NetLogo written in? NetLogo is written mostly in Scala, with some parts in Java. (Scala code compiles to Java byte code and is fully interoperable with Java and other JVM languages.)

What does NetLogo turtle own?

The turtles-own keyword, like the globals, breed, <breeds>-own, and patches-own keywords, can only be used at the beginning of a program, before any function definitions. It defines the variables belonging to each turtle. If you specify a breed instead of "turtles", only turtles of that breed have the listed variables.


1 Answers

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]
like image 158
Alan Avatar answered Sep 22 '22 16:09

Alan