Information


 Introduction

Welcome to the StarLogo 1.2 release of StarLogo, a programmable modeling environment designed to help you model and explore the workings of decentralized systems, such as bird flocks, traffic jams, and market economies.

A Macintosh-only version of StarLogo has been available for several years. In February 2000, we released the first Java-based version of StarLogo, designed to run on all different types of computers. We called this new version StarLogo 1.0, and we renamed the Macintosh-only version MacStarLogo. (While the Java-based version of StarLogo runs on Macintosh computers, Mac users with older 68K and PowerMac computers might prefer to use MacStarLogo for performance reasons.) In August 2000 we released version 1.1. It included updated features and bug fixes, many of which are documented here along with the changes in version 1.2.

StarLogo 1.2 is another updated release of the Java-based version of StarLogo, with new features, bug fixes, and documentation updates. This document will discuss how to run StarLogo, new features in version 1.2, the differences between StarLogo and traditional MacStarLogo, the system requirements for running this version, and some implementation issues.

As you use StarLogo 1.2, please let us know what you think. Please send suggestions and bug reports to bug-starlogo@media.mit.edu (Be sure to mention which Java runtime system you're running with so we can easily pin down any problems).

Thanks again for trying out this new version of StarLogo!


 How to Run StarLogo

To use StarLogo, you will need to have a version of Java 1.2 or higher installed on your computer.

Our installer for Windows includes a Java 1.3 runtime from Sun Microsystems. We recommend this version of Java over Microsoft Java for better performance as well as compability with the Java standard.

The Macintosh version requires MRJ 2.2 or higher. If you don't yet have MRJ 2.2 (or are not sure) and have Mac OS 9, use the Software Update control panel to install any updates from Apple. One of these will be MRJ 2.2 or higher. If you use Mac OS 8.1 or higher, you can download MRJ from Apple's Java web site at http://www.apple.com/java.

On Unix, we recommend using your vendor's Java, as long as it is compatible with Java 1.1. We include a shell script to run StarLogo, and include a special version for Solaris. StarLogo has been known to run on Sun's JRE 1.2.2 for Linux and Sun's JRE for Solaris/SPARC and x86. If you are running on another platform, please try it out and let us know how it goes.

After you have succesfully installed StarLogo, follow these instructions to run StarLogo on your computer:

On a Windows PC
  • In the Start Menu, look for the StarLogo 1.2 program group. Click on the StarLogo application file to run StarLogo.
  • StarLogo should start up and pop two windows up on the screen. If you don't see them, they might be hidden behind other windows. Check your taskbar for them.

On a Mac
  • Make sure that you have MRJ 2.2 or higher (from http://www.apple.com/java) installed on your Macintosh before trying to run StarLogo.
  • Double-click on the StarLogo application.
  • StarLogo should start up and pop two windows up on the screen.
On Unix
  • Install your favorite Java 1.1.x, Java 1.2.x, or Java 1.3.x.
  • Go to the StarLogo distribution directory.
  • Execute the unix-run-starlogo shell script. (Note: If you use Solaris, execute the solaris-run-starlogo shell script instead).
  • Note: We've seen that StarLogo requires that you set Java to use a larger stack size. This is necessary with Sun's Java; we're not sure whether this is necessary on other Unixes.

 New Features in Version 1.2

This version of StarLogo includes many new improvements. They include:

  • The ability to now play your StarLogo projects in a web page as an applet. Here's how: When you are ready to save your desired project, choose "Save Project as Web Page" from the File menu. You will first be prompted to save the StarLogo version of this project (a .slogo file) and then to choose a name for the .html file. To allow the applet to be run over the web, place a copy of this starlogo.jar, your project (.slogo) file, and your web page (.html) file all in the same directory (we recommend that when you FTP this to your website that you choose a binary file transfer), and then load the .html file into your browser. On a Mac, the starlogo.jar file can be found in the StarLogo folder. Windows users can find it inside the Internal StarLogo files folder. We have confirmed that this applet will run on PCs using Internet Explorer and Netscape. If you don't have the Java plug-in for Netscape, your browser will prompt you to download it when you try to load the applet. On Solaris, you will need the Java 1.3.0 plugin, not the Java 1.2.2 or earlier Java plugins. If you're using a Mac, you will need to use Internet Explorer and MRJ 2.2.5 or later (Note: At the time of this writing MRJ was not currently available, but it should be soon. Please check the apple web site http://www.apple.com/java/).

  • A new text tool for labeling your interface with movable labels.

  • Version 1.2 is also optimized for Swing, but fully supports native components. If you have Swing (if you have Java 2 or swingall.jar in your classpath) StarLogo will use it for the control center and the turtle monitors. This adds undo/redo to the text areas in these windows.

  • Patch monitors. Double-click on a patch to open one up, or use the inspect-patch command.

  • The primitive grabbed? for turtles. It returns true if you are currently being grabbed by some other entity.

  • The primitives count-patches, count-color-range, count-pc-range, to-list, to-string, and to-delimited-string.

  • The primitives switch-scheduler, scheduler, set-scheduler-random-seed, and get-scheduler-random-seed. switch-scheduler takes no arguments and switches back and forth between fixed order scheduling and randomized scheduling. scheduler reports the current scheduler, "fixed" or "random". set-scheduler-random-seed takes a 32-bit integer to set the random scheduling seed with. This is not the same as the seed used by the random primitive. get-scheduler-random-seed reports the current value of the scheduler's random seed.

  • The primitives display and no-display. Preliminary experiments show a 25x speedup (when you have 100 turtles moving forward 100 steps). Anything graphics intensive should speed up dramatically with the display turned off.

  • A warning dialog when you try to run StarLogo code when the patch canvas is obscured. Previously there was no warning that StarLogo was pausing until the offending widget was removed and the patch canvas was completely uncovered.

  • The slider thumb now visibly snaps to the integral value of the slider when mouse button is released.

  • The plotting widget's state (pen colors, plot ranges, axis labels, plot title, etc.) is now saved and restored with the project.

  • The ability to set the slider's value from code. If the slider's variable is foo, you can say set foo 56 to set the value of the slider to 56.

  • A pull-down menu in the procedures pane to list all currently defined procedures. If you select the procedure from the menu, it will move your cursor to the desired procedure.

  • When you get a runtime error in one of your StarLogo programs, it now prints out a stack trace with the names of the caller procedures and their arguments, to help you track down the bug.

  • Sounds have been disabled in this release of StarLogo due to the non-standard implementation of Java on different operating systems.

  • Setpc no longer works as a turtle command. If you want to use the command to turn a patch red, you can have the observer ask-patches [setpc red], have a turtle ask-patch-at 0 0 [setpc red], or have a turtle say stamp red.

 StarLogo vs. MacStarLogo

This Java-based version of StarLogo has some significant differences from MacStarLogo. In particular:

  • This version of StarLogo requires you to be more explicit about which StarLogo objects you are "talking to". In MacStarLogo, the compiler tries to figure out automatically whether you meant to "talk to" the turtles or the observer. That approach is elegant, but it is confusing at times. This version puts control back in your hands, with separate command centers and procedure windows for the turtles and the observer. In order to run turtle code, the observer must explicitly ask the turtles to run it using ask-turtles [do-something]. Patches do not have their own procedure window nor a command center; in order to run patch code, the observer must explicitly ask the patches to run it using ask-patches [do-something].

  • The turtles, patches, and the observer are now completely multi-threaded, so they can be running multiple processes/buttons at the same time and have them execute in parallel. Turtle code, patch code, and observer code are also now scheduled independently of one another, so they will run in parallel with respect to each other as well.

  • The turtles, patches and the observer now all run at the same speed. This means no more slowdowns by running observer code. In addition, the turtles and patches now gain all of the features that only the observer was able to perform, such as the more complicated mathematical functions and list manipulation.

  • There is a new command called grab. This lets you hold onto a turtle or list of turtles and run some code on them. It encompasses this popular StarLogo idiom:

    turtles-own [which-turtle]

    to mate
    if count-turtles-here > 0
    [setwhich-turtle one-of-turtles-here
    mate-with which-turtle]
    end

    and replaces it by this:

    to mate
    grab one-of-turtles-here
    [mate-with partner]
    end

    If there is no turtle to grab, the code is not run. Once the turtle has been grabbed, you may refer to it as "partner". If multiple turtles have been grabbed (via nesting grab calls, or passing a list of turtles to grab), you may refer to them as "partners".

  • The syntax for setting a variable is slightly different. There is now a space between the "set" and the variable name:

    turtles-own [energy]

    to foo
    set energy energy + 1
    end

    The old form, "setenergy", still works in this version, but might not work in future versions.

  • We've added new variable suffixes. In addition to -of and -at, we have introduced -towards, which is explained below.

    -of
    allows you to get the turtle variable belonging to a particular turtle.

    -at relative x relative y
    allows you to get the turtle or patch variable at x units to the right and y units up from the caller.

    -towards relative angle distance
    allows you to get the turtle or patch variable which is distance units away in the direction of the turtle's heading plus the relative angle.

  • Sounds have been disabled in StarLogo version 1.2. They were present in version 1.1, but the varying implementations of Java across different platforms made it difficult to have sounds work consistently.

  • There is a new text-only file format. It saves the entire state of the turtles, patches, and observer. It also saves the code in the procedure windows and the interface. You can open a MacStarLogo file with StarLogo and it will translate it to the new format. However, the code will most likely not run, due to the new split between observer and turtles. We hope to make an add-on to MacStarLogo to save files in the StarLogo file format.

  • There is new command called leap. Leap causes turtles look at the patch that they are leaping to. A turtle will leap the number of steps specified only if the patch is unoccupied. Otherwise, the turtle won't move.

    Using leap instead of fd or jump allows you to create projects where only one turtle is allowed on a patch at any given time. For an example, see the sample project Sugarscape.

  • There is a menu item in the File menu called Import Picture. In order for Import Picture to work, you need to have a current version of QuickTime (QuickTime for Java) installed on your computer. (The menu item will not be displayed if QuickTime is not found.) You can download QuickTime from http://www.apple.com/quicktime/download. Import Picture will load pictures of many types (such as GIF, JPEG, PICT, and others) onto the Graphis Canvas. The picture's colors will be transferred into the patches' colors. (Warning: Do not load very large pictures into StarLogo, or it will run out of memory.)

 Implementation

  • StarLogo is based partly on Java code and partly on a language we created called YoYo. YoYo is a variant of Logo that is built on Java and allows you to construct Logo/Java hybrid programs and put them on the Web. We've used YoYo here to write the StarLogo compiler and script our user interface.

Commands | Projects | FAQ | Notes