429
\$\begingroup\$

There are a number of standard loopholes which experienced question-setters seek to explicitly close. However, inexperienced question-setters may unintentionally leave them open, or respondents may try to argue for contorted interpretations of the question in order to side-step attempts to close them.

The purpose of this question is to provide a repository of standard loopholes which may be assumed to be closed without the question-setter having to explicitly close them. The intention is that each answer shall contain one and only one loophole (to allow independent voting); and that the loophole described in any answer which is at +5 or above and has at least twice as many upvotes as downvotes may be taken to be deemed to be unacceptable to the community. A link to that answer may be provided in a comment to accompany a downvote and a flag.

Return to FAQ index

\$\endgroup\$
11
  • 136
    \$\begingroup\$ Loopholes are part of what makes the game interesting. Even common ones can be funny or clever, depending on context. If you find a loophole in an answer disinteresting, don’t vote for it, or vote against it. I don’t think we need a canonical list of fun things that you can’t do. (With the exception of Interpreting the challenge too literally below. That’s always boring. ;)) \$\endgroup\$ Commented Feb 27, 2014 at 18:16
  • 19
    \$\begingroup\$ @minitech: And the countless variations of curl -L http://bit.ly/012foobar aren't? \$\endgroup\$ Commented Mar 2, 2014 at 14:59
  • 13
    \$\begingroup\$ @IlmariKaronen: Depends whether it’s actually clever. If you don’t find it clever, vote appropriately. As always. \$\endgroup\$ Commented Mar 2, 2014 at 15:57
  • 3
    \$\begingroup\$ @minitech, there seems to be a strong consensus that the appropriate vote is "Low quality, delete". \$\endgroup\$ Commented Mar 2, 2014 at 22:56
  • 50
    \$\begingroup\$ "at least twice as many upvotes as downvotes" ... You can't see that until you have at least 750 rep on the site. Seems like the rules should be visible to everyone. \$\endgroup\$ Commented Apr 14, 2014 at 16:05
  • 6
    \$\begingroup\$ @derobert, I don't want to be seen to claim that a 105 vs 100 voting situation represents a clear community consensus, and I think that looking for a supermajority is the best way to avoid that. It's unfortunate that the score breakdown isn't visible to everyone, but I don't generally expect many low-rep users to visit meta. FWIW, the only current answer which doesn't have a supermajority is "Using comments to circumvent character requirements/restrictions" on +11/-6. \$\endgroup\$ Commented Apr 14, 2014 at 16:31
  • \$\begingroup\$ @PeterTaylor Ah. I'm surprised "Using the program name to store data" isn't one of them, considering the +26 comment on it. \$\endgroup\$ Commented Apr 14, 2014 at 16:51
  • \$\begingroup\$ @derobert, it's at +28/-4. Very puzzling. My best guess is that most of the people upvoting the answer agreed with the part of the comment which says that the filename should be counted towards the length of the program. \$\endgroup\$ Commented Apr 14, 2014 at 16:57
  • 2
    \$\begingroup\$ The condition for whether the loophole applies should probably be changed to +10 or +15. All of the answers are currently above the +5 mark due to the surge in popularity of this post. Perhaps it could be a moving window (all answers with a score of average of all answer scores / 2 or the score of the highest voted answer / 5 or something), but that would be pretty complicated. \$\endgroup\$ Commented Apr 27, 2014 at 21:24
  • 1
    \$\begingroup\$ It's nice that this is in the FAQ, but I can find no obvious way to get to the FAQ so that new users can see it. I don't think we should be downvoting users for breaking a rule they don't know about. The FAQ needs to be easily available to new users who get her via any means. \$\endgroup\$ Commented Jun 29, 2014 at 12:34
  • 1
    \$\begingroup\$ When I say it is "no obvious way to get to the FAQ", I am referring to the fact that it does not seem to be linked in the Help dropdown itself nor mentioned in the Tour or Help Center pages. I know I only found out about this page after I saw a question that downvoted because of it. (And because it was mentioned explicitly in some questions, but those keep being removed.) \$\endgroup\$ Commented Jun 29, 2014 at 12:46

49 Answers 49

1
2
469
\$\begingroup\$

Interpreting the challenge too literally

That is, if the challenge says "write a function that, given a number n, returns the n-th prime", posting something equivalent to:

function f($n) {
 return "the $n-th prime";
}
community wiki

\$\endgroup\$
11
  • 316
    \$\begingroup\$ I believe you meant "Compiling the challenge too literally" :P \$\endgroup\$ Commented Jun 10, 2014 at 17:21
  • 99
    \$\begingroup\$ @Jwosty not in this case, as PHP is interpreted. \$\endgroup\$ Commented Jun 20, 2014 at 9:28
  • 15
    \$\begingroup\$ @Rokk Or is it? IT'S ALL A RUSE! \$\endgroup\$ Commented Jun 20, 2014 at 15:59
  • 7
    \$\begingroup\$ Someone may answer my question, I've said this a few months ago (meta.codegolf.stackexchange.com/questions/924/… ), but why does my question have a tag "this question has already been answered in {this topic}"? Even though my own one was months prior to this one? I didn't think it would be like that. \$\endgroup\$ Commented Jul 4, 2014 at 12:07
  • 41
    \$\begingroup\$ Your example is actually one of not interpreting the challenge quite literally enough. You would have a good point if this were a spoken medium, but on a typed challenge, "the $n-th prime" in quotes is different from "the $n-th prime" without the quotes. Punctuation matters. It's the difference between "I had a dream about 3 ballerinas, Stalin, Mussolini, and Hitler." and "I had a dream about 3 ballerinas: Stalin, Mussolini, and Hitler." \$\endgroup\$ Commented Sep 5, 2014 at 12:25
  • 21
    \$\begingroup\$ This is not a loophole actually. It's just a misconception (albeit a very extended one), a confusion between use and mention. The challenge didn't include quotation marks \$\endgroup\$ Commented Jan 25, 2015 at 18:02
  • 16
    \$\begingroup\$ @LuisMendo: It could also be viewed as a representation issue. That is, if we accept, say, "13", "13.0", "thirteen", "XIII", "0xD" and "1.3e1" as valid representations of the same number, then why not also "10 + 3" or "int(pi^2 + pi)" or "x: x^2 - 26*x + 169 = 0" or "the 6th prime"? This is not a trivial issue in philosophy of mathematics, since in math, we're constantly dealing with numbers that we can't write down as, say, a finite sequence of decimals, like pi or sqrt(2) or even just 1/3. Just about the only easy and simple answer is "because it would make the challenge boring". \$\endgroup\$ Commented Jul 16, 2015 at 8:54
  • 1
    \$\begingroup\$ @IlmariKaronen I tend to agree with your reasoning. But for the n-th prime there is a convenient decimal representation, whereas for the cases you mention there is not. Saying "sqrt(2)" is probably the simplest explicit representation of the intended number, whereas saying "the n-th prime" is not (you could write it explicitly and simply as "23", or as "127", etc) \$\endgroup\$ Commented Jul 16, 2015 at 9:11
  • 15
    \$\begingroup\$ "the $n-th prime" is not the n-th prime. \$\endgroup\$ Commented Jan 19, 2016 at 11:59
  • 23
    \$\begingroup\$ @Jwosty I think you're interpreting the answer too literally. \$\endgroup\$ Commented Aug 21, 2016 at 6:13
  • \$\begingroup\$ @Khaled.K: Exactly. It is ridiculous that people on CG SE do not understand the difference between strings and their evaluation (if any). \$\endgroup\$ Commented May 14, 2021 at 11:25
391
\$\begingroup\$

Fetching the desired output from an external source

This includes doing an HTTP request to fetch the page with the question and extracting a solution from that page. This was mildly amusing back in 2011, but now is derivative and uninteresting.

\$\endgroup\$
8
  • 46
    \$\begingroup\$ Especially getting the highest voted answer from the selected wuestion \$\endgroup\$ Commented Apr 10, 2014 at 21:13
  • 106
    \$\begingroup\$ We could allow it, if the size of the external source is added to the size of the answer. \$\endgroup\$ Commented Aug 30, 2015 at 21:21
  • 5
    \$\begingroup\$ You mean a copy-paste answer? \$\endgroup\$ Commented Jan 19, 2016 at 12:01
  • 6
    \$\begingroup\$ @KhaledAKhunaifer, no, I mean an answer which saves bytes by replacing a large string with a wget or similar that fetches it. \$\endgroup\$ Commented Jan 19, 2016 at 14:33
  • 3
    \$\begingroup\$ @PeterTaylor I see; well if the content that the solution depends on is retrieved from a source that is not part of the platform, then its size has to be added to the size of the answer. I don't see a difference between manually copy-paste or make a wget do the copy-paste. \$\endgroup\$ Commented Jan 19, 2016 at 16:06
  • \$\begingroup\$ some internet questions may need to do so, but source code itself still not allowed to just be fetched \$\endgroup\$ Commented Apr 4, 2018 at 4:58
  • \$\begingroup\$ codegolf.stackexchange.com/a/23968/59169 is an excellent example how this can be used creatively \$\endgroup\$ Commented Aug 11, 2019 at 14:36
  • 1
    \$\begingroup\$ @val, not really. It could have been golfed considerably by self-hosting a page with just the desired content and, if necessary, using a URL shortener. And that's really the point: outsourcing the output gives you arbitrary text at a fixed byte count. \$\endgroup\$ Commented Aug 11, 2019 at 16:20
337
\$\begingroup\$

Using a made-up language specifically designed for the challenge

This includes any language with commands that "do whatever I choose them to do". Claiming that your answer is written in "MyOwnLanguage", where the command x means "read a sequence of numbers, split them into groups of three, and print the last numbers of those groups where the second number is less than the first", was clever the first time it was done. That was a long time ago.

