Codingame

Posted on 28th April 2015


I've spent some time on Codingame which is an on-line Competitive programming site, based around computer games. (Though only loosely: some puzzles are just puzzles like Google Code Jam, and the "games" are often pretty obviously graph or search based puzzles). But it's kind of fun: certainly the more interactive puzzles, where your solution has to respond to unknown, almost real-time, inputs, is entertaining.

Of note is that it features an inbuilt IDE with support for a lot of different languages. However, the IDE is lacking any sort of debugger, or interactivity, so debugging is reduced to printing things to the error log. To be honest, I mostly write the code offline on self constructed test cases.

Another annoying feature is that the compiled languages are compiled without optimisation. I sort of think this hugely reduces the point of using something like C++. The beauty of this language is that you can write close to the hardware (a la C) if you wish, or you can write much higher level code, and let the compiler work its magic. Even more frustrating is that many of the games require your programme to give a response in a fixed, short time (e.g. < 100ms.)

By way of an example, I recently had cause to implement Berlkamp's algorithm (following Knuth's presentation) over the field with 2 elements. I shan't give a spoiler for saying why. On the Codingame server, my test case took between 7.3 and 6.4 ms, while my 2013 era laptop came in at 7.4 ms, this all for C++ with no optimisations (GCC 4.9.2). With -O2 optimisations, my laptop turns in 0.87 ms, eight and a half times faster. By comparison, Python3 turns in a time of 300ms, 40 times slower!

(I apologise for the rather minimal implementation. In particular, I fail to follow the best practice of defining operator+ in terms of operator+=.)


Categories
Recent posts