I'm looking for opinions on what outputs to allow as the Yes and No outputs on decision-problem challenges. The goal isn't to make a policy, but to help with a decision I often have to make when writing challenges.
One standard is Truthy/Falsey, which checks if the output satisfies the language's if
construct. I see some big benefits:
- Flexible output is good in general
- Using the language's own definition is the natural choice
- Avoids one-size-fits-all decisions like "
[0]
is Falsey" that bias towards some languages - Allows creative golfing approaches like testing for existence by counting (if 0 is Falsey) or enumerating (if the empty list is Falsey).
But, I find awkward issues coming up:
- Some languages don't have an
if
-like construct - Truthiness is arguably a non-observable requirement
- It's ambiguous whether a program outputs an object or its string representation
- I find it a step short of "decision" to output, say,
[1, 4]
which could then be converted toTrue
but isn't - Having more than two valid outputs diminishes the purity and simplicity that motivated the tag
- Some languages are limited to just True/False because their
if
construct doesn't implicitly convert to bool, which I find arbitrary - It's weird if an exact port is invalid because the new language does
if
differently even though the code never touches on this difference.
An alternative to truthiness is for the answerer to specify a consistent values to stand for Yes and a different consistent value to stand for No.
- The solver is allowed a choice convenient for the challenge, allowing challenge-specific creative approaches
- The two-consistent-outputs rule is easy to state in the challenge, making the rules self-contained and unambiguous
- Anyone can test and confirm a submission without needing to know how its language works
And some cons:
- Choosing favorable outputs feels like golfing the spec
- It's dumb that a solution can use
False
forTrue
andTrue
forFalse
- Solutions in a language can't be copy-pasted into an automated tester without adjustment
There's other possibilities like requiring both Truthy/Falsey and consistency, limiting to specific values like 0 or 1, or trying to make a new community consensus definition.
False
forTrue
andTrue
forFalse
" I'm not so sure about that, since mathematically the assignment of true and false for a property is arbitrary to begin with in most cases. \$\endgroup\$if
-like construct? I personally can't think of any \$\endgroup\$