\$\endgroup\$
14
  • 153
    \$\begingroup\$ I think HQ9+ should no longer be considered made up. It's useless for almost all challenges, and can sometimes be used creatively. \$\endgroup\$ Commented Feb 23, 2014 at 14:53
  • 6
    \$\begingroup\$ Sorry, I agree with the poster. Makes for boring answers. The question it was used to answer could have been a lot more exciting and interesting without the trolly languages and GolfScript. \$\endgroup\$ Commented Feb 24, 2014 at 21:03
  • 128
    \$\begingroup\$ -1: if a question can be answered creatively with HQ9+ or any other language that was already existing before the challenge was posted, then maybe the question was boring and not the answer. \$\endgroup\$ Commented Feb 25, 2014 at 14:09
  • 11
    \$\begingroup\$ Could this be split in two answers? I would vote up for "made-up language" but not for HQ9+. And given this answer has the most mixed votes (+13/-7), maybe I'm not the only with similar opinion. \$\endgroup\$ Commented Mar 2, 2014 at 15:52
  • 5
    \$\begingroup\$ @manatwork: I originally included the mention of HQ9+ because I was (and still am) kind of tired of people invariably trying to use it for each and every hello-world and quine challenge, even those where it fails to meet the spec. But you're right, it's been around long enough to become sort of established. I've edited this answer not to mention HQ9+, except tangentially as a "historical example". I haven't posted a separate "using HQ9+" answer, since I honestly don't see it as that much of an issue in itself; if anyone else wants to do so, feel free. \$\endgroup\$ Commented Mar 2, 2014 at 16:13
  • \$\begingroup\$ I'd bound this in with "get from external source" and other ways of hiding byte count. \$\endgroup\$ Commented Mar 12, 2014 at 19:11
  • 73
    \$\begingroup\$ I don't have any problem with made-up languages. But the language should already exist when the challenge was posted. Never versions of the language are not allowed (to prevent changing the language e.g adding an extra command to HQ9+). \$\endgroup\$ Commented Mar 13, 2014 at 15:27
  • 2
    \$\begingroup\$ Where to draw the line between "made up" languages and languages which are not made up for one specific challenge but still are not really used outside of codegolf (or similar) challenges? Does using a language for two challenges already qualify? \$\endgroup\$ Commented May 27, 2015 at 11:54
  • 7
    \$\begingroup\$ @Holger: Nowadays, from what I've seen, the general consensus seems to be that any language (version) released before the challenge started (or was first proposed in the sandbox, etc.) is OK. That is, the important point is that the language should not be made up for the challenge. \$\endgroup\$ Commented May 27, 2015 at 12:56
  • 12
    \$\begingroup\$ This standard loophole also closes the possibility of saying "since all Turing-computable programs are enumerable (and therefore representable as a number -- say, a compiled binary interpreted as a binary number), I hereby define a family of languages, MyLang-N, where each MyLang-N correspond to a language where the empty string executes the Nth program in the enumeration of all programs." \$\endgroup\$ Commented Dec 18, 2015 at 15:06
  • 2
    \$\begingroup\$ To anyone else who is looking for the more exact rule "the language should be released before the question was posted": it was given here. \$\endgroup\$ Commented Jan 5, 2016 at 9:11
  • 2
    \$\begingroup\$ Isn't that just called "a golfing language"? \$\endgroup\$ Commented Mar 8, 2018 at 9:10
  • \$\begingroup\$ MetaGolfScript is a notable one. \$\endgroup\$ Commented Apr 14, 2023 at 11:44
  • \$\begingroup\$ is anyone gonna enforce this standard loophole exclusion rule ? I feel like it's still being brazenly violated left and right. \$\endgroup\$ Commented Jul 22 at 10:41
254
\$\begingroup\$

Using two different chars which look the same

Very common in contests: you set variable a to a value, then you set variable <CYRILLIC A WHICH LOOKS THE SAME> to another value, then you pretend they're the same thing.

Most recent occurence is in the 2+2 = 5 question, in JavaScript, here.

It's just boring. It's effectively impossible to detect unless explained.

Also, it isn't a display of programming skill, it's just an easy troll. It isn't even one of those things that are funny the first time you see them (at least for me).

\$\endgroup\$
15
  • 8
    \$\begingroup\$ Impossible to detect? Manual inspection with od -a? Automatically with iconv --unicode-subst=whatever? I'll give you the "boring" part though. \$\endgroup\$ Commented Jun 1, 2014 at 16:34
  • 67
    \$\begingroup\$ @Lloeki I don't exactly hexdump every underhanded answer I see. But you could do that. \$\endgroup\$ Commented Jun 1, 2014 at 16:36
  • 27
    \$\begingroup\$ Just use Ctrl-F in your browser and search for a. \$\endgroup\$ Commented Jun 1, 2014 at 17:20
  • 129
    \$\begingroup\$ @KonstantinWeitz Yeah cos there will obviously be very few results only. \$\endgroup\$ Commented Jun 2, 2014 at 9:44
  • 6
    \$\begingroup\$ @ArlaudPierre It highlights the characters? \$\endgroup\$ Commented Jun 15, 2014 at 23:43
  • 9
    \$\begingroup\$ @YetAnotherUser In an usually really unconvenient way? It also often scrolls the page somewhere else and takes a few seconds (a.k.a. a life time) to highlight them? \$\endgroup\$ Commented Jun 16, 2014 at 7:14
  • \$\begingroup\$ i dont get how that works \$\endgroup\$ Commented Jun 26, 2014 at 12:10
  • 44
    \$\begingroup\$ I think using homoglyphs is very much in the spirit of underhanded programming. \$\endgroup\$ Commented Aug 6, 2014 at 12:50
  • 9
    \$\begingroup\$ @BrianMinton It's good for underhanded contests (the goal is to trick the user), but not very good anywhere else. \$\endgroup\$ Commented Apr 15, 2015 at 18:25
  • 11
    \$\begingroup\$ I thought underhanded was supposed to look like an honest typo even after someone finds the trick, which would make this unsuitable for it. \$\endgroup\$ Commented Apr 25, 2015 at 17:34
  • 1
    \$\begingroup\$ This should be trying to fool the reader rather than do the trick since it's one way of doing it. Let's avoid selectivism. \$\endgroup\$ Commented Jan 19, 2016 at 12:06
  • 11
    \$\begingroup\$ @Random832 "oops I forgot my keyboard was in Greek mode" \$\endgroup\$ Commented May 10, 2016 at 18:58
  • \$\begingroup\$ Moot since underhanded challenges are no longer on topic \$\endgroup\$ Commented Jul 10, 2017 at 2:01
  • 1
    \$\begingroup\$ @PierreArlaud I suppose KonstantinWeitz was proposing to Ctrl+F for <CYRILLIC A WHICH LOOKS THE SAME> not a. \$\endgroup\$ Commented Jan 18, 2018 at 7:50
  • \$\begingroup\$ I disagree that it isn't a display of programming skill. At my last job, a fellow developer spent hours trying to debug some code. When she turned to me for help, I quickly deduced that the issue had to do with a unicode character masquerading as a common ascii character. You can lose hours or days of time if you have never encountered a problem like this before. (When I was a teenager, my mother had these problems as a programmer, too!) \$\endgroup\$ Commented Jan 22, 2018 at 16:37
185
\$\begingroup\$

Using the program name to store data without counting those bytes

Example - this bash script prints Hello World!

echo 0ドル

Must be saved in a file called Hello World!.


When using the filename to store data, add them as extra bytes to your solution similarly to any non-standard parameter.

For example the correct byte count for the above is 7 (echo 0ドル) + 12 (Hello World!) = 19 bytes.

\$\endgroup\$
15
  • 305
    \$\begingroup\$ -1 I think this is completely fine, but if you are using the filename, then it has to count to the bytecount as well, just like any other non-standard parameter you have to specify in the command line / shebang. \$\endgroup\$ Commented Feb 25, 2014 at 14:06
  • 16
    \$\begingroup\$ @SztupY It's absolutely standard for the filename to be the first parameter. argv[0] is the filename in C for example. \$\endgroup\$ Commented Jun 21, 2014 at 13:57
  • 14
    \$\begingroup\$ It's quite standard for C executable to be named a.out. Can it be used without increasing bytes count? \$\endgroup\$ Commented May 30, 2017 at 18:02
  • 3
    \$\begingroup\$ @SztupY: I fixed this answer to allow using the filename, but only disallow failure to count those bytes. Your comment had 224 upvotes, but the answer only 113 upvotes (and 26 downvotes) before I fixed it. I reversed my vote after fixing it :P \$\endgroup\$ Commented Jul 20, 2017 at 16:53
  • \$\begingroup\$ Also, turns out ! instead of \! works too, with bash. History expansion doesn't apply to the results of parameter expansion, only to literal !. (And is off by default in non-interactive shells anyway.) So this example is badly golfed, but I'll leave in the \! as a hint/clue about what's going on. \$\endgroup\$ Commented Jul 20, 2017 at 17:01
  • \$\begingroup\$ @PeterCordes, there was no intention to golf the file name, because its bytes are not supposed to be counted. Space needs to be quoted in a line such as cat > Hello\ World\!, but indeed the created file name won't contain a ``. \$\endgroup\$ Commented Jul 20, 2017 at 18:12
  • \$\begingroup\$ Yeah, I realized that it only became an issue once I changed the answer. I updated it try to avoid the distraction of a sub-optimally-golfed implementation for future readers of the question, who aren't thinking about what it used to say. Your point about cat is a reason to leave both the back-slashes in, so it creates 'Hello Word!' for people that copy-paste the filename into a shell command without quoting it. Ugh, I'd rather just assume that people know how to use quote filenames in the shell, but if you want to change it back to 21 bytes, I don't object. \$\endgroup\$ Commented Jul 20, 2017 at 18:15
  • 2
    \$\begingroup\$ What if relying on a necessary part as storage? e.g. a BAT file use its whole filename"1.BAT" to do operations, count as +1 or +5? \$\endgroup\$ Commented Dec 1, 2017 at 8:12
  • 2
    \$\begingroup\$ @l4m2: What happens if I name it 1.cmd? \$\endgroup\$ Commented Sep 21, 2018 at 21:17
  • \$\begingroup\$ @SamB Discuss both situation \$\endgroup\$ Commented Oct 1, 2018 at 13:05
  • 1
    \$\begingroup\$ All answers I have recently looked at took command line arguments for granted without counting them towards the length. The problem lies in the definition here. If you ask for a program f(x) = y, and provide test values for x, then x obviously doesn't count. "Hello World" however is f() = x. Writing a program f(x) = x is not the same. So the real loophole is "defining would-be constants as variables to outsource them", which is the generalized form of multiple loopholes mentioned here. \$\endgroup\$ Commented Apr 24, 2019 at 17:23
  • 4
    \$\begingroup\$ It should just be 12. The backslash in the filename doesn't really exist on disk. \$\endgroup\$ Commented Mar 22, 2020 at 21:40
  • \$\begingroup\$ This is not right. If the filename contains the backslash, it will be present in the output too. If it doesn't it will not be. How the filename has to be entered in the shell is not the same as what the filename actually is. (if it's about counting the bytes needed to input it to the shell, the post should say that instead.) Also, if you were to actually create such a file, you'd need to escape or quote the space, but not the bang. (None of the shells that support history substitution trigger on a trailing !.) E.g. touch 'Hello World!', or touch Hello\ World! both work. \$\endgroup\$ Commented Mar 31, 2021 at 14:25
  • \$\begingroup\$ Funny is that 286 users likes your comment, but only 24 people dislike the answer :P \$\endgroup\$ Commented Jun 10, 2021 at 14:41
  • \$\begingroup\$ Is it ok to require a certain filename, even when it is not used to store data? One example would be this bash script named 0 1ドル||exec 0 $((1ドル-1)) which calls itself with a lower argument (recursive) till it reaches 0. Do i have to count the script name or not? \$\endgroup\$ Commented Jul 21, 2023 at 15:10
