Minify is cheating?

I don’t mean to rage , but is it valid to minify code like this?
exec(bytes('㵳湩異⡴਩㵩ਰ㵪ਲ㵴∢眊楨敬椠氼湥猨㨩⭴猽楛㭝⭩樽樻㴫਱牰湩⡴⥴','u16')[2:])

game:
https://www.codingame.com/clashofcode/clash/report/1817262e2a4f0dcb799cb1d393bc0db6b87c9b6

doing so it will be imposible to win against that!

5 Likes

In shortest mode, everything is allowed

Yes it’s valid code. And it’s a common trick in golf puzzles.

Writing in golf style can help building up a bad coding habit unacceptable in the majority job market. Don’t be too serious to win the game but lose the job.

2 Likes

I came here to post a related suggestion, and I will shortly, but the gist of it is this:

First off, I agree with your complaint. Using that hack is ugly and not really programming.

Second, it’s an outright cheat, exploiting a hole in the CoC engine and editor. The proper count should be code bytes, not Unicode codepoints.

So, if you change the editor and scoring engine to count actual code size, that hack goes away. There’s no advantage when each position in that source string takes 2 or more bytes to encode in UTF-8.

4 Likes

A simple solution would be to count the bytes needed to store the code instead of the the number of characters.
This seems to be a common practice outside of CG.

4 Likes

Char count is what makes CG golf unique.

I do understand why byte count is a more relevant metric cause its directly linked to memory, and memory was probably the initial motivation for codegolf.

But nowadays, codegolf is more something you do for fun, so why not chosing the char metric ? It enables more creative solutions IMO.

And for those who think that byte count leads to cleaner solutions, I can tell you that as soon as the script is a bit long, there are many tricks that make the script totally unreadable too (e.g. base64 unzipping).

I agree with the sentiment that shortest mode should count bytes, rather than characters. It doesn’t take any creativity to paste your code into a minifier. The fun of code golfing is coming up with short solutions yourself. I’m not sure where the benefit lies in counting characters, I haven’t seen anything creative come out of counting characters rather than bytes.

  • First: “It doesn’t take any creativity to paste your code into a minifier.” That’s right. But putting a long code into a minifier will not make it magically become short. The minifier technic worth the use only if your base code is already short and you want to earn some more chars.
  • Second: “The fun of code golfing is coming up with short solutions yourself.” As I said, using a minifier doesn’t exclude to write a short code by yourself. And concerning the fun, that’s your feeling, no problem with it. But for a lot of people the fun is in the competition, and in finding tricks to win it. And that’s a valid feeling too.
  • Finally: If your concern is to have fun, don’t use these techniques that you don’t find fun, and let the people who want to use them do so. This way, everybody will enjoy the clash.
    But, if your concern is to win, the rules are as they are, so use everything they allow to be first. But don’t try to change them to make them stick to your view of the game.
1 Like

The thing is, the Python minifying process with a 25 chars tradeoff has been carelesslly shared here and there and it happens to be optimal from a golf perspective.
So people feel like it’s a given but it actually took efforts to reach that optimal version.

When I started golfing, I only knew the concept of minifying and I had to find the exact process by my own and it took me time to come up with that 25 tradeoff process. My first versions had a tradeoff over 30 chars.

And Python is not the only language able to do that, you can try to find a way to do it in other langages and you’ll see that it’s not that easy, when you’re not given the ready to go optimal process.

About creativity, my most complex solution for Don’t Panic uses 3 layers of compression with 3 different techniques and 4 different languages are involved in the process.
But maybe it’s not creative enough :slight_smile:

3 Likes

Yeah, it is fun figuring this stuff out. I never would have suspected your Go thing was possible, and I’m still scratching my head over what dbdr seems to be doing with Dart and Groovy.