CS108L Spring 2014

advertisement
CS108L Spring 2014
Week 14: DO NOW QUESTIONS
1. You have been asked by a leader of your community to think about how a
sudden increase in fuel price (gas= $12/gal) will affect traffic patterns and use
of public transit. You decide to model this situation in NetLogo. What are
some of your first steps?
a. Create a setup procedure.
b. Decide what are the key decisions and behavior changes that might
occur.
c. Decide what to include in your model and what to ignore.
d. Stockpile gasoline.
e. B and c
2. In a burned-out building, you find a scrap of paper with only the top part of a
NetLogo program as below. What do you think the modeler was attempting to
model?
Breed [humans human]
Breed [non-humans non-human]
Humans-own [ alive? Have-ammo? Agentset-of-friends]
Non-humans-own [ #-eaten am-I-intact? Need-brains?…..
a.
b.
c.
d.
You can’t tell from only the custom variables.
Looks like a model of a Zombie Apocalypse.
A model of an epidemic or ecological system.
All of the above.
3. Iteration means doing (almost) the same thing over and over. Computer
models automate this work and allow us to see the changes that occur as
things change after many operations. Which of the following is NOT iteration?
a.
b.
c.
d.
e.
f.
Ask n-of 100 turtles [ set color color + who]
Repeat 1000 [set global-counter global-counter + 2]
Create-turtles 500 [ setxy random 12 random 12]
Let name “ralph”
Breed [cows cow]
D and e
Document1
4. After you create a model it is valuable to reflect whether you have
appropriately captured the behavior of the real-world system that you are
modeling. The process of building a model often helps you understand what
does and what doesn’t matter. What steps could you take to see if your model
is accurate?
a. Create sliders for key variables to see if changing them produces
reasonable effects.
b. Run the model many times with different settings
c. Show the model to experts and get their feedback
d. All of the above
5. Assume word size 32 x 32. Which of the following will result in way more
than 20 turtles.
a.
b.
c.
d.
Create-turtles 20 [ forward 13]
Create-turtles 2 [ forward 5 hatch 10 [ forward 5]]
Ask n-of 20 patches [ sprout 1 [ set color red]]
Ask one-of turtles [ hatch 20 [ setxy random-xcor random-ycor]]
;assuming there is one turtle.
e. Repeat 20 [ask patches [sprout 1]]
Document1
Download