Skip to main content

Questions tagged [code-golf]

For questions about code golf challenges and/or submissions. DO NOT post code golf challenges themselves as questions here; those belong on the main site or in the Sandbox if you want to get feedback on them.

Filter by
Sorted by
Tagged with
156 votes
17 answers
10k views

J and GolfScript suck all the enjoyment out of Code Golf

I have found code-golf a fascinating pastime for several weeks now. However, I’m already losing interest because the contests allow any language, and because of that it is pretty much impossible for ...
Timwi's user avatar
  • 12.9k
132 votes
16 answers
8k views

How can we help users who are put off by the use of golfing languages?

Every other month someone expresses their (negative) feelings about golfing languages. Here is how this usually goes: they complain that they don't enjoy golfing in the languages they know because ...
Martin Ender's user avatar
127 votes
118 answers
39k views

Default for Code Golf: Input/Output methods

It looks like we have a consensus that we want certain defaults for the format which answers are expected in for code-golf. On that poll, the question arose twice, which input/output formats should be ...
Martin Ender's user avatar
76 votes
9 answers
17k views

Interpretation of Truthy/Falsey

Quite a few code-golf questions require output to be "truthy or falsey". This is possibly confusing as these terms can possibly mean different things to different people, and especially in different ...
Digital Trauma's user avatar
53 votes
0 answers
2k views

How to count bytes FAQ

We've got a lot of questions asking how to count the bytes in different situations. This question is here to put them all in one spot. General questions How to count "interactive" answers ...
50 votes
6 answers
8k views

Default for Code Golf: Program, Function or Snippet?

One of the things many (new?) users forget to specify in code-golf challenges is whether the answers should provide a full program or a function (or even just a snippet). For most such things, we have ...
Martin Ender's user avatar
45 votes
2 answers
3k views

Golfing Class of a language

I feel like we may have enough data on this site to meaningfully break programming languages into classes. What I mean by classes is akin to Go's ranking system: If a player can win 90% of even games ...
Not that Charles's user avatar
37 votes
25 answers
3k views

Advocate languages to golf in

I'm sure many of you want to attract golfers to compete in your favorite language. Given that it takes time to learn a language for golfing, why choose it over others? What aspects of the language ...
xnor's user avatar
  • 145k
34 votes
6 answers
3k views

Can numeric input/output be in unary?

