To aid in the development of your submission, we are providing a visualization
tool to competitors. This tool is provided as is, with no guarantees of any
sort. The tool is packaged as an executable jar, which can be run either by
double clicking it (in windows anyway) or from the command line as "java -jar
As in previous contests, to use this visualization tool, you should create an application
that communicates with the tool via standard in and standard out. Note that
this does not effect the way your program should work when you submit it on
the TopCoder website.
The program that you write for the visualizer should start by reading the parameters from
the standard input stream.
Once you have read the parameters, you should write your moves to standard
out, one move per line. The visualizer will attempt to read moves until your program returns an 'X'.
After reading the initialization parameters (one per line), you should
repeatedly read exactly 7 lines of input, representing the 7 elements that would be passed to your move function.
After each set of 7 lines you should write your next move and then read another 7 lines of input.
Here is an example of what your wrapper code might look like. Your main
method could read the parameters and then pass them to your move method
(which would be unchanged between your visualizer code and your submission
code). The readInt(), readChar() and readDouble() methods each read a line of
input and parse appropriately.
for(i = 0; i<7; i++)
s[i] = readLine()
ch = move(s)
while(ch != 'X')
Using the visualizer
To use the visualizer, you must have Java 1.5 or greater installed. To run
the visualizer, you can execute the command "java -jar Mining.jar". This will
open up a new window containing the visualization, along with a number of
controls. The first thing you will need to do is specify the executable you
have made for your mining code. You may either enter its path, or select it
via the button provided. If your executable requires arguments, enter them
in the provided field. For example, if your executable is a Java class
DeepMining.class, you should enter something like "java DeepMining" (without
the quotes) in this field (replacing "java" with the full path to the Java
executable if necessary). The exact details of what you enter here will
depend on your language choice. In particular, in Java, you will need to make
sure that the class file is in the same directory as Mining.jar, or else you
will need to specify a classpath along with the executable location and class
Once you have the executable set properly, you can run the simulation.
You may customize the test case by entering any values for the parameters
that you like. The field seed is a seed for
the random number generator and will allow you to repeatedly generate the same
test case. Clicking the "Generate Map" button will generate the map based on your
parameters. Alternatively, you can select new random values for the seed and size
parameters by clicking "New Parameters and Map". If you've changed the seed,
since you last generated a map, the seed you entered will be used to generate
the parameters, otherwise a
new seed will be generated. To test the examples from the problem statement in
the same way they are tested by the TopCoder system, you simple need to use the seeds provided in the problem.
Once you've started the simulation, any output you write to standard error,
along with messages from the visualization tool will appear in the text area below the
visualization. You may control the speed with the slider on the top.
Command Line Options
You can specify a number of parameters on the command line to
simplify the automation of testing (though you don't need to use any of them).
For example, "java -jar Mining.jar -fuelTank 10000" will set fuelTank to 10000 when running the
|-height <height>|| Specify the initial height of the window |
|-width <width>|| Specify the initial width of the window |
|-fuelTank <fuelTank>|| Specify fuelTank |
|-cargoBay <cargoBay>|| Specify cargoBay |
|-maxMineral <maxMineral>|| Specify maxMineral |
|-costFactor <costFactor>|| Specify costFactor |
|-hole_prob <costFactor>|| Specify costFactor |
|-gob_prob <costFactor>|| Specify costFactor |
|-seed <seed>|| Specify the initial seed |
|-speed <speed>|| Specify the initial speed |
|-exec <command>|| Specify the command to execute your code |
|-novis||Run the test case without the visualizer (requires
-exec, implies -go) |
|-go||Start running immediately (requires -exec) |
|-drop||Tell the visualizer to drop frames if it can't keep up |
- Make sure you flush your buffers after writing to standard out, or the
visualization tool might not get your output, and it will appear to
Java users: if you get something java.lang.NoClassDefFoundError
it means that you've correctly set the path to Java, but Java can't find
your class. Among other things, you can try setting the command to something
like "PATH1\java -cp PATH2 DeepMining", where PATH2 is the location of your
If the visualizer fails to do anything, and there are no error messages, the most likely
explanation is that the visualization tool is still waiting for your program
to make a guess. An obvious cause for this is that your program is
in some sort of an infinite loop. Another possible cause is that your program
is waiting for input which it will never get, as the visualization tool is
waiting for your program. Make sure that you are reading and writing as
Please note that, while we will do our best to make the workings of the
visualizer as clear as possible, it
is impossible for us to help everyone debug their code to make it work with
the visualization tool. If you do think you have discovered a bug, please email
firstname.lastname@example.org or post the bug to the forums. The more details you
provide, the more likely you are to be helped quickly. Please to NOT post
code to the forums, as that is against the rules.