Welcome to Introduction to Complexity.
This is a tutorial video for homework number 1, the beginner's option.
Go ahead and open the NetLogo model labelled 'multiple ants.nlogo',
which is available on the course materials section of the website.
once it comes up, the interface should look like this:
and you can go to also the 'info' tab to read about the model,
as well as the code tab, to see how the code is written and to change the code.
So first, let's just walk through the model, see how it works.
Start by pressing 'setup' and then press 'go', and wow,
we see that the model is running very quickly,
so the first thing we should do is slow it down.
Go up to the 'speed' slider at the top of the screen, and we'll move it over
to the left, just a little bit.
Run the model again. Press 'setup' again, and the first question in the homework
is to change the size of the ants. So in NetLogo, all the agents are referred
to as 'turtles'. In this particular model, the 'turtles' are ants.
So 'turtles' and 'ants' are synonomous. Don't get confused by that.
So we'll go to the setup procedure, which is the first procedure in the code.
And, find where it finds set size.
And, we are going to change that from 1 to 2.
It's as simple as that.
We can check the code to make sure
it is error free.
It is.
We'll go back to the interphase and click setup again.
And now you can see the ants are a little bigger.
So, I can press Go to Stop.
And the next question is to eliminate the labels.
We can go back to the interphase.
And we can see each ant has a little numeric label
which refers to how many patches it has eaten.
So we are going to eliminate this label.
We are going to go to the code
and scroll down.
To the go procedure
and find where it has set food eaten
and we will just comment this out.
To comment something out
simple type semi-colon (;) before the line
and that grays out the line
and it is no longer part of the code.
You can still see it
and you can always bring it back by deleting that
semi-colon
So we will go back to the interphase.
Setup, press Go.
and you can see the labels are now disappeared
So the next question is to change the color of the ants.
depending on how much food they have eaten.
So, go back to the code.
and just below that last line.
We will add another line
We will insert the cursor here.
And we will write a true-false statement.
Then, a command statement
So first let's say if food eaten is greater than 2.
That is either true or false.
then the command, which requires
it be in brackets.
Be to set the color blue.
Close bracket.
let's check that.
It looks ok.
We will go to the interphase.
And now we scan see some of the ants turn blue.
After they have eaten more than two patches.
So now we are asked again to change
the color of the ant when it has eaten
four green patches
this is basically the same code
if food eaten is greater than four
bracket, set color yellow, close bracket.
That's a bracket.
Check.
Back to the interphase.
Setup. Go.
and you can see now that there are some yellow
ants as well,
So we have red, yellow, and blue ants.
A variety of different fed ants.
And that includes the beginner section of homework one.