

Is the resulting model useful? If so, how? What do Railsback and Grimm say is a "common mistake of beginners"?.To what extent would you characterize the model outcomes as emergent? In chapter 1, how do Railsback and Grimm define "emergence"?.There is still the fact that realistic lists of goals will be produced by some kind of planner, but that is another story. The complete NetLogo file can be found at found at Modeling Commons. Set goal ( sentence goal ( read-from-string new-goal)) Set goal įinally, the interface allows a new goal list, such as, to be added at the end of the existing list (using sentence and read-from-string): to add-goals Set speed (0.1 + (random-float (max-agent-speed - 0.1))) The “setup” button creates some turtles, with an initial list of four goals. The “go” button simply asks all the turtles to execute obey, stopping when there are zero turtles with nonempty goal lists: to go In the case of goto x y and meet a, we remove the appropriate number of elements from the list only if they are satisfied: to obey Let him (one-of (turtles with ))Ĭombining these actions together, an agent performs a single step by checking the first item in the goal list and executing the appropriate command. However, we need to consider the special case of an agent meeting itself (which is satisfied trivially): to-report obey-meet obey "meet agent" command report true when achieved To-report obey-goto obey "goto x y" command report true when achieved The distance d to ( x, y) is greater than the agent’s speed – so that we move forward in the desired direction ( fd speed), but indicate that the goal has not yet been reached ( report false):.The distance d to ( x, y) is less than or equal to the agent’s speed – so that the goal will be reached within one tick.We are already at ( x, y) – only a message is printed.We therefore need a reporter which indicates when the goal has been achieved. The goto x y goal may require multiple steps before it is satisfied.

Unknown goals are satisfied merely with an error message: to obey-unknown Set goal ( sentence (list "goto" new-x new-y) (bf goal )) If the “verbose” checkbox is selected, the new goal is also printed: to obey-scatter The sentence operator is used to combine the three-element list for the goto goal with the rest of the existing goal list. The scatter goal is achieved merely by replacing it by goto x y for random x and y. Since a goal may consist of one, two, or three list items, we use the following utility functions to remove items from the front of the goal list (an alternative approach would be to have a list of lists): to drop-goal Goals are executed in sequence, and removed from the front of the goal list when they are satisfied. meet a – move to the agent with identifier a.goto x y – move in a direct line to the position ( x, y).Id agent id number or name (usually a copy of "who") speed agent speed in cells per tick goal goal listįor demonstration purposes, the goals include only: To facilitate this, we use three agent variables: an identifier id (currently just a copy of the predefined who), an agent speed speed in cells per tick, and a (flat) list goal of goals, looking like : turtles-own [ In this tutorial, we use lists to give agents a sequence of goals. In a previous tutorial, I discussed some of the powerful list-processing facilities in NetLogo.
