0% found this document useful (0 votes)
91 views27 pages

Tutorial For Tree Simple (Agent Based Simulation Model Developed Using Netlogo)

This document provides a tutorial on how to use the Tree Simple model, an agent-based simulation developed in NetLogo that generates fractal tree structures. It explains that fractals are self-similar shapes that look the same at different scales. The tutorial outlines the interface components, including buttons, sliders and monitors to control the simulation. It also describes the underlying code that uses turtle agents to recursively generate the fractal pattern through procedures for setup and drawing iterations. Users are encouraged to experiment with different parameter values to create unique fractal tree designs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views27 pages

Tutorial For Tree Simple (Agent Based Simulation Model Developed Using Netlogo)

This document provides a tutorial on how to use the Tree Simple model, an agent-based simulation developed in NetLogo that generates fractal tree structures. It explains that fractals are self-similar shapes that look the same at different scales. The tutorial outlines the interface components, including buttons, sliders and monitors to control the simulation. It also describes the underlying code that uses turtle agents to recursively generate the fractal pattern through procedures for setup and drawing iterations. Users are encouraged to experiment with different parameter values to create unique fractal tree designs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Tutorial

for
Tree Simple (Agent Based
Simulation Model Developed
Using NetLogo)
Presented by:
Muleem Anjum (18-NTU-1189)
Tree Simple
Agenda
• What is Tree simple?
• How it works?
• How to use it?
• Understanding interface
• Things to notice
• Understanding code
• Things to try
(Tree Simple) WHAT IS IT
• This program draws special types of pictures called
fractals. A fractal is a shape that is self-similar - that
is, it looks the same no matter how closely you zoom
in or out. For instance, a tree can be thought of as a
fractal since if you look at the tree as a whole, you
see a stick, that is to say the trunk, with branches
coming out of it. Then if you look at a smaller portion
of it, say a branch, you see a similar thing, namely, a
stick with branches coming out of it.
HOW TO USE IT
In the "Interface" tab,
• SETUP: Set up a fractal that draws a tree.
• GO: Continuously draws the fractal.
• GO ONCE : The fractal can be drawn one step a time.
Once you click the SETUP button, instead of clicking
the GO button, click on the GO ONCE button. This
draws the fractal by drawing one iteration of the
fractal per click as opposed to continuously, like the
GO button.
HOW TO USE IT
• The INIT-X slider : The location of the fractal can be
changed by modifying the value of the sliders. INIT-X
slider sets the initial x coordinate of the first turtle. It
changes the horizontal starting location of the
original turtle.
• The INIT-Y slider sets the initial y coordinate of the
first turtle. It changes the vertical starting location of
the original turtle.
HOW TO USE IT (interfaces are on
next slides
• INIT-COLOR Slider: The color scheme of the fractal
can be changed by modifying the value of the color
sliders. INIT-COLOR slider sets the initial color of the
first turtle. The value of the COLOR-INC slider is
added to the turtles color anytime a new turtle
hatches.
• NUM TURTLES Monitor: It indicates how many
turtles are currently alive. It might be best to limit
the number of iterations to about 8 or 9 of any
particular fractal. If you go much more than that,
NetLogo might run out of memory.
Understanding Interface
In this model, there are 3 buttons, 4 sliders, 1 monitor and
a world (window for showing interactions of agents)
• SETUP: Set up a fractal that draws a tree.
• GO: Continuously draws the fractal.
• GO ONCE : The fractal can be drawn one step a time.
Once you click the SETUP button, instead of clicking the
GO button, click on the GO ONCE button.
• The INIT-X slider : The location of the fractal can be
changed by modifying the value of the sliders. INIT-X
slider sets the initial x coordinate of the first turtle. It
changes the horizontal starting location of the original
turtle.
• The INIT-Y slider sets the initial y coordinate of the
first turtle. It changes the vertical starting location of
the original turtle.
• INIT-COLOR slider: The color scheme of the fractal can
be changed by modifying the value of the color sliders.
INIT-COLOR slider sets the initial color of the first
turtle. The value of the COLOR-INC slider is added to
the turtles color anytime a new turtle hatches.
• NUM TURTLES Monitor: It indicates how many turtles
are currently alive. It might be best to limit the number
of iterations to about 8 or 9 of any particular fractal. If
you go much more than that, NetLogo might run out of
memory.
THINGS TO NOTICE
• The self-similarity of the fractal at each
iteration. The number of turtles is multiplied
by the same number “2” in each iteration.
• The number of turtle at some arbitrary step
is 128.
Understanding Code
• There are two types of variables:
1. Local variable (we declare within
brackets of keyword turtles-own
or patches-own )
Understanding Code …
turtles-own new is Boolean
type variable
because ? is used
[ new? ] to set the type of
variable as
Boolean
setup is
names of the
functions

We use to and
end keywords
for defining
body
(boundaries) of
a function
go is the
name of a
function
Agents used in this model
• There are two agents used in this model:
1. Turtle (shape is “line”)
2. Patches (back-ground has been equally divided into
40401 grids called patches, we can see the patches
settings by clicking on setting button)
1: This line gives a name “setup”
1...
to function (which is called when
user clicks the setup button).
2....
3…..
2: It clears all things of the world
where we see output of our
4.…..
agents
5……
6…… 3: This line creates two turtles
7.… 4: It alerts NetLogo to be ready
8.… to set the properties of the
created two turtles.
9…………
10 ……… 5: It sets turtles shape “line”,
11…. whereas by-default the turtle
12….
shape is:
6: It gives color to the created
line (turtles)
8: It turns the turtle 1 to east
1...
from its current direction
(heading is a built-in turtle
2....
variable. It indicates the direction
3….. the turtle is facing.
4.…..
9:
5……
6…… 10: It tells the NetLogo that
properties of the created turtles
7.…
have been completed.
8.…
11:It resets the tick counter to
9…………
zero, sets up the plot, then
10 ……… updates the plots (so that the
11….
initial state of the world is
12…. plotted)
11:It ends the function body.
Understanding “go” function

1: This line gives a name “go” to


01.. function (which is called when user
clicks the go button that starts the
02….. repeatedly execution of lines 2 to
12).
03… 2: It alerts all created turtles to be
ready to execute lines 4 to 12.
04.…
4 to 6:
05.…. 7 and 12:.

06.…
9:
10:
1…… 11:
12:
2….... 14: It increases the value of
tick by

3……

4.……

5.……
THINGS TO TRY
• Now that you have played around with settings for
the example provided, why not try making your own
tree fractals.
• Use NetLogo commands to make your own fractals
that look like trees.
• Then change the initial color and color increment
values to make the fractal more interesting to look
at.

You might also like