178
\$\begingroup\$

Outsourcing the real answer

I still did not see people using this thing here in serious answers (just in some jokes ones), but already saw it being used seriously elsewhere. To circumvent restrictions and rules in the question (normally size), the answerer writes a small program that downloads the real program from elsewhere and then compiles and runs it.

A variant of this is posting an answer that takes input from the user and then submits it to somewhere on the Internet that is responsible for solving the problem and send back the output.

\$\endgroup\$
6
  • 6
    \$\begingroup\$ +1: I think this can also be considered a link-only answer, and be flagged as such. I especially hate when answer like this appears in non code-golf questions, where they have absolutely no purpose. \$\endgroup\$ Commented Feb 25, 2014 at 14:12
  • \$\begingroup\$ @SztupY But much of the time, they aren't link only answer. They in fact do contain some working running code. \$\endgroup\$ Commented Feb 25, 2014 at 15:59
  • 85
    \$\begingroup\$ I'd lump this together with Fetching the desired output from an external source. Fetching the code instead of the output from an external source doesn't really make it any more acceptable. \$\endgroup\$ Commented Feb 27, 2014 at 12:08
  • 12
    \$\begingroup\$ I agree with Ilmari - fetch code and fetch answer are two sides of the same coin. A very low-valued coin. \$\endgroup\$ Commented Feb 27, 2014 at 14:56
  • 6
    \$\begingroup\$ I think all networking should be banned unless explicitly allowed in the question.. \$\endgroup\$ Commented Aug 1, 2014 at 17:41
  • 13
    \$\begingroup\$ A variant of this loophole is abusing an input-flexibility rule like "you can read the input in any format" to submit a program that evals the first line of input and requires, as part of the input format, that the input begin with a line containing a real program solving the problem. \$\endgroup\$ Commented Mar 23, 2015 at 3:32
140
\$\begingroup\$

Hard-coding the output

Unless the question is an obvious exception (the primary exception being those tagged ), your program is expected to do work, not just print a pre-calculated result. If the question doesn't require input and so a solution which just prints the answer would seem to meet the spec, downvote the question rather than post a protest answer consisting of the literal output.

community wiki

\$\endgroup\$
11
  • 205
    \$\begingroup\$ Often, this vulnerability is an indicator of a dumb question... \$\endgroup\$ Commented Mar 7, 2014 at 19:37
  • 28
    \$\begingroup\$ Sometimes you can't solve a problem in any other way, e.g. Factorial calculation without recursion/loops/eval - but that indicates a bad question. \$\endgroup\$ Commented Mar 13, 2014 at 15:23
  • 4
    \$\begingroup\$ How does Bubblegum fit into this? It seems to be designed to kill pure kolmogorov-complexity questions. \$\endgroup\$ Commented Feb 18, 2016 at 1:12
  • 4
    \$\begingroup\$ @CJDennis Unless the question is an obvious exception (the primary exception being those tagged kolmogorov-complexity) \$\endgroup\$ Commented Mar 3, 2016 at 0:29
  • 1
    \$\begingroup\$ Most questions provide a couple of test cases and not only one. Only a bad question would have this problem and even then, you could edit it. \$\endgroup\$ Commented Sep 30, 2016 at 18:12
  • \$\begingroup\$ Now I can't understand what this loophole means. Mr.Xcoder recently posted this chat message which doesn't seem to be correct. If the question requires input, hardcoding is impossible. Can you explain more? @PeterTaylor \$\endgroup\$ Commented Jan 12, 2018 at 13:53
  • \$\begingroup\$ @user202729, it was addressed at questions like "Write a program to output the smallest three-digit prime", where the GolfScript program 101 would almost certainly beat any program in any language which actually did work. \$\endgroup\$ Commented Jan 12, 2018 at 18:57
  • 4
    \$\begingroup\$ And as specified in the answer, it's better to downvote such challenges. Thanks. \$\endgroup\$ Commented Jan 13, 2018 at 2:07
  • 4
    \$\begingroup\$ I fell it's not a loophole to answers, but a requirement to questions \$\endgroup\$ Commented Apr 4, 2018 at 4:57
  • \$\begingroup\$ Is f=n=>[1,7,31,105,300,754,1712,3576,6975,12871][n] valid for codegolf.stackexchange.com/questions/170437/… ? \$\endgroup\$ Commented Aug 11, 2018 at 16:38
  • \$\begingroup\$ Why?? This is a mushy criterion, and I don't see how it adds any value at all. \$\endgroup\$ Commented Jul 22 at 6:04
138
\$\begingroup\$

Copying an (unimproved) answer from elsewhere

If it's not your own work, and you can't even try enough to golf or improve it, then it's not yours to post.

\$\endgroup\$
13
  • 49
    \$\begingroup\$ +1, although this could be argued to be acceptable if you really think the answer is optimal and cannot be improved. It might be good form to mark the answer as Community Wiki in that case, though. \$\endgroup\$ Commented Feb 24, 2014 at 9:42
  • 63
    \$\begingroup\$ This shouldn't need stating, because it's already a copyright violation and liable to flagging for deletion due to non-compliance with the terms of service. \$\endgroup\$ Commented Feb 24, 2014 at 10:36
  • 5
    \$\begingroup\$ @PeterTaylor Agreed; however, I have seen just such an answer occur in the past week, so it cannot hurt to hammer home the point in more than one way. \$\endgroup\$ Commented Feb 24, 2014 at 15:16
  • 9
    \$\begingroup\$ @IlmariKaronen In that case, I agree the thing to do is mark it as a CW and link to the original source with a mention of the author. But even so, in the spirit of the site, I would hope to see at least a "Here's my best attempt at golfing this answer, but as you can see it just can't be improved." \$\endgroup\$ Commented Feb 24, 2014 at 15:21
  • 1
    \$\begingroup\$ This can happen accidentally when two people post near the same time, or when the later poster just doesn't read the existing answers fully. Still shouldn't be allowed, but I feel this is less of a "loophole". \$\endgroup\$ Commented Apr 8, 2014 at 19:30
  • 16
    \$\begingroup\$ As long as the answer is marked CW and publishing it under the original license is possible (e.g. SE answers are CC by-sa 3.0, so as long as you mention the author and publish on SE you're in the clear) I don't see any problem with it. Don't forget codegolf is on SE and also a Q&A site, not a gaming site. And if you don't like others 'using' your answers don't publish on SE. \$\endgroup\$ Commented Jun 22, 2014 at 18:21
  • 1
    \$\begingroup\$ I once had a guy rip off my answer almost entirely, which made extensive use of little used quirks in C#. His first answer did not even solve the problem, so he took my logic and made it a loop rather than tail recursive. Thankfully, mine was still smaller, but it really rubbed me the wrong way. He even copied my explanation for how it worked, with his own style. Crazy. \$\endgroup\$ Commented Jan 24, 2018 at 22:18
  • 2
    \$\begingroup\$ @PeterTaylor not a violation if it's copied from another SE site, or other appropriately licensed source, with any requisite attribution. \$\endgroup\$ Commented Feb 20, 2019 at 21:36
  • \$\begingroup\$ What if the answer works in another different language (obviously with attribution) \$\endgroup\$ Commented Feb 7, 2023 at 18:03
  • \$\begingroup\$ Does this apply for AI-related answers where the AI-asker doesn't golf the response of the AI? \$\endgroup\$ Commented Feb 26, 2023 at 14:23
  • \$\begingroup\$ Sometimes there exist 2 answer in the same language. And you can use one to improve the other and vice versa, sometimes the best answer is a combination of both. What to do in this case? Which answer should be improved? \$\endgroup\$ Commented Jul 21, 2023 at 16:04
  • \$\begingroup\$ ±0, what if you’re making an account for a chatbot and you want it to get enough rep so it can actually chat? \$\endgroup\$ Commented Sep 4, 2024 at 15:40
  • \$\begingroup\$ This does not belong in a list of loopholes. It's not a loophole. \$\endgroup\$ Commented May 16 at 6:44
137
\$\begingroup\$

Adding input or rules which weren't explicitly mentioned in the challenge

There was recently a case where an answerer claimed

Nowhere does it say the program can't (also) ask the user what the [result] is.

Adding additional input or new rules, because they haven't been explicitly forbidden, can considerably simplify the challenge or make it trivial. That's certainly not in the spirit of any challenge.

\$\endgroup\$
8
  • 3
    \$\begingroup\$ Do you have a link to this, or was it deleted? \$\endgroup\$ Commented Jun 30, 2014 at 22:07
  • \$\begingroup\$ @PeterTaylor codegolf.stackexchange.com/a/32725/8478 \$\endgroup\$ Commented Jun 30, 2014 at 22:09
  • 7
    \$\begingroup\$ I think this is a bit too broad and certainly curtails any out of the box thinking which may actually be amusing or creative. I do imagine the issue you want to tackle to get annoying, but I'm inclined to think that if a question has specific loopholes that this particular meta has not covered, it is either the fault of the question or the loophole should be added here in it's specific form. \$\endgroup\$ Commented Jul 22, 2014 at 12:47
  • \$\begingroup\$ @jaybz Feel free to reword it to make it a bit more precise. I just thought if I'd write "taking the result as an additional input" it would be too narrow. "Taking more input then specified"? \$\endgroup\$ Commented Jul 22, 2014 at 12:50
  • 8
    \$\begingroup\$ @MartinBüttner I had a previous reply but I deleted it because I just realized something. I believe Outsourcing the real answer and Fetching the desired output from an external source essentially covers that particular case and any similar cases. \$\endgroup\$ Commented Jul 22, 2014 at 13:33
  • \$\begingroup\$ @jaybz I feel like someone said that before (and must have deleted the comment). Basically, while those two have quite generic titles which might cover this case, their descriptions seem to aim very specifically at downloading things from the web - one the answer, the other the program that solves the problem. That's why I added my answer in the first place. \$\endgroup\$ Commented Jul 22, 2014 at 13:39
  • \$\begingroup\$ @MartinBüttner In that case one of those two needs to be a bit broader than they already are. Obviously though, care needs to be taken not to make the loophole descriptions too broad and while I initially didn't want to combine those two for that reason, your recommendation and link convinced me otherwise. They're not even funny the first time. \$\endgroup\$ Commented Jul 23, 2014 at 4:57
  • 3
    \$\begingroup\$ Reminds me of this xkcd comic. \$\endgroup\$ Commented Dec 18, 2015 at 18:08
125
\$\begingroup\$

Zero-length quines

Considering an empty program a quine was original in the 1994 IOCCC.

Over three decades later, if you can answer a question with an empty program and that question is scored by length (e.g., ) and is tagged as , or , just notify the OP.

\$\endgroup\$
5
  • 12
    \$\begingroup\$ I mean technically, it is a quine, since the source is nothing and it outputs nothing \$\endgroup\$ Commented Jan 15, 2017 at 5:33
  • 12
    \$\begingroup\$ @TrojanByAccident Quine: a non-empty computer program which takes no input and produces a copy of its own source code as its only output \$\endgroup\$ Commented Jun 26, 2017 at 13:58
  • \$\begingroup\$ In stack based languages without other output, does stack content count as output? In that case in RPL you can get a 1-character quine, like 7, which pushes number 7 onto the stack. Maybe the way to counter it we would want the stack to contain the program listing in a string, so 7 wouldn't count as it would produce 7 rather than "7". \$\endgroup\$ Commented Nov 8, 2017 at 15:16
  • 3
    \$\begingroup\$ @Heimdall Improper quines is its own loophole. \$\endgroup\$ Commented Nov 8, 2017 at 15:21
  • \$\begingroup\$ your link is dead \$\endgroup\$ Commented Feb 7, 2023 at 18:04
97
\$\begingroup\$

Using a non-free language on a Cops and Robbers challenge

Most (currently all) cops and robbers challenges consist of two parts:

A cop submission, where a user posts some secret property of a program, such as its output, a scrambled version of the code, etc.

Then, other users, the robbers, try to deduce the original program, or another program with the same properties.

An important implicit condition of such a challenge is that it is possible for the robbers to try out many variants of the code to find the true solution. While a cop submission where this is impossible would ostensibly do well, it is not in the spirit of the challenge, and is in fact a loophole.

Therefore, pay-for-use languages are banned from competition in CnR challenges as a loophole.

Some popular languages which are thus banned are:

  • Matlab
  • STATA

However, non-free languages may still be submitted as non-competitive entries so as not to exclude potentially interesting cops from being posted altogether. If these are cracked, the crack should also be marked as non-competitive.

\$\endgroup\$
16
  • 20
    \$\begingroup\$ You forgot Mathematica. ;) What about paid-for languages with free trials though? \$\endgroup\$ Commented Oct 18, 2015 at 8:26
  • 9
    \$\begingroup\$ And what about Matlab and Octave? \$\endgroup\$ Commented Oct 18, 2015 at 9:30
  • 42
    \$\begingroup\$ @MartinBüttner If the free trial can expire, and block a user from using that language afterwards, it's still no good. \$\endgroup\$ Commented Oct 18, 2015 at 16:01
  • \$\begingroup\$ @BetaDecay Octave is fine. Matlab isn't \$\endgroup\$ Commented Oct 18, 2015 at 16:02
  • 10
    \$\begingroup\$ I think this warrants a separate meta discussion to decide what is free enough for a CnR. For example, is it enough if there is a free online interpreter, or if there is a free interpreter that works only with a particular OS? \$\endgroup\$ Commented Oct 18, 2015 at 16:12
  • 13
    \$\begingroup\$ Such as AppleScript. \$\endgroup\$ Commented Oct 19, 2015 at 18:18
  • 2
    \$\begingroup\$ Mathematica is so popular on this site. TinyMUSH, although free, seemed much worse than that... \$\endgroup\$ Commented Oct 22, 2015 at 9:45
  • 31
    \$\begingroup\$ TI-BASIC for the TI-84+ can be emulated easily, but it's technically illegal to do unless you own a calculator. I don't know where that would fall. \$\endgroup\$ Commented Nov 7, 2015 at 6:09
  • 1
    \$\begingroup\$ Are there any platform-specific languages? \$\endgroup\$ Commented Dec 19, 2015 at 16:07
  • 8
    \$\begingroup\$ @ASCIIThenANSI Well most assembly languages, for instance \$\endgroup\$ Commented Dec 19, 2015 at 17:00
  • 1
    \$\begingroup\$ @AlexA. started a discussion about the free-ness here. \$\endgroup\$ Commented Dec 27, 2015 at 10:08
  • 18
    \$\begingroup\$ Note: Mathematica can now be used freely online. \$\endgroup\$ Commented Nov 19, 2016 at 1:59
  • 4
    \$\begingroup\$ We might want to have some rules for this in normal code-golf as well, or else: "My solution to this insanely hard code-golf challenge is the empty program in this language I invented. Trust me, it works. You can verify for yourself by buying the interpreter for 1,000,000ドル." \$\endgroup\$ Commented Mar 8, 2017 at 6:01
  • 1
    \$\begingroup\$ @isaacg I think Beta Decay meant that matlab code can be (mostly?) checked with free octave, as they have compatible syntax. \$\endgroup\$ Commented May 12, 2021 at 13:38
  • \$\begingroup\$ How "official" does a free method of language access have to be? I imagine you could claim that some pay-to-use langs are free because you can keep making new email addresses for the free trial to use the language forever. \$\endgroup\$ Commented Jul 25, 2021 at 11:41
