CSCI 1006 Lecture Notes - Lecture 8: Empty Set, Cyan
➢ Mod (like remainder) 21 mod 4 = 1
➢ If statements are not connected. Each if statement is performed individually. It is
possible for nothing to happen. Ifelse is necessary to interconnect the
statements.
➢ Ifelse (random 4 = 0) [set pcolor magenta]
➢ [ifelse (random 3 = 0)
➢ [set pcolor cyan]
➢ [ifelse (random 2 = 0)
➢ [set pcolor violet]
➢ [set pcolor lime]]]
➢ Count agentset
➢ Returns the total number of agents in the given set
➢ Count patches = 1089
➢ Agentset with condition
o Returns an agent set that only contains the agents that satisfy the
condition
o Patches with [pcolor = magenta]
o The empty set is called ‘nobody’ (if no agents satisfy)
➢ Wiggle- Common name for a custom procedure that creates random turtle
movement
find more resources at oneclass.com
find more resources at oneclass.com
Document Summary
Mod (like remainder) 21 mod 4 = 1. Ifelse (random 4 = 0) [set pcolor magenta] Returns the total number of agents in the given set. Agentset with condition: returns an agent set that only contains the agents that satisfy the condition, patches with [pcolor = magenta, the empty set is called nobody" (if no agents satisfy) Wiggle- common name for a custom procedure that creates random turtle movement. It will wait . 1 seconds to perform (for forever buttons) because it will go in a blink of an eye otherwise. For insanity (slider)- smaller numbers are more circular and cover larger area. Going right then left will be straighter. All and only the newly created turtles obey. We can add our own properties to turtles and patches. To add your own property, at the top of the procedures tab: turtles-own [property, patches-own [property] You can declare multiple properties in one line.