Download Week 12: DO NOW QUESTIONS - New Mexico Computer Science

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Globalization and disease wikipedia , lookup

Germ theory of disease wikipedia , lookup

Transcript
CS108L Computer Science for All
Week 12: DO NOW QUESTIONS
1. Monitors: In NetLogo, monitors are output windows that allow you to keep
track of how a something (a variable, a reporter or an expression that evaluates
to a value) changes by showing its value as the program is run. There are a
number of fields you can change when creating a monitor. In the image below,
an entry in which field(s) will not have any impact on the value that appears in
the monitor.
,
a.
b.
c.
d.
e.
Reporter field
Decimal place field
Display name field
Font size field
C and D
Answer: e. The Reporter is the field that directly produces the value that
you see in the reporter. The Decimal place field also changes the precision
(the accuracy) of the answer. The other two fields are important for
formatting and labeling the monitor’s value but do not change the value
displayed.
2. If you build a game in NetLogo and create a reporter to display the score. What
kind of code might you see in your program? Assume: globals [score]
a. report scores
b. if something = true [set score score + 1]
Document1
c. count score
d. count turtles = score
e. turtles-own [score]
Answer: b. It will very likely be the case that the score changes as some event
occurs. You test for the event with a condition (if … then) and increment the
score if the condition happened. The others statements are wrong for a variety
of reasons:
 a. Note that the global is called score not scores.
 c. would probably generate an error since score is not an agentset
 d would probably generate an error.
 e. If there is a global variable called “score” there cannot be a turtles-own
with the same name. (not e).
3. Plots are used to display changes to values within a model as a model runs.
There can be multiple values plotted in the model because it is possible to have
plots with multiple pens. In a model of disease spreading through a population
which lines might be used to plot outcomes? Assume: turtles-own [issick? is-infected?]
a.
b.
c.
d.
e.
plot [is-sick?] of turtles
plot count turtles with [is-sick? = true]
plot count turtles with [is-sick? = false]
plot count turtles with [is-infected? = true]
b c and d above.
Answer: e. All of the answers except A are quite reasonable. A is wrong
because [is-sick?] of turtles returns a list of true false values , for example
[true true false true false false ….] It is possible to histogram values that
appear in a list but it is not possible to plot them.
4. Assume that you are creating a model that requires a plot. You are not sure how
to use plots. Which approach or approaches might help you figure out how plots
work.
a.
b.
c.
d.
e.
Use the built in NetLogo manual under Help > NetLogo Manual
Ask somebody who knows how to work with plots.
Add a plot widget to your model’s interface and play with it.
Look at other models that use plots and examine the code.
All of the above.
Document1
Answer: e. All of the above answers point to important tools for
programmers to have as they teach themselves to program. The answers are
listed approximately in the order that I use them when I (a veteran NetLogo
programmer) encounter a new situation.
5. When modeling the spread of infectious disease there are many things (factors)
that can affect the spread of the disease. These factors are often called the
parameters in a NetLogo model. When running the model it is interesting to see
how changing these parameters change the results. NetLogo programmers
often use sliders in their models so that the model can be easily run at different
settings. Which variable or variables would be a good parameters or “sliders”
for an infectious disease model?
a. wiggle-rate (rate turtle move through the world)
b. number-contacts-before-infected
c. profession (“professional” “student” “wage earner”)
d. initial-population-density
e. All except c
Answer: e. There are many values that a modeler might want to
parameterize to explore the parameter’s impact on the spread of disease. It
might be valuable exercise to brainstorm a great number of variables that
could play a role in the rate of infection, the rate of recovery and the course
of the disease in individuals and society at large. Looking at the possible
answers above:
 If the rate of contact with others is a variable the wiggle-rate would
certainly be an important variable to examine.
 number-contacts-before-infected might control the
sensitivity to infection, again, a reasonable variable to consider.
 Likewise, answer d, the population density could be important
variable.
 Only c, profession, would not be an appropriate variable and only
because it is a category rather than a continuous variable (i.e. it is not
obvious how to smoothly change from one profession to another) so
you could not use a slider to change that variable. You could use some
other input device to do so such as a chooser.
Document1