89
\$\begingroup\$

Note: Banning builtins that perform specific operations is generally considered an unobservable requirement, and as such this loophole generally isn't enforced anymore.

Identical functions with different names

For example, if + is forbidden, using any of the following is also forbidden:

num3 = num1.add(num2)

or

num3 = num1
num3 += num2

or

num1++

or (GolfScript)

)

etc.

\$\endgroup\$
4
  • 30
    \$\begingroup\$ This is usually semantics. When posting restrictions you have to specify that the restriction applies to all functions and not just that specific one. After that all posts that try to circumvent this can be downvoted/flagged as not an answer \$\endgroup\$ Commented Feb 25, 2014 at 14:11
  • 126
    \$\begingroup\$ I see a big difference between addition and increment. Unless you would interpret "* is forbidden" as banning +, I don't think you should interpret "+ is forbidden" as banning ++. \$\endgroup\$ Commented Mar 5, 2014 at 10:23
  • 30
    \$\begingroup\$ For + and add I am on your side. Than again if / is forbidden, I would not assume % (modulus) is forbidden (and for the same reason I would allow ++ when only + is explicitly disallowed). \$\endgroup\$ Commented Mar 7, 2014 at 16:56
  • 1
    \$\begingroup\$ Many of the challenges I have seen in which + would be forbidden have requirements that ban specific characters rather than specific semantics. In which case, using a .add() function would be exactly the kind of workaround expected. \$\endgroup\$ Commented May 16 at 6:42
87
\$\begingroup\$

Using MetaGolfScript

MetaGolfScript is a family of programming languages. For example, the empty program in MetaGolfScript-209180605381204854470575573749277224 prints "Hello, World!".

It is similar to using extra command line arguments, where they should also count as characters. And using the standard interpreter is likely using the program name to store data, except it's the interpreter's name. But someone can build a website with (削除) a fake directory (削除ここまで) a directory compressed by a special purpose compression algorithm like all our Kolmogorov complexity challenges, of all MetaGolfScript languages, each with an interpreter can run independently with its filename. They can also use generated descriptions and random code obfuscations to make languages not similar to each other, and it will be hard to say it's still an argument or configuration somewhere.

\$\endgroup\$
9
  • 29
    \$\begingroup\$ Isn't this covered by "languages must have an interpreter before challenge was posted"? Or "made up languages" more specifically? \$\endgroup\$ Commented Apr 14, 2015 at 19:07
  • 6
    \$\begingroup\$ @Geobits Someone can make interpreters for MetaGolfScript before those challenges posted. At least they can be appeared to exist on the internet. \$\endgroup\$ Commented Apr 14, 2015 at 19:19
  • 3
    \$\begingroup\$ I guess, but that's just plain "lying" or "cheating", not a loophole. Even so, I'd suspect a torrent of downvotes on any such answer to speak for itself. \$\endgroup\$ Commented Apr 14, 2015 at 19:21
  • \$\begingroup\$ Well, I think I'll delete this after a few days. \$\endgroup\$ Commented Apr 14, 2015 at 19:25
  • 1
    \$\begingroup\$ I agree that this is obvious and shouldn't need to be a loophole. However, we've recently seen this yet again, so it is clear that we really do need a place to state the obvious and point people to. \$\endgroup\$ Commented Aug 24, 2015 at 17:26
  • 1
    \$\begingroup\$ I think this is covered by the interpreter needing to predate the challenge. A generic MetaGolfScript interpreter would need command-line arguments to tell it what variation of the language you wanted, and you'd have to pay for those; that's fair. An interpreter for a specific instance of the language (i.e. one specific program) predating the challenge would have nothing to do with MetaGolfScript itself; it'd be more logically akin to the Hello, World program in Stuck. \$\endgroup\$ Commented Mar 18, 2017 at 1:49
  • \$\begingroup\$ @ais523 You could implement a special purpose compression algorithm, and release the interpreters in that format. \$\endgroup\$ Commented Apr 28, 2017 at 9:01
  • 6
    \$\begingroup\$ I think it's ok as long as it works as with using the file name etc. The language name part 209180605381204854470575573749277224 should be included in the byte count making it longer than eg GS version. \$\endgroup\$ Commented Jul 17, 2018 at 15:18
  • 1
    \$\begingroup\$ I think this should be extended to include the perl -nF/(?{s-.*(??{!($&=~y&R&&c==$&=~y&L&&c&&$&=~y&U&&c==$&=~y&D&&c)})--g;print})(*COMMIT)/ language family, now that we consider all of these as different languages as well (codegolf.stackexchange.com/a/205249) \$\endgroup\$ Commented Jun 2, 2020 at 4:18
68
\$\begingroup\$

Suicidal entries to King-of-the-Hill challenges.

EmoWolf was funny the first time, but it's getting out of hand.

While some not-too-serious answers are often necessary to kickstart a challenge, purely suicidal answers put in little effort and tend to get more upvotes than serious entries, simply because they're "funny".

I'm not suggesting that other answers that are for jokes shouldn't be allowed, but this specific kind that is not even trying to do anything. Submissions should at least play the game, even if badly or in a funny way.

