What is the Sandbox?





Add Proposal

Search the Sandbox

Browse your pending proposals

Get the Sandbox Viewer to view the sandbox more easily


| |

2915 Answers 2915


Make an Anti-compressor (WIP)

Create an algorithm that reversibly and losslessly makes files bigger. You must create the anti-compressor. The de-anti-compressor can be your own creation or something that already exists. The two programs do not need to be written in the same language.

Objective Validity Criteria

  • Inputs into the anti-compressor can be binary files using any or all byte values.
  • All inputs into your anti-compressor must produce outputs that are at least one byte longer.
  • The anti-compressor is losslessly reversible by either an existing program or your own.
  • The de-anti-compressor must work on (at least) all possible outputs of the anti-compressor.
  • Both the anti-compressor and de-anti-compressor can be executed on an actual computer. Keep execution time within reason (e.g. no \$O(n!)\$ programs, please)

This will be a unless I get a good suggestion for an objective scoring system.

My only idea so far is that the score could be based on the decompression ratio, cancelled out by how well gzip compresses the output. Unfortunately, this could be abused easily by inserting arbitrarily large amounts of random padding between significant bits of information, leading to an unbounded score that can always be beaten with trivial modification.

| |
  • \$\begingroup\$ Besides the usual issues with pop-cons, I'd really have no idea how to vote because the task is so broad and I don't know what's meant to be interesting in an answer. \$\endgroup\$ – xnor May 11 at 20:00
  • \$\begingroup\$ @xnor that's fair. I'm not entirely sure if this challenge is a good idea in the first place, but I got an upvote earlier, so I thought it might be worth it to refine it and see where it goes. I could see the subjective criteria being along the lines of the funniest or most clever way of anti-compressing a file. Injecting filler data, random or not, is not very clever, but having it output an overly verbose java program that outputs the original file when executed is both humorous and clever- but perhaps not as much as other ideas I haven't even thought of. \$\endgroup\$ – Beefster May 11 at 23:09
  • \$\begingroup\$ @Λ̸̸ The issue with that scoring system is that you can always make a file more bloated. Someone doubles every byte? I can just triple every byte. That kind of oneupmanship is not interesting. I can try to put limits on exactly what kind of bloating is allowed so that there is some sort of soft upper bound, but then the challenge becomes one of abusing the rules and finding clever interpretations and loopholes- also not very interesting. \$\endgroup\$ – Beefster May 12 at 15:08
  • \$\begingroup\$ I have an idea: make the answerer choose an existing compression algorithm, and then create an anti-compression program given an input string.The anti-compressed string, when compressed with the chosen algorithm, must produce the exact same output as the input. That way, the anti-compressing method of randomly inserting characters in the input string can be avoided, since there isn't a way to un-double speak a given input character, and for a string with randomly inserted characters, the compressor will not know which characters to leave out during the compression. \$\endgroup\$ – user92069 May 13 at 2:36
  • \$\begingroup\$ Given that, the scoring criterion can now be simply code-golf, since there isn't a way to create boring answers, and the only possible way to score answers left is just code-golf. \$\endgroup\$ – user92069 May 13 at 2:38
  • \$\begingroup\$ @Λ̸̸ At that point, it would make more sense to make a jillion different code-golf challenges since this essentially defines an entire class of golfing challenges. \$\endgroup\$ – Beefster May 13 at 16:32

Print all sequenced variants of the SARS-CoV-2 (COVID-19) genome in FASTA format


The FASTA format has the name of the sequence data following a >, a newline, 60 characters of As, Ts, Cs, and Gs, a newline, 60 characters of As, Ts, Cs, and Gs, and so on.

You need only print the name of the, not the location it came from. For example:

| |
  • \$\begingroup\$ I can't imagine what good does requiring newlines every 60 characters do to the challenge. That site also has very many files linked, and you have not specified which ones we need to use, nor you provided us with the expected output (a plain link to a random website where we have to scrape and parse several thousands of files you haven't told us about is not enough). Since there are thousands of them, I strongly suspect suspect that zpaq will win this time. \$\endgroup\$ – my pronoun is monicareinstate Jun 14 at 8:13

Wuhan Xi Estimates

Create a program that takes two base-ten integer number inputs (w,x). The program should output the closest integer number that is x order of magnitude smaller than w, rounded downwards. The output should be zero if the result is less than 1.

