Program to test solutions to interactive problems

Revision en2, by eku, 2017-01-02 15:54:10

It's difficult to test solutions to interactive problems during or after a contest. For non-interactive problems, I usually redirect input from a file. For interactive problems I have to type out input manually, since input depends on output. If the interaction is long, this can take time.

A more automated way will require 2 more programs:

  1. A judge program with whom our solution will interact.
  2. A program which connects stdout of solution to stdin of judge and stdout of judge to stdin of solution. I call this program a 'croupier'.

The judge program will have to be written by the user each time since it's problem-specific. But the croupier is generic and can be reused.

My implementation of the croupier, apart from connecting inputs and outputs of the two programs, also prints the output from each program so that it's easier to debug.

You can find my implementation here: https://github.com/sharmaeklavya2/croupier

I wrote the croupier so that it could help me debug 750F - New Year and Finding Roots. The croupier helped me find out many mistakes in my solution, but it seems like there are more, because I can't get my solution accepted. Here is the judge program I used for it: https://gist.github.com/sharmaeklavya2/fb9751ba0d9d5df883d4d29288db8315

Tags interactive, testing

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English eku 2017-01-03 17:37:45 424 Add info about bug and thank PikMike
en2 English eku 2017-01-02 15:54:10 322 Added judge program for 750F (published)
en1 English eku 2017-01-02 00:23:25 1043 Initial revision (saved to drafts)