2
\$\begingroup\$

It's been my understanding that answers in code golf competitions should generally be given as source code. But lately I've seen a few answers specified as x86 assembly, counting the size as the number of bytes in the compiled binary blob. For example this answer.

Firstly, it seems like this way of counting is only valid if the language is x86 machine code, rather than assembly language, as assembly language is source code that can produce a certain machine code output, rather than the machine code being submitted. But naming and byte counting aside, is it even acceptable (for code golf questions with standard rules) to post non-source code answers in the first place? Should this be considered acceptable for other languages and formats as well? Should we, for example, allow Java .class and gzip encoded .py files as well, in the name of consistency?

Edit to try to clarify: I'm not asking a question about scoring, which is the main point of the suggested duplicate question. I'm asking whether a certain class of answers are valid in the first place.

\$\endgroup\$
  • \$\begingroup\$ Machine code is fine, but then your language is something like x86 machine code (OS) \$\endgroup\$ – Pavel Jun 20 '17 at 22:11
  • \$\begingroup\$ You can run Linux ELF files on TIO \$\endgroup\$ – Pavel Jun 20 '17 at 22:11
  • \$\begingroup\$ @FryAmTheEggman Not a duplicate. I'm asking if machine code (or other non-source code) is acceptable, at all. I don't see that, specifically, addressed in the question you linked. The top answer, however, assumes without further discussion that machine code is acceptable. \$\endgroup\$ – nitro2k01 Jun 20 '17 at 22:50
  • 2
    \$\begingroup\$ I don't see any reason to assume a discussion is necessary. Machine code is a bunch of bytes that represent a program, just like source code is. \$\endgroup\$ – FryAmTheEggman Jun 20 '17 at 23:18
  • \$\begingroup\$ @FryAmTheEggman Right. To try to explain my intuition: Entries are judged based on length. However, the machine code is most likely not written directly by the contestant in a hex editor, but is likely compiled output of assembly language code. Ie, the length is based not on the code written by the contestant, but on a secondary output. My intuition is that we should primarily judge the length of code output from a human. \$\endgroup\$ – nitro2k01 Jun 20 '17 at 23:29
  • \$\begingroup\$ What stops someone from using a machine to write regular source code? Plenty of answers already do that. Also, why should you stop someone from manually writing machine code? Sorry, but I can't see any way this results in something useful besides what we already have. \$\endgroup\$ – FryAmTheEggman Jun 20 '17 at 23:32
  • \$\begingroup\$ @FryAmTheEggman If that is your opinion, make it an answer, not a comment! \$\endgroup\$ – nitro2k01 Jun 20 '17 at 23:33
3
\$\begingroup\$

There's no difference between source code and machine code

We seem to be using "Machine code" in various different ways, so I'll cover them all:

If "Machine code" means

  • The x86 assembly language:
    • There's no fundamental difference between x86 and other languages. It is written using bytes, and has an interpreter (the processor)
  • Code written using a hex editor:
    • A hex editor is very similar to a code page. It maps the character "F" into the byte "1111". If we disallowed code written in hex, how do we justify code pages?
  • Computer-generated code:
    • Trying to disallow this would be a nightmare. Should we disallow Javascript because Typescript compiles to it? What about auto-golfing programs?
    • Regardless, we require that submissions to show effort. If you've simply posted a .class file without any attempts to make it shorter, then your post is candidate for deletion.
\$\endgroup\$

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