CS 1025 01 - Week #1 (Jan 13-15)


Tuesday, January 13th


  1. Playing with NetLogo turtle graphics - handout from Wednesday, August 24th, 2011 class. Try out the links too!

  2. VIDEO review: One of the links is this Netlogo basics video tutorial created in fall of 2010. Watch it. Take some notes on it. Its only 12 minutes long.

  3. Netlogo practiced and shown this week in class:
          Netlogo shown today:
    
                   Create 16 turtles       Move forward 6 turtle steps
                   -----------------       ---------------------------
                      cro 16                          fd 6
    
                   Put your pen down       Lift your pen (or turtle tail) up
                   -----------------       ---------------------------------
                         pd                           pu
    
    
    
                   Turn right 90 degrees        Clear all (erase everything)
                   ---------------------        ----------------------------
                          rt 90                            ca
    
    
                   Draw a square (if your Pen is Down - PD you will see square)
                   ------------------------------------------------------------
                        repeat 4 [ fd 3 rt 90 ]
    
                                        The above square has a side length of 3
    
    
                   Draw a cool pattern of 36 spiralling squares (if PD pen down)
                   -------------------------------------------------------------
                      repeat 36 [  rt 10  repeat 4 [ fd 3 rt 90 ]  ]
    
                      What is 36 times 10?  360 degrees.
                                            So you will have a complete
                                               round the world circle of
                                                  squares.
    
                   Observer mode commands:   ca, cro,
                    Turtles mode commands:   fd, rt, pd, pu
    
                    Note:  repeat is used in either mode, depending on what
                           you need to do.
    
                      repeat howManyTimes [ what you want to do ]
    
                      What would the following repeat create, if we assume the
                      pens of the turtles were down (PD or pd) so we could see
                      the trail left by the turtle tails (or pens, aka pens)?
    
                             repeat 8 [ fd 3 rt 45 ]  <----  draws what????
    
                             repeat 4 [ fd 3 rt 90 ]   <---- draws a square
    

  4. Link to download and install NetLogo on your computer (PC or MAC). It is FREE!

    Netlogo is also available at most of the computer labs on the UNI campus, including all CNS labs and all of the SCC (Student Computer Center) labs like the Library, Union, Redeker, Towers, Lawther, etc.

  5. Look at the Forest Fire model in the Earth Science portion of the NetLogo Models Library. Read about it first, then click RUN FIRE IN YOUR BROWSER to try it out.


Thursday, January 15th


  1. Check out this NetLogo example of airplanes flying and fish swimming.
    1.  How do you create a circle in NetLogo?
    
        pd                pen down
        repeat 36
        [
           fd 0.05        forward 1/20th of a unit or turtle step  
           rt 10          turn right 10 degrees
        ]
    
        The 36 sided polygon looks like a circle, but its just 
                   a polygon (square, pentagon, octagon) with lots
                   and lots of sides.
     
    2.  We also covered ifelse and remainder and who numbers of turtles.
    
        There are EVEN and ODD numbered turtles.  
    
        See the airplanes and fish example above and look at the example
        and the NetLogo code on that web page for different things
        happening to the turtles that are EVEN or are ODD numbered.
    
        SET SHAPE and SET COLOR and SET SIZE of turtles.
    

  2. Introduce the Monty Hall simulation exercise. MONTY HALL game Playing the Monty Hall game with a model. Your simulation experiement will try to figure out which strategy is best - sticking with your first choice or switching to the other door.

    *** Monty Hall assignment is due anytime on Thursday, January 22nd. ***