Downloads:
In order to use the offline tester / visualizer tool for testing your solution locally, you'll have to modify your solution by adding the main method that interacts with the tester / visualizer via reading data from standard input and writing data to standard output. Each number you read or write must be located in a separate line.
To simulate a single test case, your program should read floating point numbers D and P.
Then, to imitate one call to sendRequest, you should print an integer 1, followed by integers x1, y1, x2 and y2. After that, you should read an integer. If it is 0, your ray does not intersect the polygon. If it is 2, then it does intersect the polygon and you should read two more numbers being X and Y coordinates of the approximate intersection point.
Once your estimate method has finished working, let ret be the return value. Suppose that it contains len elements (where len is always even for a valid return value). Your program should print the following data: an integer 2, len/2, ret[0], ret[1], ..., ret[len-1].
Make sure to flush the standard output after you have written any data to it.
In other words, you should implement the following pseudocode:
# use this method only for local testing # for server testing, use RayCaster.sendRequest() instead sendRequest(x1, y1, x2, y2): printLine(1) printLine(x1) printLine(y1) printLine(x2) printLine(y2) flush(stdout) res = int(readLine()) if (res == 0): return No Intersection X = double(readLine()) Y = double(readLine()) return Intersection Approximately at (X, Y) main(): D = double(readLine()) P = double(readLine()) ret = estimate(D, P) printLine(2) printLine(length(ret)/2) for i = 0, 1, ..., length(ret)-1: printLine(ret[i]) flush(stdout)To run the visualizer with your solution, you should execute the following command:
java -jar Vis.jar -exec "<command>"
<command> is the command you would use to execute your solution. If your compiled solution is an executable file, the command will just be the full path to it, for example, "C:\TopCoder\solution.exe" or "~/topcoder/solution". In case your compiled solution is to be run with the help of an interpreter, for example, if you program in Java, the command will be something like "java -cp C:\TopCoder Solution".
Additionally you can use the following parameters (all are optional):
Some additional information on colors:
You can print any debug information of your solution to the standard error stream and it will be forwarded to the standard output of the tester.
For more information on using visualizers, please check the following recipe draft from TopCoder Cookbook. Note that this is not a troubleshooting thread, please use the match forum for questions instead.