In the world of agents, knowing the basic commands is very important. The NetLogo world is made up of four types of agents - turtles, patches, links and observers.
You can think of turtles as humans that walk on a particular space. Since turtles can move, they can be located anywhere at any point in a patch. The location of each turtles can be identified through
xcor
and ycor
variables, which may be in decimals. Turtle agents represent entities and their appearance may vary from other entities. To visually represent these entities, shape variable is used to change its appearance. It holds a string that is the name of the turtle current shape. The image below contains the predefined shapes available in NetLogo.Turtle Shapes |
The size variable holds a number which corresponds to turtle's
visual size. By default, a turtle has the same size with a single patch which is 1. Assigning a bigger size would mean that the turtle is bigger and it may cover more than one patch.
Turtle Heading Values |
Changing the direction the turtle is facing requires a new heading number. This is useful when you want a turtle to make a turn at a particular angle. Take a look at the image above, 0 and 360 will direct the turtle to face north, 90 and -270 to the east, and so on.
If you want a turtle to appear or disappear, hidden? variable should be set to a value either 'true' or 'false'. Even at hidden state, an invisible turtle can switch places and do commands like the visible ones. Also, you can make the turtles appear in the view with label on its side. This text is attached to the turtle and it moves along with the turtle. Labels can change during execution, thus, you can alter its content whenever or whatever you want. Label's color can also change, with label-color, you can assign a number greater than or equal to 0 and less than 140. This number
determines what color the turtle label appears in (if it has a label).
Displaying who value as label |
The color variable holds the color of the turtle. This variable can be set to make the turtle change color. Color can be represented either as a single number or an RGB color (a list of 3 numbers).
Turtles can be identified thru who variable. It holds the turtle's "who number" or identification
number. By default who value starts with 0, the who number assigned to each turtles will never change unless clear-all or clear-turtles has been called, which creates new new turtles with new who numbers . You can set this variable with any number greater than or equal to 0.
Turtles can leave trails with pen-mode variable. This variable holds the state of the turtle's pen, which can be "down", to draw trails ; "erase", to erase trails; or "up", to stop either of the actions. The pen-size variable holds the width of the line when pen-mode is either "up" or "down".
Turtles can have groups or breeds-- you can create group of human breeds, robot breeds or alien breeds. The breed variable indicates which group the turtle belongs. For turtles that do not have any particular breed, they belong to turtles agentset. You can set this variable to change a turtle or link's breed.
Turtles can leave trails with pen-mode variable. This variable holds the state of the turtle's pen, which can be "down", to draw trails ; "erase", to erase trails; or "up", to stop either of the actions. The pen-size variable holds the width of the line when pen-mode is either "up" or "down".
Turtles can have groups or breeds-- you can create group of human breeds, robot breeds or alien breeds. The breed variable indicates which group the turtle belongs. For turtles that do not have any particular breed, they belong to turtles agentset. You can set this variable to change a turtle or link's breed.
0 comments:
Post a Comment