ABM Basics 2 & 3 (1) Flashcards
What does ABM stand for
Agent Based Modelling
In an ABM what do we use to represent the terrain?
Patches
What can turtles do in Netlogo?
Turtles can move, act and change the properties of the patches. Their behaviours and interactions can be defined using set rules, conditions or random events
What is the purpose of the “random” command?
The purpose is to introduce variability or unpredictability into simulations or models
What is a “floating-point number”?
A decimal number (e.g., 0.23)
What would you write to place turtle 0 at a random x-coordinate and y-coordinate = 2 in the command centre?
> ask turtle 0 [set xcor random-xcor set ycor 2]
ask turtle 0 [setxy random-xcor 2]
What is the primary purpose of using conditionals?
To allow agents or patches to make decisions based on conditions
In which situation would you use the IF conditional without an accompanying ELSE?
An agent needs to perform an action if a condition is met; meaning NO ACTION when NOT MET
How can we tell turtles to move forward 2 patches if their colour is red, move forward 1 patch otherwise?
> ask turtles [ ifelse color = red [forward 2] [forward 1] ]
What is the purpose of a list?
A list is meant to group and manage multiple values together
What line of code would you write to create a list called my_list comprising the elements 2 and 3?
set my_list [2 3]
What would you write to add a value (5) to the beginning of an existing list called my_list?
set my_list fput 5 my_list
What would you write to add a value (6) to the end of an existing list called my_list?
set my_list lput 6 my_list
What’s the difference between Global Variable and Local Variable?
Global variables are known to all procedure, local variables are only known to one procedure you are creating the variable in
how can we create a list of 10 random numbers between 0 and 100 using the repeat command?
let the_list []
repeat 10
[
set the_list lput (random 101) the_list
]