19
\$\begingroup\$

We have a definition of what we consider a valid programming language for answers on PPCG. (If you disagree with this definition, please do so on that other post, and not here.)

The one type of challenge where people regularly tend to ignore this is for challenges with fixed output, i.e. mostly . These sometimes get answers, which are simply a compressed version of the resulting image, or which are written in HTML + CSS only (which don't fulfil the criteria for being a programming language either).

Some examples (all are graphical output - let me know if you can think of examples in other contexts):

Especially when providing just an image file, the question also arises if that isn't a loophole of using built-in compression.

So, should we require answers to such challenges also to be written in programming languages, or are we more lenient here?

(Note, if we decide that we do only want answers in programming languages, every challenge author who does not like that would of course be allowed to override that decision in their individual challenges. This is only supposed to be a default.)

\$\endgroup\$
  • 1
    \$\begingroup\$ Even if you forbid literal output, somebody's going to claim cat is a language. \$\endgroup\$ – John Dvorak Dec 30 '14 at 10:38
  • 1
    \$\begingroup\$ @JanDvorak Well, that's why we have a definition of what constitutes a programming language. (And it's why I'm worried if people ignore that definition for some types of challenges.) \$\endgroup\$ – Martin Ender Dec 30 '14 at 10:38
  • 2
    \$\begingroup\$ Even if you want to put HTML/CSS in there with other examples of GIF/PNG etc, I don't think you are doing justice by linking to my answer, which has an actual usage of the language HTML and features of CSS. Without any hardcoding. It can be argued that HTML+CSS maps any drawing library of other languages like Mathematica one to one with things like drawRectangle mapping to a div with height and width etc \$\endgroup\$ – Optimizer Dec 30 '14 at 13:25
  • 1
    \$\begingroup\$ @Optimizer I don't mind separate rulings for HTML/CSS answers and image file answers, if that's what the community consensus it, but as it stands, neither are considered programming languages, so they technically aren't valid "programs" for PPCG standards. (That being said, I don't really understand your point... the GIF answer uses "features" of the GIF format, too.) \$\endgroup\$ – Martin Ender Dec 30 '14 at 13:27
  • 1
    \$\begingroup\$ GIF is an image format type. Even if some languages fall in the grey area, image formats are definitely not programming languages. Also, in the same Korean Flag example, if I had used JS to create the exact same DOM with exact same style, that would have been okay as JS is a language as per PPCG standards. I don't see a good reasoning behind allowing that, and not a direct use of HTML + CSS to achieve the same thing. \$\endgroup\$ – Optimizer Dec 30 '14 at 13:32
  • 1
    \$\begingroup\$ So what about if someone submits a solution in, say, Bash, that's echo"... image data ...">f.png, instead of just submitting f.png? Would that be disallowed? \$\endgroup\$ – Doorknob Dec 30 '14 at 14:23
  • 1
    \$\begingroup\$ @Doorknob冰 I think that would definitely be allowed as far as using a programming language goes. The question is whether that counts as using built-in compression to do all the work as a loophole. \$\endgroup\$ – Martin Ender Dec 30 '14 at 14:24
  • 1
    \$\begingroup\$ Another possible example - vi keystrokes ? \$\endgroup\$ – Digital Trauma Dec 31 '14 at 1:33
  • 5
    \$\begingroup\$ HTML+CSS3 does meet the criteria. \$\endgroup\$ – Peter Taylor Jan 1 '15 at 14:30
  • 1
    \$\begingroup\$ Another example for the list is my own SVG Olympic Rings. As I commented there, there is a bit of history of claiming that literal output is PHP, which allows mixing literal output with <?php ?> tags. This is particularly the case with HTML or XML output. \$\endgroup\$ – Peter Taylor Jan 1 '15 at 14:33
  • 3
    \$\begingroup\$ If the answer is in Piet, will that be considered valid code under your question despite being a PNG/etc. ? \$\endgroup\$ – Mast Jan 4 '15 at 18:49
  • 1
    \$\begingroup\$ @Mast Sure, if the output of the Piet program is the required image. \$\endgroup\$ – Martin Ender Jan 4 '15 at 18:52
  • 3
    \$\begingroup\$ Generalization of this question to all challenges. \$\endgroup\$ – user62131 Mar 29 '17 at 23:12
15
\$\begingroup\$

