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
111
votes
99answers
32k 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 ...
47
votes
6answers
7k 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 ...
152
votes
17answers
9k 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 ...
128
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 ...
52
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 ...
12
votes
4answers
2k 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 ...
15
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 ...
72
votes
9answers
15k 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 ...
9
votes
6answers
863 views

Fair size comparison across languages with different source alphabets

For fair comparison of codegolf solutions in languages with different source alphabets, there should be a common unit of information. Most sizes here are expressed in "characters" or "bytes", but not ...
33
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 ...
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, ...
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 ...
23
votes
3answers
929 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 ...
14
votes
1answer
718 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 ...
10
votes
1answer
542 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 ...
15
votes
2answers
531 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 ...
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 ...
10
votes
1answer
399 views

What is a character encoding, exactly?

Preface I've 'failed' twice at this whole golf language design thing, once with JAISBaL and again with Clack. Now that I've had a go twice, I am obviously an expert and am attempting to design the ...
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 ...
21
votes
3answers
900 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 ...
11
votes
6answers
822 views

Is a code golfing library legitimate? [duplicate]

My read on the current state of meta.CG opinion is that the use of libraries is acceptable and that the library call should count in the character count: Use of built-in functions and libraries in ...
10
votes
3answers
536 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?
8
votes
4answers
2k views

How are bytes counted in assembly?

I was told bytes in assembly are counted by the byte of machine code. Is that true? If so what steps should be taken to correctly get bytes?
17
votes
4answers
750 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 ...
26
votes
3answers
608 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 ...
16
votes
4answers
907 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 ...
13
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 ...
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 ...
22
votes
1answer
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 ...
12
votes
4answers
432 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 ...
9
votes
3answers
346 views

Can code-golf answers be too slow?

This answer is a fairly extreme example. For the largest input it would create an array with 1.048576e+26 elements which is not going to fit in RAM anytime soon (maybe not even physically possible). ...
14
votes
3answers
437 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 ...
4
votes
3answers
217 views

How should we handle Excel answers with drag-down formulas? [duplicate]

This is a very grey area, because while excel is fun to enter, and play around with, often times it's seen as a pseudo-programming language. In Excel, one can drag-down formulas to automatically match ...
27
votes
25answers
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'...
27
votes
2answers
840 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 ...
17
votes
4answers
613 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 ...
4
votes
1answer
264 views

Should point-free function expressions be allowed when a function is asked for?

Should an expression evaluating to a function count as a function for the purpose of providing a solution when a function is asked for? An earlier question on meta seems to indicate a consensus that ...
3
votes
3answers
386 views

Creating new language. Would it be legal?

Today with friend of mine discussed about code golf, I want to ask your opinion about the thing we discussed about. Would it be legal if I create my own programming (actually scripting) language with ...
11
votes
5answers
787 views

Use of built-in functions and libraries in Code Golfs

This answer used a built-in Python function to solve the question in a very short amount of code. Should we allow it and let people not up-vote, or should we police library abuse to some degree? If ...
6
votes
1answer
790 views

How to count bytes in 7 (and other languages that use fractional numbers of bytes)

(See also this question, which is similar, but talks about the situation where the language is normally stored on disk with one command per byte.) This question originally came up in connection with ...
2
votes
2answers
146 views

Do I need to use imports or can I call a class explicity?

New to code golf and tried finding an answer to this question but couldn't (surprisingly) When scoring my golfed Java code I was told that I need to add in my imports as part of my score. My question ...
42
votes
2answers
2k 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 ...
9
votes
1answer
381 views

Are languages targeting FPGAs or other non-standard/non-sequential computing platforms acceptable?

So far, almost all submissions on this site are ones that target "standard" computers, namely devices that execute code in a typically linear fashion, with a standard variety of inputs/outputs (...
18
votes
4answers
700 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 ...
3
votes
2answers
279 views

How should the length of a Commodore 64 BASIC program be measured?

Commodore 64 BASIC has abbreviated forms for most of its keywords, ranging from ? being short for PRINT (common across many ...
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 ...
18
votes
5answers
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 ...
13
votes
2answers
550 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 ...
12
votes
2answers
220 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 ?
5
votes
3answers
170 views

Accepting numeric inputs in mixed decimal and unary bases

There seems to be agreement that numeric input is by default accepted in either decimal or unary bases. The linked meta-question doesn't address the issue of whether separate inputs of the same ...