Rules of the code golf and optimization challenges

Hi, it’s quite clear to me what’s considered right or wrong in case of bot contests or puzzles. But when it comes to code golf and optimization challenges, I’m not sure (and therefore, I’d like to ask). My initial assumption was that it should be done “properly”, i.e. no hardcoding, no repeated submission abusing etc. On some challenges, I was satisfied with my leaderboard position (considering time spent on solving them), while on some I was not, e.g. Thor code golf. After browsing the related forum, I realized, that hardcoding is not considered as cheating, instead it’s OK, or even praised by some as an interesting perspective of the challenge. My hardcoded solution was half the length of the proper one and it took a fraction of time compared to the proper one (frankly, it was also half the fun, but well, that’s subjective).

And then there’s also the possibility to abuse the repeated submission. For optimization, I get better results, if I submit the solution 100 times, than if I submit it once. And even bigger difference it makes in code golf challenges, where you can (as an extreme example) create a tiny stupid program that returns random answer and submit it again and again, until it once fits all the tests.

My question is - what’s the official standpoint on those (and ideally on other shady techniques that could be considered as cheating)? I can imagine one of three answers for each X:

  • officially OK - people are allowed/encouraged to do X, it’s a part of the competition
  • not OK, but not restricted - use X with caution and be prepared to bear consequences (e.g. test cases might change any time, or results can get automatically recalculated any time), as a side effect: you probably need to use X if you want to get to top ranks
  • forbidden - anyone caught doing X will be warned/banned/pilloried



Well, there’s no “official standpoint” about all of this…
All of what is legal (From the Real Law of the Real World :wink: ) is “OK” to be used in code golf…
This said, it depend of what you want. If the official leaderboard is really important for you, so yes, you will have to put your hands in dirty things. :smiley: But some people fix rules to themselves and have the goal to do the shorter legit code…
As you wish… But nobody will punish you to use “black hat golfing techniques” ^^

1 Like

Disclaimer: I am new here, so it’s just my opinion. Also, I am bad at code golf and optimization (although for some reason, I still get a decent ranking which I don’t quite understand).

With this out of the way, as @anon72424297 pointed out, it depends on what matters to you. As far as I understand, it’s friendly competition here. There are no monetary rewards. As long as what you’re doing does not negatively impact others, you can probably do what you like. Validators can change, ranking can be recalculated, and so what ? The learning experience is probably more important than anything else. Again, just my humble opinion.

1 Like

Also, if you want pure challenge, temperatures and chuck norris are not hardcoded (actually I tried but the hardcode was longer than the legit) so your ranking for those two problems is fair.

official standpoint is not OK, but not restricted, like you explained

We never took time to properly prevent these shady techniques (when possible).

While I understand this can kill the fun of these games for some players, I’ll quote @logiqub wrote: