MIS 585 Special Topics in MIS Agent-Based Modeling NetLogo: Summary of Manual and Dictionary.

Slides:



Advertisements
Similar presentations
Why not just use Arrays? Java ArrayLists.
Advertisements

NETLOGO LISTS Or… James says, fput THIS!. What are LISTS? Shopping list Address list DNA sequences Any collection of similar or dissimilar things Often.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Netlogo! NetLogo is a programmable modeling environment for simulating complex systems. Modelers can give instructions to hundreds or thousands of independent.
13 giugno 2006Master in economia e politica sanitaria - Simulazione per la sanità 1 _Strumenti, seguito _______________________________________ Un modello.
Netlogo and its Relatives Logo (Papert) –Language for teaching mathematics graphically –Tell turtle how to move Starlogo (Resnick) & StarlogoT (Wilensky)
RAPTOR Syntax and Semantics By Lt Col Schorsch
Chapter 7 Introduction to Procedures. So far, all programs written in such way that all subtasks are integrated in one single large program. There is.
Introduction to Computing Science and Programming I
Day 1 Goal: To create a model of people hunting in the forest for mushrooms and then start working on improving their mushroom hunting ability mathematically.
String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Dr. Yang, Qingxiong (with slides borrowed from Dr. Yuen, Joe) LT4: Control Flow - Loop CS2311 Computer Programming.
New Mexico Computer Science For All Breeds and Shapes in NetLogo Maureen Psaila-Dombrowski.
CSE 1301 Lecture 6B More Repetition Figures from Lewis, “C# Software Solutions”, Addison Wesley Briana B. Morrison.
10-Jun-15 Just Enough Java. Variables A variable is a “box” that holds data Every variable has a name Examples: name, age, address, isMarried Variables.
Loops – While, Do, For Repetition Statements Introduction to Arrays
ECE122 L11: For loops and Arrays March 8, 2007 ECE 122 Engineering Problem Solving with Java Lecture 11 For Loops and Arrays.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
© 2004 Pearson Addison-Wesley. All rights reserved5-1 Iterations/ Loops The while Statement Other Repetition Statements.
CMPT 120 Lists and Strings Summer 2012 Instructor: Hassan Khosravi.
Department of Computer Science What is NetLogo UH-DMML  Multi-agent programmable modeling environment  Well suited for modeling complex systems evolving.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Week 11 DO NOW QUESTIONS. An ask turtles block is a set of instructions that is issued to every turtle. Even though computers can do things very quickly,
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Chapter 2 - Algorithms and Design
An Introduction to NetLogo Gabriel Wurzer, Vienna University of Technology AnthropologischeGesellschaftWien.
Chapter 1 - Getting to know Greenfoot
Logo For beginners By Dali Matthews 9S What is logo?
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Collecting Things Together - Lists 1. We’ve seen that Python can store things in memory and retrieve, using names. Sometime we want to store a bunch of.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
Class 2Intro to Databases Goals of this class Include & Require in PHP Generating Random Numbers in PHP Arrays – Numerically Indexed and Associative Program.
CPS120: Introduction to Computer Science Decision Making in Programs.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
New Mexico Computer Science For All Variables and Scope Maureen Psaila-Dombrowski.
Loops (cont.). Loop Statements  while statement  do statement  for statement while ( condition ) statement; do { statement list; } while ( condition.
MIS 585 Special Topics in IMS Agent-Based Modeling Bertan Badur Department of Management Information Systems Boğaziçi University.
Think Possibility 1 Iterative Constructs ITERATION / LOOPS C provides three loop structures: the for-loop, the while-loop, and the do-while-loop. Each.
MIS 585 Special Topics in MIS: Agent-Based Modeling 2015/2016 Fall.
1 b Boolean expressions b truth tables b conditional operator b switch statement b repetition statements: whilewhile do/whiledo/while forfor Lecture 3.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
Chapter 2: Fundamental Programming Structures in Java Adapted from MIT AITI Slides Control Structures.
Perl for Bioinformatics Part 2 Stuart Brown NYU School of Medicine.
M10 WS11:Krankenhausbedarfsplanung The World as We See It given by Gabriel Wurzer and Wolfgang E. Lorenz
Think Automation and beyond… FT1A Script Programming.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
M10 WS11:Krankenhausbedarfsplanung More, More and Even-More More given by Gabriel Wurzer and Wolfgang E. Lorenz
String and Lists Dr. José M. Reyes Álamo.
Management Information Systems
REPETITION CONTROL STRUCTURE
MIS 643 Agent-Based Modeling NetLogo: Summary of Manual and Dictionary.
Introduction To Repetition The for loop
Management Information Systems
Chapter 5 - Control Structures: Part 2
EGR 2261 Unit 4 Control Structures I: Selection
MIS 643 Agent-Based Modeling and Simulation 2016/2017 Fall.
Learning to program with Logo
While loops The while loop executes the statement over and over as long as the boolean expression is true. The expression is evaluated first, so the statement.
Arrays, For loop While loop Do while loop
String and Lists Dr. José M. Reyes Álamo.
Using Logo and Logic This presentation uses a version of Logo called StarLogo available through MIT. It can be downloaded for free and installed on your.
For loops Taken from notes by Dr. Neil Moore
creating a ecosystems model in net logo
Class code for pythonroom.com cchsp2cs
Presentation transcript:

MIS 585 Special Topics in MIS Agent-Based Modeling NetLogo: Summary of Manual and Dictionary

Outline 1.procedures 2.variables 3.ask 4.agentsets 5.breeds 6.lists 7.NetLogo Dictionary

1. Procedures – with inputs put input names in square brackets after the procedure name. to draw-polygon [num-sides len] ;; turtle procedure pen-down repeat num-sides [ fd len rt 360 / num-sides ] end use the procedure by asking the turtles to each draw an octagon with a side length equal to its who number: ask turtles [ draw-polygon 8 who ]

Procedures – Reporters to-report - to begin procedure. in the body of the procedure, - report to report the value you want to report. to-report absolute-value [number] ifelse number >= 0 [ report number ] [ report (- number) ] end

2. Variables global – observer – every agent can see or manipulate –declered - globals [total-enery] agent variables –turtle, patch, link – for each agent one variable –turles-own [energy speed] initial values are 0 set for assignment –ask turtles [set pcolor red] turtles can reach and manipulate patch variables they are currently on of : agents can reach variables of other agents –show [color] of turtle 5 –show [xcor + ycor] of turtle 5

Variables – local variables in procedures or blocks Example: to swap-colors [turtle1 turtle2] let temp [color] of turtle1 ask turtle1 [ set color [color] of turtle2 ] ask turtle2 [ set color temp ] end

Variables - types numeric – no distiction between integer or float boolean – true false string – string of characters in “” color – from 0 to agent or agentset list Constants –boolean – true false –mathematical – e,pi –color – red blue balck yellow

tick counter reset-ticks tick, tick-advance ticks : variable

3. ask to give commands to turtles, patches, and links contex change to turtles patches or links Example: to setup clear-all create-turtles 100 ;; create 100 turtles with random headings ask turtles [ set color red ;; turn them red fd 50 ] ;; spread them around ask patches [ if pxcor > 0 ;; patches on the right side [ set pcolor green ] ] ;; of the view turn green reset-ticks end

asking individual agents to setup clear-all crt 3 ;; make 3 turtles ask turtle 0 ;; tell the first one... [ fd 1 ] ;;...to go forward ask turtle 1 ;; tell the second one... [ set color green ] ;;...to become green ask turtle 2 ;; tell the third one... [ rt 90 ] ;;...to turn right

asking individual agents ask patch 2 -2 ;; ask the patch at (2,-2) [ set pcolor blue ] ;;...to become blue ask turtle 0 ;; ask the first turtle [ ask patch-at 1 0 ;;...to ask patch to the east [ set pcolor red ] ] ;;...to become red ask turtle 0 ;; tell the first turtle... [ create-link-with turtle 1 ] ;;...make a link with the second ask link 0 1 ;; tell the link between turtle 0 and 1 [ set color blue ] ;;...to become blue reset-ticks end

who number who number – every turtle has an who number stating from 0 turtle number number patch x y –identified with their x and y coordinates link who1 who2 –which tukrtles it is connecting

4. agentsets a set of agents containing –turtles, patches or links –but not more than one type at once in a random order turtles - reports agentset of all turtles patches - << << patches links - << << links also some tutrles, patches or links –turtles with color red –pathces on the positive quadrant - pxor>0 and pyor>0 –turtles-here, turtles-at, tutles-on

forming agentsets ;; all other turtles: other turtles ;; all other turtles on this patch: other turtles-here ;; all red turtles: turtles with [color = red] ;; all red turtles on my patch turtles-here with [color = red] ;; patches on right side of view patches with [pxcor > 0]

forming agentsets (2) ;; all turtles less than 3 patches away turtles in-radius 3 ;; the four patches to the east, north, west, and south patches at-points [[1 0] [0 1] [-1 0] [0 -1]] ;; shorthand for those four patches neighbors4 ;; turtles in the first quadrant that are on a green patch turtles with [(xcor > 0) and (ycor > 0) and (pcolor = green)] ;; turtles standing on my neighboring four patches turtles-on neighbors4 ;; all the links connected to turtle 0 [my-links] of turtle 0

what can be done? Use ask to make the agents in the agentset do something Use any? to see if the agentset is empty Use all? to see if every agent in an agentset satisfies a condition. Use count to find out exactly how many agents are in the set

any? any? agentset –Reports true if the given agentset is non- empty, false otherwise. Equivalent to "count agentset > 0", but more efficient (and arguably more readable). if any? turtles with [color = red] [ show "at least one turtle is red!" ]

what else can be done? Pick a random agent from the set using one-of. For example, we can make a randomly chosen turtle turn green: –ask one-of turtles [ set color green ] tell a randomly chosen patch to sprout a new turtle: –ask one-of patches [ sprout 1 ]

what else can be done? (2) Use the max-one-of or min-one-of reporters to find out which agent is the most or least along some scale. For example, to remove the richest turtle, you could say ask max-one-of turtles [sum assets] [ die ]

max-one-of max-one-of agentset [reporter] Reports the agent in the agentset that has the highest value for the given reporter. If there is a tie this command reports one random agent with the highest value. If you want all such agents, use with-max instead. show max-one-of patches [count turtles-here] ;; prints the first patch with the most turtles on it

with-max agentset with-max [reporter] Takes two inputs: on the left, an agentset (usually "turtles" or "patches"). On the right, a reporter. Reports a new agentset containing all agents reporting the maximum value of the given reporter. show count patches with-max [pxcor] ;; prints the number of patches on the right edge

what else can be done? (3) Use of to make a list of values, one for each agent in the agentset. Then use one-of NetLogo's list primitives to do something with the list. (See the "Lists" section below.) For example, to find out how rich turtles are on the average, you could say show mean [sum assets] of turtles

what else can be done? (4) Use turtle-set, patch-set and link- set reporters to make new agentsets by gathering together agents from a variety of possible sources. Use no-turtles, no-patches and no- links reporters to make empty agentsets. Check whether two agentsets are equal using = or !=. Use member? to see whether a particular agent is a member of an agentset.

one-of one-of agentset one-of list From an agentset, reports a random agent. If the agentset is empty, reports nobody. From a list, reports a random list item. It is an error for the list to be empty. ask one-of patches [ set pcolor green ] ;; a random patch turns green ask patches with [any? turtles-here] [ show one-of turtles-here ] ;; for each patch containing turtles, prints one of those turtles ;; suppose mylist is [ ] show one-of mylist ;; prints a value randomly chosen from the list

of [reporter] of agent [reporter] of agentset For an agent, reports the value of the reporter for that agent (turtle or patch). show [pxcor] of patch 3 5 ;; prints 3 show [pxcor] of one-of patches ;; prints the value of a random patch's pxcor variable show [who * who] of turtle 5 => 25 show [count turtles in-radius 3] of patch 0 0 ;; prints the number of turtles located within a ;; three-patch radius of the origin

of agentset For an agentset, reports a list that contains the value of the reporter for each agent in the agentset in random order). crt 4 show sort [who] of turtles => [ ] show sort [who * who] of turtles => [ ]

