Oftentimes new users innocently specify the winning criterion as fewest characters, as opposed to fewest bytes, without being aware of the differences. As a result some of the answers may be encoded into large Unicode values. But who enjoys seeing an answer solely consisting of a big Unicode turd? I propose that in the FAQ, site intro, or wherever, there should be a warning that it is better to use fewest bytes.

  • 1
    \$\begingroup\$ Really, it could even be about fewest bits, as long as it doesn't become some compression problem. :-P \$\endgroup\$ Oct 21 '14 at 20:57
  • 7
    \$\begingroup\$ For what it's worth, the [code-golf] tag wiki states the default as bytes rather than characters, but maybe it could be worded more... persuasively? \$\endgroup\$
    – Geobits
    Oct 21 '14 at 23:54
  • \$\begingroup\$ @Geobits ...implying new users read tag wikis. ;) The excerpt could make it a bit clearer (or clear at all) though. \$\endgroup\$ Oct 22 '14 at 0:08
  • 5
    \$\begingroup\$ @MartinBüttner I'd hesitate to say many new users read any section where this would go, to be honest :P \$\endgroup\$
    – Geobits
    Oct 22 '14 at 0:52
  • 1
    \$\begingroup\$ The full [code-golf] tag wiki is quite tl;dr but some may read the text of the hover-box (which lists characters as the first option, bytes second). \$\endgroup\$
    – feersum
    Oct 22 '14 at 1:44
  • \$\begingroup\$ I modified the tag wiki and excerpt a bit now. \$\endgroup\$ Oct 22 '14 at 10:52
  • 1
    \$\begingroup\$ What if I'm not new and I know the difference between bytes and chars, and I intentionnally ask to count characters? \$\endgroup\$
    – xem
    Oct 23 '14 at 7:41
  • 2
    \$\begingroup\$ @xem Well that's your call. The tag wiki doesn't require bytes. It's just the suggested default. If you're aware that character-counting challenges will likely get Unicode-packed submissions and you want that, then by all means, use characters. \$\endgroup\$ Oct 23 '14 at 8:09
  • \$\begingroup\$ well, it's my call unless it annoys everyone. If most people here think unicode packing isn't fair, I can change my rules too :) \$\endgroup\$
    – xem
    Oct 23 '14 at 8:24
  • \$\begingroup\$ When a new user makes a challenge that's scored on characters, I usually see someone in the comments suggesting it get changed to bytes before any answers are posted. If they wanted to make it bytes, they have the opportunity. \$\endgroup\$ Oct 23 '14 at 12:55
  • 1
    \$\begingroup\$ I don't really understand what the big deal is. Sure, counting by bytes effectively prevents using more than 256 distinct characters in your code (unless the penalty for having 2-byte or 3-byte characters is really worth it), but code that makes use of the upper 128 bytes of an ASCII-compatible code page won't be more readable. Even ASCII contains 32 unprintable characters (not counting LF). Plus, you can usually copy-paste Unicode answers, while StackExchange strips all ASCII control characters from answers... \$\endgroup\$
    – Dennis
    Oct 26 '14 at 13:42
  • \$\begingroup\$ en.wikipedia.org/wiki/APL_%28programming_language%29 \$\endgroup\$ Mar 15 '15 at 14:33
  • \$\begingroup\$ I actually think we should specifically suggest "8-bit bytes". If only, for precision, and because in some technical contexts, the term "byte" is overloaded to mean something else (e.g. in C and C++ standards it actually means "a contiguous sequence of bits, whose number is implementation defined, guaranteed to be at least 8 and large enough to hold any member of the basic execution character set".) \$\endgroup\$
    – Chris Beck
    Aug 20 '15 at 4:15
  • \$\begingroup\$ An encoding can be arbitrary and contain as much information as you want it to. I might as well come up with my own language/encoding where each code point "encodes" the corresponding unary program and solve every codegolf challenge from now on with one character... \$\endgroup\$
    – blutorange
    Sep 5 '15 at 15:29


I would advise scoring-by-bytes.

I think scoring-by-characters encourages weird base256/unicode compression of the source, which IMO generally doesn't really add anything to the contest, and merely serves to obfuscate the code, making less accessible answers, thus decreasing the overall quality of the site.

  • \$\begingroup\$ I don't disagree, but it's still possible when scoring by bytes. Most CJam programs that consists of more than 80 printable ASCII characters can be made shorter by using base-256 encoding (which I usually don't do for the reasons you mention). \$\endgroup\$
    – Dennis
    Aug 20 '15 at 5:36

You must log in to answer this question.

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