So, if we were to just stop right there right, if we just stop after the
the set-up procedure, we
essentially have a world that looks like this right?
Just a straight line of the agents right across the middle of -- well, not the
middle-- but the 100th x-value of the world, right?
But what we want to do is we want to have them actually take some action.
And so let's talk a little bit about what the Go code is
which is the button we would push next to actually start the model up and running
So if you look at the Go code, it basically only does three things, really
The first one says if you have any wealth, then transact.
And if you remember correctly from the beginning, right
we said that in this model, as long as you have a dollar to your name, you're going
to go out and spend it. And you're going to go out and spend it by giving it to one
other random agent in the world, right?
And we'll talk a little bit about that in the next video
where we talk about the transact procedure, right.
But essentially that's all you're going to do.
You're going to ask the turtles with wealth greater than zero, which takes
the set of all turtles and finds the ones who has wealth greater than zero
and then asks them to call to this transact action, right.
However, there's one other small issue we can run into, right?
It is possible as we continue to run our model again and again and again
and I'll speed it up a little bit, right, that we could get some agents that are
going to be way down on the right-hand side of the world
and what we don't want to do is have them actually move off the world, right?
So, we're limited on the left side by zero because our agents can't have less than
zero dollars, we just built that in, they can't spend a dollar they don't have
right, there's no debt in this particular model, right.
But, they could however earn wealth that's greater than 500 dollars, right?
They could make-- they could have a thousand dollar agent, right.
And our world only goes up to 500 dollars worth.
And so, you know I'll continue to run the model and as you can see they're
moving to the right. I don't want
in the interest of time, I'm not going to run it until they actually
hit that level. But,
one little thing you might notice if you actually turn off the view updates
and then speed it up a little bit, if we want
The one thing you might notice is that they could, obviously, they're heading in
that direction and they could hit that edge of the world.
So we add a little bit of code just for display purposes.
This says ask turtles, and this applies to all turtles whether or not their wealth
is greater than zero or not --zero or not--
Which doesn't really matter too much because it's only going to apply to the
ones with the really high wealth. If their wealth is
less than or equal to the max-pxcor, set the xcor to wealth.
In other words, all turtles no matter where you are, as long as you don't have
more than 500 in wealth, right? Then set your xcor equal to your wealth.
So if you have 1 dollar, set it to 1.
If you have 5 dollars, set it to 5, right.
But really the goal here is that we're just updating the visualization and we're
essentially making sure that they don't move too far out of the way.
If we took this out-- if we took this if wealth less than or equal to max xcor
just said set xcor wealth. We get error eventually because we might have an agent
who gets 501 dollars and tries to move off the world, right.
So this is just controlling that fact.
And the final thing we do is say tick.
And all tick does is tell all the graphs and tell the little counter that you see
here at the top of the Netlogo interface that it's time to go onto the next step.
We got a couple agents now, they ran it long enough
they're getting close to that 500 right?
So those are just--that's all the tick does. And that's the Go procedure in a
nutshell, right so very very simple Go procedure
and yet it creates some interesting behavior that we'll see.