turtle-set turtle-set value1 (turtle-set value1 value2...) Reports an agentset containing all of the turtles anywhere in any of the inputs. The inputs may be individual turtles, turtle agentsets, nobody, or lists (or nested lists) containing any of the above. turtle-set self (turtle-set self turtles-on neighbors) (turtle-set turtle 0 turtle 2 turtle 9) (turtle-set frogs mice)

patch-set patch-set value1 (patch-set value1 value2...) Reports an agentset containing all of the patches anywhere in any of the inputs. The inputs may be individual patches, patch agentsets, nobody, or lists (or nested lists) containing any of the above. patch-set self patch-set patch-here (patch-set self neighbors) (patch-set patch-here neighbors) (patch-set patch 0 0 patch 1 3 patch 4 -2) (patch-set patch-at -1 1 patch-at 0 1 patch-at 1 1) patch-set [patch-here] of turtles patch-set [neighbors] of turtles

Special agentsets observer> clear-all observer> create-turtles 5 observer> set g turtles observer> print count g 5 observer> create-turtles 5 observer> print count g 10 observer> set g turtle-set turtles observer> print count g 10 observer> create-turtles 5 observer> print count g 10 observer> print count turtles 15

5. Breeds breeds of tutrles or links behave differently –sheep or wolves breed key word breed [volves volf] breed [sheep a-sheep] in gnereal breed [pulural singular] singular form - pulural form

