# Sandbox for Proposed Challenges

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

Sandbox FAQ

## Posting

Write your challenge just as you would when actually posting it, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

When you think your challenge is ready for the public, go ahead and post it, and replace the post here with a link to the challenge and delete the sandbox post.

## Discussion

The purpose of the sandbox is to give and receive feedback on posts. If you want to, feel free to give feedback to any posts you see here. Important things to comment about can include:

• Parts of the challenge you found unclear
• Problems that could make the challenge uninteresting or unfit for the site

You don't need any qualifications to review sandbox posts. The target audience of most of these challenges is code golfers like you, so anything you find unclear will probably be unclear to others.

If you think one of your posts needs more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended!

It is recommended to leave your posts in the sandbox for at least several days, and until it receives upvotes and any feedback has been addressed.

## Other

Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

To add an inline tag to a proposal use shortcut link syntax with a prefix: [tag:king-of-the-hill]. To search for posts with a certain tag, include the name in quotes: "king-of-the-hill".

Get the Sandbox Viewer to view the sandbox more easily!

# Oh noes! A site redesign is eating my privileges!

PPCG is graduating and will soon receive a new design. Unfortunately for everbody except some people, the new design will also mean losing privileges due to higher reputation requirements.

Now, losing some privileges is a small sacrifice for the Magnificent Glorious Site Redesign®©™, but… How much do we stand do lose?

## The challenge

Your program / function receives a reputation level (e.g. 535). Output the privileges that are currently available to it, but will not be available after the redesign.

### Output

Output can be either an array or a string that's separated by a delimiter. The delimiter may not be any of A-Za-z<space>. Multi-character delimiters may end in a space, though.

If there are no matches, your program should output either an empty array or a falsy value.

### Examples

Input
25000

Output
[]

Input
24999

Output
["access to site analytics"]

Input
2000

Output
["access to moderator tools","approve tag wiki edits","cast close and reopen votes","create tag synonyms"]

Input
535

Output
["cast close and reopen votes"]

Input
350

Output
["access review queues"]

Input
5

Output
[]

Input
4

Output
["participate in meta"]


Deliberately ignoring the facts in the last example.

### Available privileges

For convenience, here is a JSON array with available privileges and the required reputation before / after:

[[5000,25000,"access to site analytics"],[4000,20000,"trusted user"],[3500,15000,"protect questions"],[2000,10000,"access to moderator tools"],[1500,5000,"approve tag wiki edits"],[500,3000,"cast close and reopen votes"],[1250,2500,"create tag synonyms"],[1000,2000,"edit questions and answers"],[750,1000,"established user"],[1000,1000,"create gallery chat rooms"],[350,500,"access review queues"],[150,300,"create tags"],[250,250,"view close votes"],[125,125,"vote down"],[100,100,"edit community wiki"],[100,100,"create chat rooms"],[75,75,"set bounties"],[50,50,"comment everywhere"],[20,20,"talk in chat"],[15,15,"flag posts"],[15,15,"vote up"],[10,10,"remove new user restrictions"],[10,10,"create wiki posts"],[1,5,"participate in meta"],[1,1,"create posts"]]


At index 0 is the reputation before, at index 1 is the reputation after. (The privilege reduce ads (200 reputation) is not available to beta sites and therefore not included in this list.)

Standard I/O and loophole rules apply.

• Related. It's borderline whether this adds enough to not count as a duplicate: I would vote that it does, but I wouldn't cast my supervote. Jul 12 '16 at 16:21
• @PeterTaylor I'm thinking of changing the challenge to allow submissions to download the privilege page. I guess that would make it distinct enough. Jul 13 '16 at 10:53
• Turns it into a hybrid parse-HTML and merge data sources question. Yes, I think that's novel. You should make it very clear that the answers should keep working after the contents of the privilege page are updated to show the new rep levels; and possibly you should take a backup copy of the page in case of future addition of new privileges. Jul 13 '16 at 11:01

Plot Partial Node Network

I have a 440*3 matrix that looks like:

1   144 Title1
1   152 Title2
1   135 Title3
2   3 Title4
2   12 Title5
2   107 Title6
2   31 Title7
3   4 Title8
3   147 Title9
3   0 Title10
4   end Title11
4   0 Title12
4   0 Title13
5   6 Title14
5   7 Title15
5   10 Title16
5   9 Title17


The left column are the starting points eg in the app all the 1's on the left would be on the same page. They lead to three choices, pages 144,152,135. These pages can each then lead to another page, and so on until the middle column says 'end'.

challenge Each number has an associated title in column three. I would like to have a function whereby if you input a given title it will plot all the possible starting points and their associated paths that will lead there. This should be a lot smaller and therefore graph friendly.

Example e.g.

44  234  tes
186  187  Frac
187  154  Low
154  end  Coll
23   52   Med
52   11   Lip
11   42   AAA
42   154   BBB
154   end  Coll


EDIT - I added to the example. In the winning entry these new nodes will not be plotted as they do not lead to Coll.

I made this example to show how column 1 leads to a value in column 2 which then refers to a value in column 1 until you reach the end. Different starting points can ultimately lead to different length paths to same destination. so this would look sometigng like:

So here, I wanted to see how you could go from all start points to 'Coll'

Input A data.frame like that illustrated (with not relevant rows included) and a given title

Rules -any language is fine as long as it will easy work with tab separated data laid out as shown

Output A graph like the one included for a given title

Win Criteria Shortest Runtime to make a png with graph

• A question should have one challenge, not two. And a challenge should ideally have one goal, not two; and should certainly have a clear description not only of the input but also of the output. Jul 13 '16 at 16:14
• Hi Peter, thanks for this. I've edited accordingly Jul 13 '16 at 16:16
• Jul 13 '16 at 22:58
• they're similar but not the same. they dont solve the problem of just plotting the rows that lead to Coll. Jul 14 '16 at 7:30
• i edited example to clarify this Peter :) Jul 14 '16 at 7:45
• I do like this question, but I currently do not support it as a question, due to it being unclear as to exactly what the png can and can not look like. I do support graphical output questions. Jul 15 '16 at 1:47

# The Library Problem

Bob has a very annoying problem. His boss told him to write a cat program that redirects the standard input to the standard output. But he recently installed a virus on his computer which deleted every libraries on it.

Now he really need to create this program without using any library (even the language standard library). It need to run at least on one operating system with one architecture.

# Challenge

Write a program or that redirects the standard input to the standard output without using any library or external program/command to run to help Bob. You can use system calls and interrupts for example, but your program must not run in ring 0 mode (most operating systems like Microsoft Windows or GNU/Linux have kernels which prevent programs from doing anything, but MS-DOS for example let programs do everything).

• Input: anything (text, binary)
• Output: exactly the same as the input

This is , so shortest answer in bytes wins!

# Example Input and Output

First:

• Input: Hello, world!
• Output: Hello, world!

Second:

• Input: ...
• Output: ...
• That's just this challenge isn't it? Jul 21 '16 at 15:26
• @MartinEnder This challenge is about doing a cat program without using any library or external command/program even the standard library built with the language.
– user54187
Jul 21 '16 at 15:30
• So everything would need to be written in assembly or equivalent? Jul 21 '16 at 15:34
• @TimmyD Yes for example, but I think there are other lower-level languages which allow this.
– user54187
Jul 21 '16 at 15:34
• In that case it just seems like the same challenge limited to a small set of languages? In that case it would probably still be considered a duplicate and the usual course of action is to offer a bounty for the language you want to see a solution in. Jul 21 '16 at 15:38
• @MartinEnder You need a lower-level language but it doesn't mean that every program made using a lower-level language works with this challenge. See this answer for example which uses a function from the standard library codegolf.stackexchange.com/a/62309/54187.
– user54187
Jul 21 '16 at 15:46

# Alphabet Circle

This post got very negative feedback, so it's apparent that it needs tweaking in the sandbox before I attempt to repost it on PCG

