New contests rule

Even if it isn’t clear, they aren’t targetting machine learning, but bots scripted to make automatic submissions either for boost another account or try variation of magical numbers in code the whole day.

1 Like

I might be wrong but, this could also be related to companies who support events like say, code for life.
They might actually sometimes want to have a look at the code of the best performers.
Obfuscating the code actually completely defeat the purpose for them.

On the other hand, I reckon that on my end, I write very “unprofessional” code for challenges in there.
For I’m just after performance and efficiency, I would never write code like that in a professional context.
Therefore, companies looking at this kind of code may get a pretty wrong picture with it…

But anyway, I can’t even tell for sure if they are interested in looking at the code in the first place…

I’m sure companies take that into account when looking at code written for a project with a limited time such as a contest :wink:

[CG]Thibaud just said that this rule does not consider the following things as cheating:

  • CGSpunk
  • A personal tool that download all your replays in the arena and compile statistics

So you can download replays and feed a Neural Network with it if you want. I’m not sure what this rule is targeting. Maybe it is just here to prevent submit bots.

You should not underestimate, companies ability to act in a very unexpected and puzzling manner :slight_smile:

After working for nearly 30 years for a bunch of various companies,
I’ve seen things you people wouldn’t believe :wink:

2 Likes

We added this rule

Cheating means:
[…]Obfuscating your code as well as creating obstacles to its reading and understanding.

to forbid this kind of code:

#include<algorithm>
#include<fstream>
using namespace std;
constexpr char en85[]{"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"};
char de85[256];
const string Base85_Binary{"e??420s#R700000000000suY$0RR91C|p1Q00000KmY&$00000000000000000000Kma%Z0sue&000000RR911poj50000000000002M$00000002M$00000S#1CS00000S#1CS00000001BW000000RR911^@s6Fa`kt00000Fa}`&00000Fa}`&0000000000000000000000000001BW000008dcGSRZv(VKoJcV0000000{vA00{vA00IC2j{pDw4gdfE7y|%5k<e?8OBwrZ#ah<mg*02^c8;+YLrAR8lgjz+e_jGd<!bi&p*Z|gP)vrEP9f-Tqu}Hp<)I?<#{BaOLT&I^<Wp?5c7n5G$E*(xHVj?H9-}Znql!5$?bC{#O(2W2>8Ef+FPx{>SzBe&gG7Y^z87M)>shwaA>?vI>qBUm<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?3WKIt(<GdfHq>ewZts%8Y9+t;GT*sZ9z_{noz17yMNs&S4^{&WT^mZN~7oKT^=>o$xGbqdGa2+pDhHlw4lkTHEbbvhX4QobP50f7XSbN4gdfE7y|$RaDDy%u8^TX6TMS5owNdC${YZw2LJ%g0RR9F0000O0{{RF)HPN3(ySE8#o?IA)wc%1>?tG*2{B(?NvHVKVAzcM-;cM5YWS!GP?En(sJTAQ6wsXJMD}8qP`4P}z1KP?1^YlaF4kSTGWN)*nwGRS3}_dkH2(SpZtXPr;<^VH8Q1#C0dlPHT_1&gg014cxFe2bqi8n_Gn4Iiw~vkA$^2Fj40m2{a;44G4NecD-nDyM9$@r7{ZWsDu$PDLT>E8FtHj`o-nW~_qehB~Z73velzeNtwRDpJ#DO2rxEn5O4qHJ*K~kc+LV!1>dAFeVkpf(krq?sV?=ya`i>}ZeZt6NkaJE)15eu$h-zIWZ!|rM=36$#t<^)w7PMAxmjN0f#tI=wkGCsM_oLhbVor4XO8^m?sel_a#O=~FCX6TjZ7I)MN+oMI0+(<FnGS~iaL4|0Fa0_4xm0w+U4HOEs&a@&WY_pp%Ushf{Rs2d-IzA5CBL3PQYqki1gDK>+h9$EhC<svxCfgEc554;~8@Cmckj@*CDUPKaz>X)CUOg#l7EFMcl74&{k@cM~Wc%7DRpYmtr3TpMAhHnR5T7SZ8Xju3qe|R8%6d#+!q%T7;=I9G!5Nb{HKT-q00000RZv(V00000RZv(V4Hgaxj3w4*B2_z+s0RQ5%>e)a00{vANd*90yZ`_I"};
string decode_85(const string &base85_string){string out;size_t str_ptr{0};while(str_ptr<base85_string.size()){unsigned int acc{0};for(int i=0;i<5;++i){unsigned char ch=base85_string[str_ptr++];int de{de85[ch]};acc=acc*85+de;}string sub;for(int i=0;i<4;++i){int val=acc%256;acc/=256;sub+=static_cast<char>(val);}reverse(sub.begin(),sub.end());out+=sub;}return out;}
int main(){for(int i=0;i<85;i++){int ch{en85[i]};de85[ch]=i;}const string Program_Binary{decode_85(Base85_Binary)};ofstream Program_File("Binary",ios::binary | ios::trunc);
Program_File.write(Program_Binary.c_str(),Program_Binary.size());
Program_File.close();
system("chmod a+x Binary");system("./Binary");};