Test cases

f(10,1) = 1
f(10,2) = 0
f(1000000, 3) = 1000
f(888, 2) = 8
f(99999, 4) = 9
f(7777777, 8) = 0
f(123455, 5) = 1
f(123455, 4) = 12345
f(123455, 0) = 123455

Example Code
Here's an ungolfed example in Lua:


if (b+0 > #a) then 
    d = (a+0)/(10^b)
    print (math.floor(d))

Try it online!

General rules

  • This is , so shortest code in bytes in its respective language wins.

  • Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN (with the specification above)/STDOUT, functions/method with the proper parameters and return-type, full programs.

  • Default Loopholes are forbidden.

  • If possible, please add a link with a test for your code (TIO).

| |
  • \$\begingroup\$ Can we take input as string where the two numbers are separated by "E-" ? \$\endgroup\$ – Adám Jun 22 at 21:52
  • \$\begingroup\$ @Adám, Is "E-" executable code? If so, I guess that's fine, but it has to be part of the byte count. If it is just a glorified separator, or a switch of some kind, then yes and doesn't have to be included in the byte count. \$\endgroup\$ – ouflak Jun 23 at 5:55
  • \$\begingroup\$ My idea what that one could do something like floor(input) where input is e.g. 888E-2 thus trivialising the challenge. \$\endgroup\$ – Adám Jun 23 at 5:57
  • \$\begingroup\$ @Adám, That would be fine, and the challenge will have many 'trivial' answers in several languages. I'd be surprised if there isn't atleast a few 2/3 byte solutions. \$\endgroup\$ – ouflak Jun 23 at 6:00
  • \$\begingroup\$ Maybe mention in the challenge text that this amounts to computing \$⌊w×10^{-x}⌋\$? \$\endgroup\$ – Adám Jun 23 at 6:10
  • \$\begingroup\$ @Adám, There are other ways to look at it. My Turing Machine Code solution certainly won't be computing any powers. \$\endgroup\$ – ouflak Jun 23 at 6:34
  • \$\begingroup\$ Is that integers or positive integers? ;) \$\endgroup\$ – Trebor Jun 23 at 16:07
  • 1
    \$\begingroup\$ The wording 'closest integer number that is \$x\$ order of magnitude smaller than \$w\$' is ambiguous. I initially interpreted it to mean, e.g., f(1000000, 3) = 9999 (closest integer to 1000000 that is 3 orders of magnitude smaller). As Adám said above, it seems that you're just asking for \$\lfloor w\times 10^{-x}\rfloor\$. \$\endgroup\$ – Dingus Jun 25 at 0:22

Code-challenge: Guess my number

The challenge



The scoring



| |
  • 5
  • 3

Bovine Ignorance



+++++ +++++
> +++++ ++
> +++++ +++++
> +++
> +
<<<< -
> ++ .
> + .
+++++ ++ .
+++ .
> ++ .
> .
+++ .
----- - .
----- --- .
> + .


| > + .                                   |
\ ++                                      /
        \   ^__^
         \  (..)\_______
            (__)\       )\/\
             >. ||----w |
                ||     ||



| |
  • 2
  • 2

99 Bottles of Errors




The scoring:


The rules

  • All the code must be in one file.
  • Any language is allowed.
| |
  • 5

Create an Identicon Generator



enter image description here


| |
  • 5
  • 5
  • 1

Underhand Bejewled


Bejewled game rules


  • image related:

enter image description here

Your challenge





Winning criteria

This is popularity contest. So highest rated game wins

| |
  • 1

Shortest Program that May or May not Terminate:



| |
  • 2

Something Else - ASCII Art maker:

A text to ASCII art generator maker, the program must input a string and return ASCII art from it. Something like patorjk.com/software/taag/. It has to use the Graffiti font. The winning criteria is the whoever gets the most likes.

| |
  • 1
    \$\begingroup\$ Hello! Just a few things to point out: 1) The current spec is very broad. For example, what fonts, how does spacing look, what characters need to be supported... there's a lot more details that need to be included than just "return ASCII art of this text" \$\endgroup\$ – Sp3000 Feb 24 '15 at 4:07
  • 1
    \$\begingroup\$ 2) What's the winning criterion? Popularity contest? Code golf? \$\endgroup\$ – Sp3000 Feb 24 '15 at 4:08