\$\endgroup\$
8
  • 47
    \$\begingroup\$ I'd prefer if this loophole was a bit more closely cut to purely suicidal submissions. I find that joke submissions in general are very important to get many KotHs going. For instance, if people had only ever posted serious submissions to RPSLV, there would have been no game, since nothing can beat a uniformly random strategy with anything but luck. Furthermore, KotHs need many submissions to be fun, and a bunch of less serious submissions in the beginning help a lot to explore the strategy space and gather some popularity. \$\endgroup\$ Commented Jul 31, 2014 at 7:30
  • 2
    \$\begingroup\$ @MartinBüttner I agree. That's what I tried to say in the last paragraph. I guess I failed. \$\endgroup\$ Commented Jul 31, 2014 at 17:17
  • 3
    \$\begingroup\$ That last sentence does point in this direction, but I'm sure if it gets more upvotes as it stands it will be used in the future to justify downvotes for any sort of non-competitive KotH submission. I'll give rephrasing it a go later. Feel free to rollback or improve that any time. \$\endgroup\$ Commented Jul 31, 2014 at 17:35
  • 7
    \$\begingroup\$ Out of hand? You don't say? \$\endgroup\$ Commented Jul 31, 2014 at 23:34
  • 1
    \$\begingroup\$ In AlienWar (codegolf.stackexchange.com/questions/32782/…), I'm somewhat worried about solutions that only set the ability points and implement the methods trivially, like the Manager and Banana Peel. Well, some KotH games are designed to let trivial implementations thrive. \$\endgroup\$ Commented Aug 10, 2014 at 6:29
  • 12
    \$\begingroup\$ Even purely suicidal submissions could still be a viable strategy, depending on the contest. If it works, and is allowed by the rules (especially when there's an explicit suicide action!), this really isn't much of a loophole. \$\endgroup\$ Commented Aug 11, 2014 at 2:28
  • 2
    \$\begingroup\$ Surely the solution is to not specifically allow a 'suicide' command in the game? \$\endgroup\$ Commented Jan 6, 2017 at 4:02
  • \$\begingroup\$ Suicidal entries to king-of-the-hill challenges are not serious cotnenders. \$\endgroup\$ Commented Aug 17, 2019 at 22:23
62
\$\begingroup\$

Abusing native number types to trivialize a problem

It is common practice to restrict challenges to cases where input, output and/or intermediate values of the algorithm of choice fit into the language's native number type. At least for input and output, this is generally assumed even if not stated in the challenge specification.

There are at least two ways to abuse this:

  1. Using a language like Boolfuck which only has a 1-bit integer type.

    With one bit of input and one bit of output, there are only four different Boolfuck programs that can solve all challenges.

    So far, at least two answers have done this:

  2. Deliberately exceeding the precision limit.

    I don't know if this has been done before, but one could start by computing A(4, y) for input y (a 19,728 digit integer for y = 2), and then do anything that works for inputs 1 and 0.

As a rule of thumb, I'd say an answer abuses the native number type if the code would require non-trivial modifications for larger number type.

Examples:

  • Implementing bit rotations as

    (x << n) | (x >> (32 - n))
    

    for 32-bit integers is allowed; only the 32 has to be changed to make it work for, e.g., 64-bit integers.

  • Hardcoding a list of the prime numbers below 128 is not allowed in a challenge that involves primality testing, even if the language of choice only supports signed 8-bit integers.

\$\endgroup\$
9
  • 18
    \$\begingroup\$ I'd say instead that the flaw is in the challenge, and the default should be that the algorithm should work for all N when precision/range limits are disregarded. \$\endgroup\$ Commented Feb 11, 2016 at 5:07
  • 2
    \$\begingroup\$ I don't think this is a problem, but a solution. Good on those users for thinking outside the box. \$\endgroup\$ Commented Sep 12, 2016 at 19:16
  • 5
    \$\begingroup\$ @tuskiomi The first time it was used was clever, but this trick could be applied to pretty much all challenges that do not state in what range the submissions must work. \$\endgroup\$ Commented Sep 12, 2016 at 19:56
  • 1
    \$\begingroup\$ @Dennis I'd say, if the input doesn't match the challenge, it isn't an appropriate answer. It's arbitrary at this point that ints are 32 bit, doubles 64, floats 32, shorts 16, bools 1/8, and Strings are infinite. \$\endgroup\$ Commented Sep 12, 2016 at 20:03
  • \$\begingroup\$ I know it's years since this was posted but I had a thought. "Hardcoding a list of the prime numbers below 128 is not allowed" -- what about including the single 128-bit value 0x800228A20208828828208A20A08A28AC or binary 10000000000000100010100010100010000000100000100010000010100010000010100000100000100010100010000010100000100010100010100010101100 which is a bitmap of the primes from zero to 127? \$\endgroup\$ Commented Nov 7, 2018 at 17:07
  • 5
    \$\begingroup\$ @RossPresser That's still hardcoding. The format doesn't matter. \$\endgroup\$ Commented Nov 7, 2018 at 17:09
  • \$\begingroup\$ For challenges that don't specify input ranges, this can go the other way: demanding a function works with 128 bits, 256 bits, etc. can be unreasonable for languages that only offer native support for 32 bit types. I think it's reasonable to accept 32 bit as a default sized input. \$\endgroup\$ Commented Feb 7, 2019 at 9:20
  • 5
    \$\begingroup\$ @qwr Are you talking about the algorithm or the implementation? I don't think a submission in a "32-bit language" should have to support 64-bit input, but I do think the underlying algorithm should. \$\endgroup\$ Commented Feb 7, 2019 at 12:56
  • \$\begingroup\$ I think the point is not abusing the fact that given limits of the language the set of inputs is finite, and the solution can be hardcoded. It is a particular case of the "do not hard-code" rule codegolf.meta.stackexchange.com/a/1063/25245 \$\endgroup\$ Commented May 21, 2020 at 16:34
61
\$\begingroup\$

Optimising for the given test cases

This applies to s and things like , where you write some code that is measured by a criterion like runtime or size of your output (e.g. in compression challenges). These often employ an obviously finite set of test cases, because you have to measure the metric somehow.

It's not in the spirit of such challenges if an answer optimises exclusively for those test cases (e.g. by hardcoding them, which would usually allow you to compress them to a single byte or execute in milliseconds), but performing much worse for general/random input.

For variable-sized input there is no way around test cases (one can use some sort of big-O class for scoring, but those tend to not be accurate enough to distinguish submissions and they require proofs instead of just running the code), so the code of conduct should be that the algorithm is such that the test cases are actually representative for the implementation's performance.

This also means, that if you optimise your algorithm to perform well on the majority of cases (and worse on a handful of edge cases) and the test cases happen to be picked from that majority, that's perfectly fine. However, optimising for a minority of cases which include one or more of the test cases is not.

\$\endgroup\$
6
  • 10
    \$\begingroup\$ +1, but also I think it would be useful guidance for question setters to either score on the worst-case input, or take such a wide variety of input that it's impossible to optimise. This is because it's hard to see from an answer whether it's been optimised for the test cases or 'happens' to give a good answer for a small amount of test input data. \$\endgroup\$ Commented Nov 17, 2014 at 18:57
  • \$\begingroup\$ @abligh Yes, larger sets test cases help mitigate that, but even those can be hardcoded. And scoring by worst-case input only really works for fixed-size problems. \$\endgroup\$ Commented Nov 17, 2014 at 18:59
  • \$\begingroup\$ With respect to: "but performing very badly for general input", the example that inspired trying to close this loophole permits performing optimally on all cases, yet still permit optimizing for the test cases. In that example, the result is effectively an integer between 0 and 6,670,903,752,021,072,936,959. It is easy to map n test cases to 0.._n_, resulting in compression to a single character (or less) for those cases, while having exactly zero impact on the average performance. So you may want to remove that condition to closing the loophole. \$\endgroup\$ Commented Nov 17, 2014 at 23:30
  • \$\begingroup\$ @MarkAdler how about now? \$\endgroup\$ Commented Nov 17, 2014 at 23:32
  • 18
    \$\begingroup\$ By the way, detecting an optimization for the minority of cases may be extremely subtle. For example, simple choices in the ordering of what is looked at or the numbering of symbols could be optimized to improve performance on the test cases. Again having no impact on the average performance. This is fine loophole to try to close, but be prepared for ambiguity and arguments about whether it applies or not. \$\endgroup\$ Commented Nov 17, 2014 at 23:34
  • \$\begingroup\$ I guess that's better. \$\endgroup\$ Commented Nov 17, 2014 at 23:35
61
\$\begingroup\$

Note: As per community consensus, languages/language versions are allowed regardless of when they were created, so this loophole is no longer enforced.

Creating a new compiler for a language after a challenge was posted

There is some debate arising from this answer. He created his own compiler for the C programming language that extends the language specifications. It seems pretty obvious that this will be declared a loophole, to me at least, but I'm posting this for the record.

\$\endgroup\$
16
  • 19
    \$\begingroup\$ I’d even go so far as to say that extending the language makes it a new and different language, and is therefore a special case of this \$\endgroup\$ Commented Sep 24, 2015 at 5:42
  • \$\begingroup\$ @Timwi So would I, but the user in the linked answer wouldn't accept that fact. \$\endgroup\$ Commented Sep 24, 2015 at 13:55
  • 5
    \$\begingroup\$ I would put it differently: answers may only make use of a language as it existed at the time the challenge was posted. If it depends on features added after the challenge was posted, it is invalid. But if you can prove your modification to the language has been published online before the challenge was posted, I don't consider this a problem. \$\endgroup\$ Commented Dec 31, 2015 at 13:45
  • \$\begingroup\$ @user2428118 That's already a rule and is mandated. It's not a loophole. \$\endgroup\$ Commented Dec 31, 2015 at 15:49
  • 1
    \$\begingroup\$ As the user referred to in this question, I still don't believe that this is a special case of existing loopholes. For example, a user could submit an empty source file written in the language Undefined (esolangs.org/wiki/Undefined) as a solution to any question, after requiring that the program be compiled with <new compiler that compiles empty source to xxx program>. That's making use of the language Undefined as it has always existed. \$\endgroup\$ Commented Oct 24, 2016 at 11:44
  • \$\begingroup\$ @Donkey_2009 The goal in golfing is not to "get around" loopholes, which is exactly what you were trying to do. You're being intentionally dishonest in how you were answering. Languages are defined by their implementation, and the compiler is part of the implementation. Your all-new compiler did not exist at the time the question was posted. It is also a forbidden loophole now, simply because it has 33 upvotes establishing meta consensus. \$\endgroup\$ Commented Oct 24, 2016 at 14:18
  • \$\begingroup\$ @mbomb007 I was one of the 33 people who voted for this, and I take issue with your statement that I was intentionally dishonest. I was always completely open about how my solution worked and that the compiler did not exist before the question was posted. And I think you'll have a hard time backing up your statement that 'languages are defined by their implementation', particularly for a language like C, for which there are numerous official standards available. \$\endgroup\$ Commented Oct 24, 2016 at 14:26
  • \$\begingroup\$ @Donkey_2009 It's meta consensus that on this site we define a language by its implementation. Every implementation is considered unique. "We", meaning, all of us. \$\endgroup\$ Commented Oct 24, 2016 at 15:21
  • \$\begingroup\$ @Donkey_2009 And you have to realize, we all disagree with you. Your comments in the discussion on your answer that was invalidated show that you still don't get it, and are trying to rationalize your usage of something we determined to be forbidden. \$\endgroup\$ Commented Oct 24, 2016 at 15:29
  • \$\begingroup\$ @mbomb007 A word of advice - when you're trying to convince someone of a point of view, it's actually counterproductive to adopt an attitude that they're being "intentionally dishonest", that they "won't accept" things and that they "don't get it", and to adopt a combative and offensive stance when talking to them. I don't know where all this anger is coming from when I have always tried to be reasonable. I have, by and large, agreed with the community and accepted their point of view, mainly thanks to other users who have been more polite to me. \$\endgroup\$ Commented Oct 24, 2016 at 17:19
  • \$\begingroup\$ Thanks anyway for pointing out the meta consensus on how a language is defined on this site - I'm not sure how I missed that, but now I've done a quick search I've found some posts about it. So I apologise for calling that into doubt earlier; I genuinely didn't realize that that was the official consensus and thought that it was just an opinion held by some users on this site. \$\endgroup\$ Commented Oct 24, 2016 at 17:22
  • \$\begingroup\$ My anger is only now, because you're bumping this and it's more than a year old, and you still didn't get it, apparently. \$\endgroup\$ Commented Oct 24, 2016 at 18:25
  • \$\begingroup\$ Your post leaves a loophole itself: building a transpiler is still possible! \$\endgroup\$ Commented Apr 14, 2018 at 14:53
  • \$\begingroup\$ @RedwolfPrograms We don't allow languages to be posted unless they have an interpreter. A transpiler wouldn't be enough to allow an answer to be posted. \$\endgroup\$ Commented Apr 14, 2018 at 20:48
  • \$\begingroup\$ @mbomb007 Just a joke. I knew about the interpreter-only rule already. \$\endgroup\$ Commented Apr 14, 2018 at 22:04
53
\$\begingroup\$

Generating all possible functions/programs to solve a challenge

In this meta post, izzyg pointed out that, under current consensus, the following Python code (edited to fix a mistake) could possibly be viewed as valid:

for i, code in enumerate(all_possible_strings):
 try: exec("func" + str(i) + "=" + code)
 except: pass

Given enough time, the desired function will eventually be generated and assigned to func<some large number>, which could then be called with the desired arguments and would return the desired result.

Though we do not forbid brute-forcing, solutions of this sort are clearly exploitative in the same vein as MetaGolfScript, and we certainly do not want this solution on every challenge where functions are allowed.

\$\endgroup\$
15
  • 7
    \$\begingroup\$ Can you explain for non-pythonians what this snippet exactly does? \$\endgroup\$ Commented Apr 26, 2016 at 20:19
  • 8
    \$\begingroup\$ @flawr For every possible string (enumerated with some running index i), it defines a function func<i> whose body is that string. Some of those will solve the problem at hand, and given any (ungolfed) solution to the problem it's even quite easy to reverse the process to figure out which number that is, so you could just submit that and then say "the function is named func102947812904". \$\endgroup\$ Commented Apr 26, 2016 at 20:22
  • \$\begingroup\$ But in tat case function to enumerate strings should be included. Also, if we force to count length of function name in such case, it will be longer then function body itself. \$\endgroup\$ Commented May 17, 2016 at 13:02
  • \$\begingroup\$ @Qwertiy The name wouldn't be included in the byte count, because it's trying them all. He's telling you so that the viewer knows which string was the one that runs. The name doesn't occur in the program's original code at all. \$\endgroup\$ Commented May 18, 2016 at 16:37
  • 1
    \$\begingroup\$ @mbomb007, yes. But we have a rule about additional compilation keys - they are not inside of code, but they do count. So if we force to count name in this case - it'll solve problem with golf but would still allow to make some interesting things. \$\endgroup\$ Commented May 18, 2016 at 16:57
  • 7
    \$\begingroup\$ Isn't this the Halting problem? What's to guarantee that you get to a solution in an infinite search space? \$\endgroup\$ Commented Jan 16, 2017 at 5:01
  • \$\begingroup\$ @xdhmoore Given enough time is the key here - since we usually don't impose time restrictions in code golf, solutions which can take multiple lifetimes of the universe to complete are valid (assuming they don't break any other rules). \$\endgroup\$ Commented Jan 16, 2017 at 6:33
  • \$\begingroup\$ I know that's practically correct, but that doesn't sound right math-wise. Maybe I'm missing something. Maybe math isn't the point :) \$\endgroup\$ Commented Jan 16, 2017 at 7:24
  • 2
    \$\begingroup\$ You're going to lose if you use this because the name of the function is longer than the target. \$\endgroup\$ Commented Apr 23, 2017 at 15:42
  • 12
    \$\begingroup\$ @xdhmoore You are correct in pointing this out. Once a non-halting program is discovered, the process of generating programs stops. But there is a well-known workaround: simulate the first function for 1 time step, then the first 2 functions for 2 time steps, the first 3 for 3 time steps, and so on. Now non-halting programs don't impede progress. I believe the technical term is dovetailing. \$\endgroup\$ Commented Jun 2, 2017 at 6:09
  • 1
    \$\begingroup\$ This program is broken, since as soon as it evaluates "while true: \n&nbsp;&nbsp;&nbsp;&nbsp; pass\n", it infinitely loops and never reaches the end. Point is valid, but I would implement it differently: Have a pool of preemptible coroutines. Each iteration, add a coroutine to the pool corresponding to the evaluation of a string. The iterate over all coroutines. If one does not halt after a second, preempt it and leave it in the pool to continue on where it left off next iteration. This guarantees that all strings eventually get iterated over on an idealized computer. \$\endgroup\$ Commented Nov 3, 2017 at 3:08
  • 1
    \$\begingroup\$ @eaglgenes101 The program is the wrong thing to focus on here. \$\endgroup\$ Commented Nov 3, 2017 at 6:25
  • 1
    \$\begingroup\$ This is my kind of program...just let it run, and eventually it will create the next big thing \$\endgroup\$ Commented Apr 14, 2018 at 14:57
  • \$\begingroup\$ @eaglgenes101 No. The program merely defines the function. At no point are any of the functions actually run. E.g. tio.run/##K6gsycjPM/7/… \$\endgroup\$ Commented Jan 5, 2023 at 14:23
  • \$\begingroup\$ However, it does kind of need modification. But no really as extreme as the answers seem to imply. \$\endgroup\$ Commented Jan 5, 2023 at 18:08