Some of you have used this kind of code since The Accountant contest. We can’t run anti-cheat on it, so we added this rule to make it clearer and not to have to deal with this kind of code anymore.

PS: We’re sorry for not informing you of it earlier. A notification will ensure every participant knows about it.

11 Likes

Okay, is encoding + compressing arrays also considered obfuscating code?

Example from my code:

data = b"...." #Encoded and compressed numpy array

decompressed    = bz2.decompress(base64.a85decode(data))
syn0            = np.frombuffer(decompressed, dtype='float32')
2 Likes

I have the same question as Icebox’s. I’ve encoded and compressed arrays (or lists of arrays) especially for neural networks that I have pre-trained. Like Icebox’s code, I think it is reasonably clear what I am doing when you look at the code. (Also, of course, increasing the code file size would eliminate some of the need for these tricks.)

I think there is quite a difference between submitting compiled binary code and easily decompressed data in code. You both should be fine IMHO.

@Magus - just for curiosity - using @Agade code is better then
'#pragma GCC optimize “O3,omit-frame-pointer,inline” ’
or
'#pragma GCC optimize “Ofast,omit-frame-pointer,inline,unroll-loops” ’
?
Code is faster?

Yes if you use the STL.
If you don’t use the STL, there’s no difference. But this is the only point of using the flag O3: to be able to code like in the normal world.

_CG_SaiksyApo had concerns about compressing executable parts. You don’t need to worry about compressing data unless, of course, your data is used to generate code later on.

Let’s say you write Python code on-the-fly and execute it (I don’t know why you would do that but let’s assume you’re doing it). Usually you would store the Python source code in a string, write it down to a file, and execute it. In that case, if the Python source code is compressed, it is unreadable and you may use it to execute hidden lines of code -> please don’t.

Apart from this crazy example, I’m pretty sure compressing data is totally legit here at Codingame.

We should not being forbidden to obfuscate our source code to keep a free software.

I think that forbid that is not the good solution to avoid cheating. If it is easy to cheat to a game, game rules should be adapted, or codingame should not take result score as reliable.

In an environment sponsored by many private companies, prohibiting code obfuscating is not an ethical solution.

1 Like

obfuscation is used mostly in proprietary software though.

I don’t know what are you referring to as “free” software, but usually that means that a user can freely modify the software to suit one’s needs. Obfuscating obviously not helping here.

Better safe than sorry!

Well, I must confess that I was looking into that tool to be able to compile rust code in release mode instead of in debug mode as (I assume) codingame does. The performance difference is abysmal.
I mean, it’s just a command-line argument that can actually make rust much more competitive, with performance allegedly comparable to C/C++. And debug mode is not how you are supposed to compile programs when performance matters.

5 Likes

As the resident Perl maniac… somehow (guess we’ll just have to wait until we get a better Perl maniac. Maybe it is because you don’t have a poorly coloured bike shed–the mascot of the Perl language)…

I’m well aware of the concept of obfuscating code… and there is a difference between messy code… and pieces of beautiful artwork that serve to marvel as much as they serve to make one vomit.

One is more inclined to merely stride through the gates of mordor than they are to accidentally make obfuscated code.

It has been stated there is a difference between poorly organised/designed code… and obfuscated code.

If anybody wants… I can try to track down some resources on proper code obfuscating–mostly making use of Perl… but only if you ask. As well–a lot of it is really really beautiful vomit inducing. Like… the things I’ve seen done. The beautiful beautiful terrible things I’ve seen done.

@_CG_SaiksyApo provide a really meanful of “what is obfuscating code” for Codingame : write directly a binary file and try to execute it. I don’t think that the fear of @Icebox holds. In the case that someone trains a neural network and his/her program loads the training data, this practice should be allowed (in my opinion).

Assuming that the above remarks are true, anyone can write code as duty as he/she wants but never try to write directly binary code.

I don’t know if I’m right, but to close this thread, my remarks should be confirmed or discuted by codingame.

PS : if I’m right, this means that the tool provided by @Agade is legal on codingame :slight_smile: (cf. first post of @Magus)

No it is not. The code provided by @_CG_SaiksyApo is exactly the code generated by the @Agade tool.

1 Like

Understood.