How was this created?
C++ is compiled, so does the server compile every round/submission, run and pipe the program’s IO with the engine, and during a fail condition, send a killsignal? (Same for the opponent too)
Is that it? Am I missing something that also has to happen?
Essentially STDOUT is redirected to the program that handles the fighting/puzzle’s STDIN. With the fighting/puzzle’s STDOUT is redirected to the bot/code’s STDIN.
So if your program were to run on your own system, it would merely ask for input that the fighting/puzzle would usually provide then output what move it would want to do.
Hell, if you want, you could take your code from the IDE, compile it–then run it in a console and give your entry input for what the next two colours are–and what the different sides looks like–and see what your program does for a response.
There is a time out mechanic on the Fighting/puzzle’s way of handling its own STDIN so as to avoid winning by stalling and/or not doing anything.
Essentially, the programming language doesn’t need to be C++ for any of this. Hell, if I really gave a crap I could try to create work-a-likes of the puzzles and have languages Codin Game doesn’t even make use of able to give input and output to these puzzles. Like a Fungoid, Malbolge, Intercal, 6502 Assembler, Whitespace, Brainfuck, Fortran, Algol-68, etc. As essentially, it is just a mere case of STDIN/STDOUT redirection.
Thanks! OK, that is how I thought it worked.