Lecture: 11-30-2012

posted Nov 30, 2012, 6:08 AM by Samuel Konstantinovich   [ updated Nov 30, 2012, 7:35 AM ]
Tutorial 12, 15 (optional,  but fun) 

Write a simple model on paper + Finish up tree functions. 

Do now /  Classwork

Open your tree functions while doing your do now. Have them ready to draw your trees. If you don't have a working computer share with someone and get yours open too. After checking them we will discuss some of the trees.

On Paper
Write the following 4 netlogo functions: You may discuss this with neighbors. 
1-An observer context function that makes 5 red car shape turtles the cars should face any of these four directions randomly: 0 90 180 or 270; it should also make 10 blue person shaped turtles. It should place the cars on the left side of the screen at random, and the people on the right side of the screen at random. 
2/3-Two turtle context functions  carMotion and peopleMotion. The carMotion function has a single turtle move forward 1. The people motion function has a single turtle wiggle randomly going forward .3 each step. 
4-An observer context go function that asks the turtles to run either carMotion or peopleMotion depenging on their shape. (Use an ifelse) There should be a brief wait at the end of the go to make the program run at a reasonable speed.