45
\$\begingroup\$

Changing your username to fit a username dependent challenge

Changing your username or registering a new one to make your score better in username or userID dependent challenges.

community wiki

\$\endgroup\$
6
  • \$\begingroup\$ I can't think of a recent challenge that required this; could you link to one where having a specific username would give you an advantage? \$\endgroup\$ Commented Jun 20, 2015 at 23:59
  • 5
    \$\begingroup\$ @M.I.Wright Username: Output your username without using any of the characters in your username! [duplicate] UserID: Red vs. Blue - Pixel Team Battlebots \$\endgroup\$ Commented Jun 21, 2015 at 8:17
  • 82
    \$\begingroup\$ I think the problem then would be in the question itself rather than the answer, since it is giving an unfair advantage for some people. I think no post should be dependant on the username/id \$\endgroup\$ Commented Sep 22, 2015 at 11:56
  • 8
    \$\begingroup\$ Some users are just fond of changing their names; it would restrict our freedom. A really good question relies on the user number, which is rigid. The ones that rely on usernames can be regarded as "take any string you want, just do not forget to throw it on your settings page". And sometimes you can do very witty things with that! \$\endgroup\$ Commented Sep 9, 2016 at 11:49
  • 2
    \$\begingroup\$ my username is 1. <s>2-1</s> 3-2. How did I manage to mess that up?! \$\endgroup\$ Commented Mar 25, 2019 at 19:41
  • \$\begingroup\$ This reminds me of Pokemon Blue Arbitrary Code Execution, because some depend on your trainer ID. \$\endgroup\$ Commented Jul 12, 2019 at 6:01
41
\$\begingroup\$

URL shorteners / shortened URLs

Every once in a while, we get a challenge that requires fetching some data from the internet. While some of them manage to ban URL shorteners in time, other don't. I propose to forbid them by default because of the following reasons.

  1. URL shorteners that were created after the challenge was posted are akin to adding a feature to the interpreter after the challenge was posted, and there's usually no easy way to determine when a shortened URL was created. They also outsource the "real" URL, which is more or less a violation of this loophole. Last but not least, it's oftentimes not possible to determine whether a given URL existed before the challenge was posted.

  2. Using a non-canonical URL is not only a bit unimaginative and rather unrelated to programming, the same URL can be used in pretty much all answers. Every time someone finds a shorter URL, all other posts can be updated to use that URL as well. That's a very tedious and boring way of saving bytes.

  3. In some challenges, API queries have to be made. Being able to fit a very complex query – which will make parsing its output easier – in the same amount of bytes as simple one actively harms the challenge; instead of coming up with clever ways to parse the output, the complex query is "golfed" down using a URL shortener.

URL shorteners are rather easy to identify. That leaves non-canonical domain names.

I propose counting all URLs on domains as shortened (and therefore forbidden) if the domain name isn't owned by the same individual/company as the canonical one. Thus, e.g., if the task at hand involves querying https://api.stackexchange.com, only URLs that belong to Stack Exchange, Inc. may be used in the challenge.

\$\endgroup\$
6
  • 12
    \$\begingroup\$ Why, I don't really agree. The principle of code-golf is that you want to shorten everything - why not the URL? You should let OP decide for this, in place of saying it is a standard loophole. Actually, for every challenge using data from internet, the question 'can I shorten URL' is asked, and every answerer is at last using a bit.ly link. \$\endgroup\$ Commented Jul 19, 2017 at 13:46
  • 6
    \$\begingroup\$ @V.Courtois The OP can still decide; this is just the default. \$\endgroup\$ Commented Jul 19, 2017 at 16:02
  • \$\begingroup\$ I disagree with the final paragraph. I think it can be fun to get a long url by other means than to store it directly in the source code, and I think we should ban url shortening services specifically. That is information that you have stored somewhere else, and you may not do that, much in the same way that you may not create a language specifically to solve a question. \$\endgroup\$ Commented Oct 25, 2017 at 10:48
  • \$\begingroup\$ I think the correct solution is to count the database entry on the URL shortener as part of the solution for the byte count. If custom code on the URL shortener is involved, then it all counts too. \$\endgroup\$ Commented Jan 8, 2020 at 12:47
  • 1
    \$\begingroup\$ That last clause seems to have some pretty big loopholes, like if the company in question happens to operate a public URL shortener, then you can do whatever you want with it? I think the main consideration here is that if you're using a URL shortener, you're essentially storing code/data somewhere, and therefore you should count that data in your solution. \$\endgroup\$ Commented Mar 18, 2021 at 11:19
  • \$\begingroup\$ @V.Courtois shortening the url is allowed, so long as the full mechnism used to retrieve the full-sized URL in part of the submission. this rule is about using code and resources maintained by external services as part of your answer. \$\endgroup\$ Commented Jun 9, 2022 at 4:04
39
\$\begingroup\$

When consistent and distinct values are asked as input, you cannot input complete or partial functions

When I create a challenge and ask for a boolean or two 'consistent and distinct values' I mean it in the sense of a truthy and falsey value. Usually I leave the choice to the ones doing the challenge, since I don't care whether it's true/false, 1/0, "yes"/"no", etc.

