Files
Implementation
To use this tool, you should modify your code to read and write from standard
in/out. As usual, this does not effect the code you submit to TopCoder. To do
this, you should first read the maze and the parameter T from standard
in. You will first read H and W on a single line. The next
H lines will contain the H rows of the maze. Finally, you
should read T. You should then continually read the inputs to the move
method. First, read N, the number of collapsed cells. Then read
the N elements of colR on a single line, delimited by spaces.
The next line will contain colC. A final line will contain curR
and curC. You should then print and flush the direction to move in.
In pseudocode, where the nextInt function reads an integer and nextString
reads a non-whitespace string:
main() {
H = nextInt();
W = nextInt();
for (i = 0; i < H; i++) {
maze[i] = nextString();
}
T = nextInt();
init(maze, T);
while (true) {
N = nextInt();
for(i = 0; i < N; i++)
colR[i] = nextInt();
for(i = 0; i < N; i++)
colC[i] = nextInt();
curR = nextInt();
curC = nextInt();
println(move(colR, colC, curR, curC));
fflush(stdout);
}
}
Usage
To run the visualizer, you should run java -jar Visualizer.jar from
the command line. There are a number of parameters that control the behavior:
- -exec <command> -- <command> is the command for your
executable. You will have to surround this in quotes if it has spaces (such
as "java MyCode")
- -seed <seed> -- <seed> is the seed for the random number
generator.
- -delay <millis> -- define the pause between moves, in
milliseconds. Setting this to -1 will cause the simulation to only advance when you press space.
- -zoom <size> -- define the size (in pixels) of each grid cell
- -novis -- turn off visualization, just run and output score
- -H <H>-- force height to <H>
- -W <W>-- force width to <W>
In the visualization, coins are denoted by gold cells, you are denoted by a
blue cell, visited locations are green and collapsed locations are red.