I have a lot of fun with CodingGame, but sometimes it’s hard to figure out why your solution can’t be validated. So I made cg-runner, a simple command line tool, able to run a given solution against various test cases.
You need to provide input and output files, and copy-past your solution from CodingGame IDE into a file, then run the tool !
Basically, it spawns an external executable with your solution as source file, and for each test case found, sends the
.in file content to standard input, and awaits on the standard output for stuff specified in the
If it differs, cg-runner will fail, and displays output and error streams to help you understand why (It should reminds you something).
Obviously, you won’t be able to simulate complex challenges that includes bots, because a static input file is not really adapted for that. But it’s perfect for optimization challenges, and you can use it with IDE to make step-by-step debugging.
I’ve just spent few hours on it, the code is not 100% documented nor unit-tested, so be indulgent.
— Merry Xmas !