I know just asking for a truthy/falsey value specifically in the challenges is also an option, but since 1/0 isn't considered truthy/falsey in for example Java or .NET C# and I still don't mind if they are used, this default loop hole would be relevant.

Since it isn't part of this default loopholes page yet, there have been answers in the past which input partial or complete functions, if the challenge rules allow this loophole. This JavaScript answer for example, takes the inputs as '/\n|-DI>-/---< ' for left, '/\n|-DI<-\\---> ' for right. In the challenge description it states:

the other being one of two distinct, consistent values of your choice (1 / 0, l / r, left / right, etc.)
...
Standard loopholes are forbidden.

Although original, and it does comply with the challenge description above, I think it would be wise to prevent these kind of partial or complete functions as input in the future. What would prevent someone from having the fictional program run param where the param is a complete program when a truthy value is asked, or a different complete program when a falsey value is asked? Also sharply mentioned by @darrylyeo as comment on that same challenge:

JavaScript, 4 bytes: eval - Input a program that generates a left-facing plane for left, and a program that generates a right-facing plane for right.

Related: Using the program name to store data without counting those bytes
In this related loophole the file-name is counted towards the byte-count. But I don't think adding the two values to the byte-count is a good idea either, otherwise the 1/0, true/false should also be counted. Where do we draw the line of which inputs should be counted towards the byte-count, and which shouldn't? So just preventing these kind of inputs as standard loophole would be better in my opinion.

\$\endgroup\$
7
  • 9
    \$\begingroup\$ Where will you draw the line between valid and invalid here? I can't think of a borderline case right now, but I think there might be some grey area here and we need to be able to make a definitive objective decision about it. \$\endgroup\$ Commented Oct 27, 2017 at 14:08
  • \$\begingroup\$ @HyperNeutrino I agree. Been thinking the same thing just yet. I remember seeing some answers with parameters like A/null, using the A for something in the code if present, which is part of the grey area you're talking about. So I'm also not sure how to consistent and definitively define it. Maybe never allowing string/text inputs, but I can imagine there are some programming languages out there without boolean nor number inputs and only have string parameter options. So yes, I definitely agree it should be specified a lot better, but I'm not sure how (yet). \$\endgroup\$ Commented Oct 27, 2017 at 14:14
  • \$\begingroup\$ I consider this is most similar to extra inputs; specifically it's "hiding" extra inputted information inside an input which IS part of the challenge specification. I'm not certain of a good way to objectively distinguish when that happens though. \$\endgroup\$ Commented Oct 27, 2017 at 19:14
  • 3
    \$\begingroup\$ One possible rigorous definition of falling into this loophole is this: Suppose that the program expects foo as an input for the program, and take bar to be an arbitrary alternate input that we want the program to accept instead of foo. If patching the program to accept bar instead of foo would entail translating bar into foo or otherwise incorporating a portion of foo into the program, it falls under this loophole. (I have a sneaking suspicion that this doesn't work quite right for data typing-based inputs, but that's what other heads are for, right?) \$\endgroup\$ Commented Dec 4, 2017 at 4:05
  • 2
    \$\begingroup\$ Can I do this but add the byte count of input function? \$\endgroup\$ Commented Dec 30, 2017 at 4:57
  • 14
    \$\begingroup\$ While I agree with the intent of this post, the wording needs work. 1, 0, l, and r are complete functions in Jelly. \$\endgroup\$ Commented May 8, 2018 at 15:17
  • \$\begingroup\$ @Dennis Hmm.. good point. But what would be a good alternative wording. Feel free to edit it as you see fit, btw; it's a community wiki for a reason. \$\endgroup\$ Commented May 8, 2018 at 15:20
36
\$\begingroup\$

Outputting an expression instead of a number

For example, outputting 3*3 instead of 9, or outputting 7/4 instead of 1.75.

Unless the challenge explicitly allows expression output, the output should be in a number format where a number is requested.

As the comments point out that what counts as a number format is hard to define, there's a separate meta discussion Which number formats are acceptable in output?

\$\endgroup\$
9
  • 14
    \$\begingroup\$ This is common sense. It shouldn't even need to be written down. +1. \$\endgroup\$ Commented May 26, 2016 at 17:38
  • \$\begingroup\$ It never occurred to me to write it down until someone asked if they could use it, and I realised I didn't have a place to point to in order to say no... \$\endgroup\$ Commented May 26, 2016 at 17:39
  • 42
    \$\begingroup\$ I think this is a bit fuzzy. Yes, you shouldn't be allowed to output a expression, but some things (Like 2/3 vs. 0.6666) should be allowed IMO. \$\endgroup\$ Commented May 26, 2016 at 17:41
  • 5
    \$\begingroup\$ Perhaps we need a new meta post to cover which number formats are acceptable by default (for things like .1 instead of 0.1 and scientific notation and rationals and symbolic constants). \$\endgroup\$ Commented May 26, 2016 at 18:44
  • 1
    \$\begingroup\$ I posted a more detailed meta discussion \$\endgroup\$ Commented May 27, 2016 at 3:59
  • 1
    \$\begingroup\$ I think this would kill creativity. If it is asked to output 14 and your programme prints 2*7 or 2×7 or 2·7, normally a sane person would write a code that evaluates to 14 because printing an expression is seldom easier. There are a bunch of hugely upvoted answers that, for example, print ASCII art instead of numbers, which is even more creative. And throw a rock at me if 7·2≠14. \$\endgroup\$ Commented Sep 9, 2016 at 11:39
  • 6
    \$\begingroup\$ @AndreïKostyrka In Bases 8, 9, B-D and F-\inf it isn't... :-) \$\endgroup\$ Commented Oct 2, 2016 at 11:30
  • 1
    \$\begingroup\$ It's hard to define this clearly. Is 1e2 an expression or a number? Is 1e9? Is 1.43e20? 1.43e22? (FWIW, Javascript expands 1.43e20 but ouputs 1.43e22 as is...) \$\endgroup\$ Commented Jun 5, 2017 at 5:51
  • \$\begingroup\$ @SteveBennett yes this topic proved to be worth its own separate meta discussion (see my previous comment), and there are a variety of answers there covering more detail. Feel free to add another answer each time something turns up that is not covered. \$\endgroup\$ Commented Jun 5, 2017 at 11:41
35
\$\begingroup\$

Generating a random stream of output when a specific output is required

For example, if a challenge requires you to output 4, you can't output an infinite stream of random digits, and say "4 is in there somewhere!" You must output 4, and no other number.

This is similar to this other loophole.

