Downloads


In order to use the offline tester tool for testing your solution locally, you'll have to modify your solution by adding the main method that interacts with the tester via reading data from standard input and writing data to standard output. Since you do not change the implementation of methods init, processImage and getCraters, this doesn't affect the way your solution works when being submitted to our server.

At high level, your main method implementation should look like this:

  1. Create an instance of your solution class file. Call init and print the return value into the standard output. Proceed to step 2.
  2. Read an integer from the standard input. If it is 1, proceed to step 3, else proceed to step 4.
  3. Read the input parameters for processImage call from the standard input (see details below). Call processImage and print the return value into the standard output. Proceed to step 2.
  4. Call getCraters and print the return value into the standard output (see details below). Stop execution of your method.

The parameters for each processImage call must be read in the following order:

The return value ret from getCraters call must be printed in the following order:

Each integer or string that you need to read will be located in a separate line. Each integer or string that you need to print must be located in a separate line.

Make sure to flush the standard output each time you finished writing some data there.

In other words, you should implement the following pseudocode in the main method of your solution:

	printLine(init())
	flush(stdout)

	while (true) {
		cmd = int(readLine())
		if (cmd == 1) {
			name = readLine()
			W = int(readLine())
			H = int(readLine())
			len = int(readLine())
			for (i = 0, 1, ..., len-1) {
				data[i] = int(readLine())
			}

			printLine(processImage(name, W, H, data))
			flush(stdout)
		} else {
			ret = getCraters()
			printLine(ret.length)
			for (i = 0, 1, ..., ret.length-1) {
				printLine(ret[i])
			}

			flush(stdout)
			break
		}
	}

In order to run the tester, you should use the following command:

java -jar Tester.jar -exec "<command>"

Here <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".

In order to operate properly, the tester needs two files:

  1. File containing paths to images. By default, this file is called "images.lst". Each its line must contain a path to a single image. The path can be absolute or relative to the current directory. The tester will call processImage for each image described in this file. NOTE: the tester is not guaranteed to work properly with images not from the provided training set.
  2. File containing paths to ground truth files. By default, this file is called "GTF.lst". Each its line must contain a path to a single ground truth file. The path can be absolute or relative to the current directory. Each ground truth file must be in the same format as GTF.lms files in the provided training set.

Additionally you can use the following options (all are optional):

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 offline testers, 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.