Identifying a Sonnet

This challenge is about determining if a given file (read-in from stdin) meets the criteria to be a sonnet. You may use any language for this challenge. If your language supports an API to use an online dictionary you may use that API, if your language doesn't then too bad.

Additionally, it is preferred if your language is one that can be ran directly from the command line and is a language that has a compiler or interpreter available directly from my distro's repos(Fedora), as I would rather just use a bash script to test the various programs, then test each program manually.

Definition of a Sonnet

  • Has 14 Lines (lines are denoted as the standard newline on your operating system).
  • Has a definite rhyme scheme, it will have one of the following rhyme schemes
  • Iambic Pentameter - consists of alternating stressed, unstressed syllables. This doesn't have to be perfect 100% of the time, just at least 50% of the time.

In order for your program to declare a given string a sonnet, it must meet all of the above criteria.

Additional Notes

You do not have to identify the following:

  • Thought Structure - too intense for a code golf challenge, and too subjective.
  • Topic - computer lacks context to determine this


Input will be read from stdin. This is the string that you will be declaring to be or not to be a sonnet.


Your program will output either yes or no for the question:

Does this string meet the given requirements to be a sonnet?

As this is code golf yes or no can be abbreviated to Y/N.


The solution with fewest number of bytes win that has the highest accuracy ratio for the correct identification of a sonnet. The preference is for higher accuracy rather than brevity of the program.

Test Data and Resources

What is not a sonnet

The following are examples that you program should return false on:

  • Beowulf
  • Haiku
  • Input that doesn't have exactly 14 Lines in it
  • The text of this question.
  • The text of just about any other question on StackExchange.
  • Things that don't have a rhyme scheme. See Below

Not A Sonnet

A man got on a boat
The boat was leaky
and had poor construction
For it was made by a one-eyed blind man
and his dumb intern
As soon as he got out of port
at the fort
it started to sink
eventually, it tanked.
And it capsized
If only that shipwright
wasn't so blind deaf and dumb
as microsoft tech support
That's not much support at all.
| |
  • 2
    \$\begingroup\$ I think without dictionaries for rhymes and stresses this is probably not a good idea. Of course you can use some sort of accuracy ratio, but then you also need false positives, and you need a lot more examples than the few on the pages you've linked. But if you do this there's no requirement to actually recognise the sonnets by their rhymes and stresses - instead, I'm pretty sure, people will just regex golf the test sets. \$\endgroup\$ – Martin Ender Mar 24 '15 at 19:36
  • \$\begingroup\$ @MartinBüttner I updated the requirements with an accuracy percentage, and added the option to use an API to look up terms from a dictionary. \$\endgroup\$ – HSchmale Mar 24 '15 at 19:57
  • 1
    \$\begingroup\$ 1. Test data which only covers one possible output isn't test data. I can write a program which always outputs Y in as little as one byte and it will pass all of the linked "test data", but it comes nowhere near to meeting spec. 2. Unless you specify which rhyme/stress dictionary to use, you can't guarantee that the test data is "correct". \$\endgroup\$ – Peter Taylor Mar 24 '15 at 20:20
  • \$\begingroup\$ @PeterTaylor I added examples of what is not a Sonnet. \$\endgroup\$ – HSchmale Mar 24 '15 at 20:32
  • 1
    \$\begingroup\$ I'm not sure how to say this, but it feels as though this task has a lot of individual parts, each of which could be quite tricky. Especiallly detecting rhymes/syllables/stresses, since words can be pronounced/stressed differently based on context. Also if you're using Shakespeare's sonnets I have no idea where to get rhyming and stress dictionaries for Elizabethan English... \$\endgroup\$ – Sp3000 Mar 25 '15 at 14:18
  • \$\begingroup\$ To make this interesting, you'll need some interesting near-misses: non-sonnets that can't be detected by something simple like counting lines or words per line. \$\endgroup\$ – xnor Mar 25 '15 at 20:59
  • \$\begingroup\$ @xnor You mean a file with a that looks like a sonnet but has no rhyme. \$\endgroup\$ – HSchmale Mar 25 '15 at 21:04
  • \$\begingroup\$ Yes, for example. Or, one with rhyme by wrong rhythm. Or, one with nonsense characters that seem to "rhyme". \$\endgroup\$ – xnor Mar 25 '15 at 21:06
  • \$\begingroup\$ @Sp3000 You can just use modern english, or just base it on words that have similar endings. \$\endgroup\$ – HSchmale Mar 25 '15 at 21:11


