Proposal: Contest game with a TWIST (Source of opponent)

Hello there. Here is a proposition for an interesting challenge
(actually a spontaneous afflatus of SuperbKitten during the last contest):

Additionally to the usual inputs for a (maybe really simplistic) game (e.g. tic-tac-toe or rock-paper-scissors) the bots get the SOURCE CODE OF THE OPPONENT bot as inputs.
So bots may analyse the strategy implement by the opponent to get an advantage (or be fooled / lured into timout :slight_smile:

This also has a few implications / drawbacks:
Passing the code correctly can be a challenge (e.g. bots that use unicode to deliberately confuse inputs for other bots)
And sadly, stderr cannot be allowed to be inspected by participants anymore to prevent copying the source of other bots, thus complicating the debugging process in the IDE.

I’d really like to know what the other Codingamers think of this.
Feedback and suggestions are welcome =)
@CG: what do you deem the chances of such a competition?

So, in addition to the input, you’ll receive the source code of the opponent and you need to be able to understand what it’s going to do (whatever the language). That sounds very very difficult. How to determine what the opponent will do, knowing that the opponent also read your code.


… that would require your bot being able to parse all 23 languages on CodinGame…

And the limited amount of code you have to make your bots does not allow you to write a quick parser for all 23 languages…

You essentially are suggesting writing a compiler as part of how CodinGame would work… and writing compilers isn’t… uh… well, you’d have an easier time just merely strolling into Mordor.


Well i think you can gain some insight even without fully understanding the code on a byte level.
I guess i’d only try to do with some heuristic functions
(maybe something like sentiment analysis on code?)
and go for patterns or just plain strings (aiming for variable names) first
instead of full blown parsing, but lets maybe play with some numbers…

Lets take as an example the language use from the last contest, “smash the code”:
Total of 2493 entries (according to leaderboard)
And the top 20, looking at counts (in order of first appearance when sorted by rank)

15x c++, 1x go, 1x java, 1x c#, 1x c, 1x objc

(i would maybe start with a c++ evaluator only at this point o.O)

And the languages’ best placements

#1 c++, #2 go, ... #15 java, #16 c#, #19 c, #20 objc ...

all places inbetween filled by c++ entries.

On a side note: At place #47 comes the first python3 entry, and at #61 follows js.

The top 8 languages by number of entries:

language:              c++, java,   c#,  py3,   js,    c,  py2,  php
their counts:          532,  528,  295,  279,  205,  157,  139,  101
accumulated sums:      532, 1060, 1355, 1634, 1839, 1996, 2135, 2236
and their percentage: 21.3, 42.5, 54.3, 65.5, 73.7, 80.0, 85.6, 89.6

(for some reason the markdown here has no tables… :frowning: )

So you may chose what (expected) coverage you’d like to see;
but i guess i would go by the best ranked solutions instead of popularity.

Lets also see, what is the best rank of the remainig languages not covered.

top 10 languages by ranking:

languag:  c++,   go, java,   c#,    c, objc,  py3,   js,  lua,  py2
best # :    1,    2,   15,   16,   19,   20,   47,   61,  125,  130
beatTop:    1,   14,   15,   18,   19,   46,   60,  124,  129,  133
acc.cnt:  532,  571, 1099, 1394, 1551, 1557, 1836, 2041, 2049, 2188
percent: 21.3, 22.9, 44.0, 55.9, 62.2, 62.4, 73.6, 81.8, 82.1, 87.7

Of course the “beatTopX” is purely hypothetical,
if analysing would somehow guarantee a win against any and all solutions in that language.

… I’d prove how there would be issues with this… but that would involve exploding your brain with my source code being shared…

My excuse is exposure to Perl Jephs. [ ]

Also… there is a reason that code highlighters are so damned hard to properly program. Hell… it took like two and a half decades for EMACS and Vim to have a C syntax highlighter that didn’t randomly commit suicide when seeing real life code (do not try to use it with Kernel code either). This is without taking into account syntax highlighters still have issue with Perl, Ruby, PHP and a couple others.

Literally, your contest is now, “repeat all the issues that people who write syntax highlighters just go, ‘fuck this shit’ over” on one side… and on the other side… well… I joke about Codin Game adding Intercal as a possible language… mostly because it is rude to refer to “good perl” as “looking indistinguishable from line noise” these days.

I mean… you might think this contest is clever… but I suggest you try writing a few syntax highlighters and having them tested in the wild (user land is a VERY scary place)… and then after you’ve finished hiding the bodies, let us know how you are wrong about this. So very very wrong.

Thanks for your feedback and sharing your experiences.
You are likely right about the syntax highlighting issues and such.
Again, i would approach the issue differently (see first paragraph of my last reply) and of course hope there will/would be other ideas alltogether.
Of course obfuscation is a valid and anticipated strategy, and programs may fail.
You can also always chose to ignore the other program’s source e.g. if you fail to parse it or for any other (or no) reason. So i don’t see a real deal breaker here, it is a “game” after all.