vendorsoli.blogg.se

Netlogo breeds
Netlogo breeds









netlogo breeds

netlogo breeds

Someone will most likely suggest a better way to do it. If you think you need to use turtle numbers anywhere in your code, come ask another question here. Good! Never¹ assign anything by turtle number! It leads to brittle, error prone, more complex, less general, unnetlogoish code. Keeping track of the different context in NetLogo can be challenging at first (the frequent confusion between self/ myself being a case in point), but once you get it, it should become easy and natural. Can you see how that was messing things up? So your calls to set flink-leader, set flink-followers and so on were all run twice, each time in a different turtle context.

#NETLOGO BREEDS CODE#

That meant that the code block was run once for each turtle that was created. In your version, you wrapped most of the code inside a code block provided for create-flinks. Other primitives depend on the context in which the code is running: the primitive named other, for example, will report all the agents from a given agentset, except the one in the context of which the block is running. Some primitives, like ask, of and create-turtles, are "context switching": one of their argument is a code block (the part between ) that runs in the context of a particular turtle. To understand what was going on, you need to grasp the notion of "context" in NetLogo. Note that your intuition about using other to make sure that the follower(s) is/are different from the leader was correct. Here is one that doesn't stray too far from the code you have provided: to setup-turtles There would be many different ways to approach this. NetLogo creates number turtles of the type breed. ( I have tried if statements, is-turtle?, one-of other, other) breed linked turtles that will turn away from sourcesĪsk flink-followers with agent-based modeling and NetLogo would be helpful: Definition 1 (Agents) The individuals or. Does anybody know a condition i can put in that will allow it to set up everytime without the error. I am receiving an error (not all of the time) 'turtle cannot link with itself' which i presume occurs when they overwrite the first set command and assign the same turtle to the two variables. There are a lot of conditions in the interface that determine how many and which breeds are created so i cannot assign by turtle number. Different types of turtles in NetLogo can be specified by defining. I need to assign these variables to turtles in the breeds and then create a link from the leader to the follower. some new NetLogo features, including breeds, behavior-space and shapes editor. I have assigned these as global variables as they come up a lot in the code further down. Each breed needs to have a leader turtle and a follower turtle. I have a programme that sets up a number of different breeds of turtles.











Netlogo breeds