GridWorld (2008 AP CS Exam)

FAQ

Question: I get this error message: bad class file: c:\GridWorldCode\gridworld.jar(info/gridworld/actor/ActorWorld.class) class file has wrong version 49.0, should be 48.0

Answer: Install and use Java 5. You get this error when you try compiling a GridWorld program with Java 1.4 or below.

Question: What is the preferred size for icons?

The preferred image size is 48 x 48 pixels. Other image sizes are acceptable, but they may not look as good due to scaling. Images are scaled isotropically (i.e. preserving the width:height ratio) to fit into tiles and menus. Tiles start at 48 x 48 pixels and can be scaled up or down by a factor of 2, either by user action or in the initial display, to make the all tiles fill the window. The minimum tile size (which is the default in an unbounded grid) is 12 x 12 pixels. Menu icons are 16 x 16 pixels.

Question: Why am I getting a MissingResourceException; can't find bundle for base name info.gridworld.gui.WorldFrameResources, locale en_US?

Answer: Make sure you are using the most current version of the JAR file.

Question: I am using the most current version of the JAR file, but the version number in the Help -> About dialog shows an older version.

Answer: Remove any older versions of the JAR file from your jre/lib/ext directory.

Question: When I run the BoxBugRunner, I cannot add a rock to the world.

Answer: A world knows only the actors that have been added, and their superclasses. If you want to allow students to add rocks, either add at least one rock in the main method, or call the addOccupantClass method on the world.

Question: Why does the case study use Math.random and not java.util.Random?

Answer: This tracks a change in the AP CS subset.

Question: Why do some of the case study methods (such as BoxBug.act) not have method comments?

Answer: When overriding a method, Javadoc automatically inherits the method comment from the superclass. We omit comments unless the subclass method can benefit from a specific comment (as, for example, Location.toString).

Question: Why is there a large number (such as 0.91) in the background of the grid?

Answer: This is the version number. It helps identify the version when someone sends a screen shot to show a problem. The version number is not displayed in the final version of the program.

Question: When clicking on an object and selecting putSelfInGrid, I get this error: java.lang.IllegalStateException: This actor is already contained in a grid.

Answer: That's how it should be.

public void putSelfInGrid(Grid<Actor> gr, Location loc)
puts this actor into the location loc of the grid gr. If there is another actor at loc, it is removed.
Precondition: (1) This actor is not contained in a grid (2) loc is valid in gr

Question: When trying to put an actor outside the grid, an IllegalArgument is thrown.

Answer: That's how it should be.

public void putSelfInGrid(Grid<Actor> gr, Location loc)
puts this actor into the location loc of the grid gr. If there is another actor at loc, it is removed.
Precondition: (1) This actor is not contained in a grid (2) loc is valid in gr

Question: When you go to set the bounded environment with both parameters being zero you get an IllegalArgumentException.

Answer: That's how