3 ms·
Huh, once you add a compiler step to turn normal code into "golfed" code, it feels like a different thing, with the goal being to write a compact bytecode form
by spencerflem 3y ago
Huh,
once you add a compiler step to turn normal code into "golfed" code, it feels like a different thing, with the goal being to write a compact bytecode format.
This one seems mostly like a workaround for having to type weird Unicode characters, so it still seem "fair" to me whatever that means.
But I wonder how much a normal java program can be auto golfed by playing with the bytecode output.
- posix86 3y agoIsn't the whole purpose of golfing to write compact in higher level languages? If writing the lower level is too hard, it's no different to jars, pyc, or x86 files.
- spencerflem 3y agoYeah, totally. I guess really the way to think about it is that any code golfing problem is a separate competition between each language. What's the shortest you can get in JS, in Java, in Pyth etc. Languages made just for golfing, and how many of them there are, seem a little silly, but theyre cute to look at and fun to make i'm sure. Its art :p Not complaining.
- MrZander 3y agoI agree. I used to frequent codegolf.stackexchange.com but nowadays it's just a bunch of 2 character solutions in 50 different home-grown golfing languages. Golfing languages can be fun, but they do feel like something totally different than trying to make a 200 line C program run in 200 bytes.
- myhf 3y agoThere are still different approaches within the same language, and having a broad consensus about which constants and abbreviations are part of the standard library puts more competitive focus on the algorithm instead of the encoding.
- recursive 3y agoIn my golf language, called stax, each program expressible in plain ASCII has a corresponding representation in a single byte character set. [0] The only reason a program wouldn't start in plain ASCII is the contents of string literals. The alternate representation generally saves ~15%, as measured in bytes. However, I totally understand the argument about human-unreadable "golfed" code, which is why you can always use the plain ASCII representation if you want. For instance, you can print fibonacci numbers in an infinite loop using this program. [1] 10Wb+Q It pushes one and zero to the stack. Then `W` repeats the rest of the program forever. `b+` copies the top 2 elements from the stack and adds them. `Q` peeks from the stack and prints to output. This program packs down to `╪Ç►╢0` for a savings of 1 byte (using the languages own impractical character encoding). [0] https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax https://github.com/tomtheisen/stax/blob/master/docs/packed.m... [1] https://staxlang.xyz/#c=10Wb%2BQ&i= https://staxlang.xyz/#c=10Wb%2BQ&i=