With all the new alphabet xxx challenges, I've decided I'll give my own challenge.

Input

An Integer, (or your languages equivalent) r, such that 0 < r ≤ 26. (you don't need to validate this)

Output

An alphabet circle. Must meet the following criteria:

• Smoothly interpolated from A at the center and Z at the edge.
• Each point in the circle is the distance from the center offset so that 0 = A, 1 = B, 2 = C etc...
• Be printed to STDOUT

Examples

r=26

r=15

Boilerplate

Anonymous classes and functions are fine. General Code Golf rules apply. Shortest code in bytes wins!Except Jelly

• Please remove the Except Jelly part... Aug 3 '16 at 11:31
• @TùxCräftîñg no Aug 3 '16 at 11:32
• Disallowing language are a thing to avoid when writing challenges Aug 3 '16 at 11:35
• It's triple super scripted, it's a joke. I'm not removing it. Get a sense of humour! Aug 3 '16 at 11:49
• Since you mention negative feedback, my negative feedback would be that a glut of recent challenges on theme X (in this case alphabet layout) is a strong reason to avoid more challenges on theme X for a while, not to add to the pile. Variety is good. If I were you I'd hold this challenge for a month. Moving onto positive feedback, the spec needs to define the desired layout more clearly. I can't work out what the precise criterion is for which letter to place in each space. Aug 3 '16 at 14:51
• If a position is not an integer distance from the centre, should the distance be truncated, rounded up/down or something else? Aug 6 '16 at 12:11
• Could you specify whether leading/trailing spaces and newlines are permitted/required? Does the circle need to be framed in a square of matching size, or can it always be in a square of a fixed maximum size? Aug 6 '16 at 12:15
• I think this would work best as a kolmogorov-complexity just for the size 26 pattern. That'd avoid any issues with defining how to interpolate the circles (or, indeed, defining the pattern generally, as it would be defined via stating the intended output).
– user62131
Nov 24 '16 at 5:24

# 2 Pass Hello world

You've heard about this fancy new programming language, but you're not sure you understand it perfectly. So you want to go over a new "Hello world" tutorial again.

How boring!

Instead you have a good idea, using your knowledge of the first programming language to create a "Hello world" program in the second programming language.

Exemple:

console.log('print "Hello world"');


Evaluated in javascript output:

print "Hello world"


Which, evaluated in python 2.X output:

"Hello world"


Nice, but, can it be shorter?

• We have a tag for multi-language challenges, polyglot. May 4 '16 at 14:06
• Pyth: \H (Guess what the second language is) May 4 '16 at 14:08
• Maybe add a scoring mechanism by how many languages it works in? e.g. console.log('print("puts\'Hello, World!\'")') would score len(submission)/num_languages_it_works_in? May 4 '16 at 14:09
• Then the submission above would score 0. May 4 '16 at 14:09
• (To OP) Maybe you would need to add some more rules May 4 '16 at 14:11
• @KennyLau no? 2/2 = 1 May 4 '16 at 14:11
• @EᴀsᴛᴇʀʟʏIʀᴋ It can be fed into itself for one more pass... May 4 '16 at 14:12
• I didn't want to add any recursive mechanism, because the end goal should be to display "Hello world" but a more than 2 language is a great idea. May 4 '16 at 14:15
• I don't see how you will be able to come up with a good scoring system for this. Using two esolangs / two times the same esolang will result in 1/2 bytes answers right away. May 4 '16 at 14:16
• @KennyLau, what rules do you generally add to a incomplete challenge? we thought adding a time/memory limit for the execution, but seems irrelevant... May 4 '16 at 14:17
• This is really closely related to several other challenges we've had on the site, such as this one and this one. You'll need to be very careful to not make it a duplicate. May 4 '16 at 14:22
• Also this one, which is practically a duplicate, just with numbers instead of "Hello, world." May 4 '16 at 14:26
• Yeah, I haven't seen all this, I guess I'll start searching for another idea instead ;) May 4 '16 at 14:29
• Also, welcome to PPCG! (I forgot to mention that earlier). Hope you enjoy yourself here! May 4 '16 at 14:36

# Return True to Win - Counter javascriptcode-golf

Original credit goes to this site, which you should all check out

Write the shortest javascript code to pass as parameter f to function counter such that it returns true:

function counter(f) {
var a = f(), b = f();
return a() == 1 && a() == 2 && a() == 3
&& b() == 1 && b() == 2;
}


I'm considering also making this a series with all the rest of the challenges on the site, where each one gets harder

• Given the lack of a terms of use page on the site, the code on that site is copyrighted, with no provisions for reproduction. This is copyright violation.
– user45941
Aug 9 '16 at 6:00
• In addition to Mego's note regarding copyright, language-specific challenges are not typically well-received by the community. Aug 9 '16 at 18:18

# Nasty Nasty Bugs

Help the programmer provide detailed instructions to the team on how to deal with bug fixes.
The team's goto instructions for dealing with bugs goes like this.

For the twelfth bug of Christmas, my team leader said to me

Tell them it's a feature
Say it's not supported
Change the documentation
Blame it on the hardware
Find a way around it
Reinstall the software
Run with the debugger
Try to reproduce it
Ask them how they did it and
See if they can do it again.


The indentation must comply with the teams coding standards, so it may either be tabs or four spaces (since the team's editors expand tabs to spaces anyway). The team lead doesn't mind a leading or trailing newline, but there is no tolerance for the dreaded standard loopholes. Also the office is a bit cramped so the code needs to be as small as possible. These lyrics are moderately adapted from http://www.manbottle.com/humor/twelve_bugs_of_christmas

• What is the actual challenge? A kolmogorov-complexity to reproduce the quoted text verbatim? Aug 8 '16 at 21:41
• whoops should have tagged it as such @PeterTaylor Aug 8 '16 at 21:42
• There doesn't seem to be much of a pattern here. What does this add over other kgc questions? (And why isn't it a dupe of the Rickroll challenge?) Aug 9 '16 at 20:23
• @FryAmTheEggman I could put all 12 verses of the 12 bugs of christmas in. But then it could be a dupe of the 12 days of christmas challenge Aug 9 '16 at 20:24

# Crab Canon

A crab canon is a piece of music where the same tune is played backwards and forwards at the same time, and it somehow sounds nice. The most famous example is this one by Bach. In Godel, Escher, Bach, Douglas Hofstadter wrote a crab canon in dialog form, in which the characters of Achilles and the Tortoise alternate lines, with one set of lines being the same as the other set except backwards. Somehow, it makes sense.

The challenge is to write a program inspired by this art form. The only requirement is that there has to be some sort of reversal of the source code involved. For example, you could make a program that:

• Prints its own source code, but backwards
• Does the same thing when reversed
• Both of the above at the same time
• Or make up something creative and wow the voters!

The reversal can happen on pretty much whatever level you want: lines of code, characters, characters within lines, or whatever makes sense for your language. The Hofstadter Crab Canon has some small changes between the two sets of lines for the sake of coherence, you can do something similar if you feel it is necessary.

This is a popularity contest, the answer with the most votes wins.

• This is without a doubt too broad. See codegolf.stackexchange.com/tags/popularity-contest/info Aug 16 '16 at 7:10
• @PeterTaylor FYI there's something wrong with that link's formatting Aug 16 '16 at 18:07
• There isn't any formatting. I just pasted the link directly. And it works for me. Aug 16 '16 at 19:11
• @PeterTaylor hmm, seems to have fixed itself... Aug 16 '16 at 19:12

## Petals around the Roses

Given 5 numbers from 1 to 6, calculate the number of Roses, Petals and Roots. Try guessing the formulas yourself by visiting http://jetpackshark.com/RPS before reading anybody's answers. (The dice-like display is significant.)

This is , so the shortest program wins.

