Hot answers tagged

51 votes
Accepted

Should answers have to handle invalid inputs?

No, invalid inputs may result in undefined behavior Requiring input validation only adds extraneous code to the answer and takes away from the challenge.
Downgoat's user avatar
  • 28.9k
37 votes
Accepted

What does "taking no input" mean for a program?

Programs may assume that input is empty I believe that the requirement The program has to ignore the standard input, that is, it should work regardless of what is given as input. is too strong. ...
Martin Ender's user avatar
33 votes
Accepted

Case Sensitive Strings

Unless specified otherwise, strings are case-sensitive. More generally, unless specified otherwise, strings are just sequences of characters with no semantics attached to any specific characters. ...
Martin Ender's user avatar
32 votes
Accepted

How should vim answers be scored?

vim answers can be run from the command line as such: ...
Doorknob's user avatar
  • 71.4k
32 votes

A proposal to combat Meta Bloat™: The Big Consensus Freeze

I propose that each commonly-used language have a separate explanation of the rules that most pertain to it, with code examples. I think this is more digestible that a big general FAQ, especially to ...
xnor's user avatar
  • 144k
28 votes
Accepted

Are compiler-specific submissions allowed?

Yes, on PPCG a language is defined by its implementation. In case your program is not portable you should specify the interpreter or compiler.
orlp's user avatar
  • 39k
23 votes
Accepted

Can I write a golfing library?

Yes, and it does not necessarily have to be a separate language. There's no problem with using your own library as long as it doesn't violate the standard loopholes. In answers where you use it, you ...
feersum's user avatar
  • 31.3k
21 votes

Are Mathematica's datasets valid?

I do consider them built-ins. Just because you sort of have to update your language (or language's standard library) before you can use them for the first time, doesn't mean you're fetching the result ...
Martin Ender's user avatar
19 votes

Should language-specific code golf challenges be explicitly disallowed?

No (with caveats) -- Language-specific challenges are on-topic Challenge authors are allowed to add other arbitrary restrictions (banning built-ins, banning capital letters, requiring out to be base-...
AdmBorkBork's user avatar
  • 43.3k
18 votes

Are bots allowed in The Nineteenth Byte?

Chat bots (that post messages) have no place in TNB. Since TNB is for discussion of code-golf and PPCG related topics, having bots in the room would be distracting and obnoxious, and would overtake ...
DJMcMayhem's user avatar
  • 58.7k
18 votes

Default policy for output in decision problems

Truthy/falsy using your language's convention (swapping allowed), or two distinct values to represent true/false respectively You can choose to output truthy/falsy using your language's convention (...
Bubbler's user avatar
  • 73.1k
17 votes

Should language-specific code golf challenges be explicitly disallowed?

Only allow challenges to restrict languages indirectly via requirements The one good reason for a challenge to restrict languages is that the spec makes sense only for languages with certain features ...
xnor's user avatar
  • 144k
17 votes

New users' guides to golfing rules in specific languages

Haskell Basic IO In Haskell, a valid answer is usually a function, unless a full program is required by the challenge. Even if a challenge requires you to output an infinite stream of data (like all ...
16 votes

If we find a programming language in the Library of Babel, can we use it?

The language would have been created on the date at which the book was bookmarked for the first time The Library of Babel is basically an encoding scheme: any possible string will exist somewhere in ...
ais523 - high effort answers's user avatar
15 votes

Should answers have to handle invalid inputs?

By default valid input is guaranteed If it's not, some behaviour should be specified: Any behaviour (but why specify this when it's defeult?) Handle it in some way and produce a specific value ...
Qwertiy's user avatar
  • 2,989
15 votes
Accepted

Duplicates on other SE sites

Let it be. Codegolf questions on SO get deleted apparently at random, so there's no telling how long that one will be there. However, it might be a good idea to link to it from your question and to ...
Peter Taylor's user avatar
  • 43.1k
15 votes
Accepted

Codegolf rules and boundaries

Answers that use a language (or a feature thereof) that postdates the challenge should be labeled non-competing. From Can I ever answer with a language invented after the challenge was posted?: These ...
Dennis's user avatar
  • 209k
15 votes

What outputs should I allow for decision problems?

One consistent, and one non-consistent The thing I like about Truthy and Falsy is that often you may do things like output 0 for falsy and everything else for ...
Wheat Wizard's user avatar
  • 95.5k
14 votes
Accepted

If your answer is acts differently depending on context, how safe do you have to be?

Our defaults say that submissions have to be full programs or functions. REPL "programs" are also allowed, but they have to be labeled as such, and still have to conform to the defaults regarding ...
Dennis's user avatar
  • 209k
14 votes

Can We Make 0-NAND OR Gates in [logic-gates] Challenges?

It depends on the question. logic-gates is a tag for challenges about logic gates. It doesn't, and shouldn't, come with special rules like this. If the person that poses the challenge wants that to ...
Wheat Wizard's user avatar
  • 95.5k
13 votes

Should a character encoding that can't actually be used by a compiler/interpreter be allowed?

No People need to be able to actually run your entry. Just as you can't write code with syntax errors, you can't write code that your interpreter won't compile because it's not encoded in a certain ...
DankMemes's user avatar
  • 2,849
13 votes
Accepted

Should graphical-output challenges accept straight up image files by default?

The thing is that not all image formats are created equal. Some are just straightforward uncompressed streams of pixels, and there is basically nothing you can do to golf those down. However if your ...
Wheat Wizard's user avatar
  • 95.5k
12 votes

New users' guides to golfing rules in specific languages

Python General I/O Your submission should be a program or a function. It should print the output or return it. These example submissions compute the factorial in Python 2: ...
12 votes
Accepted

If code fails to compile, but runs anyway, does that count as executing without error?

In my opinion, yes. Typically, anything that happens during the compilation stage is ignored. For example, a C/C++ program that produces warnings doesn't make any difference as long the executable ...
DJMcMayhem's user avatar
  • 58.7k
12 votes

What is the consensus on built ins?

If most languages have a builtin, then the challenge is too simple There are some exceptions, for example I like the existence of the Add Two Numbers challenge as a "language showcase", but ...
Kamil Drakari's user avatar
12 votes

Using resource exhaustion with a semi-deciding algorithm

No, that doesn't satisfy the rules In many code-golf questions there are infinitely many inputs, which may be arbitrarily long. And, unless otherwise stated, your code should be able to handle every ...
12 votes
Accepted

Functions throwing exceptions: an exception to the rules?

Functions throwing exceptions should be allowed based on this brief chat conversation As long as the exceptions can be caught, this seems like a perfectly legitimate way of producing output or ...
Rydwolf Programs's user avatar
11 votes

On-topic to ask for help with an pre-existing code golf challenge from another site?

Attribution First and foremost, I have no idea why one of the comments suggested editing the attribution out. If a challenge is taken from elsewhere (with minor modifications), full attribution is ...
Dennis's user avatar
  • 209k

Only top scored, non community-wiki answers of a minimum length are eligible