posted Oct 18, 2017, 6:20 PM by Konstantinovich Samuel   [ updated Oct 19, 2017, 7:56 AM ]
1. Watch netlogo videos 8, 11

2. Request membership for the Classroom discussion board:

You MUST use your stuy.edu email to get/request access. 

You should also familiarize yourself with gmail filters, to put things into "labels" automatically. Labels are like folders, but you can have an email in multiple labels. 
I suggest a COMPSCI label of something of that nature so you can see CompSci (32)  which means you have 32 unread messages regarding your CS class!

3. Reply to the post on the discussion board.

Do Now: on paper!

1. Write a function moveTo51 that performs the following actions:

-creates 1 turtle and 

-moves that turtle to (5,1) using the set command. 

Q1: What context must this be in?

2. Write a wiggle function wiggle[ dist maxAngle]  that performs the following actions:

-turns left randomly up to a maximum angle of maxAngle

-turns right randomly up to a maximum angle of maxAngle

-moves forward dist.

Q2: What context must this be in?

Q3: After you write the wiggle procedure which agent would perform the command?

Q4: Who determines which agent performs it?

Goal 1: Sliders vs parameters

Think of sliders as a variable that exists outside of the functions. These are called global variables

Assume we have a single slider set to 2 called:


to foo[ a b]  

    ;You can use turtle-size a and b here


to bar[ x y ]  

    ;you can use turtle-size x and y here


DO NOT name parameters the same as your sliders!

When should you use a slider vs a parameter?
-You can always send a slider value into a function so we don't need to use slider variables directly inside our functions.
-It is convenient to use sliders to control the overall 


General rules:

If you only use the procedure once, or only on a specific value, use a slider
   e.g. setup -> creates a number of turtles (based on a slider) and sets their starting sizes (based on a slider)

If you want to be able to use the function on different values, you should use parmeters.
    e.g.  If want to use the n-gon procedure on different numbers like :n-gon 5   n-gon 10  , AND you ALSO want to use it on a slider.... then you can put the slider when you call the function.  n-gon sides-you-want  , where sides-you-want is a slider.

Goal2 : Organization? Yes you must have it!

Assume a default world size. 
The red team starts:
   On the leftmost 1/4 of the screen. (NOT A QUADRANT!)
   red color
   shaped like sheep
The blue team starts:
   On the rightmost 1/4 of the screen. 
   blue color
   shaped like turtles
The green team starts:
   On the center of the screen, in a 7x7 square of patches. 
   green color
   shaped like trees.

Complete the setup below:
to setup
  cro 50 [
    ;blue team
  cro 50 [
    ;red team
  cro 50 [
    ;green team

Once you figure out the commands:
Q5: If you placed code next to the comments, inside the brackets:
  How can we arrange our code to make our setup function clean and easy to read?