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
votes
2answers
97 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 ...
2
votes
1answer
63 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
97 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.
2
votes
1answer
92 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 ...
1
vote
1answer
51 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 ...
10
votes
3answers
184 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 <...
0
votes
0answers
34 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
80 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 ...
4
votes
1answer
252 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 ...
0
votes
1answer
105 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. ...
1
vote
1answer
160 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
156 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 ...
0
votes
0answers
65 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
224 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 ...
-2
votes
1answer
132 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 ...
1
vote
2answers
89 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 ...
3
votes
3answers
70 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 ...
2
votes
0answers
56 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 ...
1
vote
2answers
155 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 ...
1
vote
1answer
454 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? ...
2
votes
1answer
86 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 ...
10
votes
4answers
236 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 ...
9
votes
5answers
196 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?
2
votes
1answer
101 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 ...
5
votes
2answers
246 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 ...
13
votes
1answer
351 views

Mildly not-safe-for-work challenge?

Related to this thread on reddit: [a link that was determined to be NSFW] Can I submit this as a code-golf question, or is it too inappropriate for StackExchange?
1
vote
1answer
66 views

Requiring an objectly array in JavaScript

Consider an example challenge: Given a number b and an array a, output the bth element of ...
6
votes
2answers
271 views

What must a C macro do to be a valid answer?

Recently, an answer of Peter Taylor here says: To get a macro equivalent to f(n){n=n?:1;} you need -Df(n)=((n)?:1) ...
0
votes
1answer
75 views

Is it allowed to take input by repeatedly call a function?

In C, to sum up some numbers, can do: *X;f(x,n){X=x;x=0;while(n--)x+=*X++;} // not sure if return the answer, assuming it does input a pointer ...
2
votes
0answers
29 views

Can machine code be separated into several parts with fixed distance?

Opcode can have JMP command jumping to an address that also mean another instruction: ...
13
votes
3answers
284 views

Can a C submission be in the form of a macro defined by command line argument?

In this question, the current C solution is f(n){n=n?:1;} Obviously this command line is shorter by 2 bytes: -Df(n)=n?:1 ...
11
votes
1answer
255 views

Is a transliteration tool enough to grant count as SBCS?

Prompted by this. I'll speak about Dyalog APL here, but this could really apply to any language. Background Dyalog APL has its own SBCS called ⎕AV. For backwards ...
8
votes
1answer
463 views

Should Output a number bigger than TREE(3) be edited an reopened?

The question output a number bigger than TREE(3) was closed as unclear what you are asking. I like the idea behind the question and would like to edit and reopen it. To start I'm not even fully sure ...
27
votes
2answers
597 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 ...
2
votes
2answers
103 views

Encoding data in flexible inputs

Most challenges that take a true/false or right/left or something like that input allow you to pick any two distinct values for these inputs. Recently, this answer came up. Clever use of this ...
3
votes
1answer
79 views

Are multi-method solutions allowed in Java?

I recently joined this community as a Java golfer, and I haven't been able to find a definitive consensus on acceptable solution formats for Java. From what I gather, the following are allowed (...
1
vote
2answers
97 views

Machine code submissions: Do bytes that are part of the executable file format count?

Imagine you're submitting a full program (as opposed to a function) written in assembly / machine code. You'll want to submit it as machine code (with the appropriate processor and target system) ...
0
votes
0answers
26 views

Are modifications to existing languages allowed as submissions? [duplicate]

Say I have a language I'd love to use (like JavaScript for example), but there are tons of little pieces of functionality I'd love to modify built-ins with, like ...
4
votes
0answers
188 views

How to handle large, complex challenges and built-ins?

I want to make a complicated code golf challenge (with a time limit ;). In this particular case I want people to golf the Elliptic-Curve Method to factorization. Now there are two issues with ...
1
vote
4answers
183 views

Challenges about interpreting arbitrary invented languages

This is a discussion about this challenge: Make an interpreter for my new esolang InSpace It creates a new language and asks for an interpreter for it. It was originally closed as unclear because OP ...
2
votes
1answer
82 views

Byte count for programs in visual languages

for code golf challenges, how would bytes be counted for visual programming/patcher languages like puredata? I thought maybe a system based on the language's saved file size for a patch, but that ...
10
votes
1answer
349 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 ...
4
votes
1answer
198 views

How to score “command-line” flags in Japt

When I first created Japt I was young and innocent, and I didn't know how to use a command line. So I created the interpreter with HTML and incorporated the JavaScript right into that. As Japt grew ...
-1
votes
2answers
34 views

What tag for questions that require code golfing to be valid?

Some questions require some amount of golfing because they have a maximum byte limit or are answer chaining and require no more than x bytes added to the previous answer. However, code golf is not ...
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 ...
2
votes
2answers
101 views

Multiple functions without leading/trailing mandatory parts?

Are we allowed to have multiple functions without the verbose Func-parts which are calling each other as code-golf submission? For example, in Java 8+ this is an allowed answer based on the current ...
-9
votes
2answers
83 views

Popularity-code-golf?

This question is very simple : Should we introduce a code-golf where only popular/unpopular programming languages are allowed ? And if yes, how can we measure popularity ? Probably with the Top of ...
-2
votes
1answer
124 views

New code-golf metric : Efficiency*characters

So, I thought about a new metric of code-golf, the code with the smallest value wins. The value is calculated by characters*time to run. So if you use an programming language like python, it's very ...
0
votes
0answers
45 views

What should be done when there are joint winners? [duplicate]

On the question How long is my number: Restricted Version, there are multiple answers which are 1 byte long? How should judge which answer to give the green check to?
1
vote
0answers
45 views

Are kernel-mode functions and kernel modules valid code-golf answers?

In general, user-mode processes have a much richer API environment available (through stdlib, and other libraries you can possibly import), than does (Linux) kernel-mode code. However there are some ...