35
votes
Accepted
How does this site work?
What does "Code Golf" mean?
Code golf, (Or Codegolf) as the name suggests, is the art of making programs that are as short as possible that complete a task.
What is "Code Golf & Coding ...
33
votes
Default for Code Golf: Input/Output methods
Submissions may use list of strings instead of multi-line strings
Input or output may be the equivalent of the string separated by newlines. For example, the multiline string:
...
Jo KingMod
- 47.5k
32
votes
Default for Code Golf: Input/Output methods
In languages without any method of input (e.g. ///) programs may get input through an insertion into the source code
31
votes
Can serious contenders do more than the challenge asks for?
Serious contenders do not contain superfluous code
I propose the following:
If a part or multiple parts of the code can be deleted without affecting its functionality with regard to the challenge ...
28
votes
Default for Code Golf: Input/Output methods
Multiple arguments to a function can be taken as a list or tuple instead
For example, if you needed to take in two integers as arguments, you can take one argument: a list of both integers.
Apparently,...
28
votes
Accepted
What do we rename Advent of Code Golf?
Code Golf Advent Calendar
(As suggested in the question)
While I think "Advent of Golf" is snappier, I think it should be clearer that this is referring to code golfing in the name. 'Code ...
Community wiki
27
votes
Default for Code Golf: Input/Output methods
Full programs may take array/string input (of unknown length) via stdin in the form of <length> <contents> or ...
26
votes
Default for Code Golf: Input/Output methods
Functions may return their result in an optional type wrapper
Relevant meta discussion.
By "optional type wrapper" I mean something like Maybe a in Haskell, ...
26
votes
Default for Code Golf: Input/Output methods
I/O for sequence questions may either be 0-indexed or 1-indexed
Any sequence question that has the user output the \$n\$th term, first \$n\$ terms, etc. of a sequence should allow programs to index ...
25
votes
Default for Code Golf: Input/Output methods
An array may be represented in input as a pointer and length.
For example in C you could use:
int f(int*p,int l){...}
24
votes
Accepted
How to count bytes in languages with autoformatters
Count code size before autoformatting
Rationale: You can type or paste unformatted code into the interpreter, hit run, and it works. The fact that the interpreter adds whitespace or expands shortcuts ...
21
votes
Default for Code Golf: Input/Output methods
black-box functions to be taken as input can be passed as an argument
This holds for functional languages or languanges that do have first class functions/anonymous functions/lambda functions or ...
21
votes
Default for Code Golf: Input/Output methods
You may assume that the input is valid
When parsing an input, you may assume that the input is already valid. You are not required to validate it unless the challenge is specifically about testing ...
21
votes
How can we help users who are put off by the use of golfing languages?
For me I joined because it is fun. I spend all day writing readable code and sometimes it's nice to write something just because I can. I have no problems with golfing languages. The shortest code ...
20
votes
Default for Code Golf: Input/Output methods
Functions may return a function that returns the result
This is very similar to currying, the only difference being that only the first call includes an argument. Sometimes it's useful to curry a ...
20
votes
Accepted
Are we allowed to use empty input we won't use when no input is asked (regarding functions)?
Yes
Building off of Martin's great post:
If your program takes extra input, that input must be empty.
In the case of Java, this is easy: Objects must be null, and primitives must have their ...
20
votes
Accepted
Equivalence between strictly increasing integer sequences and decision problems
This isn't a good default
I wouldn't expect or want for my sequence challenges to allow membership-oracle solution by default just because the sequence is increasing. While sequence allows various ...
19
votes
Interpretation of Truthy/Falsey
Don't forget program exit codes!
If my C or C++ or perl or bash or ... program calls exit(0) this action could be considered truthy, and calling ...
19
votes
Default for Code Golf: Input/Output methods
Programs and functions may return a boolean value via the presence or absence of output
18
votes
How to determine the length of a Piet program?
Here's an encoding for Piet programs
I've published an encoding (with a translator program) that represents a Piet program as a series of ASCII characters. It encodes each codel as one character, and ...
18
votes
Accepted
What is a character encoding, exactly?
Character encodings are just a convenience to make programs more readable if they make use of more than the usual 97 ASCII bytes (printable, plus linefeeds and tabs). At the end of the day, the only ...
17
votes
Default for Code Golf: Input/Output methods
When a challenge asks for an array as input/output, you may use a list instead, and vice-versa
Note that some languages may lack one of these concepts. For example, TI-Basic does not have an array ...
17
votes
Default for Code Golf: Input/Output methods
Lists of decimal digits and strings that match ^[0-9]*$ are interchangeable...
...but not when this may make the input format inconsistent.
For example, let's say ...
17
votes
Advocate languages to golf in
Haskell
Haskell is the functional language
Want to dive into the deep end of functional programming?
In Haskell, lambdas are cheap, higher order functions are powerful, and all operations short-...
17
votes
Potential execution flag rule break
What should we do to prevent this type of shenanigan?
Firstly, we should all solemnly commit to downvoting every answer we see in a language which is deliberately designed to try to exploit PPCG-...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
code-golf × 245discussion × 235
scoring × 38
policy × 37
answers × 37
rules × 20
defaults × 10
support × 7
asking-questions × 6
feature-request × 5
status-declined × 5
tags × 4
languages × 4
code-challenge × 4
statistics × 4
characters × 4
advent-events × 4
specific-question × 3
closed-questions × 3
output × 3
accepted-answer × 3
handicap × 3
sandbox × 2
new-users × 2
challenges × 2