so before we get into the actual code in
too much depth I want to talk a little
bit about how we control netlogo code
so we've talked a lot about the agents
and their structure and everything along
those lines but we haven't talked too
much about actually controlling the flow
so one thing that's fundamental to the
notion of an agent-based model is and is
really embedded within that logo but not
required is this notion of an initiation
phase and then in an iteration phase
write an initialization iteration phase
right
and in that logo the way that it's
suggested that you do that is by
creating a set up procedure and a go
procedure and now as you noticed in the
past right we have all these set up and
build buttons right and we've talked a
little bit about the set up and go code
right and those are kind of a great
example of how you might do this
initialization phase in this iteration
so we're gonna show you we're going to
divide down this model and split up this
model into a setup phase and it go phase
but there are a bunch of other commands
that also control and are related to
kind of be set up and go these initial
Asian initialization and iteration
phases so first of all it's the tick and
tick is a command that basically just
says this is the end of one of the
iteration phases it's tiny glance in
next one it just lets net logo know when
to change for instance the graphs right
and when to iterate the little tick
counter that we saw at the top of the
net logo world view right and then
there's if an if Allison if is
essentially conditional right it says if
this is true then do this right and if
else says if this is true then do this
else do this other thing right there's a
command called repeat that we may have
seen that we've seen a little bit of
before which says repeat something a
certain number of times and then there's
finally there's a command called wael
that says while something is true do the
following data loop so these are going
to come into play as we look through the
net logo code but given that kind of
context let me now pause for a second
and just
you what the setup and go code looked
like in the simply economy model and how
they contain some of these elements that
we've just discussed so here I pulled
open the Sybil economy model and the
smile is available under IBM textbook
chapter two in the net logo models
library so if you go up and you go up to
file a file Milo's library and you go
down to chaplain to IBM textbook and
then go down to chapter two it's simply
economy right so you can hit okay open
it up and it will show up in your net
logo application right and what we're
gonna do over the course of the next
couple of videos just go over this model
in detail and show you how it was
constructed right so just to give you an
example right as we mentioned the there
is a set up code and there is some go
code in this procedure and one of the go
codes uses the ask Turtles command that
we've talked about a little bit before
right to execute and it uses the width
right to do a collection of those
turtles right and have them carry out
some actions and here's that if command
that I talked about so if the wealth is
less than or equal to the max px core in
other words if they're about to move off
the screen set their export wealth and
won't get into the details about what
this exactly means and then there's
another one of these control variables
called tick right which control you see
tick usually at the end of every go loop
it tells the model that the time it
wants the next tick right if you'll
notice at the end of the setup procedure
there is a reset ticks command that also
controls when to reset the ticks and
that almost always happens at the end of
every reset danrage setup command right
and at the top of every set of man
there's almost always a clear off
command so the first thing I ever I do
almost inevitably when creating a new
model is type to set up clear all reset
ticks
and right and that kind of starts to
create the model that I need and then
all this type to go tick and and now I
have a basic framework that works for
almost every single got a little go
model right so let's take a second and
we're going to go back and we're going
to look at some of the setup procedure
for this particular model