Map editor

The map editor enables maps to be changed or new maps to be created. When the Map Editor is selected, a new window is opened containing an editable version of the current map - so choose a map that is closest to the one you want to create. An example is shown in Figure 1. Here the user is starting to enter an additional line of map elements and has placed the first "wall" item.

Sourkoban: map editor example
Figure 1. The Map Editor. The user has just started adding a new line. Notice that the map elements are each separated by a small gap: this is to enable the editing cursor (the black rectangle to the right of the newly inserted wall element) to be visible. When the map is finished the user clicks on the "LOAD" button or abandons the edit using "QUIT". The "LOAD" button will cause the program to read in and check the map for consistency. Any problems will be reported using a pop-up, where possible giving the line number of the error.


The Editor accepts a very limited set of inputs - all other keys are ignored. The editing cursor can be positioned by clicking with the mouse, or by the keyboard arrow keys. Map elements can be deleted by use of the Backspace button. Segments of the map can be deleted by selecting using the mouse and then typing Backspace. New lines of map elements can be started by typing "Enter". Map elements can be added at the editing cursor by typing the corresponding standard map symbols:

"@","$",".","*","+"," ","#".

Depending on the current "skin" the following map elements will appear.

Sourkoban: symbol for man Sourkoban: map element for man
Map elements for the man.


Sourkoban: symbol for box Sourkoban: map element for box
Map elements for box.


Sourkoban: symbol for designated location Sourkoban: map element for designated location
Map elements for designated location.


Sourkoban: symbol for man in designated location Sourkoban: map element for man in designated location
Map elements for the man in designated location.


Sourkoban: symbol for box in designated location Sourkoban: map element for box in designated location
Map elements for box in designated location.


Sourkoban: symbol for passage Sourkoban: map element for passage
Map elements for passage.


Sourkoban: symbol for wall Sourkoban: map element for wall
Map elements for wall.


Checking and loading the map

When the user clicks "LOAD" the edited map is checked for simple errors: (1) is there exactly 1 man?; (2) is there at least 1 box and does the number of boxes equal the number of designated locations; (3) are there at least 2 wall elements in each line of the map? (this is simply to avoid holes in the map which can confuse some algorithms). This is all the checking that is done. So if you build a wall between the man and the boxes the program won't spot it, etc. Any problems found are reported in a pop-up and the user is given the oportunity to fix them and reload or to give up using the "QUIT" button. If the map is OK it is loaded as the current map and appended as a new map set to the end of the current map sets and given the map set name "Editor". The editing window will disappear. If it doesn't disappear and you haven't noticed a pop-up reporting problems, the pop-up must be hiding behind another window. The current verion of the Editor has the unwanted "feature" that when you move the editing cursor with the arrow keys the man in the original map may also move! I will look into fixing this even though it has no effect on the user (the current map is replaced by the edited map once editing is completed anyway).

Saving a map

Maps can be saved using the "Save map" option in the File menu.