### Computer Simulations Using NetLogo

```Teaching Contemporary Mathematics Conference
January 25, 2013
Christine Belledin
NC School of Science and Mathematics
Patches
Turtles
 Variable Definitions
 Global variables
 Agentset-specific variables
 Setup Procedures
 Clear variables
 Use patches and turtles to create environment
 Reset tick counter
 Go Procedures
 Define steps that are carries out on the agents at each tick
 Use subroutines to add structure and clarity
 NetLogo tutorials
 My students work independently through the tutorials from the NetLogo
website.
 Tutorial 1: Students learn to use and explore existing models
 Tutorial 2: Students learn to write command and modify existing models
 Tutorial 3: Students build a simple NetLogo model
 For less experiences students, you may want to complete Tutorial 3 together
as a class.
 Write a program as a class
 Show students the Fire model from the NetLogo library.
 Introduce modified problem (see next slide) and develop model
 First homework: students make one addition/modification to our class model
Suppose 30% of the wooded areas along the western edge of a region catch fire.
There are 5 houses scattered throughout the area. In each step, if a neighbor of a
patch is on fire, then the patch has a 50% chance of catching fire. Which house is
most likely to burn?
Step 1: Create the environment.
 Turn patches green and brown
 Randomly place houses
 Set fires along western edge
 Spread the fire through the green patches
 Show a house burns by turning grey
Step 3: Make improvements.
 Identify problems in the simulation and address them
 Try to have a stopping point for the simulation
 Allow user to input forest density, number of houses, etc.
 Report the impact of the fire numerically or graphically