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
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 ...
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'...
14
votes
0answers
119 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. ...
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 ...
-1
votes
1answer
100 views

Why are golfing languages allowed?

I'm a bit confused about the use of golfing languages in golfing challenges. In the standard loopholes there is a point about using self-made languages that solve the problem in one symbol. And it's a ...
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 ...
1
vote
0answers
52 views

What loopholes should be assumed when a name-specific file is used for code golf?

I have posted this golfing tip for Bash before: In Pure Bash (or any other pure shellscript), use . for looping. It's a tip that recomments using a file whose the ...
9
votes
1answer
238 views

Has there been any large-scale attempt to assemble libraries or programs from aggressively-golfed solutions in a given language?

It occurred to me when I was browsing threads here that there is an immense collection of simple and extremely space-efficient functions on this site. Although I imagine the end result of such an ...
-3
votes
1answer
96 views

What's your favorite code golf video? [closed]

Do you have a favorite code-golf video? Maybe someone golfing before it was cool? Or because it was a way to solve a problem?
4
votes
3answers
115 views

Online tool to determine number of bytes for UTF-8 characters?

Is there an online tool that will tell me the number of bytes in a UTF-8 character? Or, if not, how do I determine this? I'm currently trying to determine the number of the bytes for the left and ...
0
votes
1answer
168 views

Is the Chrome UserScript still recommended?

If I recall correctly, the chrome user script used to be recommended in the About/FAQ pages somewhere, but I can't find it anymore. I know that UserScripts must be installed from the Chrome Web Store ...
-1
votes
1answer
71 views

Shouldn't the users on codegolf be able to close their questions?

Shouldn't the users on codegolf be able to close their question after let's say the question's winners are announced without them having to have some amount of reputation?
0
votes
1answer
87 views

Sort by code size for code-golf problems [duplicate]

For easier position calculation and as a handy way for the questioner, a sort by code size feature should be added which would sort out all the answers from the very least byte-ed to the most byte-ed.
8
votes
4answers
303 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 ...
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?
37
votes
22answers
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 ...
-4
votes
1answer
145 views

Need help with code golf [duplicate]

What in the world is code golf and how is it important to me? I have already looked in the tour.
4
votes
1answer
75 views

Should "import" statement be included in byte count if I'm not using it directly [duplicate]

Related: On scoring imported functions I knew that if I want to use some imported functions, I had to include "import" statement in the byte count. For example, I want to find out the most ...
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 ...
1
vote
1answer
91 views

Is returning a longer array allowed?

There exist some questions that it's easier to output an array longer than intended to output, and it costs to slice. Longer array behave like small ones as long as you don't access its length or out-...
1
vote
0answers
64 views

Can we assume computer be fast enough?

Consider such a question Take a program P and an integer n, check whether P halts. You may ...
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 ...
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 ...
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?
1
vote
1answer
100 views

What to count in assembly?

Yes, I've checked this post (How are bytes counted in assembly), but I'm asking a different question. I'm asking, if I have an .asm file, an ...
4
votes
0answers
111 views

How should answers that time out be judged?

Suppose a challenger submits a code-golf challenge to do a particular task, together with test inputs. (That is, they've determined that, in order to be convinced that the code in an answer correctly ...
5
votes
1answer
189 views

Byte counting policy for library imports in Factor

As this month's LotM (Forth) was not gaining much participation, I guessed it's partly because it's way too low-level, so I was looking into Factor as a modern, high-level alternative to Forth. If it ...
10
votes
5answers
802 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
298 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. ...
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 ...
0
votes
0answers
97 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 ...
0
votes
1answer
72 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
109 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
73 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
358 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
284 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
398 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
131 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
votes
2answers
150 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
132 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. ...
2
votes
1answer
70 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
135 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.
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 ...
3
votes
1answer
114 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 ...
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 ...
2
votes
1answer
55 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
196 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
98 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
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 ...

1
2 3 4 5