![]() New local variables using the let primitive such as let target one-of other turtles.New global variables by creating interface elements such as sliders.New global variables using the globals primitive such as globals.Lastly, you may be wondering: " If all of the examples above are primitives, what is not a primitive in NetLogo programming?" There are multiple ways for us to extend the vocabulary of our models by defining: On the other hand, the in-radius primitive requires us to provide an agentset before it and a number after it such as turtles in-radius 3.Ĭlick here to find a list of all primitives that are in this Beginner's DictionaryĬlick here to find an exhaustive list of all NetLogo primitives For example, the facexy primitive requires two numbers as x and y coordinates after the keyword such as facexy -3 5. Some primitives may require additional information to be provided after writing the keyword, while others may require information before writing the keyword. If we wrote just forward in our code, NetLogo would show an error as follows: FORWARD expected 1 input, a number. ![]() On the other hand, the forward primitive requires us to provide it with a number such as forward 5 or forward 0.375. Wherever we write max-pxcor in our code, it reports the pxcor of the rightmost patches in our model. Similarly, the max-pxcor primitive just works. Wherever we write clear-all in our code, everything in our model is wiped out. For example, the clear-all primitive just works. Some primitives just work, while others require us to provide more information. You can click here to learn more about these color codes.Įach primitive requires a specific structure to properly function in code, which is called the syntax of the primitive. These colors give us hints on the function of each primitive. Notice how each primitive has a specific color. Some examples to NetLogo primitives are: forward Most primitives are one word terms (e.g., forward, to) except some multi-word ones (e.g., clear-all, scale-color, create-links-with) and some arithmetic operators (e.g., >=, +, /). As this Beginner's Interactive NetLogo Dictionary is all about some of the most commonly used primitives in NetLogo, it is helpful to understand what is a primitive and what is not a primitive. They are the simplest and smallest pieces of pre-defined NetLogo keywords that can be used to put together longer algorithms to construct complex agent-based models. Primitives are the building blocks in NetLogo programming. ![]()
0 Comments
Leave a Reply. |