CS 1025 01 - Turtles, Termites, and Traffic Jams



Assigned: Tuesday, January 21st

Due: Tuesday the 28th or Thursday the 30th...



  1. Read Decentralization and Agents pages from Turtles, Termites, and Traffic Jams to prepare for Tuesday class discussion. Pages 3 through 12 of the textbook.


    1. Assignment for TUESDAY, January 21st: Read/study the 10 pages (page 3-12) from textbook or PDF link above.

    2. Bring to class to turn in 1/2 to 1 page of notes, questions, quotes, confusions, opinions.

    3. Pen/pencil hand-written is just fine. It does not need to be printout and word processed.

    4. Try to think of examples of how the concepts relate to your major or hobbies or current events or whatever. Brainstorm.

  2. The NetLogo remainder operation and turtle WHO numbers: EVEN and ODD turtles, Sliders and Buttons. the ifelse (condition) [EVEN turtles actions] [ODD turtles actions], REMAINDER and WHO numbers.

    EVEN versus ODD turtles.
       
    WHO numbers of turtles are 0, 1, 2, 3, 4, 5, 6, 7, 8, ..., 14, and 15
               for 16 turtles created with 
                                           cro 16.
    
    remainder who 2 is either = 0     EVEN turtle
                    or else
                           is = 1      ODD turtle
    
    ifelse (remainder who 2 = 0)
    [
         what I want the EVEN turtles to do...    remainder was = 0
    ]
    [ 
         what we want the ODD turtles to do...    remainder was = 1
    ]
      
    ;; Here is an example similar but simpler than the one above
    ;;                               with the airplanes and fish...
    
    TO Stagger  
       ca        ;; ca is short for the clear-all, an Observer Command
                 ;; ca clears out EVERYTHING 
                 ;; doing clear-turtles, clear-patches, clear-drawing.   
                 ;; What are PATCHES?  Don't worry!    
       
       cro howManyTurtles  ;; howManyTurtles is the name of the SLIDER
       
       ask turtles
       [
           ifelse (remainder who 2 = 0) 
           [  
              set shape "airplane" 
              fd 12    
              changeColorEven
           ]           
           [  
              set shape "fish"
              fd 10
              changeColorOdd
           ]        
       ]  
    END