define a breed: –breed [sheep a-sheep] create-sheep, hatch-sheep, sprout- sheep, sheep-here, sheep-at, sheep-on, is-a- sheep?. define new variables for breed: s heep-own [... ] tutle breeds – breed variable stores breed if breed = wolves [... ] can be tested ask one-of wolves [ set breed sheep ] can be changed

breeds – who numbers who numbers assigned irrispective of breeds breed [mice mouse] breed [frogs frog] mice-own [cheese] to setup clear-all create-mice 50 [ set color white set cheese random 10 ] create-frogs 50 [ set color green ] reset-ticks end

6. Lists single variables e.g. numeric, strings –holds one pice of information lists –multiple pices of information heterogenuous –boolean, number, string, agent, agentset, list List related primitives but-first, but-last, empty?, filter, first, foreach, fput, histogra m, is- list?, item, last, length, list, lput, map, member?, modes, n-of, n-values, of, position, one-of, reduce, remove, remove- duplicates, remove-item, replace-item, reverse, sentence, shuffle, sort, sort-by, sort-on, sublist

Constant lists e.g. set mylist [ ] lists within lists: [[2 4] [3 5]] empty list: []

Building lists on the fly list accepts two reporters run them and form a list e.g.: list from two random numbers list (random 10) (randonm 20) for one or mere then three reporters use paranthesis (list random 10) (list random 10 random 10 random 10)

