Author's note: This is a meta post tagged with discussion. The goal of this post it to create a community-wiki for Code-Bowling. Please post suggestions / concerns as answers and feel free to utilize the comments section on this post as well as on answers to discuss the topics at hand. (For extensive discussions consider using
chat
). This index is best used when sorting answers byactive
so you can see the current issues-at-hand being discussed.
Code Bowling
code-bowling is a challenge similar to code-golf except the objective is to solve a problem in the most bytes/characters possible (or highest complexity
).
Fluffing up code to contain many bytes isn't that impressive or challenging so the fun in Code Bowling challenges typically stems from the limitations, obstacles, and penalties defined in a challenge's scoring system and/or rules. (Refer to section: Common Scoring Metrics and Challenge Styles)
Most Code Bowling
challenges posted to this site are [closed]
for a variety of reasons, including an obvious ability of exploitation, lack of a defined scoring system, vague rules, "too broad
", and many other reasons. Due to this, Code-Bowling challenges are rarely created and if they are they are usually poorly received. (Relevant: Meta/Should we kill code-bowling?)
The goal of this index is to help create a reference for Code-Bowlers that defines what is allowed and what is not allowed (standard loopholes and more), what is encouraged and discouraged, common scoring systems that can be used (along with automated scoring tools), and various other resources that will be helpful in not only creating code bowling questions, but also in properly answering them.
This post has been broken-down and organized into 5 sections:
Common Rules • Common Scoring Metrics • Best Practices • FAQ • Useful Tools
Common Rules (Rev. 1.0.0)
These are some objective rule-criterion that can be used in your challenge to limit a scope of answers and avoid being closed for
too broad
. Not all of these rules will be compatible with your challenge-type / scoring-system. Select a few you wish you include by copy pasting them into your challenge.
Please copy-paste the following into your Code-Bowling challenges:
*This challenge is using some rules from <a href="https://codegolf.meta.stackexchange.com/questions/11737/code-bowling-index">Code-Bowling: Common Rules, Revision 1.0.0</a>*
Character : Byte Ratio
In Code-Bowling acharacter-count
is preferred over abyte-count
. The obvious reasoning for this is that multi-byte unicode characters (e.g. 🁴) can be used in place of single-byte unicode characters to fluff up byte count and will make bowling more about who renames the most variables with high-byte unicode characters rather than who most strategically creates meaningful complex code. (See Useful tools section at end for character-counting widget)Variable/Function/Object Names
All variable names (or object pointers, function names, etc) should be 1 character long. The only acceptable time to use 2-character variables names is after all possible 1-character variables have been used. The only acceptable time to use 3-character variables names is after all possible 2-character variables have been used. Etc.Non-simplified Arithmetic
All arithmetic should be in simplified form unless there is a justifiable reason for doing otherwise (e.g. circumventing penalties defined in the scoring system of the challenge (In which case you still must use the smallest possible alternative form)). Finding the simplified form of any equation (as well as a list of small alternative forms) is easy to do using Wolfram|Alpha. (See Useful tools section at end)Un-used Code
All code must be used. Meaning the program must fail to always properly complete the task if any individual character (or varying set(s) of characters) is/are removed. Naturally, a subset of the program should not be able complete the task on its own without the rest of the program.Line-breaks and White-space
Unless necessary for code function or otherwise specified by the challenge, all line-breaks and white-space should be removed from code before scoring by counting characters.Comments
Comments are not permitted towardscharacter-count
, unless somehow utilized by your program/function.
Revision History: (Utilizes archive.org)
• Revision 1.0.0 - Mar 14 2017
• Revision 0.0.2 - Mar 12 2017
• Revision 0.0.1 - Mar 11 2017
Common Scoring Metrics and Challenge Styles
Code-Bowling challenges that are simply just to find the largest solution to a problem are often ambiguous and broad (and therefor will get close votes for being too-broad
). These also often result in uncreative ∞-byte answers.
Most code-bowling challenges can be made more challenging, fun, and narrow by applying various limitations and penalties so that the solutions will have a theoretical maximum score
(typically 4-figures or less in character-count
).
(For Challenge types that place limitations on source code, please include that tag restricted-source in your challenge/question.)
- Pangram Challenges
A pangram is a sentence that uses every letter at least once. (The quick brown fox jumps over the lazy dog).
These types of challenges have scoring systems designed where a perfect pangram would achieve the theoretical maximum score (though you are not required to use every character at least once.) Additionally, using any character more than once will start incurring a penalty.
These challenges typically expand to more than just [A-Z] by including numbers and sometimes symbols in their scoring metrics.
Here is an example of a simple pangram scoring system (with an online scoring tool). (See Useful tools section at end):1. Each character used increases your score by 1 point.
2. Any repeated character decreases your score by 1 point. That is, they do not count towards character total.
Here is another example of a more complex pangram scoring system (with an online scoring tool). (See Useful tools section at end):1. Each character used increases your score by 1.
2. Repeated use of any alphanumeric character (a-z, A-Z, 0-9) will result in a deduction of 3 points per repeat (first use does not result in a deduction).
3. Repeated use of basic punctuation([!?.-,":';])
- including the brackets - will result in a deduction of 2 points per repeat.
4. Repeated use of other ASCII characters{`~@#$%^&*_+=|\/><}
- including the curly brackets - will result in a deduction of 4 points per repeat.
5. Use of spaces, tabs, and newlines will result in a deduction of 1 point per use. That is, they do not count towards character total.
6. Characters not mentioned above (Exotic Characters) will result in a deduction of 1 point per use. That is, they do not count towards character total. - Rectangular Challenges
These are challenges where the source code has to be formatted to be in the shape of a rectangle. Line breaks do count towards character count in these challenges.
The dimensions (w:h) of the rectangle must be in the range of (2h:h) to (w:2w). So a rectangle of 6 lines of code, each containing 11 characters (6x11) would be valid. But a rectangle of 2 lines of code, each containing 20 characters (2x20) would not be valid. (Naturally, all lines must contain the same number of characters)
Each line of code must bedistinct
to a certain threshold.Distinctness
is typically calculated using the Levenshtein distance. The threshold may change from challenge to challenge but a typicaldistinctness threshold
is 85%, where the Levenshtein distance between any two lines must be greater than or equal to 0.85*w, where w is the number of characters used in a line of your rectangle.
Penalties may be added for failing to meet thedistinctness threshold
, or it may just be listed as a requirement and code that does not meet the threshold is invalid.
Including a Levenshtein distance calculator in your challenge is good practice. (See Useful tools section at end)
Best Practices
There are many things that can be done in Code-Bowling that, while technically permitted, are frowned upon and will likely result in down-votes. There are also many good things you can do that will be smiled upon and likely result in up-votes. In this section you can find a list of practices that should, in most common cases, be avoided, as well as a list of practices that, in most cases, should be encouraged.
Purposefully Overly-Verbose Languages
Languages that require a ton of characters on purpose are usually frowned upon in code-bowling. Many challenges might not even really allow these to stand a chance in competing due to the penalties and limitations defined in the challenge. Examples of Overly-Verbose Languages include (but are not limited to):
• ArnoldC
• SPL (Shakespeare Programming Language)
• LOLCode
• Any other wordy esoteric languages (likely somewhere on this list)Code That is Too Long to Post
If your code is too long to post, it is good practice to post it on a text sharing site and then post the link to your code. Hastebin and Pastebin are good resources for this. (See Useful tools section at end)
If your code is so big that it was not hand-typed it is recommended that you also share your generating function that created the code.Online IDEs
It is good practice and courtesy to post a link to an online IDE that is running your code so that others may execute it and see for themselves, as well as tweak your code to potentially help you increase your score. (See Useful tools section at end)Vague (unenforceable) Rules
Do not add rules that have no clear measuring objective or systematic ruling system, for example a rule like "All code must be useful". Rules like this are unenforceable and likely to get your question[closed]
. All rules should be defined in a way where they could theoretically be enforced with an automated algorithm; so NO SUBJECTIVE RULES.Bogus Code
Bogus code (that is added obviously just to fluff up character-count) should be avoided, unless utilizing them for good reason (e.g. to avoid penalties defined in the scoring system). Utilizing bogus code will often result in down-votes from viewers. Common examples of bogus code to avoid are as follows:a) Duplicating Variables
Adding an extra variable for no reason except to increase the number of variables used. For example changinga=5; a++;
to something likea=5; b=a; b++;
b) Significant-Figures Abuse
Adding extra degrees of accuracy to an object with no real reason to do so
For example changingf = 3;
to something likef = 3.00000000000;
.c) Literals Abuse
Adding extra content (typically to literal types) that is un-needed and typically immediately discarded.
E.g. changingi = 2;
toi = numberOfCharacters("abcdefghijklmnopqrstuvwxyz")-24;
or changings = "hello";
tos = "hellooooo"[0-4];
.
FAQ
Frequently Asked Questions:
This section will be created as questions are asked and answered.
Useful Tools
Character Counting Widget — MotherEff.in, ETHProductions
This is useful for determining the number of characters used in your application. In Code-Bowling a character count scoring system is favored over a byte count scoring system. (See Rule #1)Arithmetic/Equation Simplifier — Wolfram|Alpha
This is useful for simplifying your equations. Input an equation (e.g.x+x+x+x
) and it will output the simplified forms (e.g.4*x
) (See Rule #3)Text Sharing Sites — HasteBin, PasteBin
These are useful tools for sharing code that is too big to post on the site. (See Best Practices #2)Online IDEs — Try It Online!, JSFiddle, SE Snippets
These are useful for allowing others to easily execute your code online and modify it. Try It Online! is useful for most programming languages. JSFiddle is useful for HTML/CSS/Javascript/etc but these can also be executed natively in StackExchange's Code Snippets (See Best Practices #3)Pangram Scoring Tools — Example 1 (simple), Example 2 (complex)
These are two automated score calculating tools for common Pangram scoring metric variations (See Common Scoring Metrics #1)Levenshtein distance calculator — PlanetCalc
This is a Levenshtein distance calculator useful for quantifying the changes made between two lines of code. (See Common Scoring Metrics #3)
a=12
where any one of the digits1
or2
are removed? \$\endgroup\$