In this competition you are asked to write a Java program to
control a robot miner to collect all the valuables in a mine and to lift them to the surface.
The best program is the one that accumulates the most points in a variety
of different mines.
This problem was part of a ICFP competition, but we use only the basic types
of mine and none of the advanced features.
You may wish to play the game yourself in order to gain an understanding of the
Several on-line versions are available.
(They work with all the advanced features as well.)
In this document we describe the rules of the Lambda Lift
and how a Java program interfaces with the mine program.
Some knowledge of Java programming and the Java JDK is required.
A mine is an n×m grid of cells.
Each cell contains one of the following.
||the robot miner
||a brick wall
||a gold lambda
||a closed lift
||an open lift
||an open space in the mine
Nothing can pass through a brick wall
or a closed lift ,
and it is not possible to move outside the
n×m grid of the mine.
The mining robot
can excavate earth ,
move into an empty space ,
move onto and collect a lambda ,
push rocks ,
and enter an open lambda lift .
Rocks will fall if they are not supported by another object.
More specific details follow.
The mining robot can move right, left, down, and up.
(The only other moves are wait and abort.)
Not only can the mining robot move through empty space,
but it can also move onto earth and onto a lambda.
The earth is removed permanently leaving empty space
and lambdas are collected permanently also leaving empty space.
The goal is to collect all the golden lambdas and take them to the lift.
The lift is operational only after all the golden lambdas have been collected.
Watch for Falling Boulders
Boulders or rocks fall down when not supported.
The robot miner may choose to wait 'W' instead of move.
If a rock lands on the robot miner's head, it is broken and the game is over.
The robot miner can push a rock left or right (but not up or down),
if there is a empty spot to push the rock into.
It is possible to catch a falling rock, if the robot miner times it just right;
it is also possible to push a falling rock.
When rocks fall they may slide left or right, and even crash into each other.
A rock cannot support another rock by itself.
A robot exploring a mine will score points as follows:
- 25 points gained for every lambda collected
- 1 point lost for every move made
- 25 extra points per lambda collected on executing an abort
- 50 extra points per lambda collected on lifting them out of the mine
The games ends when:
- the robot miner reaches an open lift (win)
- the robot miner
is crushed by a falling rock or executes an abort (broken)
- the robot miner makes too many moves (exhausted)
- the program fails to make a move in a reasonable amount of time
Example Mine Maps
Maps of a mine are just US-ASCII text file. One can create a
map using any text editor.
Only eight characters #* \R.LO are used as described earlier.
Listed below are some maps which have already been
created. The actual maps used in the competition are not revealed
until after the competition.
To write your own Java program for the robot miner
it will be necessary to download the file
You can use this Java jar file for three different purposes.
- To play the game interactively with some particular mine:
java -Dinput=key -Ddisplay=graphics -cp mine.jar Main http://cs.fit.edu/~ryan/java/programs/llift/maps/contest3.map
- To compile your Java program:
javac -cp .:mine.jar MyFirstRobotMiner.java
- To watch your Java robot miner in some particular mine:
java -Ddelay=100 -Ddisplay=graphics -cp ./agents:mine.jar Main http://cs.fit.edu/~ryan/java/programs/llift/maps/contest3.map MyFirstRobotMiner
To create a Miner, the Java programmer implements a class
and computes the next move of the robot miner given the
current situation in the mine.
This information is held in a Java object
implementing the interface MineInterface.
This object will answer several questions about the mine:
- How tall is the mine?
- How wide is the mine?
- How many lambdas are currently left to be collected in the mine?
- In which row in the mine is the robot miner currently located?
- In which column in the mine is the robot miner currently located?
- What object is located at position (row,col) of the mine?
The rows are numbered 1 to R from bottom (down) to top (up).
The columns are numbered 1 to C from left to right.
The object at position (row,col) of the mine
is represented by one of the eight characters
"#* \R.LO" as described earlier.
Here is the Java source code MineInterface.
It is not necessary to have the source file for the Java interface
MineInterface as the class file is provided in the jar file.
To create a robot miner, the Java programmer implements a class with two methods
name and next.
The method next returns the next move of the robot miner as a single letter
|A||abort; give up|
|W||wait on the same spot|
Here is a complete example of a robot miner.
This robot miner may choose to push a rock even when it is not
possible to move it. In this case the move is interpreted
the same as a wait.
You may wish to cut and paste, or download this Java program,
to use as a template in developing your own first robot miner.
Here is another, more complicated, robot miner to study.
It chooses the direction to explore randomly from
the possible directions.
Suppose you have created the Java source file
in order to translate the file to a Java class file
you must have access to mine.jar.
In Eclipse you can import the jar file to your Eclipse project
and Eclipse will add the jar file to your project's class path.
Or, you can translate the Java source file using
a command something like this:
javac -cp .:mine.jar MyFirstRobotMiner.java
javac -cp .;mine.jar MyFirstRobotMiner.java
A Java program for a robot miner depends on
the Java interface
this class is found in the jar file, mine.jar.
Your Java source files must also be on the classpath for the compilation.
In the example above,
the file MyFirstRobotMiner.java is located in the current directory . (“dot”).
And, so is the jar file.
Please note the class path separator is colon on Unix/MacOS computers,
and semi-colon on Windows computers.
You can try running the robot miner program on the map of a mine by
running the following command:
java -Dseed=12345678 -Ddelay=100 -cp .:mine.jar Main contest3.map RandomWalk
java -Dseed=12345678 -Ddelay=100 -cp .;mine.jar Main contest3.map RandomWalk
If you run this command,
RandomWalk, the program given above,
completes this mine in 964 moves.
- The Java property seed controls the sequence of random numbers used
by the robot miner RandomWalk and may not be necessary
for other robot miners.
- The Java property delay controls the speed at which the
miner moves. A small delay speeds up the simulation.
- The class path must be set to include mine.jar and the directory
of the class of the robot miner, if any.
In Windows, elements of the class path are separated by a semi-colon;
in Unix/MacOS systems: a colon.
- The name of the Java program that runs the simulation is Main.
Is is provided in the jar file.
- The map of the mine is required for the program to work.
The first command-line argument is the name or the URL of a correctly formed map file.
This could be a file name in the local system, if you write your own map file.
Some map names, like contest3.map, are known to the program and are supplied in the Java jar file.
- The second command-line argument is the name of a Java class which
controls the miner.
The robot miner RandomWalk is provided in mine.jar, so it is always
a legal choice.
All the class files of the robot miner must be on the class path.
All participants must register before submitting.
Your name and e-mail address is required.
A control code will be e-mailed you.
This control code is used when you submit your robot miner.
The robot miner may be implemented using multiple classes.
This is fine, just submit all of the classes at once.
Please do not leave print statements in your code.
Also, do not use Java packages!
They complicate running and launching the game.
Turn in Java source files only.
Do not turn in class files.
Go to this
WWW page to upload your submission.