\$\endgroup\$
16
  • 32
    \$\begingroup\$ I would not consider this as a loophole. This just does not meet the specifications of the corresponding challenge and is therefore invalid. Why do you want to explicitly add this as a loophole? \$\endgroup\$ Commented Jun 27, 2016 at 8:23
  • \$\begingroup\$ +1, but it's essentially covered by meta.codegolf.stackexchange.com/q/8379/8478 if you consider the RNG's seed as part of the program's input. \$\endgroup\$ Commented Jun 27, 2016 at 8:25
  • \$\begingroup\$ @MartinEnder Good point, I didn't think about that meta post. I don't think it hurts to have it explicitly stated here as well as on that post. \$\endgroup\$ Commented Jun 27, 2016 at 8:26
  • 1
    \$\begingroup\$ @Mego I think what is allowed or isn't should always be clear from the challenge itself. Can you provide an example where we need this loophole rule? (Where this is not alredy clear from the challenge itself?) Otherwise I think this is a tautology, which does not make any sense adding here. We could write a ton of others such as "loophole: if the output must be true you cannot output false" The challenge requiring you to output 4 does exactly imply that you cannot output any other number. \$\endgroup\$ Commented Jun 27, 2016 at 8:31
  • 3
    \$\begingroup\$ @flawr here, before I added the word "deterministically". \$\endgroup\$ Commented Jun 27, 2016 at 8:33
  • 2
    \$\begingroup\$ If you do not add deterministically your challenge really asks for the infinite monkeys solutions, which would be perfectly fine under these challenge rules. I can imagine that the loophole as it is now would restrain certain solutions for code-challenges or popularity-contests. I suggest rephrasing it, as it does not really catch the problem of LeakyNun's challenge. My suggestions: "Generating a random sream of output when specific output is required" with "For example, if a challenge requires you to output 4, you cannot output and infinite stream of random digits.". \$\endgroup\$ Commented Jun 27, 2016 at 8:42
  • \$\begingroup\$ @flawr I agree with your improved wording and have made the edit. \$\endgroup\$ Commented Jun 27, 2016 at 10:15
  • 4
    \$\begingroup\$ I still think that if the challenge requires you to output 4 and you output something like 8 7 1 2 4 3 5 6 you simply don't meet the specs \$\endgroup\$ Commented Jun 27, 2016 at 11:57
  • \$\begingroup\$ @LeakyNun, if this is really a problem with that question (and I agree with those who are saying that it isn't) then adding the word "deterministically" doesn't fix anything. If finding the desired output somewhere in the middle of a stream of junk meets spec then the stream can be generated deterministically for fewer characters than required to generate it randomly. \$\endgroup\$ Commented Jun 27, 2016 at 16:01
  • \$\begingroup\$ @LuisMendo Right, this is all in all quite similar to this loophole, so they could probably be merged? \$\endgroup\$ Commented Jun 27, 2016 at 17:42
  • 4
    \$\begingroup\$ @flawr I'd say it's not even a loophole, it's an answer that doesn't meet the specs \$\endgroup\$ Commented Jun 27, 2016 at 18:02
  • \$\begingroup\$ @LuisMendo I wouldn't agree with that, since you could argue that the program has a chance to get the correct result (and not "chance" as in "clearly invalid program produces correct output because cosmic rays cause a bit to be flipped at the right time"). Often there is a very reasonable likelihood of getting the right output by chance, so you'll see a lot of programs on the Anarchy Golf server using randomness, although usually to select a canned output (which AFAIK is already a loophole here). \$\endgroup\$ Commented Jun 28, 2016 at 15:20
  • 2
    \$\begingroup\$ I think this loophole description is too narrow. I suspect you also want something like 1. to be an invalid entry. It's a program which deterministically prints Graham's number in unary. It's followed by additional digits, but it's not simply a case of "Graham's number is in there somewhere": Graham's number appears right at the start, with nothing in between, and extra output at the end is generally considered to be valid. (Or should I post that as an answer? (: ) \$\endgroup\$ Commented Jun 28, 2016 at 20:47
  • \$\begingroup\$ @hvd I believe that is already covered by another loophole. I'd drop a link, but navigating this post on mobile is a nightmare. Look for "abusing number systems". \$\endgroup\$ Commented Jun 28, 2016 at 20:58
  • 1
    \$\begingroup\$ I don't think the randomness is important here. The important part is whether is is allowed to output more than the expected output or not. \$\endgroup\$ Commented Nov 20, 2016 at 11:18
34
\$\begingroup\$

Using a language's lack of features to trivialize a challenge

This is in the same vein as this other loophole.

Consider this challenge. Using a language that cannot access an Internet connection would be a violation of this loophole - it could simply output a falsey output all the time, because it would never be able to access the Internet.

\$\endgroup\$
1
  • 29
    \$\begingroup\$ Challenge: "Check if this device is connected to the internet". If your language cannot determine that, it's the wrong tool for the job and therefore an invalid submission. All you can say fir sure is that your program is not connected to the internet, but it says nothing about the device as a whole. \$\endgroup\$ Commented Jan 26, 2017 at 14:53
31
\$\begingroup\$

Improper quines

We've reached consensus on what counts as a proper quine over a year ago, yet the occasional "quine" that consists of nothing more than literals and/or NOPs still comes up.

While these answers used to be tolerated (and, on occasions, applauded) unless the challenge specifically asked for a proper quine, the community has recently started to downvote and/or delete improper quines even if the challenge didn't explicitly disallow them.

This course of action is a sane default; almost all quine-related challenges are rendered trivial if the program 1 is deemed quine enough for a submission. To back these actions with community consensus, I therefore propose the following.

If the challenge asks for quines and its spec doesn't explicitly allow improper quines, all submissions have to be proper quines.

If the challenge mentions quines and/or is tagged with , a program that would count as an improper quine (if its output matched its source code) is likewise disallowed.

\$\endgroup\$
2
  • \$\begingroup\$ what is an improper quine, de facto? \$\endgroup\$ Commented Jul 19, 2017 at 13:55
  • 1
    \$\begingroup\$ @V.Courtois cat 0ドル in Bash or This is a quine. is PHP. \$\endgroup\$ Commented Jul 19, 2017 at 16:03
25
\$\begingroup\$

Output shall be non-trivial (e. g. not empty)

Mainly targeting where the score is determined by the output. This results in very boring, but valid, answers which tend to get upvoted especially on pop-cons with no other answers.


An example: if the goal was to output the Mona Lisa as close as possible. Outputting a blank image should be considered a loophole.


Another Example: In a such as this one where score is determined by the most correct output. Always outputting false and claiming a score of 0 should count as a loophole.

\$\endgroup\$
5
  • \$\begingroup\$ This is already forbidden by our rules. Answers must make a serious attempt at competing. \$\endgroup\$ Commented Jan 31, 2016 at 4:58
  • 5
    \$\begingroup\$ Already mentioned in the help center. \$\endgroup\$ Commented Jan 31, 2016 at 4:59
  • 1
    \$\begingroup\$ I didn't think the "serious attempts" fully covered it because many of these types of answers can be considered "serious" attempts and still violate this loophole. I've reworded \$\endgroup\$ Commented Jan 31, 2016 at 5:00
  • 3
    \$\begingroup\$ Your edits so far only describe what is already forbidden by the serious attempt rule. \$\endgroup\$ Commented Feb 2, 2016 at 2:14
  • 8
    \$\begingroup\$ I think that if the empty output actually gives a good score, then it should not be considered a loophole. If it was actually a serious attempt (which means that it would actually give a good score), then that means that it's a flaw in the challenge, not the answer \$\endgroup\$ Commented Mar 17, 2019 at 18:41
24
\$\begingroup\$

Using an inconsistent I/O format to encode information

For example, for a hypothetical challenge where the output could only ever be two or eleven, submitting the python program

lambda x:print"11"

and claiming that it outputs in unary for certain inputs and in decimal for other inputs should not be allowed, even though outputting in either of these bases is usually allowed.

Likewise, for a challenge, submitting the python function

lambda i:type(i)is str

and claiming it takes input as a singleton list for inputs that match the challenge's criteria and as a string otherwise shouldn't be allowed, even though taking input as a singleton list is usually allowed.

\$\endgroup\$
2
  • 7
    \$\begingroup\$ Is this an issue which has actually come up, or a pre-emptive strike against a hypothetical answer? \$\endgroup\$ Commented Oct 14, 2019 at 8:16
  • 9
    \$\begingroup\$ It hasn't been a problem as far as I know, but I figured it might be best to have it written down either way. Maybe it would have been better to wait until it actually was a problem, but this feels like the kind of rules lawyering that someone would come up with soon enough and that wouldn't be all that interesting even the first time. \$\endgroup\$ Commented Oct 14, 2019 at 10:36
23
\$\begingroup\$

Using cryptographic functions in a cops and robbers challenge

Almost every cops and robbers challenge will have the following requirement:

Using cryptographic functions such as hashes or PRNGs is disallowed

...and for good reason. A trivial answer such as if (hash(input) == "[ example_hash ]") return true is near impossible to crack, yet requires almost no ingenuity on the part of the cop.

Some very specific challenges may not be susceptible to trivial solutions like these, but the default should be to consider hashing functions a loophole. I'm surprised this isn't already here, I think it would save everyone a lot of typing if this was the default policy :D

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Related discussion here and here. \$\endgroup\$ Commented Sep 8, 2020 at 2:49
  • \$\begingroup\$ "some very specific challenges may not be susceptible": I think relatively few challenges are. \$\endgroup\$ Commented Sep 8, 2020 at 4:26
  • 1
    \$\begingroup\$ Here's a challenge that explicitly allows cryptographic functions. Not that it matters, because challenges are allowed to override standard loopholes, but pointing it out anyway. The only problem with it is the large number of invalid answers. \$\endgroup\$ Commented Sep 8, 2020 at 21:22
  • \$\begingroup\$ mathematically impossible – It's not impossible, it's just computationally infeasible. \$\endgroup\$ Commented Apr 30, 2021 at 2:30
  • 1
    \$\begingroup\$ @forest Changed it to "near impossible". Thanks! \$\endgroup\$ Commented Apr 30, 2021 at 3:26
  • \$\begingroup\$ What if you implement it yourself? \$\endgroup\$ Commented Jul 21, 2023 at 18:48
  • \$\begingroup\$ @Iamkindofalanguagedev Still invalid. How it's implemented is unobservable and irrelevant to the reasons for why this is annoying \$\endgroup\$ Commented Jul 21, 2023 at 19:58
22
\$\begingroup\$

Exactly duplicating another answer

This specifically came up for me in a contest. In particular, this contest had a random component, so replicating a submission could allow one to win by luck.

In general, duplicate submissions are uninteresting, and do not add anything to any sort of contest, king of the hill, code golf or otherwise.

Importantly, even if the posters came up with the answers separately, duplicate answers should still be banned.

\$\endgroup\$
6
  • \$\begingroup\$ I don't think this really needs to be stated. It seems like in your challenge the duplicate poster was just unaware of the basic bots you had posted. \$\endgroup\$ Commented May 7, 2018 at 8:27
  • 2
    \$\begingroup\$ @Chris I'm not thinking of the situation that game up in my contest. I'm thinking of the potential exploit where someone just copy-pastes the leading answer. This is obviously not allowed, and so goes here, on the list of stuff that's obviously not allowed. \$\endgroup\$ Commented May 7, 2018 at 8:38
  • 4
    \$\begingroup\$ Well, that's already on here ;) \$\endgroup\$ Commented May 7, 2018 at 8:59
  • \$\begingroup\$ @Chris The implication of that question seems to be that it's about copying a solution from another source, e.g. not stack exchange. But more importantly, I'm saying they should be banned even if they were invented separately, as can happen in KotH challenges. \$\endgroup\$ Commented May 7, 2018 at 9:02
  • 9
    \$\begingroup\$ The current consensus actually allows duplicate answers. \$\endgroup\$ Commented May 7, 2018 at 10:05
  • 2
    \$\begingroup\$ @Laikoni That answer isn't specific to KotH \$\endgroup\$ Commented Aug 28, 2018 at 21:37
21
\$\begingroup\$

Outputting Unicode characters in challenges

If a challenge requires an image to be output, outputting a Unicode character instead is not acceptable. In challenges, the output should always be an image.

\$\endgroup\$
12
  • 14
    \$\begingroup\$ Disagree. If you're outputting say HTML+CSS, it seems just as valid to use a Unicode character as to use SVG, CSS or any other method to draw a circle, for instance. Of course, individual challenges can still ban unicode chars if they want. \$\endgroup\$ Commented Jun 5, 2017 at 5:46
  • \$\begingroup\$ @SteveBennett In challenges which say "output an image" (which is all graphical-output challenges), an output consisting of one or more Unicode characters is not acceptable because it is not an image (excepting those obvious exceptions where it is a textual encoding of an image). \$\endgroup\$ Commented Jun 5, 2017 at 5:48
  • 15
    \$\begingroup\$ Based on what definition of "image"? Is SVG an "image"? Is HTML? What about SVG that contains unicode characters? \$\endgroup\$ Commented Jun 5, 2017 at 5:53
  • 2
    \$\begingroup\$ @SteveBennett Now you're just splitting hairs. \$\endgroup\$ Commented Jun 5, 2017 at 5:54
  • 2
    \$\begingroup\$ No, I think you are. I'm saying all these things qualify as outputting an image, and you're (implicitly) saying that some of them don't - so I'm asking you where you're drawing that line. \$\endgroup\$ Commented Jun 5, 2017 at 5:55
  • \$\begingroup\$ @SteveBennett Here's a simple (but not perfect) test: if display (from the ImageMagick toolkit) can display it, it's an image. If not, then it's not. \$\endgroup\$ Commented Jun 5, 2017 at 5:57
  • \$\begingroup\$ That's a definition of an image file. \$\endgroup\$ Commented Jun 5, 2017 at 6:44
  • \$\begingroup\$ Also, from the documentation, a directory of image files would qualify, so...yeah imperfect. :) \$\endgroup\$ Commented Jun 5, 2017 at 6:45
  • 9
    \$\begingroup\$ It sounds like you really want to impose some kind of minimum resolution requirement. Are you trying to rule out programs that generate ascii-art graphics? Some video players (like mplayer/mpv) have ASCII-art video-output drivers, as well as the usual opengl, vdpau, X11, and so on. e.g. archive.oreilly.com/pub/h/4441. \$\endgroup\$ Commented Jul 20, 2017 at 17:39
  • 9
    \$\begingroup\$ Or are you really trying to rule out using just a couple characters, effectively taking major advantage of font glyphs instead of drawing pixels directly or with image-library functions? \$\endgroup\$ Commented Jul 20, 2017 at 17:41
  • \$\begingroup\$ If you can see it, then it’s an image. \$\endgroup\$ Commented Jun 27, 2023 at 18:51
  • \$\begingroup\$ Wouldn’t any Unicode character output also require to specify a font? Otherwise it’s just a byte, it does not say what it looks like. If my default font represents "O" like an "X", it does not look like a circle any more. SVG and HTML however specify (default) fonts/font families. \$\endgroup\$ Commented Aug 31, 2023 at 22:51
1
2

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.