list list value1 value2 (list value1...) Reports a list containing the given items. The items can be of any type, produced by any kind of reporter. show list (random 10) (random 10) => [4 9] ;; or similar list show (list 5) => [5] show (list (random 10) (random 10)) => [ ] ;; or similar list

Varying number of inputs Some commands and reporters involving lists and strings may take a varying number of inputs. In these cases, in order to pass them a number of inputs other than their default, the primitive and its inputs must be surrounded by parentheses. Here are some examples:

examples show list 1 2 => [1 2] show (list ) => [ ] show (list)  [] special commands - default number of inputs. list, word, sentence, map, foreach.

n-values n-values size reporter-task Reports a list of length size containing values computed by repeatedly running the task. If the task accepts inputs, the input will be the number of the item currently being computed, starting from zero. show n-values 5 [1] => [ ] show n-values 5 [?] => [ ] show n-values 3 turtle => [(turtle 0) (turtle 1) (turtle 2)] show n-values 5 [? * ?] => [ ]

of primitieve again of primitive take an agentset and produce a list applying the reporter to the set max [...] of turtles sum [...] of turtles

sentence sentence value1 value2 (sentence value1...) Makes a list out of the values. If any value is a list, its items are included in the result directly, rather than being included as a sublist. show sentence 1 2 => [1 2] show sentence [1 2] 3 => [1 2 3] show sentence 1 [2 3] => [1 2 3] show sentence [1 2] [3 4] => [ ] show (sentence [[1 2]] [[3 4]]) => [[1 2] [3 4]] show (sentence [1 2] 3 [4 5] (3 + 3) 7) => [ ]

list and sentence show list [1 2] 3 => [1 2] 3] show sentence [1 2] 3 => [1 2 3]

