This is a tutorial video for homework number 7, the beginner's option. Start by opening up the model labeled fireflies.nlogo. This model is located in the NetLogo models library. Begin by pressing setup and then press go. We can study the behavior of the model. It represents a number of agents which are fireflies and they gradually begin to flash synchronously. You can see this kind of punctuated equilibrium route to synchronicity. Let me stop the model. The interesting thing about this model is that it's based on a pretty simple algorithm which you can study by going to the code tab and you can see that it's pretty short. I'll let you look at that further. But, the homework asks us to insert a lot of code that basically stops the model once all the turtles turn yellow. So to do that, I'll say if all turtles are yellow, then stop. I'll check that. Go back to the interface and let's see if that works. It takes them a little while to get started, but then once they all start to synchronize, they rapidly synchronize. It took about 695 ticks, so that was one run. It would be interesting if we could do many many runs and use many different values in these parameters. So to do that, NetLogo has embedded a tool called behavior space which is really great because it allows us to experiment with this parametric space in a variety of ways. And I think if you did the math and determined how many different types of settings you could set up for this model, it would be 600,000. So that's quite a lot of time to manually adjust the parameters, so instead of doing that, we're going to setup an experiment using this tool, behavior space. So I'll press on that and that brings up a dialogue box called behavior space and then I'll press on new and this will be where we input our new experiment. So, let's first call it something. I'll call it flies and in this first window, we can define what our parameters are to be. So, I'll change a couple, you can also define a range for your parameters, and all that is spelled out in this little text below the window. Repetitions, I'll say 2 just for brevity because we're doing a tutorial. Count turtles with color equal to yellow and yes we'll measure runs at every step and we'll use these setup and go commands. Everything looks good. I'll keep the time limit set at 0 because we just inputted some code that automatically stops it when all the turtles turn yellow. So it doesn't matter really how long the program runs. Then I'll press okay and now we can see that the experiment has been setup and it tells us that it will be doing 2 runs, so I'll press run and now there is another dialogue box which asks us whether we want to output the data as a spreadsheet which would be a .csv file or as a table output, or both. So I'm just going to select spreadsheet for now and I'm just going to do one experiment at a time to demonstrate, but I guess if you have multiple processors I guess you can run multiple experiments in parallel. Then I'll press okay and it's asking me where I want to save this, so I'll just save it to my desktop and it begins to run. This is telling us it's on the first run and how many ticks and this is the data that will be recorded in the spreadsheet. Run number 2. Looks like they're about to synchronize. There they go. So this is really handy because it can all be running in the background and you can literally go to lunch and come back with quite a bit of data to study the behavior of your model. And it finished, so I'll just cancel out of that. Now let's take a look at the output file. I will navigate to my desktop and open up the fireflies.csv file that NetLogo has conveniently outputted for me. And here is the spreadsheet. You can see the values of the parameters we setup for our different experiments and below is all the data for the 2 runs. So I think you can imagine how helpful this would be if you wanted to do some extensive analysis of a model. Here we can see that initially the turtles were not well-synchronized, about 200 or so are flashing together, but over time they start to synchronize. And you can see here that they are getting very close and eventually they are insync. So, I hope this tutorial has been helpful and you like behavior space as much as I do. Good luck!