NetLogo - Friday 09/03/2010 StudioIT 1 ITT 134 hands-on class.


Look at the NetLOGO statements and Procedures to review HOW the above was done. Note: A procedure is just a new word that we taught the TURTLES. Friday 09/03/2010 StudioIT 1 ITT 134 lab: SEE the example NetLogo code, which includes many extra statements we did NOT do in that class, but that you will learn later. How to do the SLOW WALKING and the SLOW or FAST TWIRLING will be taught later. You will just have to WAIT, but that is a HINT. It is all done with WAIT to slow things down! :-)


Note: Wednesday's class will be completely devoted to teaching what you need to know to do ALL the HOMEWORK that is due on Friday at 5 p.m. along with going over this example from our Friday lab.

No class on Monday. It is a Labor Day UNI Panther and USA National Holiday!

VIP Note: Be sure to READ and STUDY what is below here as you review and play with the above example!

powered by NetLogo

view/download model file: 2ndLabOnFriday3rd2010.nlogo

WHAT IS IT? - We will review it carefully on Wednesday, September 8th in class. Especially the ifelse, which you need for your current HW assignment.

Computational Modeling and Simulation 810:025 01 9 MWF hands-on class example from class #5, Friday Sep 3rd, 2010.


HOW IT WORKS - The turtles agents do different things if they have EVEN who numbers than if they have ODD who numbers. ifelse ( remainder who 2 = 0 ) [ do this if EVEN ] or [ do this if ODD ]

     ifelse (remainder who 2 = 0)           ; We will REVIEW and discuss IFELSE on Wednesday!
     [                                      ;                            ifelse ( condition that is T or F )
        set shape "airplane"                ;                                [ Do if TRUE  ]
        fd 2                                ;                                [ Do if FALSE ]
        
        if (remainder who 4 != 0) [ fd 3 ]  ; We did NOT do this in class
        
        set color 85
     ]
     [
       set shape "turtle"
       set color 45
     ]

HOW TO USE IT

Play around with it. Click the REFRESH button on your browser to try it again with the DEFAULT settings for the TWO SLIDERS. Have fun!


If you have trouble with it in your web browser or on your computer:

The applet requires Java 1.4.1 or higher. It will not run on Windows 95 or Mac OS 8 or 9. Mac users must have OS X 10.2.6 or higher and use a browser that supports Java 1.4. (Safari works, IE does not. Mac OS X comes with Safari. Open Safari and set it as your default web browser under Safari/Preferences/General.) On other operating systems, you may obtain the latest Java plugin from Sun's Java site.


TO LOOK AT THE NetLOGO models library: http://ccl.northwestern.edu/netlogo/models/index.cgi

For questions TWO and FOUR of the HOMEWORK that is due on Friday Sept 10th, 2010, you can also do that just using a web browser.

NetLogo Models Library: http://ccl.northwestern.edu/netlogo/models/index.cgi - lots of sample models! Includes links to DOWNLOAD NetLogo so you can install it on your Mac or PC too.


See the NetLogo code for the above application. Much of it you used in Friday class, but some is new.

  1. VIP: SEE the example NetLogo code, which includes many extra statements we did NOT do in that class. You will learn those during week #3.

  2. How to do the SLOW WALKING and the SLOW or FAST TWIRLING will be taught then.

  3. You will just have to WAIT, but that is a HINT. It is all done with WAIT to slow things down! :-) Waiting is the KEY here, lol! :-)


NETLOGO FEATURES

ifelse ( logical condition ) where the logical condition uses the remainder operation and the turtle's WHO number to divide by the 2 number and see if there is a remainder. If there is not, there really is, because 0 is a remainder. But that means the WHO number was an EVEN number, so we make the turtle into an AIRPLANE. If the remainder is 1, the turtle had something ODD about it, i.e. it had an ODD WHO number. So we make it shaped like a TURTLE in the above example, replacing the default arrowhead shape for NetLogo.


RELATED MODELS

Fly Fishing, fabulous fun: Airplanes flying and circling and Fish swimming off into the sunset. Airplanes are EVEN and Fish are ODD. Who is who, or, should I saw what is your who. Every turtle has a WHO number! This model was shown on the first day of class.


CREDITS AND REFERENCES

All credit here has to go to a very enthusiastic and wonderful group of Computational Modeling and Simulation students, two thirds of whom are only in their 2nd week of being UNI Panthers! :-)