Changing list items can't be modified replace-item set mylist [2 7 5 “ Bob ” [ ]] ; mylist is now [2 7 5 “ Bob ” [3 0 -2]] set mylist replace-item 2 mylist 10 ; mylist is now [ “ Bob ” [3 0 -2]]

replace-item replace-item index list value replace-item index string1 string2 On a list, replaces an item in that list. index is the index of the item to be replaced, starting with 0. for a string, but the given character of string1 removed and the contents of string2 spliced

replace-item show replace-item 2 [ ] 15 => [ ] show replace-item 1 "cat" "are" => "caret"

adding or droping items To add an item, say 42, to the end of a list, use the lput reporter. ( fput adds an item to the beginning of a list.)

adding or droping items set mylist lput 42 mylist ; mylist is now [ “ Bob ” [3 0 -2] 42] The but-last (bl) for short) reporter reports all the list items but the last. set mylist but-last mylist ; mylist is now [ “ Bob ” [3 0 -2]]

to get rid of item 0, the 2 at the beginning of the list. set mylist but-first mylist ; mylist is now [7 10 Bob [3 0 -2]]

to change the third item that's nested inside item 3 from -2 to 9? The key is to realize that the name that can be used to call the nested list [3 0 -2] is item 3 mylist. Then the replace-item reporter can be nested to change the list-within-a-list. The parentheses are added for clarity. set mylist (replace-item 3 mylist (replace-item 2 (item 3 mylist) 9)) ; mylist is now [7 10 Bob [3 0 9]]

item item index list item index string On lists, reports the value of the item in the given list with the given index. On strings, reports the character in the given string at the given index. Note that the indices begin from 0, not 1. (The first item is item 0, the second item is item 1, on.)

item ;; suppose mylist is [ ] show item 2 mylist => 6 show item 3 "my-shoe" => "s"

Iterating over lists foreach command map reporter.

foreach examples (1) foreach - run a command or commands on each item in a list. foreach [1 2 3] show or foreach [1 2 3] [show ? ] => 1 => 2 => 3 foreach [2 4 6] [ crt ? show (word "created " ? " turtles") ] => created 2 turtles => created 4 turtles => created 6 turtles In the block, the variable ? holds the current value from the input list.

foreach examples (2) foreach [1 2 3] [ ask turtles [ fd ? ] ] ;; turtles move forward 6 patches foreach [true false true true] [ ask turtles [ if ? [ fd 1 ] ] ] ;; turtles move forward 3 patches

foreach foreach list command-task (foreach list1... command-task) With a single list, runs the task for each item of list. foreach [ ] show => 1.1 => 2.2 => 2.6 foreach [ ] [ show (word ? " -> " round ?) ] => 1.1 -> 1 => 2.2 -> 2 => 2.6 -> 3

foreach: multiple list With multiple lists, runs commands for each group of items from each list. So, they are run once for the first items, once for the second items, and so on. All the lists must be the same length. (foreach [1 2 3] [2 4 6] [ show word "the sum is: " (?1 + ?2) ]) => "the sum is: 3"  "the sum is: 6“ =>"the sum is: 9"

foreach: multiple list (foreach list (turtle 1) (turtle 2) [3 4] [ ask ?1 [ fd ?2 ] ]) ;; turtle 1 moves forward 3 patches ;; turtle 2 moves forward 4 patches

iterating over lists - map map - reporter. It takes an input list and a reporter name or reporter block. show map round [ ] ;; prints [1 2 3] map reports a list containing the results of applying the reporter to each item in the input list. Again, use ? to refer to the current item in the list.

iterating over lists – map (cont.) show map [? < 0] [ ] ;; prints [false true false false true true] show map [? * ?] [1 2 3] ;; prints [1 4 9] Besides map and foreach, other primitives for processing whole lists in a configurable way include filter, reduce, and sort-by.

map map reporter-task list (map reporter-task list1...) With a single list, the given task is run for each item in the list, and a list of the result are collectedand reported. show map round [ ] => [1 2 3] show map [? * ?] [1 2 3] => [1 4 9]

map: multiple list With multiple lists, the given reporter is run for each group of items from each list. So, it is run once for the first items, once for the second items, and so on. All the lists must be the same length. show (map + [1 2 3] [2 4 6]) => [3 6 9] show (map [?1 + ?2 = ?3] [1 2 3] [2 4 6] [3 5 9]) => [true false true]

