Lambda Lift

Introduction

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 rules. 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.

The Mine

A mine is an n×m grid of cells. Each cell contains one of the following.
R the robot miner
# a brick wall
* a rock
\ a gold lambda
L a closed lift
O an open lift
. earth
[sp] 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.

Movement

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.
movement movement movement

Lambdas

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.

lift

Watch for Falling Boulders

Boulders or rocks fall down when not supported.

fall

Wait

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.

wait

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.

push

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.

catch

Tumbling Rocks

When rocks fall they may slide left or right, and even crash into each other. A rock cannot support another rock by itself.
slide lambda slide tumble crash

Scoring

A robot exploring a mine will score points as follows:

The games ends when:

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.
  1. http://cs.fit.edu/~ryan/java/programs/llift/contest1.map
  2. http://cs.fit.edu/~ryan/java/programs/llift/contest2.map
  3. http://cs.fit.edu/~ryan/java/programs/llift/contest3.map
  4. http://cs.fit.edu/~ryan/java/programs/llift/contest4.map
  5. http://cs.fit.edu/~ryan/java/programs/llift/contest5.map
contest1.map contest2.map contest3.map contest4.map contest5.map

Download

To write your own Java program for the robot miner it will be necessary to download the file mine.jar.

You can use this Java jar file for three different purposes.

  1. 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
    
  2. To compile your Java program:
    javac -cp .:mine.jar MyFirstRobotMiner.java
    
  3. 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
    

The Interface

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:
  1. How tall is the mine?
  2. How wide is the mine?
  3. How many lambdas are currently left to be collected in the mine?
  4. In which row in the mine is the robot miner currently located?
  5. In which column in the mine is the robot miner currently located?
  6. 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 LRDUAW.

Lmove left
Rmove right
Dmove down
Umove up
Aabort; give up
Wwait 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.

Translating

Suppose you have created the Java source file MyFirstRobotMiner.java 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 MineInterface; 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.

Running

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.

Submission

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.