When solving a decision-problem, a program takes an input and either accepts or rejects it. How is accepting and rejecting defined for the purposes of code golf?
In decision-problem challenges, solutions output one of two distinct outputs, depending on the properties of the input. "Accepting" and "rejecting" can be mapped to those two distinct outputs - one represents acceptance, and the other represents rejection. How the mapping is done depends on the challenge - if the challenge is of the "Does the input have property X" variety, then the "accepted" output is whichever output is given for inputs with the property, and the "rejected" output is the other one.
For challenges of the form "Is the input part of set X or set Y", it's less clear (especially if X and Y are not complements of each other). But, in those challenges, there's not really a need to distinguish "acceptance" from "rejection" (and if there is, the challenge can be rephrased as "Does the input belong to set X?").
The programmer chooses either to output a truthy/falsey value, or to crash or not crash
The programmer picks between two options:
- Their program always outputs a truthy/falsey value. If it corresponds to true, it has accepted the input. If it corresponds to false, it has rejected the input. (If it does not output a truthy value, it has neither accepted nor rejected the input, and, depending on the question, is probably incorrect.)
- Their program either terminates with no errors or with errors. If it terminates with no errors, it has accepted the input. If it terminates with errors, it has rejected the input. (If it does not terminate, it has neither accepted nor rejected the input, and, depending on the question, is probably incorrect.)