Anti golfing - Write the longest program not repeating any character







  • Variable names are only allowed to consist of a single character








Example in awk


It prints 15.5, score is 42.





Please don't invent languages for this ;)

The longest code in bytes wins.

| |
  • 1
  • 2
  • 2

Linear Time Sorting






do sorting in how that was called.. linear time?

You: Well you know that's impossible?



Your task






Sandbox Worries


Obviously there is a need for testing program and test cases.

| |
  • 1

Alphabetization 101 (popularity contest)




  • Not sure if this has been done before.
  • Any questions regarding the task?
| |
  • 1
  • 3

Why did I come to Sandbox?








Output the string "Valdosta ACM".



  • No input can be accepted by your program

  • Your program must halt



 086 097 108 100 111 115 116 097 032 065 067 077


Example Input and Output


NO input is allowed


Valdosta ACM

| |
  • 2

Cops and robbers : Programmers/Hackers




C (1)

    printf("[Programmer's username]")

After executing this program programmer saw this on the screen:

[Robber's username]


Matlab (2)/parser



PHP (3)



PHP/Regex(pcre flavor) (4)



PHP (4)




Perl/dynamic-regex (4)

local @a=('');

sub check{
   {push @a,@_[0]; } 
    foreach $item (@del_indexes) {
     splice (@a,$item,1);
return 1;

sub actor{
 {return "print robber";}

sub initiate{
return 1;



Scoring and rules

How is the score counted ?



| |
  • 3
  • 1
  • 1
  • 1
  • 3
  • 1




This is , so least bytes wins.

| |
  • 3










  • codegolf
  • codegOlf
  • codEgolf
  • codEgOlf
  • cOdegolf
  • cOdegOlf
  • cOdEgolf
  • cOdEgOlf



Length of code characters or bytes is not relevant.

Programming language is open.

| |
  • 3

Make a Fork Bomb

under construction, please constructively (no pun intended) criticize



  • No spoon bombs allowed, please.
  • Don't make any assumptions about the location of the program.

Bash, 10 chars


Acts as a standard punching bag for other solutions.

Microsoft Windows Batch file, 5 chars



| |
  • 4

2 Pass Hello world



How boring!



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?

| |
  • 1
  • 1
  • 1
  • 3
  • 1
  • 2

Return True to Win - Counter



function counter(f) {


| |
  • 6
  • 2

Stump The Golfing Languages




| |
  • 2
  • 2

Draw "Stack Exchange"

Stack Exchange has many site (159) and It has a logotype too. Anyway, In this challenge you'll need to draw Stack Exchange in the most shortest way.

This is a code-golf. challenge.


  1. Have fun!
  2. You've to draw Stack Exchange, you can't use Paint or something like that, you can't use libraries.
| |
  • \$\begingroup\$ Challenges that start with "Most creative" are almost certainly guaranteed to not generate creative answers (or any answers for that matter) \$\endgroup\$ – Fatalize Sep 8 '16 at 13:47
  • \$\begingroup\$ @Fatalize I changed the challenge. \$\endgroup\$ – Rizze Sep 8 '16 at 13:54
  • \$\begingroup\$ Now there is basically no interesting solution possible to the challenge, because there is no patterns in Stack Exchange. So all shortest solutions will to print that string directly or a compressed version of it. \$\endgroup\$ – Fatalize Sep 8 '16 at 13:58

99 selttob fo reeb no eht llaw

I teb ev'uoy lla draeh tuoba eht doog 'lo 99 selttob fo reeb no eht llaw. Llew ti os sneppah taht I emoc morf na evitanretla esrevinu - eht esrevinu erehw ew etirw gnihtyreve ni esrever! Ew peek eht snoitisop fo lanigiro hguoht. Siht osla snaem reporp noitazilatipac fo tsrif (ekil rettel ni siht txet). Ruoy egnellahc si ot etirw a margorp taht stuptuo eht lausu 99 selttob fo reeb no eht llaw, tub ni esrever (ni ruo egaugnal uoy dluow llac ti 99 bottles of beer on the wall). Siht si a ytiralupop tsetnoc, os teg evitaerc dna yrt ot sserpmi eht dworc. Doog kcul!

I bet you've all heard about the good ol' 99 bottles of beer on the wall. Well it so happens that I come from an alternative universe - the universe where we write everything in reverse! We keep the positions of original though. This also means proper capitalization of first letter(like in this text). Your challenge is to write a program that outputs the usual 99 bottles of beer on the wall, but in reverse (in our language you would call it 99 selttob fo reeb no eht llaw). This is a popularity contest, so get creative and try to impress the crowd. Good luck!

Elpmas fo derised tuptuo:

Sample of desired output:

99 selttob fo reeb no eht llaw, 99 selttob fo reeb. Ekat eno nwod dna ssap ti dnuora, 89 selttob fo reeb no eht llaw.

89 selttob fo reeb no eht llaw, 89 selttob fo reeb. Ekat eno nwod dna ssap ti dnuora, 79 selttob fo reeb no eht llaw.


1 elttob fo reeb no eht llaw, 1 elttob fo reeb. Ekat eno nwod dna ssap ti dnuora, on erom selttob fo reeb no eht llaw.

On erom selttob fo reeb no eht llaw, on erom selttob fo reeb. Og ot eht erots dna yub emos erom, 99 selttob fo reeb no eht llaw.

| |
  • 3
    \$\begingroup\$ There's no need for the reversed text in the description - it distracts the viewer from the challenge at hand. \$\endgroup\$ – clismique Oct 21 '16 at 12:06
  • \$\begingroup\$ @Qwerp-Derp I wanted to make this a bit more "unique" and "immersing", so I thought about giving the reversed description(I like it). I also included original text(although in spoilers), but I was also wondering about distracting readers. Do you have some other idea on how to keep both versions without making it look obscure? \$\endgroup\$ – MatthewRock Oct 21 '16 at 12:10
  • 2
    \$\begingroup\$ 1. This should not be a popularity-contest. 2. It's fundamentally a duplicate of codegolf.stackexchange.com/q/64198/194 . 3. If you're going to muck around with the question text, write a program that mucks it around correctly. "elpmaS" doesn't follow the specified transformation rule. \$\endgroup\$ – Peter Taylor Oct 21 '16 at 12:34
  • \$\begingroup\$ @PeterTaylor 1. why not? 2. It's not. You can't simply reverse, and counting is a bit different. \$\endgroup\$ – MatthewRock Oct 21 '16 at 13:24
  • 2
    \$\begingroup\$ Do X creatively popularity contests have fallen out of scope. This will get closed if posted on main. \$\endgroup\$ – Dennis Oct 21 '16 at 13:46
  • \$\begingroup\$ @Dennis Damn, too bad. I guess I won't be posting it then, it's boring "shortest code". \$\endgroup\$ – MatthewRock Oct 21 '16 at 14:16
  • 2
    \$\begingroup\$ What does this add to the original '99 bottles of beer on the wall'? \$\endgroup\$ – 0WJYxW9FMN Oct 21 '16 at 20:54

Best n out of 2n - 1


This one should be relatively simple. Output this exact text:

Best [n] out of [2n - 1].

given n as an input.


Just the integer n, can be from stdin or as an argument. n will always be greater than 0.


The exact text above. Trailing spaces/newlines are allowed.


This is , so shortest code in bytes wins. Standard loopholes are forbidden.


Is this too simple? What other tags should be included, ?

| |
  • 1
    \$\begingroup\$ Seems like a dupe of 2spooky4me, just with a different operator. \$\endgroup\$ – Geobits Nov 1 '16 at 17:52
  • 1
    \$\begingroup\$ Your wording specifies "this exact text" while I think your intent is "Best 5 out of 9." or the like. \$\endgroup\$ – AdmBorkBork Nov 1 '16 at 17:53
  • \$\begingroup\$ @Geobits Aha, I knew I remembered a similar challenge. Just forgot the exact name, so I thought maybe I was just imagining things after I tried to find it. My bad. \$\endgroup\$ – Yodle Nov 1 '16 at 17:55

Google Home / Amazon Echo - Turing complete?

Your challenge is to try to make a turing machine based on Google Home and Amazon Echo, see this video.

You must describe how to set up the machine, and how to give it input.

You must also describe a program for integer addition. It should compute 1+1 to be 2, 200+55 = 255, 200+56 = 0, and so on for all other combinations of 2 8-bit integers.

| |
  • \$\begingroup\$ It's basically not possible... \$\endgroup\$ – TuxCrafting Dec 2 '16 at 19:52
  • \$\begingroup\$ VTC as unclear and too broad. What are you even expecting as an answer? \$\endgroup\$ – Rɪᴋᴇʀ Dec 2 '16 at 19:52
  • \$\begingroup\$ @EasterlyIrk A set of commands that send the 2 computers into infinite loop, reading commands endlessly from a list of commands for the other to run, eventually processing a computer program and finally calculating the answer to the universe. \$\endgroup\$ – SoniEx2 Dec 2 '16 at 20:14
  • \$\begingroup\$ @TùxCräftîñg Why not? I mean other than that we have yet to prove their turing-completeness. \$\endgroup\$ – SoniEx2 Dec 2 '16 at 20:14
  • \$\begingroup\$ @SoniEx2 so only 1 of each computer? And what defines a command? \$\endgroup\$ – Rɪᴋᴇʀ Dec 2 '16 at 20:16
  • \$\begingroup\$ @EasterlyIrk A command is anything that starts with "Hey google" or "Alexa" and triggers a successful response on either of the computers. \$\endgroup\$ – SoniEx2 Dec 2 '16 at 20:19
  • \$\begingroup\$ Are we allowed to program the Echo and Google device? If so this is trivial. If we're supposed to construct a sentence that winds up having the devices compute using existing services like the calendar in the video, there are plenty of web sites that can process a variety of languages and read back the solution. Echo has basic math built in. \$\endgroup\$ – wyldstallyns Dec 2 '16 at 21:09
  • \$\begingroup\$ I really hope this can be tweaked into a challenge because the youtubes would be awesome. \$\endgroup\$ – wyldstallyns Dec 2 '16 at 21:12
  • \$\begingroup\$ @wyldstallyns tbh I have no idea what I'm doing... But yes, you're allowed to program both of them. \$\endgroup\$ – SoniEx2 Dec 2 '16 at 22:51
  • \$\begingroup\$ A question should ideally be self-contained. In this case the APIs for Google Home (whatever that is) and Amazon Echo (whatever that is) probably won't fit in the question, but an overview and links to the APIs would. \$\endgroup\$ – Peter Taylor Dec 2 '16 at 23:03
  • \$\begingroup\$ @PeterTaylor This isn't a matter of APIs. This is a matter of voice commands. \$\endgroup\$ – SoniEx2 Dec 3 '16 at 0:19


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...


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


(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.


Printr, score 4:


This program prints "r" then quits.

| |
  • \$\begingroup\$ is it allowed to throw an error? \$\endgroup\$ – FlipTack Dec 18 '16 at 14:00
  • \$\begingroup\$ @Flp.Tkc, good question, errors shouldn't be allowed (syntax error be like). \$\endgroup\$ – n4melyh4xor Dec 18 '16 at 14:07
  • \$\begingroup\$ What about a warning to STDERR? Stray error output is allowed by default on meta... \$\endgroup\$ – FlipTack Dec 18 '16 at 14:19
  • \$\begingroup\$ @Flp.Tkc, should be okay. \$\endgroup\$ – n4melyh4xor Dec 18 '16 at 14:24
  • \$\begingroup\$ ><>, in ><>, score 0, infinite loops. \$\endgroup\$ – redstarcoder Dec 18 '16 at 15:56
  • \$\begingroup\$ 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. \$\endgroup\$ – redstarcoder Dec 18 '16 at 16:00
  • \$\begingroup\$ in brainfuck you can just write brainfuck and it won't do anything... \$\endgroup\$ – FlipTack Dec 19 '16 at 17:31

A simple challenge: Shortest program that takes the longest to compile.

| |
  • \$\begingroup\$ What's the scoring requirement (i.e. how will programs be scored)? Who's machine will this be run on? \$\endgroup\$ – clismique Feb 11 '17 at 1:43
  • \$\begingroup\$ It's too broad of a challenge; are infinite loops allowed? To reiterate what Qwerp-Derp said, how will it be scored? Longest to compile -- what if it's an interpreted language? \$\endgroup\$ – user42649 Feb 11 '17 at 1:47
  • \$\begingroup\$ @AlexL.: languages without a compiler would be excluded. \$\endgroup\$ – jmoreno Feb 11 '17 at 1:57
  • \$\begingroup\$ I still believe this is not a good challenge because it is unclear what you are asking and it is too broad. \$\endgroup\$ – user42649 Feb 11 '17 at 2:01

Make a Simple GUI application

I have made a simple glade layout. The chalenge is to remake it in as few bytes as possible.

The glade file:

<!-- Generated with glade 3.20.0 -->
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkApplicationWindow">
    <property name="can_focus">False</property>
    <property name="title" translatable="yes">Remake me!</property>
      <object class="GtkBox">
        <property name="orientation">vertical</property>
          <object class="GtkButton">
            <property name="label" translatable="yes">hello</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          <object class="GtkLabel">
            <property name="label" translatable="yes">world</property>
            <property name="position">1</property>

| |
  • \$\begingroup\$ This probably doesn't break any rules, but it also doesn't seem that fun. It would be preferable if it was a more substantial task than simply golfing the code you already wrote. \$\endgroup\$ – Ad Hoc Garf Hunter Feb 18 '17 at 2:09

Rock Paper Scissors Lizard Spock

This game is from The Big Bang Theory, an extended version of the classic Rock Paper Scissors game.


To create a full program that I can run to play Rock Paper Scissors Lizard Spock against an "AI". The opponent ("AI") will pseudo-randomly choose their option after receiving user input.

The program must be run with user input of the following;

| Input     | Meaning   |
| R         | Rock      |
| P         | Paper     |
| S         | Scissors  |
| L         | Lizard    |
| SP        | Spock     |

The game is played with the following rules that Sheldon tells us;

Scissors cuts Paper

Paper covers Rock

Rock crushes Lizard

Lizard poisons Spock

Spock smashes Scissors

Scissors decapitates Lizard

Lizard eats Paper

Paper disproves Spock

Spock vaporises Rock

Rock crushes Scissors

enter image description here

Once you've taken user input, psuedo-randomly chosen the AIs option, you must output either "Player wins (<<user_input>> vs <<ai_input>>)" or "AI wins (<<user_input>> vs <<ai_input>>)". In the event of a tie (both the user and AI choose the same options), you must output "It's a tie"

Sample Runs

//Player chooses Scissors (S)
//AI chooses Paper (P)
$ php -f rpslsp.php S
Player wins (S vs P)

//Player chooses Spock (SP)
//AI chooses (R)
$ php -f rsplsp.php SP
Player wins (SP vs R)

//Player chooses Lizard (L)
//AI chooses Scissors (S)
$ php -f rsplsp.php L
AI wins (L vs S)

//Player chooses Lizard (L)
//AI chooses Lizard (L)
$ php -f rsplsp.php L
It's a tie


  • Standard loopholes apply.
  • The computer must choose an input at random (pseudo random) so that on each program run, the AI chooses (in a perfect world) a different input and that each input has the same percentage of being chosen.

This is code-golf so the shortest code in bytes wins.

| |
  • \$\begingroup\$ "A full program" means that we're not allowed to return the result from a function? Must it be a full program?? \$\endgroup\$ – Mr. Xcoder Mar 13 '17 at 12:55
  • \$\begingroup\$ @Mr.Xcoder What I mean is we are able to run it in environments like TIO or REPL.it \$\endgroup\$ – ʰᵈˑ Mar 13 '17 at 13:01
  • \$\begingroup\$ 1. It's not true that the game is from BBT. BBT made a cultural reference to a preexisting game. 2. The output spec is incomplete because it doesn't say what to do in the case of ties. \$\endgroup\$ – Peter Taylor Mar 13 '17 at 14:32
  • \$\begingroup\$ @PeterTaylor Ah, I've only known the game exists because of TBBT, though the origin of the game doesn't really affect anything except maybe tread on the toes of some serious competitive RSPLSP players. Thanks for reminding me about it being a tie. \$\endgroup\$ – ʰᵈˑ Mar 13 '17 at 14:36
  • \$\begingroup\$ Closely related. Less closely related. \$\endgroup\$ – DLosc Mar 17 '17 at 19:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .