With TuringArena, the same problem can evaluate solutions written in different programming languages. This is possible since the problem defines an interface between the evaluator and the solution code.
First of all, the interface specifies one or more functions that the solution must implement, but this is not all. When a solution process is started, its communication with the evaluator happens as follows. The process:
- receives some input,
- calls the functions implemented in the solution, and
- produces some output, according to the results of the functions called.
The interface specifies how the solution process behaves: when it receives its input, when it calls the functions, how and when it produces its output. This behavior of the solution process is called communication protocol.
The interface (both the functions and the communication protocol) is defined in the file
Have a look at the file
There is only one function defined,
sum, which accepts two parameters and returns a value.
In this case, the communication protocol is very simple:
- the process reads two variables:
- the process calls the
bas arguments, and saves the returned value into a variable
- the process writes the content of variable
Try it yourself!
Change the interface of
Here are some suggestions.
sumto accept three arguments.
- For every pair
b(read only once as input to the solution process), call both
Remember that you have to change both the interface and the evaluator!