Computer Science- Netlogo Primitives Flashcards
(23 cards)
ca
- observer
- clear all, kills all living entities and sets all vars to defeault
crt
- observer
- creates n turtles, placed at the origin with random headings
fd
- turtle
- move forward n units
lt
- turtle
- move left n degrees
rt
- turtle
- move right n degrees
pd
- turtle
- lower the pen to “paper” (pen down), starts tracing
pu
- turtle
- stops tracing, pen up
random
- observer
- if n is positive, returns [0, n)
- if n is negative, returns (n, 0]
who
- immutable turtle attribute
- who # will not be reassigned until ca
other
returns agentset without calling agent
die
- turtle
- kills turtles
ask
- allows communication across contexts
- its command block is issued from 1 or more entities to 1 or more entities
mod
- obs context
- residue of num1 / num2 , similar to remainder but different results for negative numbers
- equivalent to: num1 - (floor (num1/num2)) * num2
floor
- observer
- reports largest integer less than or equal to number
neighbors
returns agentset of neighboring patches
count
- turtle/patch/link
- reports the number of agents in the given agentset
with
- allows for specifying a subset of an agentset
- agentset WITH [reporter]
breed [ ]
defines a breed
-own [var1 …]
defines variables/ attributes belonging to each turtle, patch, breed, etc.
mouse-down?
reports true if mouse button is down, false otherwise
mouse-xcor and mouse-ycor
- reports the x or y coordinate of the mouse in 2-D view
- in terms of turtle coordinates (may not be an integer)
scale-color
- ask agent [set (p)color scale-color color # range1 range2]
- if range1 < range2, greater number = lighter shade
- number < range1, darkest shade of color is chosen
- number > range2, lightest shade of color is chosen
shade-of? color1 color2
reports true if both colors are shades of one another