RobotRouting 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 Robot.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. 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 standard in. Once you have read the parameters, you should write your robot planning to standard out. Each line of your output should correspond to one time step.

The first line that you read will contain the values of the parameters C, M, N, K, rowGap, and colGap, in order separated by spaces. The next two lines will contain robotX and robotY, respectively. Each of these lines will start with an integer, R, giving the total number of robots. This will be followed by R integer values for the coordinates. The next line will simply contain P, the number of products. This will be followed by P lines, each of which corresponds to one element of products. Finally, the taskID and taskY parameters will be given in the same format as robotX: a single line starting with the number of elements in the array, followed by that many integers representing the elements.

For instance, to use the visualizer, you might implement the following pseudocode, and adapt your solution to use it:
    products()
        length = nextInt()
        ret[length]
        for(i = 1 to length)
            ret[i] = nextLine()
        return ret

    nextIntArray()
        length = nextInt()
        ret[length]
        for(i = 1 to length)
            ret[i] = nextInt()
        return ret

    main()
        C = nextInt()
        M = nextInt()
        N = nextInt()
        K = nextInt()
        rowGap = nextInt()
        colGap = nextInt()
        robotX = nextIntArray()
        robotY = nextIntArray()
        products = getProducts()
        taskID = nextIntArray()
        taskY = nextIntArray()
        route(C, M, N, K, rowGap, colGap, robotX, robotY, products, taskID, taskY)
A sample of the input you will be reading looks like this
    1 14 28 10 1 2                  //C M N K rowGap colGap
    3547 0 53 63 28 ...             //robotX
    3547 0 1 4 88 23 ...            //robotY
    2290                            //number of  products
    12,34 56,17 2,2                 //product 0
    63,12                           //product 1
    ...
    10000 43 1009 547 2111 ...      //taskID
    10000 4 3 17 29 44 ...          //taskY

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 Robot.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 robot 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 RobotRouting.class, you should enter something like "java RobotRouting" (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 Robot.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. The colors of the robots correspond to the number of items being carried, while green and yellow correspond to putting and taking items. 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-5, corresponding to examples 0-4, 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 Robot.jar -M 50" will set M to 50 when running the tool.
-height <height> Specify the initial height of the window
-width <width> Specify the initial width of the window
-C <C> Specify C
-M <M> Specify M
-N <N> Specify N
-K <K> Specify K
-R <R> Specify number of robots
-P <P> Specify number of products
-rowGap <rowGap> Specify rowGap
-colGap <colGap> Specify colGap
-P <P> Specify P
-seed <seed> Specify the initial seed
-speed <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

Final Notes