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
92
votes
84answers
25k 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 ...
43
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 ...
121
votes
15answers
6k 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 ...
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 ...
11
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 ...
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 ...
9
votes
6answers
825 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 ...
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 and flags ...
33
votes
8answers
4k 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, ...
66
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 ...
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
869 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 ...
13
votes
1answer
687 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
357 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 ...
17
votes
2answers
479 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 ...
12
votes
1answer
455 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 ...
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 ...
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 ...
11
votes
6answers
792 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 ...
8
votes
2answers
398 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?
22
votes
3answers
847 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 ...
15
votes
4answers
691 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 ...
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 ...
26
votes
3answers
590 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 ...
17
votes
4answers
853 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,...
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 ...
11
votes
4answers
402 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 ...
14
votes
3answers
399 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 ...
6
votes
4answers
1k 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?
5
votes
3answers
203 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 ...
23
votes
1answer
715 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 <...
20
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
590 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 ...
8
votes
3answers
328 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). ...
5
votes
1answer
250 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
369 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
709 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
570 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
139 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 ...
10
votes
1answer
364 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 (...
28
votes
2answers
747 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 ...
18
votes
4answers
640 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 ...
24
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 ...
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 ...
13
votes
2answers
213 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
350 views

How should we score compiler/interpreter build-time options?

Prompted by this comment. The scoring of optional flags passed to compilers/interpreters has already been handled here and here. However there is another case of one more level of indirection. ...
5
votes
1answer
288 views

Do we accept submissions in unimplementable languages?

I recently posted a code-golf answer in Scheme-1. However, the Scheme-1 language cannot be implemented (as it would require the implementation to solve the halting problem). I marked it as non-...
5
votes
1answer
332 views

should imports/includes count in golf [duplicate]

follow the title mainly I'm asking this so I know whether to count all the import declarations that are required for the code to run successfully (especially when the import/include is required in ...
5
votes
3answers
168 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 ...