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
1 vote
0 answers
66 views

Are there specific types of code golf challenges on this site?

I posted a question in hope of starting a shortest code challenge, but it seems to attract lots of downvotes and the only answer tried to help as a programming problem. One comment on the question ...
paki eng's user avatar
  • 163
7 votes
2 answers
187 views

Equivalence between strictly increasing integer sequences and decision problems

I have noticed that sequence questions are often looking at strictly increasing integer sequences. For these types of sequences, the sequence task of outputting the values in the sequence is largely ...
Command Master's user avatar
2 votes
2 answers
107 views

Can the binary representations of argv[n] be used for numeric input?

TL;DR: Is int d = *(int*)argv[1]; allowed to obtain a integer input? A special case of this question: Can numeric input/output be in the form of byte values? This ...
12431234123412341234123's user avatar
-6 votes
2 answers
202 views

Why do I feel like Code Golf is ruining the point of Python?

The Zen of Python ...
OmegaO333's user avatar
-1 votes
1 answer
133 views

Maximum code-golf length

If we have a code-golf question that we have a golfed answer to in, say, Python, how long does that program have to be for it to not be a good idea to ask that question/for that to be code-golf (if ...
Dadsdy's user avatar
  • 2,035
7 votes
0 answers
201 views

Does the initial `:` in a TI-BASIC program count?

According to this meta post, TI-BASIC is scored in tokens rather than characters, to more accurately reflect the byte count in-memory. On my graphing calculator (TI-84 Plus C Silver Edition), the ...
Bbrk24's user avatar
  • 2,745
3 votes
1 answer
85 views

Is byte count on TIO valid, specifically for non-ASCII C code?

When I have non-ASCII characters in my C code, TIO counts them as 1 byte. For example, the following C program prints 56 music-related characters on the terminal. Link TIO reports its length as "...
anatolyg's user avatar
  • 13.1k
6 votes
2 answers
143 views

What is a good ASCII boundary-character for regex unary, and will using that instead of a delimiter affect the perceived legitimacy of my answers?

So far, I have only used comma-delimited unary for my answers taking a list / array as input, since it's the "obvious" choice. That looks like ...
Deadcode's user avatar
  • 11.5k
1 vote
1 answer
73 views

Is outputting by modifying an input with no modifying access allowed?

Say Round to nicer numbers where it's possible to always output n'=m. I submitted a Javascript solution that does this. I can require input be f(x,n,[m]) and then ...
l4m2's user avatar
  • 20.5k
12 votes
3 answers
645 views

What do we rename Advent of Code Golf?

Recently, Seggan received an email from Eric Wastl, the owner of Advent of Code, part of which is quoted below: Please do not call your event something like "Advent of Code Golf"; this ...
Ginger's user avatar
  • 5,420
24 votes
28 answers
2k views

Announcing Code Golf Advent Calendar 2022! (+ Event challenge sandbox)

Following last year's event, we're doing Advent of Code Golf Code Golf Advent Calendar 20221! On each day between Dec 1st and Dec 25th (inclusive), a new challenge will be posted at UTC midnight2. It ...
Bubbler's user avatar
  • 73.8k
1 vote
3 answers
64 views

Can Function Objects be Appened to STDIN From the Stack?

This is mostly specific to Vyxal, but I've worded the language so that any hypothetical stack language could utilise this Say you have a stack-based language which supports function objects on the ...
lyxal's user avatar
  • 32.3k
2 votes
1 answer
91 views

Using compression tools

Are you allowed to use compression tools (e.g. gzip, xz) in your code? For example, a shell script with: cat script.sh.gz|gzcat|sh (25 bytes) where the content of ...
littleb2009's user avatar
2 votes
2 answers
76 views

Byte counting for BASIC style DATA / READ inputs

Background Many BASIC dialects idiomatically use DATA and READ commands to store and read input data from the source code. We ...
Taylor Alex Raine's user avatar
15 votes
0 answers
179 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. ...
Bubbler's user avatar
  • 73.8k
-1 votes
1 answer
216 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 ...
Vilx-'s user avatar
  • 1,601
27 votes
25 answers
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'...
Bubbler's user avatar
  • 73.8k
1 vote
0 answers
67 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 ...
user avatar
9 votes
1 answer
242 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 ...
CuriousCoder's user avatar
-3 votes
1 answer
99 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?
Filip Haglund's user avatar
4 votes
3 answers
317 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 ...
theorist's user avatar
  • 1,477
-4 votes
1 answer
147 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.
idiot's user avatar
  • 1
4 votes
1 answer
99 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 ...
tsh's user avatar
  • 34k
1 vote
1 answer
93 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-...
l4m2's user avatar
  • 20.5k
1 vote
0 answers
68 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 ...
l4m2's user avatar
  • 20.5k
1 vote
1 answer
131 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 ...
atzlt's user avatar
  • 487
4 votes
0 answers
116 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 ...
Rosie F's user avatar
  • 417
8 votes
1 answer
218 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 ...
Bubbler's user avatar
  • 73.8k
11 votes
2 answers
333 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. ...
Adám's user avatar
  • 29.9k
0 votes
0 answers
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 ...
qwr's user avatar
  • 11.5k
0 votes
1 answer
82 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} ...
Dannyu NDos's user avatar
  • 5,447
10 votes
5 answers
825 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 ...
RGS's user avatar
  • 14k
2 votes
0 answers
78 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 ...
Dannyu NDos's user avatar
  • 5,447
2 votes
1 answer
125 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). ...
Dannyu NDos's user avatar
  • 5,447
7 votes
3 answers
370 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.
USERNAME GOES HERE's user avatar
4 votes
1 answer
304 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 ...
moltarze's user avatar
  • 2,552
5 votes
1 answer
635 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: ...
GammaFunction's user avatar
1 vote
1 answer
137 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....
Dannyu NDos's user avatar
  • 5,447
-2 votes
2 answers
165 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 ...
Andrew Baumher's user avatar
2 votes
1 answer
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: ...
Barranka's user avatar
  • 432
2 votes
1 answer
161 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.
mekb's user avatar
  • 623
3 votes
1 answer
123 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 ...
Hille's user avatar
  • 389
2 votes
1 answer
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 ...
user avatar
11 votes
3 answers
199 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 <...
vityavv's user avatar
  • 785
1 vote
0 answers
37 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, ...
Olivier Grégoire's user avatar
2 votes
1 answer
101 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 ...
Geza Kerecsenyi's user avatar
4 votes
1 answer
258 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 ...
trichoplax is on Codidact now's user avatar
1 vote
1 answer
140 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. ...
Silas Reel's user avatar
2 votes
1 answer
188 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 ...
Eduardo Hoefel's user avatar
1 vote
2 answers
226 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 ...
ibrahim mahrir's user avatar

1
2 3 4 5