GridWorld News

November 12, 2011

Version 1.02 fixes a bug.

June 20, 2007

Version 1.01 fixes two bugs.

April 16, 2007

Version 1.00 is out! The last change, also requested by Robert Glen Martin, is a secret system property "info.gridworld.gui.frametitle" to change the text in the world frame from the default "GridWorld" .

March 7, 2007

Version 0.99 has a few additional pre- and postcondition tweaks.

February 8, 2007

Version 0.98 cleans up postconditions in Critter and has a couple of minor tweaks in the display code that were requested by Robert Glen Martin.

November 12, 2006

Version 0.97 adds postconditions in Critter and has a couple of minor tweaks in the display code:

October 13, 2006

Version 0.96 makes two useful changes requested by Dave Wittry:

July 26, 2006

Version 0.95 cleans up rounding errors when scaling and rotating images. The preferred image size is now firmly set at 48 x 48 pixels. Images are scaled by a factor of 2, down to a minimum size of 12 x 12 pixels. (Menu icons are still at 16 x 16.)

Setting the secret system property info.gridworld.gui.selection to "hide" turns off the selection square, as requested by Robert Glen Martin for his Quzzle world.


Speaking of secret system properties, set info.gridworld.gui.watermark to "hide" if you want to take screen shots without the version watermark (such as the 0.95) in the screen shot above.

June 7, 2006

Version 0.94 lets you override the keyPressed method in custom worlds, as suggested by Evelyn Torres-Rangel.

April 25, 2006

Version 0.92 contains the images supplied by the School for the Talented and Gifted, Dallas Independent School District.

April 6, 2006

Version 0.91 contains the changes from the "Fresh Eyes" reviewer feedback.

March 15, 2006

Happy First Birthday, GridWorld!


Version 0.90 contains the first version for the "Fresh Eyes" review. No functional changes from 0.24; just cleaner comments/formatting and a couple of minor bug fixes in the GUI.

March 6, 2006

Version 0.24 contains the changes of the March 5 committee discussion.

Here is SIGCSEWorld, preserved for posterity.


February 23, 2006

Version 0.23 is a minor tweak of the "simplified" version.

January 30, 2006

Version 0.22 (unofficial) is an existence proof of today's discussion

Again, this is just a proof of concept that will hopefully be an inspiration, not an official release. 

January 4, 2006

Version 0.21 has these changes:

December 13, 2005

Version 0.20 has these changes:

December 6, 2005

Version 0.19 has these changes:

December 2, 2005

In this version, all classes except the critter and GUI classes are presumed stable. 

Version 0.18 has these changes:

November 21, 2005

Version 0.17 has these changes:

November 19, 2005

Version 0.16 has these changes:

November 9, 2005

Version 0.15 has these changes:

November 5, 2005

Version 0.14 has these changes:

November 4, 2005

Version 0.13 has these changes:

November 1, 2005

Version 0.12 has these changes:

October 23, 2005

Version 0.11 has these minor changes:

October 8, 2005

Version 0.10 only has a couple of minor changes, as requested by Chris:

September 28, 2005

Some cleanup, as prompted by Chris' questions

September 27, 2005

Only three minor changes

August 24, 2005

This build has just a few cosmetic changes to improve the out-of-box experience.

April 15, 2005

Here is the latest GridWorld build. This time, the distribution is quite different. Unzip the file, and you get

Now open a command shell and type

java -jar gridworld.jar

The GUI comes up with a starter world. To load a different world, select World -> Load Project and navigate to one of the project  directories. (You select the directory and accept the file dialog; no need to enter it. It's just like in BlueJ.) The GUI now loads main all classes in the project directory. This setup greatly simplifies the students' life. They no longer need to write a method. They merely subclass Actor and, optionally, SimWorld , compile the classes, and launch the GUI. If the project files are recompiled, there is no need to close the GUI. Simply reload the project, and the newest versions of the classes are loaded. The GUI can also be run as an applet. However, then it can only show a single world. To make an applet, zip up the project and make an applet tag like this:

<applet code="com.collegeboard.gridworld.gui.WorldApplet"
    width="500" height="600"


Have a look at the Stepper project. This example extends StepWorld , not SimWorld . In the run method, the student writes code such as the following for loop practice.

      int n = 5;
      for (int i = 1; i <= n; i++)
          for (int j = 1; j <= 2 * i - 1; j++)
             add(new Location(i, n - i + j), new Rock());

Whenever the pause method is called, the StepWorld pauses until the user clicks the Step button.


The GUI gives students a visual way for debugging loop problems. This has nothing to do with the case study, but if teachers can put the framework to good educational use, it should make it more attractive.

a l l t h
e n e w s
t h a t s
g r i d w
e p r i n

April 7, 2005

Here is the latest GridWorld build--again distributed as source-only. This version requires Java 5.

Unzip and compile with javac *.java . Make sure that you do not have a CLASSPATH that contains a previous version, or the current case study.



Things to Try


March 31, 2005

Here is the latest GridWorld build--again distributed as source-only. This version requires Java 5. Don't look to close into the internals. It is still quite messy.

Unzip and compile with javac *.java .

This week's big news is a significant change in the user interface. I had tried to integrate GridWorld into BlueJ. I wanted to call a method on the critter and have the critter move, but it didn't really work. So I decided to steal an idea from BlueJ. When the user clicks on an actor in the grid, all methods pop up, and you can call any of them.


If the method has parameters, you get to specify them.


The change is immediately reflected in the display.

Très cool, if I may say so. If you click on an empty cell, you get a list of constructors.


The "actor panel" to the right of the grid is no longer needed.

If you all agree that this is an improvement, I can ditch quite a bit of old code that contained ugly special cases.

Your opinions needed

March 25, 2005

Here is the latest GridWorld build--this time distributed as source-only.

Unzip and compile with javac *.java .





Q: What is it?

A: This framework was obtained from the Marine Biology Simulation framework by ruthlessly removing gratuitous complexity. I kept the parts that have proven to be most useful for asking exam questions:

The grid is simpler than the old environment for two reasons:

I also kept the excellent GUI (there is quite a bit of wizardry under the hood). I made it easy to add image files--you just supply a file with the same name as the class (e.g. Rock.gif ).

grid world screen

Now we have the following classes and interfaces

For A:

For AB:

For further extension:

Q: Why is the environment class now called Grid?

A: Grid is a four-letter word.

Q: Why another grid?

A: It's the year of the grid. Everyone and their brother has a grid framework:

Q: What do I need to do to make my own actor?

A: (1) Overload the act method (unless it's a rock or wall that doesn't act). (2) Maybe supply a GIF image

Q: Could I do Carol-the-Robot with this framework?

A: Yes but... It is easy to make classes Carol, Wall, and Beeper. But then what does Carol do? All steps in the act method are instantly executed. You could program the act method so that it does things in steps (like the SquareDancer). Alternatively, you can place a Robot in a StepWorld and have it call  pause in its move and turn methods. However, with multiple robots, there would be nasty concurrency issues.

Q: Could I make hexagonal or triangular grids?

A: No.

Q: Why isn't there a Direction class any more?

A: It was ruthlessly eliminated, in order to minimize the number of classes. Directions are now integer values, measured in degrees. Useful constants ( Location.NORTH , Location.RIGHT , etc.) can be found in the Location class.

Q: Can you have multiple actors in a grid location?

A: I suppose one could make a Grid<Set<Actor>> , but then the simulation loop would need to be rewritten, and someone would need to write a SetDisplay.