Testing Interactive problems

How do I test interactive problems assuming that I already wrote an interactor code which can output some data to STDOUT based on input file and the output to STDOUT of the required code for a problem?
guessprm.py is the required code, interactor.py is interactor code and input.txt contains test cases

1 Like

There might be some solution. I generally create function (in place of judge).
Would like to listen good methods to do that when we have different codes for judge and user.

Have a look at this article.

This is just about to how to take inputs from a file and get output in a file.
It doesn’t tell anything about how to do interaction.
Can we do interaction using that article ??

What I do is keep running both codes alternatively, untill I get the answer.
Although it won’t be effective when there’s large interaction.

1 Like

What I do is make a testcase generator and then copy-paste in stdin manually.

I tried but couldn’t get my two programmes (judge and solution) to interact.

Interactive https://www.codechef.com/viewsolution/25073708
Stress Test https://www.codechef.com/viewsolution/25287716

Just use some functions and variables for different modes.


that’s weaving both codes in one. Nice :ok_hand::+1: approach though. But codechef judge won’t be using that approach. An interacting code with a few test cases seems a logical approach of the judge. Do question setter of interacting problems need to send any such code?

Nice :ok_hand::+1: thanks. \hspace{0mm}

they make judge itself. judge is a c++(or any other lang) code itself.
We can apply any algo in judge as well.