Lists of agents sort and sort-by. take an agentset as input. The result is always a new list, in a particular order. sorting: – turtles - list of turtles - in ascending order by who number. – patches - list of patches sorted left-to-right, top-to- bottom. – links - list of links, sorted in ascending order first by end1 then by end2 any remaining ties are resolved by breed in the order they are declared in the Code tab. descending order - reverse with sort reverse sort turtles.

Lists of agents sort-by ordered by some other criterion sort-by sort-by [[size] of ?1 < [size] of ?2] turtles list of turtles sorted in ascending order by their turtle variable size.

sort sort list sort agentset Reports a sorted list of numbers, strings, or agents. If the input contains no numbers, strings, or agents, the result is the empty list. If the input contains at least one number, the numbers in the list are sorted in ascending order and a new list reported; non-numbers are ignored. Or, if the input contains at least one string, the strings in the list are sorted in ascending order and a new list reported; non-strings are ignored. Or, if the input is an agentset or a list containing at least one agent, a sorted list of agents (never an agentset) is reported; non-agents are ignored. Agents are sorted in the same order the < operator uses.

sort examples show sort [ ] => [ ] let n 0 foreach sort patches [ ask ? [ set plabel n set n n + 1 ] ;; patches are labeled with numbers in left-to-right, ;; top-to-bottom order

sort-by sort-by reporter-task list sort-by reporter-task agentset If the input is a list, reports a new list containing the same items as the input list, in a sorted order defined by the boolean reporter task.

sort-by The two inputs to the reporter task are the values being compared. The task should report true if ?1 comes strictly before ?2 in the desired sort order, and false otherwise. If the input is an agentset or a list of agents, reports a list (never an agentset) of agents. If the input is a list, the sort is stable, that is, the order of items considered equal by the reporter is not disturbed. If the input is an agentset, ties are broken randomly.

sort-by examples show sort-by < [ ] => [ ] show sort-by > [ ] => [ ] show sort-by [length ?1 < length ?2] ["Grumpy" "Doc" "Happy"] => ["Doc" "Happy" "Grumpy"]

sort-on sort-on [reporter] agentset Reports a list of agents, sorted according to each agent's value for reporter. Ties are broken randomly. The values must be all numbers, all strings, or all agents of the same type.

sort-on examples crt 3 show sort-on [who] [turtles] => [(turtle 0) (turtle 1) (turtle 2)] show sort-on [(- who)] [turtles] => [(turtle 2) (turtle 1) (turtle 0)] foreach sort-on [size] turtles [ ask ? [ do-something ] ] ;; turtles run "do-something" one at a time, in ;; ascending order by size

Asking a list of agents foreach and ask commands in combination: foreach sort turtles [ ask ? [... ]; end of ask ]; end of foreach ask each turtle in ascending order by who number. Substitute "patches" for "turtles" to ask patches in left-to-right, top-to-bottom order.

turtles moving tutles reporting patches from turtles obtaining information obut patche tutles towardsxy x y –returns heading form x and y face

turtles tutles-at dx dy –reports tutles dx dy away form turle or pathc turtles-here -here –reoprt tutles at patch tutles-on agent(set) -on agent(set) –turtles on the given agent or agent set

back (bk) -at -here -on can-move? clear-turtles (ct) create- create-ordered- create-ordered-turtles (cro) create-turtles (crt) die distance distancexy downhill downhill4 dx dy face facexy forward (fd) hatch hatch- hide-turtle (ht) home inspect is- ? is-turtle? jump layout-circle left (lt) move-to myself nobody no-turtles of other

patch-ahead patch-at patch-at-heading-and-distance patch-here patch-left-and-ahead patch-right-and-ahead pen-down (pd) pen-erase (pe) pen-up (pu) random-xcor random-ycor right (rt) self set-default-shape __set-line-thickness setxy shapes show-turtle (st) sprout sprout- stamp stamp-erase subject subtract-headings tie towards towardsxy turtle turtle-set turtles turtles-at turtles-here turtles-on turtles-own untie uphill uphill4

inspect layout-circle set-default-shape __set-line-thickness shapes stamp stamp-erase subject subtract- headings tie turtles-own untie

tutrles - creation creating or dieing turtles or breeds create-, create-ordered- <breeds, create-ordered-turtles (cro), create-turtles (crt), die hatch hatch- sprout sprout- clear-turtles (ct)

-at -here - on turtle turtle-set turtles turtles-at turtles-here turtles-on no-turtles

turtles - movement back (bk), forward (fd), jump –t forward num, t jump num left (lt), right (rt) face facexy –t face agent, t facexy num1 num2 –t right angle move-to –t – move-to agent

turtles - movement setxy, random-xcor random-ycor home downhill, downhill4, uphill, uphill4 boolean –can-move,

turtles - information distance distancexy towards towardsxy dx dy is- ? is-turtle?

turtles - information patch-ahead patch-at patch-at-heading- and-distance patch-here patch-left-and- ahead patch-right-and-ahead turtles-at -at turtles-here -here turtles-on -on –from turtles or patches to set of turtles or breeds

pen-down (pd) pen-erase (pe) pen-up (pu) hide-turtle (ht) show-turtle (st), show- turtle (st) show-turtle (st) show-turtle (st)

patches clear-patches (cp) diffuse diffuse4 distance distancexy import-pcolors import-pcolors-rgb inspect is-patch? myself neighbors neighbors4 nobody no-patches of other patch patch-at patch-ahead

patches patch-at-heading-and-distance patch- here patch-left-and-ahead patch-right- and-ahead patch-set patches patches-own random-pxcor random-pycor self sprout sprout- subject turtles-here

patches diffuse diffuse4 import-pcolors import- pcolors-rgb inspect patch-at patch-ahead  patch-at-heading-and-distance patch- here patch-left-and-ahead patch-right- and-ahead patches patches-own random-pxcor random-pycor sprout sprout- subject turtles-here

clear-patches (cp)

distance distancexy neighbors neighbors4 is-patch?

no-patches patch patch-set

agentsets nobady no-patches patches patch patch-set

all? any? ask ask-concurrent at-points -at -here - on count in-cone in-radius is-agent? is-agentset? is- patch-set? is-turtle-set? link-heading link-length link-set

link-shapes max-n-of max-one-of member? min-n-of min-one-of n-of neighbors neighbors4 no-patches no-turtles of one-of other patch-set patches sort sort-by sort-on turtle-set turtles with with-max with-min turtles-at turtles- here turtles-on

Important other of with self myself

Control flow andlogic and ask ask-concurrent carefully end error error-message every if ifelse ifelse-value let loop not or repeat report run runresult ; (semicolon) set stop startup to to-report wait while with-local-randomness without- interruption xor

Control flow andlogic carefully error error-message run runresult ; (semicolon) startup every wait with-local-randomness without- interruption

assignment let set

condition if ifelse ifelse-value and not or xor

flow control ask ask-concurrent to to-report end report stop while loop repeat

Task filter foreach is-command-task? is- reporter-task? map n-values reduce run runresult sort-by task

List but-first but-last empty? filter first foreach fput histogram is-list? item last length list lput map member? modes n-of n-values of position one-of reduce remove remove- duplicates remove-item replace-item reverse sentence shuffle sort sort-by sort-on sublist

List but-first but-last empty? filter first foreach fput histogram is-list? item last length list lput map member? modes n-of n-values of position one-of reduce remove remove- duplicates remove-item replace-item reverse sentence shuffle sort sort-by sort-on sublist

String Operators (, =, !=, =) but- first but-last empty? first is-string? item last length member? position remove remove-item read- from-string replace-item reverse substring word

String Operators (, =, !=, =) but- first but-last empty? first is-string? item last length member? position remove remove-item read- from-string replace-item reverse substring word

Mathematical (1) Aritmetic operators: –+, -, *, /, mod, ^; =; !=,, =

Mathematical (1)

functions: take a number, proces it and reports another number –abs, acos, asin, atan, celling cos e –trigonometric/inverse trigonometirc:cos, sin, ta acos, asin, atan –logarithmic/exponentioal: exp, ln, log- e –Verious funcitons: ceillin, floor, int, precision, remainder, round, sqrt, substract-headings

–boolean: is-number? –random number generations: random, random-exponential, randonm-floa random-normal, random-poisson, random- seed, new-seed

Mathematical (2) primitives taking a list of numbers and reporting a number –mean, max, min, median, modes, standart- deviation, variabce, sum constants: –e,pi