• If you're looking for a "solve-the-puzzle" challenge, the site for that is Puzzling. If you want it to be a code-golf, then please include a formula for how the roses, petals, and roots are calculated. Aug 16 '16 at 13:06
• Or at the very list a definition of roses, petals, and roots in this context. At present this question makes no more sense than the output of a Markov text generation process. Aug 16 '16 at 13:44

## Write a Brainfuck interpreter in Brainfuck

Since Brainfuck is known to be turing-complete, it is possible to write a Brainfuck interpreter in Brainfuck. This is what you're supposed to do.

You will get the input from the standard input and output to the standard output. This is a programming-puzzle, so the length is not top priority, however if there are multiple solutions, the shortest one wins!

• BF interpreter (non language specific) challenge has already been done, and language exclusive challenges generally aren't good Aug 19 '16 at 1:45

# Iпtгodцctioп

Iп tиe Iпteгпets, people sometimes liкe to stчlize tиeiг posts дs if tиeч щeгe щгitteп iп д diffeгeпt scгipt. Tидпкs to tиe пotoгietч of Soviet Яцssiд, tиe Cчгчlic scгipt seems to бe pдгticцlдгlч fдvoгed.

Бцt щидt cдп д пext-dooг tгoll do if tиeч'гe пot д pгogгдmmeг? Mдпцдllч гeplдciпg eдcи дпd eveгч letteг cдп бe qцite tedioцs...

# Cидlleпge

Чoц дгe to щгite д pгogгдm tидt щill дccept дп дгбitгдгilч loпg iпpцt of Lдtiп cидгдcteгs дпd sцбstitцte some letteгs щitи similдгlч looкiпg Cчгчlics cидгдcteгs. Tиe oцtpцt sиoцld бe ideпticдl to tиe oцtpцt pгodцced бч tиe folloщiпg цпgolfed C# scгipt:

цsiпg Sчstem;
цsiпg Sчstem.Collectioпs.Geпeгic;
цsiпg Sчstem.Liпq;

pцбlic clдss Test
{
pцбlic stдtic void Mдiп()
{
Dictioпдгч<cидг, cидг> tгдпs = пeщ Dictioпдгч<cидг, cидг>{
{'A', 'д'},
{'a', 'д'},
{'B', 'Б'},
{'b', 'б'},
{'N', 'И'},
{'b', 'и'},
{'K', 'К'},
{'k', 'к'},
{'N', 'П'},
{'n', 'п'},
{'R', 'Я'},
{'r', 'г'},
{'U', 'Ц'},
{'u', 'ц'},
{'W', 'Щ'},
{'w', 'щ'},
{'Y', 'Ч'},
{'y', 'ч'}
};

stгiпg s; щиile((s = Coпsole.ЯeдdLiпe()) != пцll) {
Coпsole.ЩгiteLiпe(
пeщ stгiпg(s.Select(c => tгдпs.CoпtдiпsКeч(c) ? tгдпs[c] : c).
Toдггдч()
)
);
}
}
}


Tиe sиoгtest code щiпs.

# Exдmple Iпpцt дпd Oцtpцt

Iпpцt:

As we know, the goal of every struggle is victory. But if the proletariat is to achieve victory, all the workers, irrespective of nationality, must be united. Clearly, the demolition of national barriers and close unity between the Russian, Georgian, Armenian, Polish, Jewish and other proletarians is a necessary condition for the victory of the proletariat of all Russia.

We are for the withering away of the state, and at the same time we stand for the strengthening of the dictatorship of the proletariat, which represents the most powerful and mighty of all forms of the state which have existed up to the present day. The highest development of the power of the state, with the object of preparing the conditions of the withering away of the state: that is the Marxist formula. Is it "contradictory"? Yes, it is "contradictory." But this contradiction is a living thing and wholly reflects the Marxist dialectic.

Oцtpцt:

дs щe кпoщ, tиe goдl of eveгч stгцggle is victoгч. Бцt if tиe pгoletдгiдt is to дcиieve victoгч, дll tиe щoгкeгs, iггespective of пдtioпдlitч, mцst бe цпited. Cleдгlч, tиe demolitioп of пдtioпдl бдггieгs дпd close цпitч бetщeeп tиe Яцssiдп, Geoгgiдп, дгmeпiдп, Polisи, Jeщisи дпd otиeг pгoletдгiдпs is д пecessдгч coпditioп foг tиe victoгч of tиe pгoletдгiдt of дll Яцssiд.

Щe дгe foг tиe щitиeгiпg дщдч of tиe stдte, дпd дt tиe sдme time щe stдпd foг tиe stгeпgtиeпiпg of tиe dictдtoгsиip of tиe pгoletдгiдt, щиicи гepгeseпts tиe most poщeгfцl дпd migиtч of дll foгms of tиe stдte щиicи идve existed цp to tиe pгeseпt dдч. Tиe иigиest developmeпt of tиe poщeг of tиe stдte, щitи tиe oбject of pгepдгiпg tиe coпditioпs of tиe щitиeгiпg дщдч of tиe stдte: tидt is tиe Mдгxist foгmцlд. Is it "coпtгдdictoгч"? Чes, it is "coпtгдdictoгч." Бцt tиis coпtгдdictioп is д liviпg tиiпg дпd щиollч гeflects tиe Mдгxist diдlectic.

• Welcome to PPCG and thanks for using the Sandbox! Unfortunately, this challenge is essentially the same as this question. Also, please don't write your specs in this "stylised" manner. It greatly hurts the searchability of your post. Aug 20 '16 at 22:03
• Your code is also stylized. Does your code run properly? Aug 20 '16 at 22:34
• @ColdGolf And do you think I'd stylize my post by hand? Aug 21 '16 at 2:13
• @FryAmTheEggman OK, thank you. I now see my challenge was pointless and won't post it to the main. Aug 21 '16 at 2:14
• Nothing is pointless: now you you know more and can come up with a better challenge! :) Aug 21 '16 at 2:17
• @ColdGolf OK you were right, I messed up the stylization. {'b', 'и'} - here is a bug. Sorry. Aug 21 '16 at 2:22
• @gaazkam Does your code, with the stylized цsiпg Sчstem;, run properly? Aug 21 '16 at 2:39
• @ColdGolf I regard people of CodeGolf intelligent enough to find out they'd have to unstylize this code ^^ :) Aug 22 '16 at 7:11
• @gaazkam I see. Aug 22 '16 at 17:34

### Alphabet ripple

You must print out this exact text:

abcdefghijklmnopqrstuvwxyzzyxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwxyyyyxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwxxxxxxwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvwwwwwwwwvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuvvvvvvvvvvutsrqponmlkjihgfedcba
abcdefghijklmnopqrstuuuuuuuuuuuutsrqponmlkjihgfedcba
abcdefghijklmnopqrsttttttttttttttsrqponmlkjihgfedcba
abcdefghijklmnopqrrrrrrrrrrrrrrrrrrqponmlkjihgfedcba
abcdefghijklmnopqqqqqqqqqqqqqqqqqqqqponmlkjihgfedcba
abcdefghijklmnopppppppppppppppppppppponmlkjihgfedcba
abcdefghijklmnoooooooooooooooooooooooonmlkjihgfedcba
abcdefghijklmnnnnnnnnnnnnnnnnnnnnnnnnnnmlkjihgfedcba
abcdefghijklmmmmmmmmmmmmmmmmmmmmmmmmmmmmlkjihgfedcba
abcdefghijkllllllllllllllllllllllllllllllkjihgfedcba
abcdefghijkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkjihgfedcba
abcdefghijjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjihgfedcba
abcdefghiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiihgfedcba
abcdefghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhgfedcba
abcdefggggggggggggggggggggggggggggggggggggggggfedcba
abcdeffffffffffffffffffffffffffffffffffffffffffedcba
abcdeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeedcba
abcddddddddddddddddddddddddddddddddddddddddddddddcba
abccccccccccccccccccccccccccccccccccccccccccccccccba
abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbba
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


