MaxwellDemon Visualization

To aid in the development of your submission, we are providing a visualization tool to competitors. 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 Maxwell.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 W, H, D, N, and speed, from standard in, all in one line, in that order. You should then read N lines representing the N particles, in the same format as described in the problem statement. (Hint: you may need to be careful to consume the new line character before moving on to the first line of the particles.)

For instance, to use the visualizer, you might implement the following pseudocode, and adapt your solution to use it:
    main()
        W = nextInt();
        H = nextInt();
        D = nextInt();
        N = nextInt();
        speed = nextInt();
        //consume end of line
        for(i = 0 to N-1)
            particles[i] = readLine();
        output = moveOpening(W,H,D,speed,particles);
        println(length(output))
        for(i = 0 to length(output)-1)
            println(output[i]);

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

You may customize the game by entering any values for the parameters that you like, and then clicking generate. The field seed is a seed for the random number generator and will allow you to repeatedly generate the same game (note, however, that seed 0 means to use time as a seed). Clicking the "Generate" button will generate the game based on your parameters. Alternatively, you can select new random values for all parameters by clicking "New Parameters". 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 appropriate seeds and click "New Parameters".

Once you've started the simulation, any output you write to standard error, along with messages from the visualization tool will appear in the visualization. You may control the speed with the slider on the top of the control panel.

You may also play the game manually, with the keyboard. To do this, simply check the "Manual" box and click start. You may then use the up and down arrows to move the openning. If you have problems playing, make sure that the game window has focus by clicking anywhere inside the vessel.

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 Maxwell.jar -width 5" will set width to 5 when running the tool.
-W <W>
-H <H>
-D <D>
-N <N>
-speed <speed>
-simSpeed <speed> Change the speed of the simulation
-seed <seed> Specify the initial seed
-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)
-onewindowRun in one window instead of 3

Final Notes