The maze.py file is the top level file to run and loads the modules and graphics. I run this with python 2.5 and gtk 2.0 on debian linux 5.0 with a 1.6 ghz processor. You should be able to run this by double clicking maze.py or:
cd /maze/directory
python maze.py
to run in the shell and see any erroneous output.
The contents of the readme.htm file are as follows but you can view this file with a web browser if you have downloaded it.
MAZE
Maze introduction:
There are nine elements in the maze.
man
floor
wall
brick
ball
hook
hole
gem
bomb
The objective is to find all of the gems. The man can only push things that are pushable though. Simple enough, except the walls get in the way and are not pushable but you can usually go around them. If you can't get around the walls don't worry because there are bombs that can destroy walls but don't push two bombs together because it makes a hole in the floor. A hole can filled though by pushing a brick into it but bricks are heavy and you can only push one brick at a time so don't push the bricks together. The balls are easier to deal with because they are easy to move and you can push any number of balls at the same time and you can always dump them down a hole to get rid of them. If you really get stuck you can probably find a hook. Hooks will switch places with any moveable item like a ball or a brick or a gem.
The real problem is you can only see the part of the maze where you are standing and the rest of the maze is a mystery but the gem counter will let you know how many gems there are left to find and the step counter will show how many steps you have taken.
Maze is a two dimensional spacial relations puzzle, technically speaking. Maze is not just a maze, it can create mazes that are generated from scripts. (A script is a text file containing instructions for the maze program to read ) The scripts describe to the program, what sort of maze to make.
A script can specify what maze elements should be included and which ones should not be included or how much of certain elements should be in the maze relative to the others. A script may specify that the maze elements should be random or that certain elements should be at certain places. It is up to the scripter to design a maze that conforms to the style that they want.
Script commands are written in the script using what is called a script language. This is a special language that the program understands and is easy for humans to learn also. In this way there is a common language that humans can use to communicate complex ideas to the program.
The maze scripting language and it's commands are covered in great detail in the scripting section of this document.
The Maze Menu
Load:
Loads a .smz script file.
When the program starts it loads an embedded script. To play anything else you need to load it.
Reload:
Reloads the last script file again.
Restart:
Starts the game over from the beginning.
Save:
Saves the game as a .smz script file.
Quit:
Exits the program immediately.
Maze Strategy Guide:
If you play maze enough eventually you will want to have more challenging problems and maze can provide them, up to extraordinarily difficult problems that will require a lot of thought and planning as well as numerous actual steps to execute. The subject of this section then is to address the issues involved in the solution of these extra difficult problems.
Mazes can be generally classified into several different types. Those that contain lots of easily acquired resources that require very little skill or planning to complete he maze. These types of mazes are simple and quick to solve. Other types of mazes can require a lot of thinking and planning and probably restarting the maze from the beginning when mistakes are made. These mazes can consume a great deal of time and effort to complete. This 'Strategy Guide' section refers to the second type where technique makes a difference between success and failure. Named concepts are introduced first to facilitate the discussion and aid in conceptualization of the ideas presented. Most often this process of breaking down a complex problem into component ideas is of itself an aid to understanding the collective problem.
Strategy component concepts and terms:
Staging Areas:
The first technique which is of primary importance is the staging area. Staging areas are simply clearings where you can get around the other side of a maze element to change the direction in which you can move it. Very dense mazes do not have many staging areas inherently and so they must be created and this should be the first order of business when beginning a dense maze. This will often involve the expenditure of several resources but a well placed staging area can be of inestimable value.
Looping Paths:
Often a staging area will be in the shape of a loop for lack of better circumstances. Loops can serve the same purpose of allowing you to move around the opposite side of a resource element to shift the direction of it's allocation to a new place.
Encircling Paths:
Loops can be very small or they can be very large and may they have the purpose moving around a particularly dense area of the maze which resists access. Encircling allows you to move about the area for the purpose of peeking and piercing access.
Path Finding:
Path finding is similar to Staging except that the area cleared for use is linear in shape rather round like a Loop or a Staging area. Paths are useful for connecting separate staging areas and loops or for exiting an area which has been exhausted to explore a new area. One path can often be connected to another path for the creation of large loops or encirclements.
Piercing Paths:
The path finding technique is used to pierce deeper into unexplored areas allowing for a better view of the circumstances. Since the viewable area of the maze is restricted you often need to move about just to evaluate the plausibility of exploiting an area. Piercing may also be a preferable method of entry to an area rather than trying to encircle it.
Exchanging Resources:
Exchanging resources involves sacrificing a resource to acquire another resource which is of greater value in terms of it's quality. For example , You need to fill a Hole and all you have available is a Bomb and you use the Bomb to acquire a Brick which is then used to fill the Hole. Of course this may include exchanging multiple undesirable resources for one of the type that is needed.
Resources:Investing
Investing refers to the technique of using resources to acquire additional resources which are greater in quantity. Typically the Hook is used in this way but it may be any type of resource. For example; using a Hook to acquire 2 Bricks.
Resources : Mining
Mining resources means that you enter an area with the sole intention of extracting the available resources from it.
Resources: Warehousing
Most difficult mazes will require the acquisition of stock piles of resources. After accumulating many resources it is necessary to be able to find them and not have them scattered all over. A large expanded staging area can serve as a rendezvous or warehouse for materials.
Resources: Housekeeping
Housekeeping is habit of moving resources into logical order in the anticipation of further activity in the area even though there is no immediately obvious reason for doing so. It often happens that the extra energy expended on housekeeping will be a time saver later on.
Resources: Flagging
Flagging means to arrange elements in a non random way so as to mark an area as having been explored already in contrast to the randomized areas which have not been explored yet. In the event that you become disoriented and are not sure which areas you have been to already it would not not be wise to expend resources unnecessarily to pierce into an area which has already been exhausted.
Resources: Disposing
It is sometimes desirable or necessary to just be rid of certain resources. If you have deemed them completely unusable you might rather just have the space they are taking up or in some cases they are just in the way of progress and need to be removed.
Paving Paths:
Paving is used here to describe the action of smoothing a transition path from one area to another for the reallocation of warehoused materials. Sometimes the path between two staging areas can be very complex to traverse with resources in tow and is worth the expense of utilizing some resources to pierce the barrier and make the transition path straight and easily navigable.
One Way Paths:
Some paths allow the reallocation of resources in only one direction, for instance Left to Right but will not allow the movement of resources from Right to Left. These paths are called "one way paths". It is very useful to be able to recognize these types of paths before you attempt to move something through them.
Peeking:
This is the action of moving to an area that is known to be a dead end just to have a look at an adjacent area. You may have forgotten the particular lay out of an area that can be viewed with greater clarity by moving down a path that has pierced that area but which dead ends without giving access to it. The information acquired may be of use from another vantage. In general you should never move anything unless you have a reason for moving it. Moving items tends to pack them together and makes them more immobile. Try to get a picture in your mind of the area that you are contemplating piercing from what information you have about it. Blindly stabbing at things rarely is a successful technique.
The choice of how best to employ resources is one of the skills that must be learned. The concepts mentioned here will help you to organize your strategy in terms that are applicable to mazes. You will need to take calculated risks in order to achieve your goals. There is no avoiding this issue since you cannot see the whole maze you must only guess which is the correct path to follow. Often it happens that you are following a blind alley. Many mazes are constructed to be misleading and you will have to contend with this. It should be a primary goal initially to get a good picture of the maze as a whole in your mind before attempting to address certain specific problems which present themselves in the immediate circumstance.
The Maze Scripting Language
The maze scripting language is extremely terse. It consists of 5 commands.
configuration
rectangle
circle
glob
map
configuration:
The configuration command is used to control the percentage of individual maze elements for a randomized fill operation.
A typical configuration instruction example.
configuration floor:202 ball:32 wall:115 brick:50 hook:7 gem:0 bomb:16 hole:13
You may alternately use only elements that are to change value such as
configuration gem:7
in this case only the gem percentage will be changed and all other element values will retain the same value that was already assigned to them previously.
If you want to eliminate a certain element you must declare it as zero. such as
configuration bomb:0
This would produce output with no bombs in following operations.
The elements that can be used for a configuration are in the elements list.
Elements List.
floor
wall
ball
brick
hole
hook
gem
rectangle:
The rectangle command specifies a rectangular area that is to be filled. For example:
rectangle type:wall x1:0 y1:0 x2:99 y2:99
This would fill the entire maze with walls. All mazes are 100x100 square with the X dimension being left to right and the Y dimension being top to bottom. The top, left corner is 0, 0 and the bottom right corner is 99, 99. So any value that you use should be between 0 and 99. The x2 and y2 values should always be larger than the x1 and y1 values.
Alternately you can use the form.
rectangle type:gem x1:67 y1:45
This would place a single item at 67, 45 , in this case a gem which is specified by the type parameter. The type can be any of types listed in the type list. Element type list.
rand
none
wall
floor
hole
ball
brick
hook
gem
man
Specifying the rand type will cause the fill operation of the rectangle command to use the configuration for the generation of random elements. You should always set the configuration first before using a fill command like rectangle. There is only one configuration and it is used by all fill operations that occur after the configuration is set until another configuration command changes the values of the configuration then those values will be used.
Setting the configuration is like choosing the color that you want to paint with and the rectangle command is like choosing a brush to paint with.
Choosing none as a fill type applies a special transparency that when combined with other fill operations will paint nothing, allowing the other layer to show through. This is not very useful with a fill command like rectangle because it paints nothing. None is mostly used for the map command but it is allowed for other fill operations. The last special value for rectangle's type is man. This is allowable also but again there can only be one man in the maze so filling an area with man makes no sense.
The rest of the rectangle type values are normal configuration values.
circle:
The circle command is exactly the same as a rectangle command except that it draws a circle.
An example circle command.
circle type:rand x1:50 y1:50 radius:30
The x1 and y1 specify the coordinate of the center and the radius specifies half the width of the circle.
Circles are good because walkable areas of the maze are difficult work in with ninety degree corners. In spite of the fact that the maze is a square and matrices are square you should tend to use circles.
glob:
The glob command is similar to rectangle and circle except that it creates an irregular shaped area.
An example glob command:
glob type:rand x1:70 y1:30 size:5 freq:50
The glob command will make freq number of circles with radii of size starting at x1, y1.
The utility of the glob command is that you don't know the ultimate shape that the glob will take because it is random so that even the script writer cannot predict it's form.
maps:
The map command is different than the other commands and allows for fine grain control of maze elements.
An example map command.
beginmap x1:20 y1:60
LL##LLLLLL
LL*LLL?LLL
LLLL@LLLLL
LLLLLLLLLL
endmap
This map instruction specifies forty particular maze elements at forty individual locations without the need for many commands. It draws the maze characters directly to the maze array. The maze array is a two dimensional matrix of key characters. This is the way that the maze maintains it's state information.
The map instruction inserts the map into the matrix just as it is written. The x1 and y1 parameters are used as offsets which move the map to the given offset and write it there.
The lines of a map instruction must be of equal length. They can be up to 99 characters long but then all of the lines need to be 99 characters long. The width need not match the length as is shown in the example, there are ten characters in each line and four lines so that it draws an area that is 10x4.
map element chart
rand %
none ~
ball O
brick #
bomb *
gem V
hole @
hook ?
wall H
man !
floor L
There is also a comment command which is not a command since it has no effect on the script output. Comment are any line that begins with the # character and extends to the end of the line. Comments are useful for making notes about the script to yourself or to others who might have to read the script.
An example comment.
"#I wrote this script on Tuesday."
Comments can also be used to temporarily disable script code.
good scripting
These script commands allow you to things that you should not do or probably wouldn't want to do and this section will describe good scripting technique that makes for playable mazes.
Certain common sense things are needed. First there can only be one man in the maze and you need to take care to always make a man and only one.
The man must be able to move. Encasing the man in stone would make for an unplayable maze. Where randomness is used to generate mazes you will need to take precautions that the man is able to move about the maze.
All areas of the maze should be accessible to the man. If two areas of the maze are separated by a thick wall then he man may not be able to get to the other area.
There needs to be at least one gem in the maze or it is unplayable. Again where randomly generated mazes are used you will need to take care that there are sufficient gems used.
The configuration balance is an important matter and you will need to gain experience with this to write good scripts. For example if there are more holes than there are bricks then the player will not be able to fill all of the holes. This is an imbalance in the configuration. It may be that you want to create an imbalance in the game and that depends on the theme of the maze you are creating. The idea is that it must be a playable maze and hopefully an enjoyable challenge for the player.