### Specs

• You may do it in all-uppercase instead of all-lowercase.
• A single leading and trailing newline are allowed
• You may not output an array of strings - the delimiter must be a newline

### Scoring

This is . Program with lowest byte-count wins.

• Seriously, another alphabet challenge ._. Aug 21 '16 at 14:23
• Duplicate, too lazy to find. Aug 21 '16 at 14:27
• @LeakyNun you're too lazy to search through your own challenges...? Aug 21 '16 at 20:49
• @trichoplax I don't feel like wasting my time to search for the duplicate. Aug 21 '16 at 20:57
• @LeakyNun I knew what you meant - I was just making a poor joke that you would only need to search your own challenges since you wrote every alphabet challenge... Aug 21 '16 at 21:15
• @LeakyNun, this Show tree rings age? Aug 23 '16 at 10:50
• @LeakyNun what exactly is the duplicate? I'd like to know. Aug 27 '16 at 16:39
• @ConorO'Brien this Aug 27 '16 at 16:46

# The Note-Takers Dream

## Meta

This challenge requires more than most challenges. Is it to much?

The goal here is simple. Turn my notes into text. To this end, any tool or web service may be employed.

## Specification

• Input
• An image of handwritten notes, stored an some data structure (this structure is flexible)
• This image will be a direct, over-head shot of a single page of graph paper
• Notes
• The notes are taken on graph paper with one character per box
• The characters will be printable ASCII
• An empty box should be considered as a single Space character
• There is an implicit New Line character between each row
• Output
• A string of the text represented in the image
• This image should be trimmed of leading white space
• Trailing white space is fine
• Score
• The score is the sum of the Levenshtein distances between required outputs and actual outputs
• Lowest score wins

## Test Cases

Coming soon. . .

• Mathematica will win, and everyone else will weep Aug 30 '16 at 22:42
• So basically codegolf.stackexchange.com/q/28207/194 with a larger character set and probably a smaller test set. It's effectively a dupe IMO. Aug 31 '16 at 7:52
• Golfing in ABBYY FineReader Engine has never been so exciting. Aug 31 '16 at 14:45

# Print the name of the language

The goal of this challenge, as implied in the title, is to print the name of the language with a program in said language, in as few bytes as possible.

But that would be too easy, right ?

So to add a litle bit of challenge, you are not allowed to use any characters included in the language's name.

# Rules

• Each submission must be a full program.

• The program must take no input, and print the name of the language to STDOUT plus an optional trailing newline, and nothing else.

• The program must not write anything to STDERR.

• Usual loophole rules apply

• Submissions are scored in bytes, in an appropriate encoding, usually (but not necessarily) UTF-8.

• This is , so the shortest program (in bytes) wins.

# Sandbox

After checking, I don't think this question is a dupe.
Are there any grammatical mistakes ? (English isn't my first language)
Are there any rules that should be added (like banning languages created after the challenge ?) Should I add any further specification ?

• Do X without Y is discouraged. We're talking about your question in Code Golf Chat right now. (And now the conversation's moved on...) Sep 1 '16 at 8:39
• @wizzwizz4 Would removing the "not use characters in the program name" rule make it better ? I didn't want the challenge to become "who has the shortest printf command" Sep 1 '16 at 8:45
• At the moment it's "who has the shortest program name". Sep 1 '16 at 8:48
• If the challenge is in danger of becoming "who has the shortest printf command" then rather than trying to fix it you should consider throwing it away and looking for an interesting challenge. Sep 1 '16 at 11:42

# Make a dummy C program

We all know the feeling. You have written a short, efficient and readable one-liner that's the perfect solution to the problem. Then your code-illiterate boss looks over your shoulder and is not very happy that you've spent an entire paid hour producing "nothing". You could politely explain the situation to your boss, complete with a demonstration that your code does what it should. Or, because talking to people is Hard Work™, you could fake it.

Your task is to write a program that takes a list of keywords as input, and outputs dummy C code that looks like it does something to do with those words. Sandbox note: not happy with the wording in final bit here.

For example, if the inputs were integral, formula, math, proof, fit and square, the output might be:

#include <math.h>
#include <setjmp.h>
double* squarefit(int integral, float* mathproof)
{
char **integralb={{0}};
double square[integral];
int i=0;

//integral math formula fit
for(integralb[0][0]=(char)erff(*mathproof);isnan((double)++integral);i++) {
return hypot(sqrt(square[integral]),integral)?square:square;
printf(*integralb,integral,*mathproof);
}
setjmp((struct __jmp_buf_tag*)mathproof+(int)(abs(--integral)-expm1l(integral)));
longjmp(0,0);
return square;
}


Although it doesn't have to do anything, or even run successfully properly, the source code produced by your program must compile in gcc (no additional options) without fatal errors. You do not need to provide a main function; if you don't, expect the line int main(void){} to be appended to the output file before it is compiled.

This is a , so the best-liked answer will win. However, voters should keep these questions in mind when assessing the submissions:

• Does the produced source code look like it does the expected task? Yes.
• Does the produced source code look like it has taken a long time to produce? Yes.
• Do different inputs result in the same program, just with different variable names? No.
• Does the produced source code look like the same code repeated over and over? No.
• Do your parents, grand-parents, co-workers or other "not computer people" think the produced source code was something to do with the input keywords (optional)? Yes.
• Would you think the produced source code was written by a person with knowledge of the C language, if you did not know that it was just dummy code (optional)? Yes.
• Does the code look readable (e.g. ungolfed)? Yes.

Not all of the standard loopholes apply for this challenge. For example, you mignt use external resources, such as library files or an indexable website. However, voters should use their discretion as to what is reasonable and what is not (such as expecting the "keywords" to be in a format that includes a high-quality, valid C program).

Sandbox note: how to finish challenge body?

• Is this a language-specific challenge?
– user56309
Sep 29 '16 at 17:05
• @tuskiomi No, it's open to all languages. Sep 29 '16 at 17:06
• Generally it's a good Idea to separate your challenge into five sections: the intro, summary, input, output, and examples. I'd recommend you do so here as well.
– user56309
Sep 29 '16 at 17:07
• @tuskiomi Thanks, will do. Give me 6 to 8 weeks... Sep 29 '16 at 17:11
• @tuskiomi I disagree. There are plenty of ways to organize a challenge effectively. However, this challenge looks like it might suffer a bit from the "art contest" issue, so be wary wizz. Sep 29 '16 at 17:31
• @HelkaHomba I never said that it's the ONLY way to organize challenges to be effective, I said that generally it's a good idea to do that format.
– user56309
Sep 29 '16 at 17:34
• @HelkaHomba That's the format I often use, and I plan to split it into headings. What do you mean by "art contest issue"? Sep 30 '16 at 6:28
• I mean the judging is up to the whim of the voters own opinions and knowledge of how C code should look. We've had issues before with challenges like "draw the prettiest picture" which is plainly an art, not programming contest, and those kind of thing rarely go over well, often close voted as "primarily opinion based". This challenge (and all pop-cons really) suffer from similar issues. I'm not personally against this challenge or art contests, but it's just an issue you may need to face. Sep 30 '16 at 6:35
• @HelkaHomba Do you have suggestions as to which questions to change / remove / reword to stop it being bad subjective? Sep 30 '16 at 6:45
• I kind of like this, but I bet it would be closed as too broad. Anything from the program you provided to main(){integral+formula+square+proof+fit==math?return 0:return 1;} would be allowed. May 26 '17 at 20:13
• @MDXF That wouldn't be valid if the inputs foo, bar, baz, fizz, buzz, fred would result in main(){foo+bar+baz+fizz+buzz==fred?return 0:return 1;}. Also, gcc gets very cross that none of those names are defined, so it won't compile. So actually that wouldn't be allowed. Also note that that is a boring submission to a popularity-contest. May 27 '17 at 8:06

# Urinal Discomfort!

