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
7
votes
2answers
303 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) ...
-1
votes
1answer
81 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 ...
3
votes
0answers
31 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: ...
14
votes
3answers
305 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
320 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
525 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
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 ...
2
votes
2answers
113 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
96 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
112 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
28 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
191 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
207 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
92 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
399 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
221 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
37 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 ...
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 ...
2
votes
2answers
109 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
102 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
129 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
49 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
53 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 ...
2
votes
1answer
130 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. ...
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?
4
votes
1answer
110 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 ...
5
votes
1answer
322 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
143 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 ...
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 ...
5
votes
2answers
260 views

Same language different version for polyglots [duplicate]

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 ...
12
votes
5answers
431 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 ...
-5
votes
1answer
79 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
552 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
83 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 ...
2
votes
1answer
177 views

Why do we score codegolf submissions in "bytes" instead of "chars"?

A single 05AB1E char takes all 8-bits of a byte, whereas BF only has 8 commands, so 3 bits per char, 2.5 BF commands per byte. I'm not suggesting we change the judging rules, but why do we use the ...
0
votes
0answers
66 views

Can lambda parameter types be left off if potentially inferable from context? [duplicate]

This Java answer (and this one) uses a lambda that does not explicitly declare its parameter type, but this Scala answer includes a parameter type. in both cases, the type could be inferred when it is ...
2
votes
1answer
92 views

Is Ctrl-C one keystroke or two?

Preliminary question: is it valid to score Excel in keystrokes? I guess it is, but I'm not sure what our policy is. Assuming it is (or, in general, for languages that are scored in keystrokes), does ...
8
votes
2answers
287 views

Is "vim + plugins" a valid language?

It is probably not a shock to most of you, but I really enjoy answering code golf questions in Vim. There are many vim plugins that could greatly shorten some answers. For example, surround, subvert, ...
4
votes
1answer
174 views

Should Java Applets include HTML in the byte count?

I'm curious whether or not the HTML required to run applets should be included in byte count. Also what's the current standard for counting bytes with applets? In Eclipse if I recall correctly you can ...
1
vote
2answers
105 views

Strange byte count for winforms

How to cout bytes for winforms programs? Just met a strange situation here: C#, 120 bytes ...
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 ...
2
votes
1answer
135 views

Is that built in allowed?

I have recently created a coding language called Valyrio. I have also posted a proposal for a question in the Sandbox. I have a problem though. It has been well-established that any builtin or ...
7
votes
0answers
177 views

Why can't we take input from a variable? [duplicate]

On the default allowed I/O methods, we have come to a consensus that programs may not take input from a predefined variable. However, we have decided that anonymous functions are allowed. In the ...
0
votes
0answers
80 views

A meta PCG question (challenge?) [duplicate]

Are there PCG challenges where "general purpose" or "commonly used" [*] programming languages do better than the special PCG targetted languages? Is this in itself an interesting meta challenge? I ...
2
votes
2answers
224 views

How should we score SmileBASIC programs?

SMILEBasic is a 3DS application that lets you run their own flavour of BASIC called SmileBASIC. It's a pretty cool language, and might have some potential for code-golf, but I don't think a lot. The ...
7
votes
1answer
258 views

If your answer is acts differently depending on context, how safe do you have to be?

This is kind of a follow-up to / re-asking of "Should point-free function expressions be allowed when a function is asked for?" with specific reference to the only language I know how to golf in, j, ...
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?
2
votes
1answer
140 views

Reopen my question that has several correct answers

Shortest Konami Code I have this question and for some reason it was closed as unclear what I was asking for a second time. I fixed it the first time and it become open. Several correct answers were ...
16
votes
4answers
907 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 ...
6
votes
1answer
790 views

How to count bytes in 7 (and other languages that use fractional numbers of bytes)

(See also this question, which is similar, but talks about the situation where the language is normally stored on disk with one command per byte.) This question originally came up in connection with ...