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
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 ...
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 ...
9
votes
5answers
763 views

Ruleset for RGS's Golfing Showdown - competition is over!

RGS RGS stands for RGS's Golfing Showdown, a golfing competition. The competition has ended, final leaderboard at the end of this post! 1 - The format The RGS will be a virtual golfing competition ...
9
votes
2answers
276 views

Omitting trailing closing parentheses in Excel

When golfing in Excel, it is often possible to omit closing parentheses at the end of an expression. Excel will detect this, add the missing closing parentheses and ask if this is what was meant. ...
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 ...
3
votes
2answers
251 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 ...
0
votes
0answers
90 views

Are Rubik's Cube fewest move type challenges allowed? [duplicate]

We have atomic-code-golf which lets us have challenges involving things other than byte count. So I wonder if Rubik's Cube fewest move challenge (FMC) type challenges are allowed. I see no objections ...
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 ...
0
votes
1answer
54 views

Do golfing languages support rational number arithmetic?

I proposed this code golf on sandbox: Integer Logarithm Take \$a \in ℤ_{>1}\$ and \$b \in ℤ_+\$ as inputs. Write a function \$f\$ that: $$ f(a,b) = \left\{ \begin{array}{ll} ...
2
votes
1answer
96 views

Are all golfing languages friendly to Unicode?

I'm going to make a challenge involving Mahjong Tiles (U+1F000 – U+1F02F, though I'm going to use only U+1F000 – U+1F021). ...
3
votes
0answers
66 views

Is asking for a bounded time complexity allowed?

Say, if someone asks for a code-golf like this: Test primality under polynomial time Given a positive integer, test whether it is prime. Rules The algorithm must have polynomial time complexity in ...
6
votes
3answers
265 views

Can I use here my own language for code-golfing?

Can I golf in my own programming language here? I ask it 'cause there is no online way to check it out.
4
votes
1answer
258 views

Are transpiler languages allowed?

I recently created a simple little language that transpiles Brainfuck into a format that is half the size of its input. It can be used to compress and decompress Brainfuck programs. Provided I ...
5
votes
1answer
254 views

Zsh: Functions and Math functions

I have been using functions for Zsh submissions for some time. I typically submit the body alone, as the body can be run as a full program with no modification: ...
1
vote
1answer
122 views

Code golf involving GPS?

I planned to ask a code golf involving GPS: What's the current zodiac? Objective: Display the emoji of the zodiac of current time, according to your location. Rules: 1. There's no input....
1
vote
2answers
130 views

Ethics of Golfing in Assembly or other extremely uncommon languages

My understanding of code-golf in general is that you're to provide the shortest solution in a given language. However, for most challenges, you could safely pick a language no one really is familiar ...
1
vote
1answer
121 views

It seems the consensus on Scratch is to use scratchblocks2 syntax, but what about “when green flag clicked”?

In many code-golf Scratch submissions, I see when green flag clicked used, when when gf clicked is also valid in scratchblocks2. ...
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 ...
3
votes
1answer
67 views

Is it all right to edit challenge to recognize the winner?

I know that the best answer in a code golf challenge should be the accepted one. Is it a good idea to add a "final positions table" to the end of the post once a winner is found? Something like this: ...
2
votes
1answer
117 views

Does [code-golf] count in bytes or character length

In the code-golf challenges, does it count in bytes or character length. Because one character can 1 byte ranging from charcode 0 to 255, 2 bytes ranging from 0 to 65535, etc.
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 ...
3
votes
1answer
107 views

Who wins code golf if there is a tie?

On my code golf challenge, there are two tie 24 Bytes answers. The first one (Excel) is great because of the creativity put into it and the second one (MATL) is just skill I think and each one should ...
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 ...
2
votes
1answer
54 views

Where timing between outputs matters, does the solution need to account for buffering?

In certain languages (i.e. C), writes to streams like stdout can be buffered by default - what this means is that when one calls functions like ...
11
votes
3answers
191 views

Do different ImageMagick tools count as their own languages?

Here is an answer that I made recently: https://codegolf.stackexchange.com/a/181416/70328 A commenter suggested that I could remove convert from my code, and use <...
1
vote
0answers
36 views

Can we pass properties of the input as parameters? [duplicate]

