Lumberjack Visualization

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 Lumberjack.jar".

As in the previous contest, to use this visualization tool, you should create an application that communicates with the tool via standard in and standard out. Upon first launching the application, you should read the parameters from standard in (the parameters that will be provided to your examineForest function in the real contest). Once you have accomplished that, you should interact with the visualizer by writing your move sequences and look commands to standard out and reading the response from standard in. The protocol is as follows:
Method Output Input Sample
Lumberjack.init None
HEIGHT WIDTH TIME DENSITY
IN : 50 50 500 0.15
Lumberjack.look
0 DIR
DIR is E, N, W, or S. The number 0 tells the visualizer that you are performing a look, not a move.
LEFT RIGHT
Where LEFT would be element 0 of the Lumberjack.look return, and RIGHT would be element 1. In the event that LEFT or RIGHT would have 0 characters, they are changed from "" to "^"
OUT: 0 E
IN : ^ YYNNNNYYYNNN
Lumberjack.move
1 MOVES
MOVES is a sequence of E, N, W, and S. The number 1 tells the visualizer that you are performing a move.
X Y
The X and Y coordinates that you end up at.
OUT: 1 EEESSS
IN : 3 3
For instance, to use the visualizer, you might implement the following pseudocode, and adapt your solution to use it:
    look(dir)
        print("0 "+dir)
        ret[0] = nextString()
        ret[1] = nextString()
        return ret
    
    move(moves)
        print("1 "+moves)
        ret[0] = nextInt()
        ret[1] = nextInt()
        return ret

    main()
        height = nextInt()
        width = nextInt()
        time = nextInt()
        density = nextDouble()
        //YOUR CODE STARTS HERE
    

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 Lumberjack.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 from your lumberjack 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 LumberjackExam.class, you should enter something like "java LumberjackExam" (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 Lumberjack.jar, or else you will need to specify a classpath along with the executable location and class name.

Once you have the executable set properly, you can run the simulation. You may customize the game by entering any values for the parameters that you like, and then clicking generate map to make a new map. The field seed is a seed for the random number generator and will allow you to repeatedly generate the same map. Clicking the "Generate Map" button will generate the map based on your parameters. Alternatively, you can select new random values for all 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 as well as the map, otherwise a new seed will be generated. To test the examples from the problem statement, you may simply enter the seeds 1-10, corresponding to examples 0-9, and click "New Parameters and Map".

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 Lumberjack.jar -M 50" will set M to 50 when running the tool.
-height <height> Specify height
-width <width> Specify width
-time <time> Specify time
-M <M> Specify M
-P <P> Specify P
-density <density> Specify density
-q <q> Specify q
-q0 <q0> Specify q0
-s <seed> Specify the initial seed
-t <speed> Specify the initial speed
-exec <command> Specify the command to execute your code
-novisRun the test case without the visualizer (requires -exec, implies -go)
-goStart running immediately (requires -exec)
-dropTell the visualizer to drop frames if it can't keep up
-showallShow all the individual moves, even ones that are concatenated together in a single call to move

Final Notes