2015-11-30 LabN02

posted Nov 30, 2015, 4:50 AM by Samuel Konstantinovich   [ updated Nov 30, 2015, 5:14 AM ]
Pair up with a different neighbor and make a model as follows: (you can work on your own copy, at home, but you should share in class)

Make sure you should break your code into functions. I do not want to see a really long set of if statements with tons of code in it in the go command.

BOTH of you must write the answers to the paper questions on your notebooks. You should discuss it first. 

1. You should have a setup button and a go button.
PAPER1 - What context should the buttons be? Why?
-Setup : call the setup procedure
-Go : call the go procedure

2. Make the go button a forever button.

3. Sliders
a - Turtles regular speed that is determined by a slider turtle-speed from 0.01 to 1.0 with increment of .01
b - Turtles have a regular max turn angle slider max-turn-angle from 1 to 180 degrees based on a slider
c - The number of turtles spawned is based on the slider num-turtles between 1 and 100 .

4. Setup:
a - Reset the world 
PAPER2 - What command would do this? Are there other commands that can do the same thing?
(Note: On a lab/test I will never tell you to run a command, I will always describe what your goal is, and you make it happen.)
b - Spawn a number of turtles based on the num-turtles slider. 
c - Set the x and y positions of the turtles randomly based on your world size. They should be distributed evenly throughout the entire world.

5. Go:
a - Turtles move in a wiggle like manner using the speed and angle sliders. 
PAPER3 - Explain what it means when I tell you "You can make the turn equal probability or biased"
b - The world has 4 quadrants like in math, and in each quadrant the turtles behave differently as follows, so you have to write different code for each of their behaviors.

TERMINOLOGY: A frame is one execution of the go command. Every time you run go, netlogo will draw the screen once. We call this a frame, just like in animation.

Quadrant 1 Turtles: 
move: forward aturtle-speed
turn: do not turn. 
color: change to red.
size: decreases by 0.1 per frame every frame but cannot shrink below size 1.

Quadrant 2 turtles: 
move: forward at double turtle-speed
turn: randomly up to max-turn-angle
color: increases by 0.1 every frame, such that the ones digit never passes a 9 (ones digit should stay at 9 if it passes 9,  19 stays 19, 39 stays 39.)
size: decreases by 0.2 every frame but cannot shrink below size 1.
PAPER4 - How do we get the ones digit of a variable? The rest of the digits? (Look up in the math portion of the dictionary)

Quadrant 3 turtles:
move: forward at half turtle-speed and 
turn: randomly up to double max-turn-angle
color: stays the same
size: increases by 0.1 every frame up to a maximum size of 5. 

Quadrant 4 turtles 
move: forward at turtle-speed
turn: randomly up to max-turn-angle
colors: set to random multiples of 10 + 5 like 15 25 35 etc.range is 5 to 135.
size: decreases by 0.1 every frame but cannot shrink below size 1.

Use your wiggle function, provided it has two parameters like this:
to wiggle [ howFar  angle]
  fd howFar
  rt random (angle + 1)
  lt random (angle + 1)