Some challenges require, for instance, lists as input. A list has a property being its size. Several languages have builtins to get properties such as the size for a list (all golfing language, ...
2
votes
1answer
88 views

Can I repost a challenge with different rules? [duplicate]

Recently, I posted a code-golf question about number sequences. However, as I was looking through the question later, I thought to myself, "Wouldn't this be good as a fastest-algorithm question?" It's ...
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 ...
5
votes
1answer
255 views

Does linter golf require a specific interpreter to be a valid answer for golf?

If someone answers a code-golf challenge in, for example, JavaScript, and as an additional challenge restricts to only code that is approved by http://www.jslint.com/ that answer is valid if an ...
2
votes
1answer
169 views

Need contributions to my new Programming Language

My name is Eduardo and I'm a Computer Science student from Brazil, finishing college by the end of this year. My undergraduate thesis is about the programming language JAEL that I'm developing for ...
1
vote
2answers
173 views

Include characters or just bytes?

I'm using javascript as a golfing language. I've just noticed that the number of characters used in a program may differ from the number of bytes that program takes (due to text encoding?). For ...
2
votes
2answers
257 views

How should I submit an anonymous lambda that has a self reference?

In a lot of situations we allow for C# answers to simply be an anonymous lambda with the assumption that to run it it needs to be stored in a variable. So given that, is it acceptable to also assume ...
1
vote
0answers
69 views

Is a slightly changed compiler allowed? [duplicate]

Some maybe not-intended-to-program languages may have some extra limitations. Is it allowed to change it to solve a problem? If so, how the length go? p.s. marking this topic as duplicate of this ...
7
votes
1answer
245 views

What is the consensus on built ins?

Originally on this challenge I banned built in matrix functions but people complained about it. I then removed the ban but there were few interesting answers given and some people complained and said ...
-3
votes
1answer
135 views

User disobeying rules?

So last question that I posted. i.e : this, I wanted to ask because a specific new user whom I have warned almost on all answer he has posted (5-6) was not following, yet he keeps answering with ...
2
votes
2answers
98 views

Interpret BF (question on repost)

Sandbox : link Interpret BrainF**K : This is usually a very common challenge on a lot of sites and on PPCG we also have this Interpret BF. I wanted to know if we could make a repost of that question ...
4
votes
3answers
86 views

Pointing out bugs without comment privilege

I found a bug in a code golf submission but do not yet have commenting privilege. Is there a polite way for me to let the user know about this bug? The site offers me to "suggest an edit" but I'm not ...
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 ...
1
vote
0answers
59 views

Function not that directly used allowed? [duplicate]

In this answer, the function is defined as With(Math)f=(a,b,c,d)=>... (1) However, f is not used in the function, so it ...
2
votes
2answers
175 views

Why do Jelly submissions get to ignore the `Y` atom in the byte count?

For those not familiar, Y in Jelly joins a list of strings (actually a list of lists of characters) with a newline. In plenty of challenges with text output, Jelly ...
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 ...
2
votes
1answer
782 views

What is the purpose of “header” and “footer” for C++ submissions using TIO?

What are the rules for using c++ in code golf? In TIO, there is a header section and a footer section. Can you put your #includes in the header section? Do you use this template? ...
1
vote
1answer
87 views

Are fixed input allowed if the bytes count? [closed]

E.g. requiring to call by f(4), and add 1 to the byte count Or maybe when inputting a choice, require input f`!#%` or ...
11
votes
4answers
263 views

Answers still marked as “non-competing”

The community has decided that answers in newer languages can now compete in code-golf (they were previously required to be marked as non-competing). However, now and then I will still come across an ...
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 ...
10
votes
5answers
201 views

Is my question a duplicate even though it doesn't impose a requirement that the original one did?

I asked a challenge to interpret deadfish here, but it got closed for being a duplicate of a challenge to write an interactive deadfish interpreter here. Is this really a duplicate?
1
vote
1answer
102 views

Bulk editing code-golf answers to add headers [duplicate]

Is it considered bad to edit old code-golf answers to add in headers so that the answers can be easily seen by tools using the SEDE or data dumps? I can see pros and cons to doing this, and I what is ...
7
votes
4answers
287 views

Metadata for answers?

It would be great to have an option in answers to add metadata. (This would be most useful for questions tagged code-golf, but maybe also other tags?) You would be able to put in the language, the ...
8
votes
2answers
310 views

URL shortener policy [duplicate]

I haven't seen a discussion on this yet, but I also haven't really seen it used in answers, so I figured it was worth asking a question for link-reference in the future. So, what's the policy on ...
4
votes
2answers
255 views

Can I redo the Solve Rubik's Cube challenge?

The challenge Solve Rubik's cube has a lot of flaws: Arbitrary limits: (say, max. 5 seconds on your machine and less than 1000 moves) Cumbersome input format: The input is in the format ...

1
2 3 4 5