What is the Sandbox?

This "Sandbox" is a place where Code Golf users can get feedback on prospective challenges they wish to post to the main page. This is useful because writing a clear and fully specified challenge on the first try can be difficult. There is a much better chance of your challenge being well received if you post it in the Sandbox first.

See the Sandbox FAQ for more information on how to use the Sandbox.

Get the Sandbox Viewer to view the sandbox more easily

To add an inline tag to a proposal use shortcut link syntax with a prefix: [tag:king-of-the-hill]

• How are tags added to questions? – guest271314 Jan 9 '19 at 7:51
• @guest271314 You can use this markup to create a tag in a draft: [tag:code-golf] – DJMcMayhem Aug 29 '19 at 15:19
• Why no featured anymore? Can't we have it auto-added or something? – S.S. Anne Sep 26 '19 at 15:57
• @JL2210 We now have a permanent info box that links to the Sandbox, so the featured tag isn't necessary – caird coinheringaahing Sep 29 '19 at 13:43

Output Infinity (updated v2)

Challenge

Output the following infinity symbol:

         ∞∞infinity                         ∞infinity
infinity∞∞infinity                 infinity∞∞infinity
infinity∞∞∞∞∞∞∞infinity           infinity∞∞∞∞∞∞∞infinity
infinity        ∞∞infinity      ∞∞∞∞∞infinity        ∞∞∞∞∞∞∞
∞∞∞∞∞                 ∞∞∞∞∞∞∞  ∞∞∞infinity               ∞∞∞∞∞
∞∞∞                      ∞∞∞∞∞∞∞infinity                   ∞∞∞
∞∞∞                         ∞∞infinity                       ∞∞∞
∞∞∞                       ∞∞infinity                         ∞∞∞
∞∞∞                    ∞∞∞∞∞∞infinity                      ∞∞∞
∞∞∞∞∞               ∞∞∞infinity  ∞∞∞∞∞∞∞                 ∞∞∞∞∞
infinity       ∞∞∞∞∞infinity     ∞∞∞infinity        infinity
infinity∞∞∞∞∞∞∞infinity           infinity∞∞∞∞∞∞∞infinity
infinity∞∞infinity                infinity∞∞∞infinity
∞infinity                        ∞∞∞infinity


Rules

• No input.
• Output can be given in any convenient format.
• Any number of trailing spaces at the end of each line is allowed.
• Any number of trailing new lines at the end of the shape is permitted.
• Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
• If possible, please include a link to an on-line testing environment so other people can try out your code!
• Standard loopholes are forbidden.
• This is so all usual golfing rules apply, and the shortest code (in bytes) wins.
• need some comments for down-vote... – mdahmoune Apr 20 '18 at 19:01
• If the challenge's goal is -- as I understand it -- to output one of the five objects, in most languages that would result in an optimal submission of something along the lines of print("∞"). A rather boring but valid submission to a challenge that effectively asks to print a single unicode character. – Jonathan Frech Apr 20 '18 at 19:34
• The downvotes are probably because you're allowing multiple outputs, some of which are interesting (4-5), some of which are trivial (1-3). As @JonathanFrech suggests, for a code-golf challenge, everyone is going to chose a trivial output for shortness. Alternate ideas: Input an integer 1-5, output the corresponding form of infinity. Or perhaps narrow to just output option #4 (or an even larger, fancier ASCII infinity), and make it a kolmogorov-complexity question. – BradC Apr 20 '18 at 20:59
• I would even say that this challenge in its current form should be tagged kolmogorov-complexity. If you decide to go in the direction @BradC suggested, you could maybe also consider to incorporate the challenge's theme into your challenge rather than posting yet another Kolmogorov complexity challenge. Something along the lines of infinitely outputting the ASCII art or taking two numbers as input, dividing them and producing the infinity symbol when the second one is zero. – Jonathan Frech Apr 20 '18 at 22:01
• I don't think this is anyhow related to math. Only "inspired by math", maybe. – user202729 Apr 21 '18 at 10:54
• Now -- is there any exploitable pattern in the output such that it should not be closed as a dupe of "We're no stranger to code golf, you know the rules, and so do I"? – user202729 Apr 21 '18 at 10:55
• @user202729 No, there is no predefined specific pattern, I prepared this MANUALLY. How could I specify that in the challenge? – mdahmoune Apr 21 '18 at 11:00
• I believe it's customary to specify if trailing spaces / new lines are permitted and if so, how many – Asone Tuhid Apr 21 '18 at 19:30
• @AsoneTuhid for spaces I think it is ok because it does not deform the shape, but I do not think so for new lines, what do you think? – mdahmoune Apr 21 '18 at 19:54
• Not between the lines, of course. I mean new lines after the whole drawing. Some people put restrictions (none, one, whatever). Nice art btw – Asone Tuhid Apr 21 '18 at 19:57
• @AsoneTuhid yes of-course, thanks a lot for this remarks. – mdahmoune Apr 21 '18 at 20:06
• Can you write a reference implementation which beats bzip2 and gzip, preferably by a few percent? – Peter Taylor Apr 25 '18 at 12:05

