14
4
Code-Bowling Challenge
Write a program or function that produces the same output, no matter how you re-arrange the source code. (Output can't be an error)
Pangram Scoring
Your score is the amount of unique characters in your source code.
A program with source code
AJB
would have a score of3
A program with source codeAAJ
would have a score of2
A program with source code111
would have a score of1
This is a code-bowling variant. The program with the highest score wins!
(For your convenience an automated scoring tool has been created here)
Challenge Rules
Input
The program/function can take an input, that's entirely optional though.Output
This output can be anything you want, but it should be non-nil, non-null, non-empty, and non-error. (Therefor output must be at least 1 byte)- Rearrangement
No matter how the source code is re-arranged, the output should be the same.
Example:
Program:ABJ
outputshello world
, as does programs: [AJB
,JAB
,JBA
, etc.]
This is a code-bowling variant. The program with the highest number of characters wins!
Must output be in stdout, or could it be a place in memory? – brianush1 – 2017-03-18T00:26:41.610
1Without any specific task to achieve, this challenge is too broad in my opinion. – Dennis – 2017-03-18T00:31:03.773
Is "non-nil" the same as non-zero, or is the literal zero output allowed? – Jonathan Allan – 2017-03-18T00:33:36.957
@JonathanAllan Edited in, output must be at least 1 byte. – Albert Renshaw – 2017-03-18T00:34:49.683
@Dennis I feared requiring a specific output might make it
too narrow
(If that's a thing haha). The specific task is in the re-arranging of the code in my opinion. – Albert Renshaw – 2017-03-18T00:35:26.4602What does non-nil mean? – Dennis – 2017-03-18T00:51:34.030
@dennis by non-nil I meant it can't be empty or unassigned. An output of "0" is fine – Albert Renshaw – 2017-03-18T04:35:41.357
2While your pangram scoring is an attempt to make code bowling work, I'm not sure these challenges should really be tagged [tag:code-bowling]. The scoring mechanism is quite different from what code bowling is supposed to be, so I'd say either use [tag:code-challenge] or create a new tag. – Martin Ender – 2017-03-18T11:31:39.193
1
I have to agree with Martin. For example, this challenge isn't a code-golf. As soon as you score by anything besides total number of characters (or bytes), it isn't a code-bowling challenge anymore
– Nathan Merrill – 2017-03-18T12:33:32.737Non-empty output is clear. What is "unassigned output"? – Nathan Merrill – 2017-03-18T12:35:47.297
3Does the program/function have to end? (e.g. can I print
0
forever?) – MildlyMilquetoast – 2017-03-18T18:16:48.2771@MistahFiggins The program/function does not have to end. Printing forever is fine – Albert Renshaw – 2017-03-19T20:48:52.883
1@NathanMerrill Unassigned is for programs without an stdout and therefor their output is done in memory, <s>variable assignment</s>, or other. – Albert Renshaw – 2017-03-19T23:28:30.073
@AlbertRenshaw Outputting to a variable is not an allowed output method
– Nathan Merrill – 2017-03-19T23:31:41.467@NathanMerrill didn't know that, thanks! – Albert Renshaw – 2017-03-19T23:32:14.420
1
The near-infinite scoring answers on this challenge are valid. I am really loving seeing the creative and well-bowled solutions for languages scoring under 100. If anyone has ideas for how to systematically limit near-infinite scoring answers in future code-bowling challenges, feel free to share on this meta post: https://codegolf.meta.stackexchange.com/a/11817/16513
– Albert Renshaw – 2017-03-20T04:49:35.797