Files

Visualizer.jar
TilesPuzzleVis.java
To use the visualizer for testing your solution locally, you'll have to adopt your solution to read parameters from standard in and write the output to standard out. This doesn't affect the functioning of the solution you submit to our server.

Your program should first read the size of the board N. Then you should read N*N lines, each corresponds to one element from the tiles array. Finally, you should output N*N lines containing the elements of your return and flush standard out.

To do this, you should implement the following pseudocode:
    main
    {   
        N = int(readLine())
        for (i=0; i<N*N; i++)
            tiles[i] = readLine()
        ret = solvePuzzle(N, tiles)
        for (i=0; i<N*N; i++)
            printLine(ret[i])
        flush(stdout)
    }
To run the visualizer with your solution, you should run:
java -jar Visualizer.jar -exec "<command>" -seed <seed>
Here, <command> is the command to execute your program, and <seed> is seed for test case generation. Additionally you can use "-vis <name>" option to generate a file <name>.png which shows the board with the tiles you placed. White numbers indicates matching edges, while red numbers indicates edges that do not match their neighbors. The numbers corresponds to the color index of the each edge. If you set <name> to "-" (quotes for clarity only) for -vis, the image will be displayed in a window instead of written to the file.

Finally, you can print any debug information of your solution to standard error, and it will be forwarded to the standard out of the visualizer.