Shorter coding in non-golfing language

Copper write a requirement, a sample program in a golfing language, and a required non-golfing language. Rob hack it with the required language, with fewer bytes of code.

I guess it'd be cuz it's sometimes hard to define which is "golfing language". Also is it a duplicate?

• If it's a cops-and-robbers, then it can't be a popularity-contest. I personally don't think this challenge would work out; first of all, it's virtually impossible to outgolf a golfing language using a non-golfing languages because most golfing languages can complete most reasonable tasks in fewer bytes than it takes a non-golfing language to even print Hello World. Also like you said, golfing/non-golfing is extremely difficult to define. I also don't think this challenge would be particularly interesting because you'd likely end up with a bunch of miscellaneous cops posts with all – HyperNeutrino May 2 '18 at 13:09
• sorts of random requirements, which is basically just going to be a bunch of questions that either exist on PPCG already or could be posted to PPCG main as its own challenge, without any robber posts because it would be basically impossible. – HyperNeutrino May 2 '18 at 13:09
• IMO this is well past the threshold of "Too Broad", so I would vote to close for that reason. – Peter Taylor May 2 '18 at 15:23

(Now I don't know what the name should be)

Intention

I want to create a challenge based on dependent typing, feature that exists in Idris, Coq, Agda and the similiar.

Text

You should create a function in dependently typed language (Idris, Coq, Agda, etc) so that:

1. The function will receive a string that denotes format.
2. The format string will have s or n, s means it will receive a string, n means it will receive a number. You can assume that there is no other thing in the string
3. Arguments is received in order. If there is type mismatch, the error must be reported on compile-time.
4. After all arguments is received, the function will return a string, that is list of all passed argument

For example

formatf "sn" "goods" 25
> "goods 25"
> Type error in compile time
formatf "ak" "Akangka" 25
> You can do anything.
formatf "nnn" 24 25
> Either type error or return a function expecting a number and return string (currying is almost universal in these languages)
formatf "ss" "Akangka" "Martin Ender" "Adám"
> Type error on compile time


This challenge is similiar to printf-style string formatting, the difference that the function in this challenge has to be type safe.

Note that you cannot use build-in function or macro to do this

Discussion

1. What should be the name of this challenge?
• Any reason why full programs are not allowed? – user202729 May 2 '18 at 9:29
• What happens if the language is not compiled? – user202729 May 2 '18 at 9:32
• (if you didn't realize, it's not just some languages can't solve it, but in some languages your requirements don't make any sense. There are languages without functions, language with only monadic functions, languages without integers, language without macros, language where macros have different meaning than C #define, language without string (C), etc.) – user202729 May 2 '18 at 9:59
• If the string is possibly not known at compile time, how can it produce a type error at compile time? – Angs May 2 '18 at 10:04
• Personally I think it's a bit too similar to the challenge you linked.. The only difference is validating the input-type with the format.. In which case it would be better to have a challenge dedicated to that, as in: Given this format and a variable amount of other objects, check if the format and types of these objects match. In which case "%s: %i%%", "Percentage", 25 would be truthy, and "%s: %i%%", 123.45, 25 would be falsey. In addition, most languages are type independent, which can change during run-time based on their use.. 10.0 could be all three types in some languages.. – Kevin Cruijssen May 2 '18 at 10:07
• Suggested re-working of the problem: Given a pattern using only %s and %n (for number), slot in the given list of strings and numbers in the given order, but return a distinct value or throw an error if the given list doesn't fit right. – Adám May 2 '18 at 10:08
• @Angs dependent typing. In fact, this challenge is about dependent typing. – Akangka May 2 '18 at 10:17
• @user202729 well, by compile-time, I mean about typechecking time. I specifically disallow dynamic typing, as one of the point of the challenge is to make the program fail to typecheck if %s format is supplied by integer, etc. – Akangka May 2 '18 at 10:21
• @KevinCruijssen Indeed, not all language can do this challenge. After all the intention is on the dependent typing, which most programming language (but not Idris, Coq, etc) lack. – Akangka May 2 '18 at 10:26
• @Adám nice suggestion. But the type-safe feature (i.e. all error is on type-checking time) is integral part of the challenge – Akangka May 2 '18 at 10:28
• @Akangka I don't understand why my suggestion doesn't satisfy that. You get a list of strings and numbers and need to check against each tag in the format that you've been given the right tag. – Adám May 2 '18 at 12:12
• I think you should limit to some languages (perhaps extend the language list if needed), as the challenge does not make sense in other languages anyway. – user202729 May 3 '18 at 1:26
• @Adám I actually implement your suggestion, except the throw an error part. I make the challenge require the result is type error – Akangka May 3 '18 at 2:03
• @Akangka I don't understand why you insist on language specific features like "type errors" and "compile time". Your examples do not show how to format ss, ns, and nn. You mention float dots, but floats are not part of the examples any more. – Adám May 3 '18 at 5:46
• @Adám thanks about float dots. About language specific features, I just want to create a challenge about dependent typing. – Akangka May 3 '18 at 6:50

Challenge:

Your challenge is to write a quine-like program that takes a string from stdin and gives two outputs: Output A is the input string. Output B is your source code.

Output Formats:

You can send your outputs to stdout, stderr, and/or files. If A and B go to the same output, they must be separated by a newline. Having a newline at the beginning of your source doesn't count. You'd need to print that newline from your source and then another newline to separate A and B.

Examples:

source: print($stdin+"\n"+codeThatGeneratesSource) input: Hello, World! Both outputs on stdout: Hello, World! print($stdin+"\n"+codeThatGeneratesSource)


Separate Outputs:

stdout: Hello, World!

$hiworld = new hiworld; echo$hiworld->$print; ?>  Alternate Example Answer format My Oh so wrong and totally fake Hello world - PHP - Alt.Points(53) <?php class hiworld{public$printme = "Hello World"}
$hiworld = new hiworld; echo$hiworld->\$print;
?>


Attempted with:

50 pts: PSR-2 Foo's Enforcement Hook: Foo-Checker [http://foo.example.com] (Broke)

3 pts: PSR-2 Bar's Enforcement Hook: Bar-Checker [http://bar.example.com]

Deleted Version

• That just makes it better. – liljoshu Mar 8 '19 at 23:29
• Hate as measured by votes, however, is a discrete value, and therefore objective. – liljoshu Mar 8 '19 at 23:37
• While I disagree that pop cons need an objective criterion for voting (anything objectively measurable wouldn't need votes), pop cons are out of favour for that very reason. It is rare for a pop con to be welcomed. – trichoplax Mar 10 '19 at 10:00
• @trichoplax Fair enough on that. I'll change encouragement to just be on coding style. – liljoshu Mar 10 '19 at 22:25
• The problem is mostly the popularity-contest tag, which are very hard to do correctly. For example, how do you define break as many coding conventions as possible? How do you define convention, especially for esoteric languages where there are no conventions? The amount of conventions broken also depends on the poster's and viewer's standards, and is therefore not objective. – Jo King Mar 12 '19 at 21:38
• If a voter agrees it violates all the listed coding conventions, upvote the code that violates the most while still functioning is still subjective. All conventions are going to be subjective, e.g. Proper indentation, does that mean 4 spaces or a tab? One voter might think one way, and another might think another way. In general, I think you've chosen a very subjective winning criterion, and short of listing and defining the conventions yourself, it's not going to become objective again. – Jo King Mar 13 '19 at 0:06
• I've removed my downvote and the related comment. – trichoplax Mar 13 '19 at 6:59
• The new scoring mechanism is still subjective, but a big improvement. What counts as a convention still seems like a grey area. Does it need to be from an official source, for some definition of official? Does it need to have been posted online prior to the posting of this challenge? Does it need to be stating that coders "must", "should", or something else? – trichoplax Mar 13 '19 at 7:05
• One way to make this objective would be as a language specific challenge, for example with something like JSLint. That way your score is the number of complaints triggered when running it through the linter, and highest wins. Only being able to compete in one language doesn't seem ideal, but I mention it as an example in case someone can come up with a more inclusive approach. – trichoplax Mar 13 '19 at 7:08
• "Whatever makes you feel dirty for having put it through your keyboard" and "Each answer should list and link to coding conventions it breaks" are mutually contradictory. – Peter Taylor Mar 13 '19 at 12:00
• @trichoplax I do like your idea of counting linter complaints to make it more objective, and feel that's on the right track. Maybe bringing some code-cleanup program into it, and seeing how much work it has to do? – liljoshu Mar 13 '19 at 15:33
• I feel like this could work if one language was selected, with associated style guide/linter, and an objective scoring system made for that. Otherwise, you're comparing a lot of apples and shoes. – Spitemaster Mar 14 '19 at 16:36
• I know this probably isn't going anywhere, but the most 'official' python style guide is probably PEP 8. – Artemis still doesn't trust SE Apr 6 '19 at 18:17
• @liljoshu You've got my upvote for what it's worth, though I agree this needs some improvements. – Artemis still doesn't trust SE Apr 8 '19 at 22:35
• Something like codegolf.stackexchange.com/questions/172445/… might be ok – Embodiment of Ignorance Apr 10 '19 at 3:04

Output an alphabet suite

A successor to the ŋarâþ crîþ alphabet challenge.

Outputting the alphabet song with as few letters as possible was too easy, but what about outputting many of them?

Your challenge is to write as many programs as you can, with no two programs sharing any Unicode codepoints, and each program outputting the names of the letters of the alphabet (or the glyphs of some other kind of phonetic script) used by a different language. For instance, one program can output

a bee cee dee e eff gee aitch i jay kay el em en o pee cue ar ess tee u vee double-u ex wye zed


and another program can output

a be ce de e efe ge hache i jota ka ele eme ene eñe o pe cu erre ese te u uve uve doble equis ye zeta


Notes:

• For a given language, there will probably be some leeway in what you can output.
• Unlike in the previous challenge, you don't need to worry about any particular punctuation. You should at least separate each letter name with whitespace.
• You must output the names of the letters, not the letters themselves (so A B C... is invalid), unless the letters are literally pronounced so in the language in question.
• If a language uses both capital and lowercase letters, then you may output the letter names in either case. If it uses only one of them, then you must output the alphabet in that case.
• You must use a different language's alphabet for each program, but you are allowed to use the same script in the context of different languages.
• Constructed languages are allowed, as long as they predate the challenge.
• You may use different programming languages for each program. Or the same.
• Standard loopholes are forbidden.

TODO:

• is the requirement against sharing any codepoints too strict?
• I haven't downvoted you, but suspect that the major reason that you're getting downvoted is that it's totally unclear what outputs are valid or not, and skimming the edges of that is where most of the byte savings are going to come from in a code-golf. That said, I don't think this is code golf, despite having the tag. You'll probably find that, when any golfing aspect is removed, the strings to print are more or less irrelevant, so you might as well use a fixed, objective set of strings instead of the ones you have. – ais523's temporary account May 13 '19 at 16:24

Count the Trees

Challenge

Given an input consisting of ASCII art of trees such as

  0            <
|      >       @
|   @          |    0
|   |    #     |    |
|   |    |     |    |
==========================


count the number of trees present (5 in this case).

Rules

Input

• The input might not have all lines at the same length.
• You can take your input from stdin or take it as a string argument.
• There will be a ground as the last line, consisting of = characters.
• All trees have a straight trunk of | characters.
• The crown of the tree can be one of 0@#.
• Each tree will have at least one trunk character.
• You may assume that there is at least one tree.
• Unfortunately, there might be birds (< and >) photobombing the ASCII art. They should be ignored.
• If you find a bird on the ground, then it is dead and another tree will grow in its place tomorrow (carcasses make great fertiliser). In the ASCII art below, there will be two trees tomorrow:
   #
|   <
=========


Output

• Output the number of trees that are present today and those that will be present tomorrow.

Test cases

  0            <
|      >       @
|   @          |    0
|   |    #     |    |
|   |    |     |    |
==========================


(5, 5)

   #
|   <
=========


(1, 2)

 0#@
|||
|||
=====


(3, 3)

• What about languages that can't handle input over multiple lines? Can the input be taken as a list of strings? Or a single string with \n as separators? Also, the task is basically just counting all non-space characters on the second line from the bottom. The birds in the air, different crowns etc. won't affect the answers in any way. MATLAB: @(s)nnz(s(2,:)-32). – Stewie Griffin May 23 '19 at 10:16
• A single string should be fine; a list is not acceptable. And thanks for pointing out the shortcut. Maybe it would be better to require validation? – bb94 May 24 '19 at 15:50

The heights of Natural Numbers

Every number can be expressed as the product of itself and/or smaller numbers. This is a fundamental feature of our world.

For example 10 can be expressed as the product of 5 and 2, or as the product of 1 and 10.

9 can be expressed as the product of 3 and 3, or 1 and 9.

12 can be expressed as the product of 2 and 6. 6, in turn, can be expressed as the product of 2 and 3. It could also be the product of 3 and 4, and in turn 4 is the product of 2 and 2. Lastly there is 1 and 12.

7 can only be expressed as the product 1 and itself.

The numbers in the products are called factors. Every number has at least 2 factors, itself and 1. Numbers with only those two factors are called prime. Numbers with more than 2 are called composite.

These factors can be written as trees. The root begins with the number itself, and factors are written below, by adding branches to the root.

7 has 1 and 7. This is a short tree. It has one prime.

9 has 3 and 3. This is also a short tree, but it has two branches. It has two primes, but they are both at depth of 1 down the tree.

10 has 5 and 2. Again, short. Again, primes are at depth 1.

12 has 6 and 2, 6 has 3 and 2. This tree has two levels of height. Note that at the second level, every factor is prime, but at the first level, some factors are composite. 12 has also 3 and 4, and 4 becomes 2 and 2 - the tree looks similar to when using 6 and 2, this is called Isomorphic, which comes from the Greek language words for same shape.

In other words, every number has several trees of factors, and each tree has leaves that are prime factors. And every tree has a height, the number of branches one must travel between the root and the furthest leaf.

For example, every number has a tree of height 1. Itself and 1. So.

7 has height 1, because 1x7=7

9 also is height 1, because 3x3=9, and 1x9=9, are both of height 1.

12 is height 2. 3x2x2 becomes 3x4, which becomes 12. There are two branches between 12 and either leaf of 2.

But 12 is also height 1 because it has a different tree of height 1: 1x12=12.

16 is height 3, because 16 becomes 2*8 becomes 2*2*4, becomes 2*2*2*2. But 16 is also depth 1 because 1x16=16. However 16 is not depth 2, because no tree of it's factors has primes up two branches from the root.

Write a program that given an integer n, returns a sequence of the first 100 numbers that have prime factor trees of height n.

• The prologue about factors and primes is unnecessary-- we know what they are. A diagram would be nice. You didn't explicitly mention the rules for creating trees-- why can't 16 = 4x4 = (2x2)x(2x2), or 16 = 8x2 = (8x1)x2? Are depth and height the same? – lirtosiast Jun 29 '19 at 7:12

Best Mile Time

Introduction

Your friend has been trying to improve his mile time on. Unfortunately, he isn't very good at keeping a steady pace and constantly speeds up and then slows down. He usually runs for many miles at a time and wants to choose the fastest mile of his run to determine his mile time.

Given your friend's distance versus time, determine his fastest mile time for a contiguous mile stretch.

Input

A list of distances (in miles) sampled at an even interval.

Output

The length of the smallest interval during which a distance of at least one mile was traveled.

Rules

• You may assume that the the total distance traveled is at least 1 mile.
• The mile time must be for a continuous time interval.
• Standard loop-holes are forbidden.
• Standard rules apply.
• This is , so the program with the smallest asymptotic time complexity wins!
• Ties will be broken by fastest run time.

Example

Python 3.7, O(n ^ 2)

Try it online!

from typing import List

def fastest_mile_time(distances):
"""Determines the fastest mile time from a list of distances.

Parameters
----------
distances : List[float]
The list of distances in miles.

Returns
-------
int
The length of the smallest interval during which at least one mile was traveled.
"""
intervals = []
for i in range(len(distances) - 1):
for j in range(i + 1, len(distances)):
if distances[j] - distances[i] >= 1:
intervals.append((i, j))
break

return min(map(lambda x: x[1] - x[0], intervals))

• @FryAmTheEggman how's this? – Billylegota Jul 19 '19 at 2:32
• Unless I'm missing something this is trivially O(n): keep two pointers into the list, advance them keeping them 1 mile apart, and keep track of the running minimum time. I'm downvoting, so ping me if I was mistaken or if this is updated so I can update my vote. – lirtosiast Jul 19 '19 at 2:52
• @lirtosiast O(n) is trivial. I just gave O(n ^ 2) as an example. However it isn't clear to me that O(n) is the lower bound. I think the fact that the sequence is monotonically increasing may be of some use (although I've yet to show that to be the case). – Billylegota Jul 19 '19 at 3:20
• The optimal solution is O(n). You need to iterate two pointers through the entire list one time to ensure that you have found the minimum valid difference. The range of time this will take ranges from Ω(n) to O(2n) in the optimized case. for(i=j=0;j<length;i++){for(;array[j]-array[i]<1&&j<length;j++){}minTime=min(minTime , j-i)} – fəˈnɛtɪk Jul 20 '19 at 17:00
• Consider a list where every element at even index 2n is n, and every element at index 2n+1 is either n+.5 or n+1. If there is an integer at an odd index, the fastest mile time is 1, otherwise it's 2. But we have no way of determining this without reading all n/2 odd indices. – lirtosiast Jul 20 '19 at 18:17
• @lirtosiast +1 thanks for such a clear example! – Billylegota Jul 21 '19 at 6:16

Produce a self-reproducing data structure

Write the shortest code to produce a self-reproducing list, dictionary, array, and so on and so forth. That is, when you index any one of the logically-available items that belongs to the resulting data structure that you have produced, you get the same data structure when you compare the equality between the data structure before you indexed and the data structure after you indexed.

• In order to verify your code with automatically-provided constructions in programming languages, you should pick an operator that compares whether two values are equal (or does type-comparisons, if available).
• If your language does not provide an equality operator, you should simulate an equality operator yourself using operators like - or other operators that do the job of comparing values (as in Acc!, where an explicit comparison operator is not provided.)

Example

This is an example of a validity/equality test of a possible solution in a Python REPL (when you have already produced a list, namely list, where it produces itself at its 0th item). This test simply compares the equality between the non-indexed list and the indexed list:

>>> list
[[...]]
>>> list[0]
[[...]]
>>> list==list[0]
True


However, if the result of the last line (the equality comparison) is not a truthy value in your language (for example False and 0 in Python), then your answer is invalid and should be improved.

Rules

• Your program does not have to take input; neither does it have to explicitly output the data structure. However, your resulting data structure has to be accessible in some way.
• This is a contest; the shortest answer will win.
• In this challenge, the values on both operands in the equality check should have the same type.
• Your code (both your testing code and your producing code) should not produce any errors; any outputs to stderr are considered non-truthy values and demonstrates that your code is invalid.
• What does "compare it" mean? There are many many types of comparison one can perform, and they don't necessarily give the same result for the same values. – Peter Taylor Jul 24 '19 at 7:11
• @A__ For JavaScript, is it == or ===? Either way, people will be angry. – wizzwizz4 Jul 24 '19 at 13:16
• @A__ Because either the challenge is trivial (['']) or you're arbitrarily restricting a language. Work on your definition of "equality operator". – wizzwizz4 Jul 24 '19 at 13:46
• @A__ So, basically, you want (x=[])[0]=x? No clever tricks? Just a bog-standard recursive data structure? (Though, it might be interesting in languages where those aren't allowed.) – wizzwizz4 Jul 24 '19 at 14:07
• @wizzwizz4 In fact, your program is a clever trick that I have not thought of. Mine is 13 bytes, yours is 11 bytes. Yes, what I want is a bog-standard recursive data structure, as long as it is not a duplicate of another question. (My program is a=[];a.push(a)) – a'_' Jul 24 '19 at 14:10
• @U10-Forward 0 bytes – tjjfvi Jul 24 '19 at 14:32
• @tjjfvi I thought about that one, but I didn't think it'd be syntactically valid. It does, however, work. – wizzwizz4 Jul 24 '19 at 15:19
• @wizzwizz4 How do you know which language? – tjjfvi Jul 24 '19 at 15:31
• @tjjfvi I just assumed it was a language where the "null" / "undefined" singleton was indexable, returning the very same value. – wizzwizz4 Jul 24 '19 at 15:34
• @wizzwizz4 No, JS: window.window === window :) – tjjfvi Jul 24 '19 at 15:38
• @tjjfvi I read the challenge differently to you. I thought it meant "any one of the logically-available items". By this rule, (x={}).x=x is the shortest I can think of, other than the trivial case. – wizzwizz4 Jul 24 '19 at 15:53
• @tjjfvi Well i do it in Python so no such a thing called 0 bytes in python – U10-Forward Jul 25 '19 at 1:08
• Alternative: window["window"]===window – a'_' Jul 25 '19 at 4:06

Recursive Sum Up The Digits

Produce the shortest code that sums up all the digits in a number, and after if it still has more than one digit, sum it up again and again until it's with one digit, example: 987 would become 6 since 9 + 8 + 7 is 24, whereas 2 + 4 is 6.

• I have the feeling I've seen this challenge before, but I'm unable to find it. It could be that I'm confusing it with two similar loose challenges, since there are more challenges where we continue doing something until a single digit remains, and there are also loads of challenges summing the digits of an integer. I'm not 100% sure anymore whether there is already one with both combined. – Kevin Cruijssen Aug 5 '19 at 6:37
• This is just "Given n output n % 9". – Peter Taylor Aug 5 '19 at 7:46
• @PeterTaylor Ah, now I remember where I've seen it before: here in the sandbox, and you (or someone else) made that same comment. :) – Kevin Cruijssen Aug 5 '19 at 12:24
• Isnt this just a duplicate of codegolf.stackexchange.com/q/1775/87923? – EdgyNerd Aug 6 '19 at 8:19
• @EdgyNerd It's related, but not a dupe. That challenge takes multiple integers as input simultaneously, instead of a single input. And it outputs the amount of iterations for each of those integers to become a single digit, instead of the resulting digit itself. In addition, it has rather cumbersome output-format.. So that challenge would result in 987 2 for input [987]. The core part of both challenges is the same though: continue summing the digits of an integer until a single digit remains. – Kevin Cruijssen Aug 6 '19 at 9:16

The goal is to make a program that is compilable in as many languages as possible.

• The program must be compilable with a specific compiler version and compiler parameters without any errors.
• The program may result in an error when run.
• The source code must not be empty or whitespace.
• This is somewhat similar in spirit but not the same. This probably is a duplicate of something, strictly or less so, but that's the first thing that came to mind – Unrelated String Aug 27 '19 at 7:48
• A null program is compilable in most(if not all) languages. (Including specific compilers of C(in IOCCC).) – a'_' Aug 27 '19 at 10:15
• @A_ I've added an additional rule. – user2190035 Aug 27 '19 at 10:58
• As-is, this will be closed as Too Broad, since there's no "thing" for the program to do. Have a look at the polyglot tag and see what others have done. – AdmBorkBork Aug 27 '19 at 14:25
• Define "compile". – pppery Aug 28 '19 at 23:23

I reverse the source code, you keep the output

Yet another blatant rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!

Your task, if you wish to accept it, is to write a program/function that outputs/returns its own output. The tricky part is that if I reverse your source code, the output must be preserved.

Examples

Let's say your code is ABC and the corresponding output is XYZ. If I run CBA, the output must also be XYZ

• What's to prevent a trivial solution of just 1 in many (many) languages? – AdmBorkBork Sep 25 '19 at 18:30
• Or trivial comment abuse? – S.S. Anne Sep 25 '19 at 20:39
• @JL2210 This works in codegolf.stackexchange.com/questions/193315/… print("ABC")#("ABC")tnirp – gadzooks02 Sep 26 '19 at 15:21
• @AdmBorkBork This works in codegolf.stackexchange.com/questions/193315/… too: 1 is the reverse of 1 – gadzooks02 Sep 26 '19 at 15:22
• And to both of you: why did these not stop that code golf becoming a challenge? – gadzooks02 Sep 26 '19 at 15:23
• I didn't say it couldn't be a challenge. I just wanted to point out that this is trivial in many languages. And for what it's worth, I downvoted the challenge you linked for the same reason. – AdmBorkBork Sep 26 '19 at 15:48
• @gadzooks02 That challenge requires you to reverse the input. The input can be anything in that challenge. – S.S. Anne Sep 26 '19 at 15:49
• @JL2210 Ah yes. Would preserve the input work better? – gadzooks02 Sep 26 '19 at 16:02
• No, then it would be trivial in Bash and BrainFuck and C and, well, you get the point. – S.S. Anne Sep 26 '19 at 16:26
• @JL2210 Yes, OK. Do I need to do something if I've decided against a challenge? Delete the post? – gadzooks02 Sep 26 '19 at 16:29
• No idea. Read over the guidelines, they might help. – S.S. Anne Sep 26 '19 at 16:31