I don't think we should generally disallow solutions written in non-programming languages:

  • They are only an issue for a minor subset of challenges (mainly or challenges).

  • Challenge authors can already exclude such solutions, if they don't want them. Individual voters are free not to upvote them, if they don't like them. IME, looking at the votes on such solutions, I'm not really seeing the kind of universal distaste that'd earn them a spot on the standard loopholes list.

  • For challenges where such solutions might typically be competitive (such as generating a fixed high Kolmogorov complexity output), disallowing "raw" answers would typically just turn the challenge into a contest to see which language has the minimum overhead for printing a literal string. That's a sign of a bad challenge, not of bad solutions.

  • Despite the existence of a "canonical" definition, it's actually quite hard to draw the line between programming and non-programming languages, and the results might not be quite what you'd expect. Arguably, CSS is a programming language, so HTML+CSS (or SVG+CSS) should be allowed under this rule. PHP certainly qualifies as one, and has a 0% overhead for outputting any string that does not contain the bytes <?; thus, almost any "cat script" is also a valid (if boring) PHP program.

  • Non-programming-language solutions can display a high level of creativity and golfing skill. See the linked optimized PNG solution by KennyTM for an example. I don't see why such solutions should not be considered equally worthy as those written in a Turing-compatible language.

\$\endgroup\$
  • 1
    \$\begingroup\$ The canonical definition does not require languages to be Turing-complete. E.g. regular expressions (as implemented by most flavours) are valid by that definition. Also, answers in non-programming languages aren't only a problem in kolmogorov complexity - the problem is much worse for some quine-related challenges. \$\endgroup\$ – Martin Ender Jan 5 '15 at 20:37
  • \$\begingroup\$ @MartinBüttner: OK, yeah, I can see how this would be an issue for quine challenges. But to really solve it there, you'd still have to come up with some way to exclude "solutions" like posting an empty program as a PHP quine. This proposal does not do that, since PHP and other "template languages" like it are programming languages by any sensible definition. \$\endgroup\$ – Ilmari Karonen Jan 5 '15 at 20:48
  • \$\begingroup\$ True, although it's questionable whether anything outside the <? is actually PHP. However, if raw answers perform well on a challenge, I don't really think that's necessarily the fault of the challenge. It just means that there exists some facility (e.g. the built-in compression of the PNG or GIF format), which does the job really well. Which is why I also asked if this shouldn't fall under the "built-in functionality" loophole. \$\endgroup\$ – Martin Ender Jan 5 '15 at 20:50
  • \$\begingroup\$ @MartinBüttner: I'm probably not the best person to say, since I personally feel that excluding (or not excluding) built-in functionality is also best done on a challenge-by-challenge basis, and thus downvoted that loophole back when it was first posted. The community seems to disagree with me, though, by about a 2:1 margin. \$\endgroup\$ – Ilmari Karonen Jan 5 '15 at 20:57
5
\$\begingroup\$

I don't think we should allow answers that just contain final output, such as simply posting the contents of a JPG/GIF/PNG file. That falls under using a built-in function because you use the compression of PNG/GIF/JPG/... (and in some cases, it might fall under hard-coding the output, but is the primary exception for that loophole).

(I expressed my opinion about HTML/CSS/... here).

\$\endgroup\$
  • 1
    \$\begingroup\$ What if someone claims cat is a declarative programming language? \$\endgroup\$ – John Dvorak Dec 30 '14 at 10:37
  • \$\begingroup\$ I would agree in general but for codegolf.stackexchange.com/questions/42928/… OP specifically requested a PNG file named newyear.png, so in this case at worst it's a "hard-coding the output". \$\endgroup\$ – kennytm Dec 30 '14 at 12:48
  • \$\begingroup\$ @KennyTM I'm not entirely sure - what do you mean exactly? \$\endgroup\$ – ProgramFOX Dec 30 '14 at 13:12
  • \$\begingroup\$ "Using a built-in function" is at +49/-46 currently, and is very far from being a standard loophole. \$\endgroup\$ – lirtosiast Oct 14 '15 at 3:08
  • \$\begingroup\$ @ThomasKwa Hmm... that's a good point. If I remember this correctly, though, that answer was scored higher when I posted this... but as it currently stands, yeah, it's probably obsolete. \$\endgroup\$ – ProgramFOX Oct 14 '15 at 12:31
0
\$\begingroup\$

It is written right in the info

On the other hand, "4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd" has a high Kolmogorov complexity, and the shortest way to produce it would (most likely) be to just print it literally:

"4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd"

I interpret that as the raw content is allowed for .

I don't see much difference from submitting the final output than a program like this in the byte-code of some hypothetical assembly language:

           mov r0, Lfilename
           mov r1, Lcontent
           mov r2, (Lend - Lcontent)
           goto __builtin_open_and_write_file
Lfilename: .data "filename.png"
Lcontent:  .data "file_content"
Lend:
\$\endgroup\$
  • 1
    \$\begingroup\$ The difference between submitting the final output and a compressed image file is that the latter just outsources the hard work to the built-in compression of the file format. Also that line still says you need to "print" that strings, which (to me) implies you need to do so using code (even if it's just wrapping the string in quotes in CJam). \$\endgroup\$ – Martin Ender Dec 30 '14 at 12:43
  • \$\begingroup\$ @MartinBüttner: The concerned question expects a PNG file named newyear.png. The PNG file is the final output. \$\endgroup\$ – kennytm Dec 30 '14 at 12:52

You must log in to answer this question.

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