This question springboards off of Positional Bathroom Etiquette, while adding an extra twist.

### Background

I'm going to take @Nick Frev 's formulae for the total discomfort of a urinal spot

dist(x,y) = linear distance between person x and person y in Urinal Units
discomfort(x) = sum(1/(dist(x,y)*dist(x,y))) for all persons y excluding person x
total_Discomfort = sum(discomfort(x)) for all x
short_urinal_discomfort = discomfort_from_surroundings + 1/9 (inherent_discomfort)


Your task is to put a person into the spot with the least total discomfort. However, now you have big and small urinals. The small ones, obviously, cause a little inherent discomfort, so we prefer to not use those if we have a choice.

## The Challenge

### Input/Output

Your program will take in a string of 1,0,i,o to represent the row of urinals. 1 represents a person in a tall urinal, 0 is an empty tall urinal, i is a full short urinal, and o is an empty short urinal.

Using the above formulae, build a program that will replace an empty urinal with the correct placement of the next person(0->1 or o->i).

• The short urinals have an inherent discomfort of 1/9 which will be added onto the discomfort provided by the surroundings.
• The door is to the right of the row, so the urinals fill up right to left, because you have to pee really bad and can't walk further than you have to.

Input Output 000 001 101 111 1000001 1001001 101010101 101010111 000o 001o 100o 100i oo0oooo oo1oooo 11000ii 11010ii

## Any tips would be super helpful

More test cases maybe? Or more clarification?

# Stump the OEIS!

The OEIS is a wonderful database of integer sequences, but occasionally, there are code golf problems that generate integer sequences not found in the OEIS. Your challenge is to write some code that generates a sequence that meets all of the following criteria:

1. Sequence must not exist in the OEIS. Prove this by providing a link to the search for your sequence showing 0 results, such as this: 1,2,6,81,35246. In the spirit of good faith, please do not generate a sequence that is merely an existing sequence offset or multiplied by some constant.
2. The sequence must be non-repeating, non-oscillating, etc. Formally, there must not exist a subsequence S with finite length L, that begins at index I such that the subsequence from [I+kL] to [I+(k+1)L-1] for every k is identical to S. Such an invalid sequence would be 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, ... because the subsequence 1, 2, 3 beginning at index 1 with length 3 also exists as the subsequence from 4 to 6, from 7 to 9, from 10 to 12, etc.
3. The sequence must contain a minimum of 3 distinct integers.
4. The sequence must be deterministic, e.g. there must not be any element of randomness in the generation of your sequence. Every time your program is run, it must provide the same exact sequence.

Please write code that provides as many integers in your sequence as feasible. At least 20 is recommended, though sequences that grow incredibly fast can provide fewer, provided you also give a proof that your code would produce that number if given enough time.

This will be a problem, so the entry with the fewest number of bytes wins.

A bonus of -20% can be applied to your score if, in addition to your sequence, you can also provide some mathematical justification for your sequence being included in the OEIS in the future.

Standard loopholes are disallowed, as well as sequences that are simply "this sequence is just the handful of numbers I came up with to fit this problem."

• You say "must contain an infinite number of entries not 0 or 1", then go on to talk about finite sequences, so I'm not sure what you're looking for here. Nov 17 '16 at 17:44
• Changed it to "The sequence, if infinite, must contain" blah blah blah Nov 17 '16 at 17:45
• This is definitely going to be closed as "Too broad" - if it isn't closed first as "Unclear what you're asking" because of the impossibility of testing whether "this sequence is just the handful of numbers I came up with to fit this problem." Nov 17 '16 at 17:52
• @PeterTaylor If I removed the possibility of finite sequences, then IMO that second possibility goes away. As for being closed for too broad, there have been problems that don't have a single goal that have done well, such as Does this code terminate? that inspired a lot of very creative answers. Nov 17 '16 at 17:59
• Its pretty easy to fill most of the requirements you've listed here: all you need to do is combine two different OEIS sequences (multiply or add). Restriction 3 should be changed to "Your sequence must contain at least 3 distinct terms". I'd also definitely recommend disallowing finite sequences, as well as the 20% bonus (which is very ambiguous) Nov 17 '16 at 18:33
• @NathanMerrill That's a good idea for a change to #3, but as for being able to simply combine existing sequences, there's plenty of existing sequences like that are already in the OEIS even without necessarily being important. Nov 17 '16 at 18:44
• @GabrielBenamy right, its not necessarily a bad thing, its just that most sequences generated aren't going to be that interesting. Also, what's to stop me from simply adding a random "9" number to the beginning of the sequence, or replacing the first term with "9"? Nov 17 '16 at 18:45
• Consider the family of sequences parameterised by x where S(x, n) = n >= x ? n+1 : n. Only a finite number of those sequences are either in OEIS or a linear transform of a sequence in OEIS. Are they caught by "just the handful of numbers I came up with to fit this problem"? IMO it's ambiguous. Nov 17 '16 at 19:22
• That's a good point. Is there any way to salvage this concept? Nov 17 '16 at 19:24
• This is similar to the question "print something with no results on google". It got closed for being a question about Google's database, not about code-golf, so this one will probably be closed too. Nov 19 '16 at 13:37

# Golf + Polyglot + Circle = ?

In the original challenge, we asked you to do this:

Program | Language | Result
--------|----------|----------
A       | A        | Program B
B       | B        | Program A
A       | B        | Program C
B       | A        | Program C
C       | A        | "Wrong language!"
C       | B        | "Wrong language!"


Now we're asking you to do this*:

Program | Language | Result
--------|----------|----------
1       | 1        | Program 2
2       | 2        | Program 3
3       | 3        | Program 4
|    ...   |
X       | X        | Program 1
--------|----------|----------
1       | Any but 1| Any member of Set %
2       | Any but 2| Any member of Set %
|    ...   |
X       | Any but X| Any member of Set %
------------------------------
Set %   | Any lang | "Wrong language!"


(see original challenge for clarification)

## Rules

• Do not grab source off of internet, or read own code from file
• Programs don't have to be distinct - you can make a polyglot quine
• Don't take input for any of the programs
• Different versions of the same language count do as different languages. (although this is discouraged because it leads to boring solutions)
• Standard loopholes apply

## Scoring

Score is byte_count_of_program_one/2.75**languages_supported, the submission with the lowest score wins.

## Template

Because of its length, the answer template is here.

*not that I'm expecting X to be so large

• +1 this comment if you think the title should be "Polyglot-Quine-Codegolf Returns!" Nov 23 '16 at 23:38
• +1 this comment if you think the title should stay the same Nov 23 '16 at 23:38
• Reply to this question if you have a better title Nov 23 '16 at 23:38
• I personally think the title is way too descriptive, but "polyglot-quine-codegolf" isn't really descriptive enough. The problem is, I don't currently have a better idea... Nov 24 '16 at 0:12

# Signs in Permutations

### Introduction

Let's take the permutations of 123.

123
132
213
231
312
321


We can insert signs in between the numbers and count how many > signs there are:

1 < 2 < 3 # 0
1 < 3 > 2 # 1
2 > 1 < 3 # 1
2 < 3 > 1 # 1
3 > 1 < 2 # 1
3 > 2 > 1 # 2


We can arrange this in a table with n corresponding to the number (in this case 3) and k corresponding to the number of > signs, you get this:

┌───┬───┬────┬─────┬─────┬────┬───┐
│n\k│ 0 │  1 │  2  │  3  │  4 │ 5 │
├───┼───┼────┼─────┼─────┼────┼───┤
│ 1 │ 1 │    │     │     │    │   │
│ 2 │ 1 │  1 │     │     │    │   │
│ 3 │ 1 │  4 │   1 │     │    │   │
│ 4 │ 1 │ 11 │  11 │   1 │    │   │
│ 5 | 1 │ 26 │  66 │  26 │  1 │   │
│ 6 │ 1 │ 57 │ 302 │ 302 │ 57 │ 1 │
└───┴───┴────┴─────┴─────┴────┴───┘


Given an n and k, print the number in the table corresponding to that n and k.

Remember, this is , so the code with the fewest bytes wins.

Related OEIS sequence

• Dupe Dec 1 '16 at 22:07

I want to post the question here to make sure it is suitable.

# Question: Word Equations

Given a word equation, the solution must output the answer.

My definition of a 'word equation' is an equation where the operators are words.

The operators will be spelt as

The solution must take one input

The solution must give one output

### Examples:

Input: 7 add 8 Output: 15

Input: 9 times -2 Output: -18

Input: 24 divide 2 Output: 12

Input: 4 minus 5 Ouput: -1

You are not required to deal with divide by zero errors.

Fewest characters will win

Feedback is welcomed

• What is the winning criterion? Dec 2 '16 at 22:14
• @daHugLenny fewest characters, should have known to include that Dec 2 '16 at 22:59
• Be aware that you will receive many answers in the form: substitute words with corresponding char (+-*/), then evaluate the string you got. Non necessarily a bad thing, just pointing this out in case you expect people to build a calculator from scratch.
– Leo
Dec 3 '16 at 18:41
• @Leo the way I expected to solve it was by char substituting. However building a calculator from scratch only using + and - could be an interesting challenge Dec 3 '16 at 18:55

## GoL flooding

Considering a 1000x1000 grid (no wrapping, borders dead), your task is to grow the maximum "stable" population from the fewer individuals.

For the purpose of this challenge, the definition of stable is a configuration who repeat with a period of less than hundred(100) generations.

# Scoring

Your score is lowest number of live cells in your stable population divided by the number of initialy live cells, highest score win

• How many generations does the simulation run before the score is tabulated? Dec 8 '16 at 13:48
• @TimmyD I would say 10.000 but feel free to suggest a better number if you think it could improve
– Sefa
Dec 8 '16 at 14:07

# Convenient Palindromic quine golf, Cops cops-and-robbers

## Cop's Challenge

A program is conveniently palindromic if

it is equal to the string derived when its reverse has all its parentheses (()), brackets ([]), and braces ({}) flipped. No other characters are special and require flipping. (<> are sometimes paired but often not so they are left out.)

copied from this challenge.

Write a conveniently palindromic program that prints its own source. This is the robber's goal:

• Remove byte(s) from the cop's program so that the resulting program:
• prints the original source, or
• prints the new modified source
• Resulting program need not be a convenient palindrome

## A counterexample

### JavaScript

(function $(){console.log('('+$+'())')}())//((){('(()'+$+')')gol.elosnoc}()$ niotcnuf)


is easily cracked because the robber can remove all the characters past the comment and it will still print its own source.

## Rules

• Program must be longer than one character
• No reading from a file or grabbing from an external resource
• Submissions that aren't cracked for 7 days are marked as "safe", and cannot be cracked anymore
• Cop's submissions after XX/XX/XX are non-competing (can be pushed back depending on popularity), so there are still robbers around to crack it
• The shortest safe solution in bytes wins.
• Robbers won't have a chosen winner

• This is basically just a "comment-free palindromic quine" challenge, right? When those challenges have been run elsewhere, the comment-freedom has been verified via brute forcing rather than via a robber, and I suspect that the robbers might not have much to do here. (That said, some languages are slow enough that brute-forcing their correctness would be difficult.) In other news, you should probably require proper quine rules, even if we can't quite define them; under your current rules, 1 is a valid palindromic quine in PHP.
– user62131
Dec 9 '16 at 22:41
• I would possibly change the palindrome restriction to convenient palindromes, as these are way easier to implement in most common languages such as JS and Python. Dec 9 '16 at 23:01
• @ais523 1. Yas. That was my aim! 2. It's difficult to implement a brute-force solution for a longer submission, how would that work? 3. Program must be longer than one character 4. Thanks. Dec 10 '16 at 14:27
• 11 then :-P. Also, in a way I think this might be more interesting with true palindromes, as it forces you to hide the backwards string somehow, but I agree that it would disqualify a lot of languages.
– user62131
Dec 10 '16 at 14:40
• @ais523 I'll do a true palindrome one then a convenient palindrome one later, perhaps? (also 11 then means ?) Dec 10 '16 at 14:44
• @ais523 When those challenges have been run elsewhere, they have? Dec 10 '16 at 14:51
• Neither this challenge nor this challenge has the same task as yours, but they both disallowed comments in much the same way as this one (i.e. by ensuring that deleting from the program breaks it).
– user62131
Dec 10 '16 at 15:27

# Prelude:

Joke languages are allowed.
Submissions' scores will vary depending on whether they'll be made in a joke language, golfing language or a Turing complete language, don't worry if your score is high just because you chose a TC language.
That being said, let's get right into the challenge...

# Challenge:

Make a program as close as possible to the language name and document what it does in the description.

# Scoring/rules:

(will assume a simple language I made up, called Printr that has only a print() command that can take a argument to print but doesn't have to)

• Submissions that contain more than a 1/2 of whole language name in a string (ex. print("Printr")) are banned.
• Submissions must not throw any errors/exceptions/warnings (writing to an error stream is okay though).
• +1 for every char away from language's name (ex. print("r") is 4 chars away, (""), +4 points)
• Submissions need to contain (at least once) the language name "in a row" excluding nonalphanumeric characters and ignoring case (ex. print(" *@)!R") is okay, print("lolz R") is not okay)
• Duplicates of the name will be counted as other characters (ex. print("r") print("r") is still 4+1 [space]+10=15).

By looking as close as the language I mean having the least score (since scoring is based on other characters than the language name itself.

# Example:

## Printr, score 4:

print("r")

This program prints "r" then quits.

• is it allowed to throw an error? Dec 18 '16 at 14:00
• @Flp.Tkc, good question, errors shouldn't be allowed (syntax error be like). Dec 18 '16 at 14:07
• What about a warning to STDERR? Stray error output is allowed by default on meta... Dec 18 '16 at 14:19
• @Flp.Tkc, should be okay. Dec 18 '16 at 14:24
• ><>, in ><>, score 0, infinite loops. Dec 18 '16 at 15:56
• or actually if we're excluding non-alphanumeric characters, this could also be golfed down to > or empty depending on if outputting "something smells fishy..." is a valid program. Dec 18 '16 at 16:00
• in brainfuck you can just write brainfuck and it won't do anything... Dec 19 '16 at 17:31

# Print number of possible values of X if:

• Code 1: X is dividable by 3, X contains the number 3 and input() < X < 10000
• Code 2: X is dividable by 7, X contains the number 2, X doesn't contain the number 3 and input() < X < 5000

Sub-Challenge:

Do the same but instead of printing the number, print the values

Disclaimer: This is my first code golf challenge, and it's very simple, but could bring up some really short answers and cool languages

• First thing: Sub-challenges are not a good idea. People will write the shortest code they can and just disregard the sub-challenge. Jan 16 '17 at 19:49
• Should you output the sum of the numbers from both two bullet points, in one? I don't think it benefits the challenge to have two different upper limits. I can see why you want it there, but I personally don't think it's a good thing. This needs some good test cases. Jan 16 '17 at 19:52
• Those were actually different puzzles, sorry! Jan 17 '17 at 12:10
• Two different independent puzzles in one challenge is not a very good idea either I'm afraid. I think it would be better to use the same upper limit and require the numbers from both 1 and 2 together, I.e. the union of the two sets. Jan 17 '17 at 12:23

Mark got an idea of making a path finding algorithm for auto driving vehicles.

Unfortunately, Mark doesn't yet know about programming, so he decided to get help from the code golfers.

# How should it work?

First, we input how many 'nodes' there are. we call it 'N', and its an integer up to 16 bit values.

Second, we input what nodes are connected to each nodes, and the length of the connection. for example, if the diagram is

(1)-5-(2)-2-(3)

the input should be

2 5  //node 1 is connected to node 2, and the length is 5
1 5 3 2 //node 2 is connected to node 1 and the length is 5. and its also connected to node 3, and its length is 2.
2 2  //node 3 is connected to node 2, and the length is 2.


then, finally, the starting node, and the final node. they are inputted as node numbers.

# Examples

Input:

3
2 5
1 5 3 2
2 2
1 3


Output:

1->2->3

Explanation:

(1)-5-(2)-2-(3) starts from 1, and ends in 3. there is only one path, and it is the answer.

# Specs

Standard rules apply.

• Possible duplicate. And another related question. Suggested tags for this challenge: graph-theory and path-finding Jan 17 '17 at 9:35
• Not a duplicate. Though related, clearly not a duplicate. Jan 17 '17 at 10:32
• By the standards of this site, it is a duplicate. Jan 18 '17 at 11:48
• Proof of duplicate? Jan 18 '17 at 11:50
• Currently the only differences are that not all nodes are necessarily connected and the specified input format. However both input formats are tight and string based, so I'd like to see this challenge with a loosened input format, e.g. allow all reasonable input formats for a weighted graph. Jan 18 '17 at 11:53
• Okay, thanks for the suggestion. @Laikoni Jan 18 '17 at 11:55
• The way we identify duplicates on this site is to ask "Can answers from one question be copied over to the other with little or no modification and still be competitive?" Jan 19 '17 at 7:09
• @trich Seems legit, but those two question have quite of a difference, and second, I have came up to this idea all by myself, and being tagged as dupe, seems a tad unfair. Jan 19 '17 at 12:12
• Being marked as duplicate doesn't mean "This is a bad challenge", it just means "This challenge has already been posted". This is a good challenge idea, but we only host each challenge once, so that all the answers are in one place. Jan 19 '17 at 13:42

# Generate "N" random numbers which their sum is exactly "N"

Your goal is to generate N pseudo-random numbers R, then sum or subtract all the R togheter and obtain as result N.

Rules:

• You get N from standard input as integer number, such as N <= 1000.
• You can't perform operations like sum 100 times 1, 50 times 2, or similar...
• R shall be generated in any reasonable non-deterministic way
• R shall be integer such as 0 <= R <= N.
• R can't have a constant value each time you generate it. For example you can't generate R with methods like R = rand(1,2) with the result that 1 <= R < 2 (R is constantly always =1), and then sum R 100 times.
• You can perform only sums or subtractions of the generated R's.
• You have to sum or subtract the newly generated R to the total of R's.
• Standard loopholes are forbidden.
• This is so the shortest code wins.

Example 1:

1. Get N=100 from standard input.
2. Generate 100 pseudo-random integer numbers R such as 0 <= R <= 100.
3. Sum or subtract all the R and obtain 100(N) as result.

Example 2:

1. Get N=20 from standard input.
2. Generate 20 pseudo-random integer numbers R such as 0 <= R <= 20.
3. Sum or subtract all the R and obtain 20(N) as result.

Not-so-smart-but-working example in C#:

using System;
public class Program {
public static void Main() {
int S = 0, N, R = 1, X;
Random rnd = new Random();
for (int I = 1; I < (INPUT+1); I++) {
X = (INPUT+1) - I;
if (I == INPUT && S == INPUT) {
R = 0;
}
N = rnd.Next(R, X);
if (S <= INPUT) {
S = S + N;
} else {
S = S - N;
}
Console.WriteLine("I = {0}      N = {1}     S = {2}", I, N, S);
}
}
}


Test online

• I don't understand what the goal is. If my program accepts the number 20, I have to generate 20 random numbers that sum to 20? So I generate random real numbers? Integers? Positive integers? Positive-or-zero integers? Jan 19 '17 at 15:27
• "You get N from standard input as integer" and "N shall be generated in any reasonable non-deterministic way" seem incompatible. If these are referring to two different things, then it would be clearer to not call them both N. Jan 19 '17 at 15:42
• It's not clear to me what your working definition of "random number" is, especially given that the system to be implemented has fewer degrees of freedom than "random" numbers. For a question about random numbers to be well specified it should state the distributions to be followed (modulo limitations of PRNGs). Jan 19 '17 at 21:17
• @GabrielBenamy Yes you understood correctly the challenge. I changed it adding more specs and more details. If you have further doubts please let me know. Jan 20 '17 at 8:03
• @trichoplax Thanks for your comment. I edited the question to make it more clear with more details and specifications. Please let me know if I can improve it in a better way. Jan 20 '17 at 8:04
• @PeterTaylor I am not sure I get what you mean, probably they are too advanced concepts for me :) Anyway I largely edited the question to make as more clear as possible. If you think it needs to be improved please give me your suggestions on how to make it a more clear and better challenge. Jan 20 '17 at 8:07
• What about cases where it is impossible to sum/subtract to R? For example: N=5, R=[0,1,1,1,1]. Jan 20 '17 at 9:46
• @Emigna if you try my C# example it works for N=5. Jan 20 '17 at 11:22
• If random distributions are too advanced a concept for you then I think you should abandon the idea of trying to post a question about sums of random variables. Jan 20 '17 at 11:23
• The explanation is still unclear, and needs work in itself. Separately from that, I recommend example inputs and outputs (literal output rather than explanation). The specification should be unambiguous before seeing the examples, and then the examples should come afterwards to confirm correct understanding of the spec. At present I believe the intention is to output an expression containing N integers, each added or subtracted, each in the range [0, N], evaluating to N, and for the integers to be randomly distributed amongst those that meet these criteria. Jan 20 '17 at 11:55
• @trichoplax thanks for your comments and explanations, although the challenge seems clear to me it's obvious that I am missing something that goes beyond my knowledges. I think I will delete the post maybe reviewing it. Jan 20 '17 at 12:24
• @PeterTaylor I got an idea and I posted it here to have feedbacks about it and maybe help or suggestions for improvement, but as I said obviously I am missing something that I haven't studied. I'll delete the challenge. Jan 20 '17 at 12:28
• A post always seems clear to the person who wrote it, because they already knew what they meant. That's why the sandbox is so useful - I can't tell if my challenge is really clear until I show it to other people. Being unclear doesn't make it a bad challenge. It just means it needs rewording before it will be ready. Here in the sandbox you don't need to delete. You can simply keep making adjustments and getting feedback until it's ready. Jan 20 '17 at 13:17

# Make the Shape

This is a wider version of this question, so it may not get posted.

Given a single character e.g. H or ! and a sequence of letters e.g. abcdefghijklmnopqrstuvwxyz you must output the character drawn using the letters in the sequence. If you need more letters, just loop through the sequence again.

# Input

A single character, c. You can assume that it will always be one character.

A sequence of charaters s. All characters must be printable ASCII letters.

# Output

c made up of the letters in s

# Examples

Let's say c = "H" and s = "abcdefghijklmnopqrstuvwxyz". The correct output would be

ab   cd
ef   gh
ij   kl
mnopqrs
tuvwxyz
ab   cd
ef   gh
ij   kl


c = "!" and s = "hello, world" outputs

he
ll
o,
w
or

ld


# Rules

• Shortest code (in bytes) wins
• Any correct output may be outputted i.e. either one of the example
• c must be one character
• Standard golfing loopholes apply
• Lines must be 2 characters thick
• You must use every letter in s at least once to make c
• Either a full program or a function, NO snippets
• You need definitive rules about the shape and size of each letter or else this will probably be closed as unclear. Jan 22 '17 at 17:35
• This is similar to another question, that I can't find at the moment. It's about making words from other words, nested n times. Jan 22 '17 at 18:42
• "Both inputs must be surrounded by "" - um, why? This isn't a parsing challenge. Input should be allowed to be taken in any reasonable format, as is the code-golf standard. You should only break the IO defaults if it is of paramount importance to your challenge, whereas it just looks like a trivial pointless rule here. Jan 22 '17 at 18:49
• It was to clarify for languages that need " at input. I'll change it.
– user63571
Jan 22 '17 at 19:06
• Also whoever downvoted can you tell me why? I might be able to improve the question
– user63571
Jan 22 '17 at 23:26
• If you want to limit it to alphabetical characters, you may use my list of ASCII art: codegolf.stackexchange.com/questions/99913/5-favorite-letters Jan 23 '17 at 19:36
• Also, Jack, they're probably downvoting because of how open-ended it is. You haven't defined the layout of any of the characters beyond H!. Jan 23 '17 at 19:52
• Thanks for the help
– user63571
Jan 23 '17 at 20:24
• If you want to reply to someone, tag them - @JackBates Jan 23 '17 at 22:49

# Why is it buff...........ering?

As the Internet isn't perfect, occasionally the videos we watch start buffering. When this happens, I get very annoyed. As the wait gets longer, I get even more annoyed.

Your task is to write a function or program that waits a random amount of time and then outputs an angry message with the level of anger increasing the longer it waits

None

# Output

An angry message and the length of the wait

# Examples

Time waited: 5 seconds

Angry message: Never mind!

Time waited: 30 seconds

Time waited: 1 minute

Message: Die computer, die!!!

This code is an example in Python, obviously ungolfed.

import time
import random
messages = ["Never mind!","Getting annoyed","I hate YouTube!","Die computer, die!"]
slept = random.randint(5,60)
msg_num = slept//len(messages)
time.sleep(slept)
print("Time waited:",slept)
print(messages[msg_num])


# Rules

• Messages are up to you
• The time to wait ranges from 5 seconds to 1 minute
• Standard code-golf rules apply
• Standard code-golf loopholes are disallowed
• This won't work as code-golf because it'd mostly be about golfing the angry messages in question, and golfing English is always highly subjective; how angry does the message have to be before it qualifies as "angry"?. I don't really see it working with another victory condition, either.
– user62131
Jan 25 '17 at 19:14

# Don't know what to call this

Some people here may be familiar with Euler's identity. If not click the link

Now you know what the equation is, what if we change it slightly? No-one like to imagine numbers so instead we're going to use an unknown number x.

So first we get rid of i and replace it with x. Now we all know that i*i is -1. But with i gone, so must -1. Let's change it to x^2 instead. However this means there is only one solution. So instead let's make it x^random_integer(0,x) to spice it up

If we change the equation from e^(i*π) - 1 = 0 to e^π / (x^random_integer(0,x)) = 0 we now have something we can work with.

Given an integer or float as input, x, calculate if it satisfies the above equation. Your code should result in True or False or the closest equivalent.

# Input

A single number between -(2^32-1) or what ever your language can handle and 2^32-1 or whatever it can handle called x

# Output

A Boolean that says whether the number satisfies the above equation and the random number that is picked

# Rules

• The code must calculate if x fits this equation rather than take it from an outside source

• Results in True if within -0.1 and 0.1

• This is code-golf so shortest code (bytes) wins

• Builtins that postdate this challenge are allowed unless they are specifically designed for the sole purpose of winning this challenge

• Standard code-golf loopholes apply

# Examples

x = 5
e^π / 5 ^ rand(0,5) = 0
rand(0,5) = 2
results False (0.92)

x = 6
e^π / 6 ^ rand(0,6) = 0
rand(0,6) = 4
results True (0.01)

• Most languages don't have accurate enough floats to be able to compare the two sides as equal. As such, they could just arbitrarily return false. You might want to add a precision level. (Also, I assume there are only finitely many solutions anyway…)
– user62131
Jan 25 '17 at 20:19
• Sorry I'm a bit all over the place. I'm not perfect with the maths and keep changing it so it might work :/
– user63571
Jan 25 '17 at 20:30
• I found something that works! :)
– user63571
Jan 25 '17 at 20:44
• Check rules number 2 and the examples
– user63571
Jan 25 '17 at 20:55
• According to your equation the rule number two has both of those as false, 0.92 and 0.64 are not 0.1 away from 0. Random numbers are also usually considered a bad thing to be using in the challenges. Jan 25 '17 at 20:56
• Sorry got the example wrong, fixing now. I thought it was to 1 while I did the first one :/
– user63571
Jan 25 '17 at 20:57
• e^π / (x^random_integer(0,x)) = 0 requires e^π = 0 (false) or x^random_integer(0,x) to be infinite (in which case it's not strictly true, but it is in the limit). The only way it's going to be infinite with real x and non-negative random_integer(0, x) is if x is infinite. Therefore the explanation of the task effectively states that the task is to return False. It's very confusing that the rules then contradict this. Jan 25 '17 at 23:06
• @PeterTaylor If you look at rule 2, it explains how to beat this. Also check the example true one
– user63571
Jan 25 '17 at 23:09
• My point is precisely that rule 2 and the second example contradict the problem statement, which therefore needs fixing. Jan 25 '17 at 23:26
• I'm not sure if I understand you correctly. The problem is to find if x satisfies the equation e^pi / x^rand(0,x) = 0 plus-minus 0.1. Rule 2 and the examples both follow this problem and output the correct result.
– user63571
Jan 25 '17 at 23:32
• The problem statement clearly says "Given an integer or float as input, x, calculate if it satisfies the above equation" where the above equation is e^π / (x^random_integer(0,x)) = 0. Then half a screen later the rules say, in effect, "Actually, what I said earlier was a lie." That's not the way to write a clear specification. One way to fix it would be to change the problem statement to say "If we change the equation from e^(i\*π) - 1 = 0 to e^π / (x^random_integer(0,x)) = 0 we now have no solutions, so let's make it an inequality: abs(e^π / (x^random_integer(0,x))) <= 0.1". Jan 26 '17 at 8:34
• What rules make it say "What I said earlier was a lie"?
– user63571
Jan 26 '17 at 15:34
• Loophole found: Consider a/(x^b): For a non-zero a, this fraction gets closer to 0 as x^b gets closer to infinity, where higher values for b result in outcomes closer to 0. As such, if you want to check if the fraction is smaller than some other value c if b goes from 0 to x, you only have to check if a/(x^x) < c, because if that's false, there will be no value for b smaller than x for which it is true.
– Luke
Jan 26 '17 at 19:03
• What's your point? Are you suggesting I change it in some way?
– user63571
Jan 26 '17 at 19:28
• You should at least remove the word "random" from the question, since this has nothing to do with randomness. The question is stated a lot more complicated than it actually is.
– Luke
Jan 26 '17 at 20:07

# Count My Change

Your task is to sort an array containing the strings "quarter", "dime", "nickel", and "penny" any number of times in no specific order and sort them so that they are in this order: quarter dime nickel penny (in other words, greatest to least monetary value).

## Rules

1. Your program must take an array as input containing the names of U.S coins and sort them from greatest to least by monetary value.
• For those who are not from the U.S or don't use change, the values of U.S coins, from greatest to least, are:
• Quarter: 25 cents
• Dime: 10 cents
• Nickel: 5 cents
• Penny: 1 cent
2. You may sort this array in any way you wish, as long as the output is ordered by the monetary values shown above.
3. Input can be taken in any way, be it command-line arguments or STDIN.
4. An input array would be all lowercase strings, something like this:
• quarter dime nickel nickel quarter dime penny penny
5. If there is a value in input that is not a quarter, dime, nickel, or penny, your program should output 0 .

## Test Cases

• penny nickel dime quarter should become: quarter dime nickel penny
• nickel penny penny quarter quarter quarter dime dime dime dime
• quarter dime nickel nickel quarter dime penny penny
• euro quarter nickel dime would output 0 because a euro is not U.S currency.
• esac (not a test case, I just like bash a lot)

This is , so standard rules & loopholes apply.

• Test cases please? Feb 3 '17 at 16:01
• @MistahFiggins On it Feb 3 '17 at 16:26