![]() ] show of end1 ) - ( of end2 )] of links check everything’s OK 8. agentset satisfies a certain condition ask turtles and with same color as me. if all? turtles use all? to see if every agent in the Use member? to see if an agent is a member of an agentset. Check whether two agentsets are equal using = or != show member? ( turtle 0 ) turtles with-min Use turtle-set, patch-set and link-set reporters to make new agentsets by gathering together agents from a variety of sources show ( turtles with ) = ( turtles with ) show ( turtle-set turtle 0 turtle 2 turtle 9 turtles-here ) Use of to make a list of values, one for each agent in the agentset. max-one-of agentset reports an agent in the agentset that has the highest value for the given reporter show mean ( of turtles with ) one-of reports a random agent from an agentset ask ( max-one-of turtles ) You can make a list by simply putting the values you want in the list between brackets, e.g.: Each value in the list can be any type of value: a number, a string, an agent, an agentset, or even another list. Lists let you store multiple pieces of information in a single variable by collecting those pieces of information in a list. In the simplest models, each variable holds only one piece of information, usually a number or a string. to ask the patch to her east set pcolor red. ] ask turtle 0 [ ask the turtle with who number 0 ask patch-at 1 0 [. ] ask link 0 2 [ ask the link between turtle 0 and 2. ] ask turtle 0 [ ask the first turtle (with who number 0) create-link-to turtle 2 to link to turtle with who number 2 ![]() ] ask patch 2 -2 [ ask the patch at (2,-2). The following code is an example of the implementation of procedure to setup:Ĭlear-all clear the world create-turtles 3 make 3 turtles ask turtle 0 tell the first one to go forward 10 steps ask turtle 1 [ ask the second turtle (with who number 1) set color green. Once you define a procedure, you can use it elsewhere in your program. The NetLogo Dictionary has a complete list of built-in instructions (i.e. Whether the instruction is implemented by the user ( procedures), or whether it is built into NetLogo ( primitives).Three characteristics are useful to remember about instructions: However, when reading NetLogo documentation, it is important to remember that these four types of entities are all agents in NetLogo. the mobile agents in NetLogo), while patches and links are not considered agents (and the observer is not even mentioned). Note that in many descriptions of agent-based models, the word agent is used only to refer to the turtles (i.e. The observer: There is only one observer and it does not have a location. You can think of the observer as the conductor of the whole NetLogo orchestra. ![]() Links can be directed (from one turtle to another turtle) or undirected (one turtle with another turtle). Links: Links are agents that connect two turtles.Each patch is a square piece of “ground” over which turtles can move. Patches: The NetLogo world is two-dimensional and is divided up into a grid of patches.The NetLogo world is made up by four types of agents (see figure 2), i.e.: The NetLogo world is made up of turtles, patches, links and the observer. We say most because in some models part of the code is included within the plots in the interface tab. The Info tab can be used to include the documentation of the model.įinally, the code tab contains most of the code of the model. It often contains buttons, sliders, switches, plots… Most models include a button labeled setup, which is used to initialize the model, and another button labeled go, which is used to run the model. The interface tab is used to run the model. Top bar of the NetLogo Interface tab, where you can select the tab you want to see. The main window of NetLogo contains three tabs, i.e. the interface tab, the info tab and the code tab (see figure 1). For future reference, you may wish to download our NetLogo quick guide, which is a 6-page pdf file containing the main concepts outlined here. Very basicsįeel free to skip this section if you are already familiar with NetLogo. The following table provides links to the different aspects of NetLogo programming that we cover here. By no means do we claim originality on the content of this section all credit should go to Uri Wilensky and his team. It is strongly based on the excellent NetLogo user manual, version 6.1.1 (Wilensky, 2019). ![]() ![]() This section provides a succinct overview of the fundamentals of NetLogo. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |