Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-golf]

For questions regarding code golf challenges and/or submissions

0
votes
2answers
116 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
64 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
201 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
117 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
88 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
63 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
138 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
137 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
85 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 ...
9
votes
4answers
215 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
189 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
100 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
235 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
347 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
63 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
263 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
73 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
265 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
235 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
431 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
522 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
100 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
70 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
94 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
25 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
185 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
158 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
79 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
316 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
166 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 ...
19
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
95 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
74 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
118 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
44 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
44 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 ...
1
vote
1answer
106 views

Strikethrough byte counts in answer headers [duplicate]

In code-golf submissions, people often like to show how they golfed their program down, striking out the previous byte counts and leaving the current one unformatted. I've seen this done two ways. ...
6
votes
4answers
399 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?
4
votes
1answer
93 views

JS Promises in code-golf? [duplicate]

Should code-golf submissions written in JS that return a promise be allowed? For example: Promise.resolve("hi") Doesn't output ...
3
votes
1answer
218 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-...
1
vote
1answer
109 views

Regex Challenges

So I had an idea to make a challenge where users have to make a regex expression, based on what I give them. Example: test2 FIND test3 FIND test SKIP Then they ...
7
votes
4answers
280 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 ...
6
votes
2answers
224 views

Same language different version for polyglots

I recently answered a polyglot challenge (my answer is here). I'm using Python 2 and Python 3, abusing the floor division of py2. However, a commenter asked me if using the same language but ...
13
votes
5answers
397 views

Potential execution flag rule break

I am currently developing a golfing language for a specific type of task. I was hoping to use some command line flags for different options in the language. Since the language is intended to be a ...
-6
votes
1answer
66 views

New challange variant “Scored Code Golf” [closed]

I have a new idea for code-golf challenges, scored code golf would be used for multi part challenges that correspond and the score adds up. This would allow for linking different challenge types ...
9
votes
5answers
399 views

When to allow flexible input/output

First, I hope this isn't a duplicate (I've tried my best to search through for similar questions, but I very well may have overlooked one). In the spirit of being fair to inflexible programming ...
1
vote
1answer
79 views

Language util name byte counting

I'm trying to figure out how the byte counting works in "Sum the numbers on standard in". In one answer using the jq util counts the non-space bytes after the util ...