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
149
votes
17answers
8k 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 ...
124
votes
16answers
7k 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 ...
100
votes
86answers
27k 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 ...
67
votes
9answers
14k 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 ...
50
votes
0answers
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 ...
46
votes
6answers
6k 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 ...
36
votes
23answers
2k 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 ...
34
votes
8answers
5k 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 ...
32
votes
6answers
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 ...
32
votes
2answers
945 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 ...
28
votes
2answers
708 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 ...
26
votes
3answers
597 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 ...
25
votes
3answers
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 ...
25
votes
2answers
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 ...
24
votes
1answer
731 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 <...
23
votes
3answers
879 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
3answers
884 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 ...
21
votes
1answer
1k 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 ...
19
votes
4answers
593 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 ...
18
votes
4answers
665 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 ...
17
votes
2answers
490 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 ...
17
votes
4answers
863 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 ...
17
votes
5answers
2k 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 ...
16
votes
4answers
438 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 ...
16
votes
2answers
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 ...
15
votes
4answers
676 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.
15
votes
2answers
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 ...
15
votes
3answers
420 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 ...
15
votes
1answer
390 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 ...
15
votes
1answer
383 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'...
15
votes
4answers
709 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 ...
14
votes
2answers
270 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. ...
14
votes
4answers
1k 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 ...
14
votes
5answers
469 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 ...
14
votes
2answers
368 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 ...
13
votes
2answers
216 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 ?
13
votes
5answers
416 views

Potential execution flag rule break

I am currently developing a golfing language for a specific type of task. I was hoping to use some command line flags for different options in the language. Since the language is intended to be a ...
13
votes
2answers
480 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 ...
13
votes
1answer
692 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 ...
13
votes
3answers
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 ...
13
votes
2answers
1k 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, ...
13
votes
3answers
987 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 ...
13
votes
3answers
289 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 ...
13
votes
3answers
644 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,...
12
votes
4answers
2k views

Language Handicap

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 ...
12
votes
1answer
353 views

Mildly not-safe-for-work challenge?

Related to this thread on reddit: [a link that was determined to be NSFW] Can I submit this as a code-golf question, or is it too inappropriate for StackExchange?
12
votes
4answers
409 views

Presolving Golf Questions

I notice some users are posting questions where they are immediately posting a long-standing (or just extremely well golfed) solution to the problem. On StackOverflow posting your own questions has ...
12
votes
1answer
313 views

Am I allowed to use my own invented languages to solve a code golf?

On the conditions that the language is general use (i.e., doesn't perform the task in 1 character) and follows the rule of having been invented before the question was asked. I've written languages ...
12
votes
5answers
221 views

Should locale be explicitly specified?

Triggered by this comment. Some code-golf answers assume a specific locale. For example this answer assumes a locale of en_US.UTF-8. If the default locale on a ...
12
votes
1answer
481 views

On scoring imported functions

There are lots of questions about whether to count the bytes in an import statement, etc. This question is not about that. Instead, this question is more inline with this question but I think it would ...

1
2 3 4 5