Some string-based languages (including but not limited to sed, Retina, ///) can't really handle integer arithmetic in decimal (or other normal bases). Therefore, these almost always have to start by ...
Martin Ender's user avatar
33 votes
8 answers
6k views

Programming in Minecraft (Redstone) - how to measure program size?

Since programs may be created in vanilla (un-modded) Minecraft using redstone to create logic gates (and more), someone could create such a program for a challenge on this site. How would such an ...
mbomb007's user avatar
  • 23.4k
28 votes
3 answers
2k views

Do function submissions have to be reusable?

Simple question: if I answer a code golf with a function (for a task which is supposed to terminate), does the function actually have to be reusable? Or could it, say, modify some globals which break ...
Martin Ender's user avatar
27 votes
25 answers
3k views

Announcing Advent of Code Golf 2021! (+ Event challenge sandbox)

Originally from caird coinheringaahing's idea, I thought about how we could do it this year with such a short time before December, and I decided to gather some ideas from previous AoC events. (There'...
Bubbler's user avatar
  • 76.8k
27 votes
2 answers
1k views

How does this site work?

Hello, I have spent time looking at the StackExchange sites and especially this has seemed quite interesting to me. But I would like you to explain how it works and what it is about. I know how to ...
ESCM's user avatar
  • 101
26 votes
3 answers
617 views

Where does Programming Puzzles & Code Golf fit in the SE mission?

Don't get me wrong, I love this website. I think it's fun and all but I can't help thinking... How does it correspond to Stack Exchange's mission : What is Stack Exchange? Stack Exchange is a ...
user avatar
25 votes
2 answers
2k views

Programming in LabVIEW - how to measure program size?

Inspired by this question, how would a LabVIEW program be scored? As one of the only graphical languages in common use today, LabVIEW is a bit of an outsider. As odd as it is, LabVIEW is a serious ...
Kyle G's user avatar
  • 870
24 votes
28 answers
2k views

Announcing Code Golf Advent Calendar 2022! (+ Event challenge sandbox)

Following last year's event, we're doing Advent of Code Golf Code Golf Advent Calendar 20221! On each day between Dec 1st and Dec 25th (inclusive), a new challenge will be posted at UTC midnight2. It ...
Bubbler's user avatar
  • 76.8k
24 votes
1 answer
827 views

Introducing a New Golf Language

So over the past week I've developed Just Another Interpreted Stack-Base Language (JAISBaL for short), and I had a few questions: Is there any reason JAISBaL would be illegal to use for the general <...
Socratic Phoenix's user avatar
23 votes
3 answers
1k views

What details should always be given for a code golf task?

Related: For Code Golf, how do you deal with languages without a traditional print/echo statements? Related: What programming language should we consider for the code-golf solution ? Related: Use of ...
22 votes
1 answer
2k views

Are we allowed to use empty input we won't use when no input is asked (regarding functions)?

Let's say a code-golf challenge is asking for a program without arguments or function without parameters. Are we allowed to take an empty parameter instead we won't use anywhere? As example: In Java ...
Kevin Cruijssen's user avatar
21 votes
3 answers
912 views

Does PPCG fulfil a role as a catalogue for golfed solution of standard programming exercises?

Rosetta Code collects solutions to standard programming exercises in hundreds of programming languages. However, it focuses on "good" or idiomatic solutions in those languages. I'm not aware of a ...
18 votes
4 answers
3k views

How to score TI-BASIC

How do we score code written in TI-BASIC, when it comes to multi-character words? For example: :If X>2:Then:Stop Seemingly, the above should count as 17 ...
Ypnypn's user avatar
  • 10.9k
18 votes
4 answers
721 views

Code Golf Tutorials?

There are a lot of intelligent people on PPCG, and for that reason a lot of our usual challenges are hard. This means that we are throwing new users straight into the deep end with huge problems which ...
Beta Decay's user avatar
  • 23.4k
18 votes
4 answers
792 views

How to Make Code Golf More Enjoyable: Winners by Language?

So, I was reading the related question here, when I went off on a tangent. The point of the given post, as I read it, is that certain languages like GolfScript, K, and some other extremely-high level ...
Andrew Gray's user avatar
17 votes
2 answers
1k views

Can numeric input/output be in the form of byte values?

This answer just prompted a question, which I've wondered about a few times when answering challenges in esoteric languages: For some esoteric languages, the only means of input/output is reading and ...
Martin Ender's user avatar
16 votes
4 answers
493 views

Should answers have to handle invalid inputs?

I'm trying to get advice on how to make my challenges better. One rule that I feel like I'm always specifying is what to do when an invalid input is given. There's really two main paradigms to take ...
DJMcMayhem's user avatar
  • 59.2k
16 votes
4 answers
973 views

Can serious contenders do more than the challenge asks for?

As our help center likes to put it: All solutions to challenges should: Correctly implement the required specification. Be a serious contender for the winning criteria in use. For example, an entry ...
Dennis's user avatar
  • 210k
16 votes
2 answers
568 views

Are compiler-specific submissions allowed?

For example, in a c++ submission, this is valid if you use g++ #include <iostream> main() { std::cout << "Hello world!"; } but in any other ...
DJMcMayhem's user avatar
  • 59.2k
16 votes
4 answers
648 views

Should bonuses be allowed for [code-golf] questions?

Prompted by a discussion between Peter Taylor and myself, I'd like to solicit the community's opinion on the following issue: Should awarding score bonuses for extra features disqualify a challenge ...
Ilmari Karonen's user avatar
16 votes
1 answer
800 views

What are our rules about additional code accompanying function submissions?

This is an extension of this meta question. I've always assumed that function submissions were allowed under the premise that the code would be evaluated once and would in the process either: Define ...
Martin Ender's user avatar
16 votes
1 answer
479 views

On using multiple languages for a singular code golf submission

I was wondering if it were possible to use multiple languages in the same submission. Not a polyglot, but using each of the languages. I have two thoughts on this. One language invokes the other. Let'...
Conor O'Brien's user avatar
15 votes
4 answers
725 views

Are newbies allowed to write programs in golf languages?

I'm afraid that languages like CJam are reserved for pro golfers. I think about that because I get the impression that answers in languages like CJam just need to be accepted.
Xwtek's user avatar
  • 2,039
15 votes
2 answers
350 views

Defaults for reading several pieces of input

When reading several pieces of input as command-line arguments, it is common practice to read each piece as a different argument. The command-line arguments now provide an array of the input pieces. ...
Dennis's user avatar
  • 210k
15 votes
4 answers
2k views

Should function literals be allowed when a function is asked for?

I'm arguing with the poster of this answer. The function literal as is doesn't cause the function to be defined, it has to be assigned to a variable, giving it a name or wrapping it like ...
user avatar
15 votes
1 answer
411 views

If a challenge is difficult, can I provide a completely non-golfed answer?

Let's say I have a challenge that is difficult. Indeed, people may believe it to be impossible, since it is somewhat obscure. Should I provide a completely non-golfed answer, sort of as a hint, to ...
Christopher King's user avatar
15 votes
1 answer
424 views

Is a transliteration tool enough to grant count as SBCS?

Prompted by this. I'll speak about Dyalog APL here, but this could really apply to any language. Background Dyalog APL has its own SBCS called ⎕AV. For backwards ...
Adám's user avatar
  • 30.3k
15 votes
3 answers
336 views

Can a C submission be in the form of a macro defined by command line argument?

In this question, the current C solution is f(n){n=n?:1;} Obviously this command line is shorter by 2 bytes: -Df(n)=n?:1 ...
l4m2's user avatar
  • 24.4k
15 votes
0 answers
182 views

Advent of Code Golf 2021 is over! (Stats, Hall of Fame)

Advent of Code Golf 2021 is over! Thanks to everyone who participated in and/or helped me run the Advent of Code Golf 2021 event. It wouldn't have been so successful without the help of the community. ...
Bubbler's user avatar
  • 76.8k
14 votes
2 answers
1k views

How should vim answers be scored?

I like vim a lot. I've been golfing with it a lot recently. We already have clearly established that vim is a programming language, but there aren't any clear rules on how to score vim answers. The ...
DJMcMayhem's user avatar
  • 59.2k
14 votes
3 answers
466 views

Should language-specific code golf challenges be explicitly disallowed?

In light of a recent code golf challenge in which the specification restricts participation to JavaScript, I think it's time we revisited making a hard rule about language-specific golfs. We may ...
Alex A.'s user avatar
  • 24.6k
14 votes
5 answers
528 views

Remove number of characters from answers, if it's not a CG-question

I like to encourage people, to remove the number of characters from answers, given for questions, which are not code golf. Example: Here is a recent question which isn't a codegolf, which has 8 ...
user unknown's user avatar
  • 4,591
14 votes
3 answers
1k views

Counting bytes for multi-file programs

So far, submissions consisting of multiple files have simply been counted by summing up the scores of the individual files. Also file names aren't counted as long as they are arbitrary. (We do count ...
Martin Ender's user avatar
13 votes
4 answers
3k views

Language Handicap [duplicate]

This question is because my favorite language C++ does not lend itself to code golf. Now I could try and pick up a new scripting language (like golf-script) or brush up on an old favorite (perl), but ...
Martin York's user avatar
13 votes
2 answers
702 views

Byte count for imports (or other things) not needed for definition, but for execution

When we define a function that needs an import, we have to add it to the byte count. So far, so good. What about cases where the definition itself doesn't need the ...
nimi's user avatar
  • 35.8k
13 votes
2 answers
2k views

Unnamed Functions in Code Golf

For many code golf questions, we allow functions as answers. What exactly does it mean for some code to be a valid submission as a function? This question came up during a discussion on built-ins, ...
isaacg's user avatar
  • 42k
13 votes
3 answers
1k views

Huffman Encoded Golfing Language

Here's have an idea, which may save millions of bytes to golfers out there. But I'm not sure it's good. Take a language that's good for Golfing (e.g. Pyth). Take all existing CodeGolf answers in this ...
ugoren's user avatar
  • 17.4k
13 votes
3 answers
694 views

JavaScript Standards for IO

When it comes to JavaScript code-golf, there tends to be two schools of thought regarding IO (specifically printing). Some golfers will use functions such as alert,...
zzzzBov's user avatar
  • 3,274
13 votes
2 answers
444 views

How to count programs in Folders?

Folders is an esoteric programming language without any files at all. Instead, the program is represented by the directory structure instead, so our normal rules for counting the file size of the ...
Martin Ender's user avatar
12 votes
3 answers
718 views

How to determine the length of a Piet program?

I noticed that Piet is not mentioned in the How to count bytes FAQ. How should we determine the length of a piet program?
Mike Bufardeci's user avatar
12 votes
3 answers
667 views

What do we rename Advent of Code Golf?

Recently, Seggan received an email from Eric Wastl, the owner of Advent of Code, part of which is quoted below: Please do not call your event something like "Advent of Code Golf"; this ...
Ginger's user avatar
  • 5,590
12 votes
2 answers
231 views

Do I have to verify all answers?

I have an idea about a code-golf challenge. Will I need to verify/test every answer submitted ? Will I need to run code submitted to be sure that the answer meets the requirements ?
Luc M's user avatar
  • 101

1
2 3 4 5