## CS 1025 01 - Week #14 (Apr 21-23)

### ... T2 Study Guide: 04/23/Thursday Test Two Study Guide and Outline ...

1. Mushroom Hunting and NetLOGO Tuesday and Thursday Example program.

Play with the NetLOGO example program to understand the MUSHROOM assignment and model.
Note: Right mouse button click and download the model - then run it.

2. Mushroom Hunting: M U S H R O O M S - WEEK #13 - Tuesday and Thursday HELPFUL Example.

3. Folding a sheet of paper in half 50 times exercise.

4. NetLOGO Mushrooms model is due on Tuesday, Apr 21st.

Questions on the MUSHROOMS model assignment are due on Tuesday 04/21 too.

I prefer you turn in a hard copy of your answers to the questions about the experiments and the model changes and results.
Note: - pen or pencil hand-written or word processed printout, either one is okay.)

You do NOT have to send ALL of the .nlogo models. Just send ONE .nlogo model as an attachment to jacobson@cs.uni.edu.

Help on the TURNING with the MUSHROOM Hunting NetLOGO model.

5. Review concepts and skills related to the MUSHROOM hunting assignment. It is due on FRIDAY Oct 31st.

6. What does the RANDOM expression do in NetLOGO/
```random             <------ From NetLOGO Help menu > Dictionary command
random is in the Math Category.
Categories: Math
random number

If number is positive, reports a random integer greater than or equal to 0,
but strictly less than number.

show random 3
;; prints 0, 1,  or 2           0 <= random 3 < 3 means 0, 1 or 2 is result.

show random 6                   0, 1, 2, 3, 4, or 5 is the output or result.

show (random 6) + 1             1, 2, 3, 4, 5, or 6 is the result.

show random 21                 0,  1,  2, 3, ..., 18, 19, or 20 is the result.

show (random 21) - 10        -10, -9, -8, ..., -1, 0, 1, 2, ..., 9, or 10
is the result.
```
7. What color is a patch that represents a MUSHROOM? When do the mushrooms get created? Which procedure, SETUP or GO?

8. What color does a patch change to if the mushroom hunter (our NetLOGO turtle) finds it and eats it?
```What is the statement that causes the turtle to detect it has found a mushroom?

What is the statement that resets the time when the turtle has just found a mushroom?
```
9. What does the n-of do? Note: There are two different "ask n-of" statements in the code.
```n-of       <---------- From the Help menu > Dictionary
Easiest to find by searching the letter "N" group of Netlogo commands.
n-of size agentset

From an agentset, reports an agentset of size size
randomly chosen from the input set, with no repeats.

Turtles are AGENTS.  cro 16 creates an AGENTSET of
16 turtles, i.e. a SET of 16 turtle AGENTS.
The patches are considered AGENTS here too,
although they do not move.  They can change!

ask n-of 50 patches [ set pcolor green ]
;; 50 randomly chosen patches turn green
```