Here's have an idea, which may save millions of bytes to golfers out there. But I'm not sure it's good.

  1. Take a language that's good for Golfing (e.g. Pyth).
  2. Take all existing CodeGolf answers in this language, and build a character frequency table.
  3. Build a Huffman tree based on this table.
  4. Create a new language, which is basically the same, except that the interpreter starts by Huffman-decoding the program, using this fixed tree.


  1. Does it have a real saving potential? Intuitively I'd say that for 10 char programs it should save a byte or two.
  2. Is it nice to create a language that's 99% based on an existing language?
  3. Should we use 7-bit only?
  4. How will it affect the site? Won't answers in the new language be (even less) interesting than answers in the one it's based on?

Anyway, I'm too lazy to actually implement it. So if anyone wants to, feel free.

  • \$\begingroup\$ What would you call it? Pyt? Sounds too close to Piet. :-) \$\endgroup\$ – Level River St Oct 23 '15 at 18:15
  • 1
    \$\begingroup\$ @steveverrill, Py. If you Huffman-encode the name Pyth with a custom table, you need 9 bits. So it should be 2 bytes. \$\endgroup\$ – ugoren Oct 25 '15 at 7:46

You can do it if you want, but don't expect it to be well received as a golfing language. The language would be valid, but uninteresting, and won't be usually compared with the original language just like nobody would compare Python and Pyth.

But as long as it is valid, I think someone have to do it at least once in the history, to see how uninteresting it exactly is. And that may inspire other useful ideas.

There are many golfy esolangs that are rarely used by golfers. It's not bad to just invent a new one, just like the first person who wanted to invent a golfing languages when all other existing languages are used for serious programming. (Or maybe you want to invent a codepage instead, to allow better presentation.)

  • \$\begingroup\$ I've made a golfed version of Java. Check it out if interested: github.com/magicgoose/gj It doesn't use any cool compression techniques, though. And it's theoretically editable by hand, if there's an editor which can work with 6-bit numbers, not 8 as usual hex editors. I think I'll try to do some challenges with it sooner or later. \$\endgroup\$ – Display Name Sep 12 '16 at 17:01

The general rule is that what we count is the length of the source code, where that is understood as the file/string which the programmer edits. Your proposed language would really be an intermediate bytecode which no-one would ever edit directly, and so it would be irrelevant from the point of view of scoring answers on PPCG.

  • 3
    \$\begingroup\$ I see two problems with this argument - 1. I think that what the interpreter can read is source code, however weird looking it may be. And theoretically one could code directly in this language. 2. There are occasional machine language posts, they're normally not so short, but they're not disqualified. \$\endgroup\$ – ugoren Oct 20 '15 at 11:31
  • \$\begingroup\$ Question - is there a reference to what's considered a source code? \$\endgroup\$ – ugoren Oct 20 '15 at 11:35
  • \$\begingroup\$ And another point - this answer is admittedly machine generated. Does it disqualify it? \$\endgroup\$ – ugoren Oct 20 '15 at 11:36
  • 3
    \$\begingroup\$ @ugoren You linked a question there. \$\endgroup\$ – Martin Ender Oct 20 '15 at 12:37
  • 1
    \$\begingroup\$ @ugoren Theoretically, one could code directly in the "source code." But that would just be a downvote magnet. \$\endgroup\$ – Doorknob Oct 20 '15 at 12:57
  • \$\begingroup\$ @ugoren, possibly the most relevant previous question. As for your pointed mentioning of some of my kolmogorov-complexity answers, it's reasonable to draw a distinction between generated source code in a language which is commonly hand-written and generated bytecode in a language which is rarely if ever hand-written. \$\endgroup\$ – Peter Taylor Oct 20 '15 at 13:47
  • \$\begingroup\$ @PeterTaylor, the common way to develop is quite a fuzzy rule. I think more solid criteria are needed to decide on the validity or character count of an answer. And the top voted answer to the question you quoted says machine language is OK. \$\endgroup\$ – ugoren Oct 20 '15 at 17:07
  • \$\begingroup\$ @MartinBüttner, Sorry, I meant this answer. I think other answers are generated too, but this one clearly says so. \$\endgroup\$ – ugoren Oct 20 '15 at 17:08
  • \$\begingroup\$ @ugoren, but note the much-upvoted comment to that answer. \$\endgroup\$ – Peter Taylor Oct 20 '15 at 19:48
  • 1
    \$\begingroup\$ How do tokenized languages like TI-BASIC fit into this? Based on consensus (meta.codegolf.stackexchange.com/questions/1541/…), they count the tokens for the score, not the characters in the posted source code. \$\endgroup\$ – Reto Koradi Oct 22 '15 at 6:06
  • \$\begingroup\$ @RetoKoradi, I'm not sure what your point is. That seems to be an orthogonal issue. \$\endgroup\$ – Peter Taylor Oct 22 '15 at 19:13
  • \$\begingroup\$ It could be seen as an example of an established policy where we count the bytes of an intermediate code, and not of the source code. \$\endgroup\$ – Reto Koradi Oct 23 '15 at 2:24
  • \$\begingroup\$ What about Malbolge? Are all answers generated? \$\endgroup\$ – trichoplax Oct 23 '15 at 12:14
  • \$\begingroup\$ (+1 for this answer - I'm just wondering if that should also mean Malbolge is not valid for answers) \$\endgroup\$ – trichoplax Oct 23 '15 at 12:31
  • 1
    \$\begingroup\$ This is an interesting point, but we do have quite a few answers in machine code, and no-one has complained about them. We also have answers in which data is compressed, which people find boring but blame the challenge rather than the answerer. So I like what you say, but I'm not sure if its enforceable / being enforced. \$\endgroup\$ – Level River St Oct 23 '15 at 18:14

There's golfscript2 (aka gs2) which also uses non-printable characters and non-ascii characters (which most languages don't use because you don't want to program in a hex editor). You could also easily compress any Burlesque program by almost ~50% by just mapping every built-in to a single character using non-printable and non-ascii ranges. But then I wouldn't want to use it anymore as my little desk calculator because I don't want to use a hexeditor for that.

  • \$\begingroup\$ Yes, but Huffman can do better. Any way you'll do it, character frequencies would not be uniform, so a variable-length encoding would still be useful. \$\endgroup\$ – ugoren Oct 27 '15 at 9:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .