![]() ![]() |
Karel the Robot |
![]() ![]() |
How to build a world.Double click on the WorldBuilder.bat file Pick up a tool in the tools (button) panel. The name of the current tool is
highlited. To put more than one beeper on a corner, click more than once with the beeper
tool active. 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've used an extension kwld here, but there is nothing special about it. It is neither assumed or automatically appended. 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.
World builder shows the position of the mouse in street,avenue coordinates if you have selected any tool. If the current tool is the Beeper tool, it shows the nearest corner (where the beeper will be placed if you click). If the current tool is the Horizontal Wall tool, it shows where the corner below the wall that will be placed. If the current tool is the Vertical Wall tool it shows the corner to the left of the wall that will be placed. How to use a world created with the world builder.Remember the name you used when you saved it. Say test.kwld. Include a statement in your robot program to open it. Include this at the
beginning of World.readWorld("test.kwld");
The world file will be opened and its content merged into your existing world. Note on the files created by the world builder.The format is compatible with that of the older simulator. However, there is no need to use the older version as this is an extension. You can actually write the world files with a text editor. Lines that do not start with a keyword for the builder are ignored. Elements can appear in any order. They are NOT case sensitive. Here is a sample file. KarelWorld The first line (KarelWorld) is not a keyword, but it might be in the future. It might also contain a version number eventually. It is ignored when reading now, but written when you save a world. The following gives the meaning of the current keywords. This is not expected to change.
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. If you create a world in a Robot program using the programming interface (in this version or the previous one) and save it, it will be consistent with the world builder files. Karel Home Page |