How to build a world --- Computer Science II --- Haas
Running WorldBuilder
Double click on the KarelJRobot.jar file to launch the world builder. If this does not work create a file named WorldBuilder.bat with contents
(just one line): java-jar KarelJRobot.jar
Put it in the same directory as the jar file and double click it to run the world builder.
Using WorldBuilder
- Click on a button on the world panel. The name of the current tool is highlited.
- Click where you want to place an item controlled by that tool.
- For beepers click near an intersection when using the beeper tool.
- For walls, click across streets (for vertical walls) and across avenues (for
horizontal walls) when using the corresponding tool.
- To put more than one beeper on a corner, click more than once with the beeper
tool active.
- To lower the number of beepers on a corner, control click the corner with the
beeper tool.
- To put an infinite number of beepers on a corner, control-click (with the
beeper tool) when there are none on the corner.
- To clear all the beepers from a corner, shift-click the corner when using the
beeper tool.
- To remove a wall from across a street, control click the wall segment with
the appropriate wall tool.
- To change the number of streets or avenues in the world, enter an integer
into the corresponding text field and hit enter. Note that this doesn't restrict
the world in any way. It just determines how much of it is drawn with street and
avenues.
- Save when you like. I use an extension kwld or wld, but there is nothing
special about it.
- You can also open an existing world to edit/modify it.
- The Clear World button will remove all elements from the world. (Be careful,
there is no UNDO here.)
- Quit the world builder by closing either of its windows. If your world has
been modified since the last Save you will be prompted to save it again. Note
that if you QUIT using a menu or command key, this extra Save prompt will NOT
occur.
If you can�t get the jar file to run you will have to build worlds by editing
text files. Here is a sample file.
KarelWorld
Streets 10
Avenues 20
beepers 3 4 1
beepers 4 2 1
eastwestwalls 3 2 4
northsouthwalls 4 2 2
northsouthwalls 4 3 3
northsouthwalls 1 5 5
northsouthwalls 1 4 4
- Make the first line: KarelWorld
- Streets: the number of streets to draw.
- Avenues: the number of avenues to draw.
- beepers: street, avenue, number of beepers
- eastwestwalls: North of Street, first avenue crossed, last avenue crossed. Last should be bigger than first (or equal).
- northsouthwalls: East of Avenue, first street crossed, last street crossed. Last should be bigger than
first (or equal).
- The world builder writes out a separate wall command for each segment of a wall (one block long).
If you do it by hand, you can combine them.