495
\$\begingroup\$

What is the Sandbox?

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

To post to the Sandbox, scroll to the bottom of this page or click on the "Add Proposal" link below, and click "Answer This Question". Click "OK" when it asks if you really want to add another answer. Write your challenge just as you would when actually posting it. 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, replace the post here with a link to the challenge and delete it.

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

The Sandbox works best if you sort posts by "active".

Add Proposal

Search the Sandbox

Browse your pending proposals

Get the Sandbox Viewer to view the sandbox more easily

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

| |
\$\endgroup\$

3001 Answers 3001

-2
\$\begingroup\$

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.

| |
\$\endgroup\$
  • \$\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
-2
\$\begingroup\$

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

https://www.ncbi.nlm.nih.gov/genbank/sars-cov-2-seqs/

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:

>XX-NNNNNN.N
GENOMIC DATA GOES HERE
>XX-NNNNNN.N
MORE GENOMIC DATA GOES HERE
| |
\$\endgroup\$
  • \$\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\$ – the default. Jun 14 at 8:13
-2
\$\begingroup\$

Wuhan Xi Estimates

Challenge
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:


b=io.read()
a,b=b:match("([^,]+),([^,]+)")

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

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

| |
\$\endgroup\$
  • \$\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
-2
\$\begingroup\$

Meta-golfing Numbers

The Esolangs Wiki has a page here cataloging the shortest known programs in Brainf*** to generate a given number. A similar catalog could exist for any language: it would simply be a list of the shortest known programs in that language outputting a given constant. By extension, we can assume that for any given language, a catalog like this could be generated programmatically, by creating a program that given a constant outputs another program outputting that constant.

The Challenge

Your challenge is to create a program in any language \$A\$, such that when that program is given an input \$N\$, it outputs a program in language \$B\$ that will ouput \$N\$.

  • Languages \$A\$ and \$B\$ need not be different; you can output a program in the same language as your source code.
  • All outputted programs must be in the same language \$B\$.
  • \$N\$ is guaranteed to be a positive integer. It may be \$0\$.

I/O

  • Input and output can be done with any of the default I/O methods.
  • \$N\$ should be inputted as an integer, the string representation of an integer, or an array of digits. Programs should be outputted as a string or a list of characters.

Restrictions

  • Your program must handle values of \$N\$ at least up to \$255\$.
  • Trailing whitespace and newlines are allowed, as long as they do not make any program invalid; ie., I can have trailing newlines and whitespace as long as the implementation of \$B\$ allows them in programs.

Scoring

This question is a , so the answer with the most votes wins!

| |
\$\endgroup\$
  • 2
    \$\begingroup\$ A critique of the scoring system (and possibly the challenge as a whole): In some languages, the empty program outputs its input, and in some languages, a numeric literal outputs itself. So the optimal submission will be program A, 0 bytes, for a score of 0. But even if the scoring system is changed to prevent the multiplying-by-zero exploit, I don't see how any other approach will be better than the empty-identity-program approach. So as it stands, this challenge will gather multiple trivial answers--and probably some interesting ones, but with worse scores. \$\endgroup\$ – DLosc Aug 21 at 1:52
  • \$\begingroup\$ I don't think lowest score wins is a good idea for a contest where you have the flexibility to choose how difficult the task it. Might be better as a popularity contest, or maybe it would be better with a list of difficult languages to print constants in. \$\endgroup\$ – Razetime Aug 21 at 2:09
  • \$\begingroup\$ @Razetime yeah, I actually hadn't realized the multiplying by zero exploit, so this seems like the best course of action - I've updated the answer. \$\endgroup\$ – sugarfi Aug 21 at 12:09
  • \$\begingroup\$ Righ now, this is not metagolf, this is just... meta? \$\endgroup\$ – the default. Aug 22 at 3:10
  • \$\begingroup\$ I guess so, yeah... But metagolf is a bit catchier, isn't it? \$\endgroup\$ – sugarfi Aug 22 at 13:23
  • \$\begingroup\$ Program: any implementation of cat in any language A. Language B: cat. \$\endgroup\$ – user253751 Aug 24 at 17:46
-2
\$\begingroup\$

Feedback Wanted

  • Is this too vague? should I change it to something like "create a quine with the fewest unique bytes", or perhaps adapt another existing challenge that might otherwise use lots of repeated bytes?
  • Maybe the idea is just too boring on its own and I should create a new proper challenge based around it?
  • Should I change the scoring system (votes - unique_bytes) - should it be divided instead, or use a more complex formula?

Introduction

This is , but not as you know it. Instead of every byte, This is sort-of also a question.

Challenge

Write an interesting program that uses the fewest unique bytes. This is not really about what the program does, but what you can do with a limited set of characters.

Rules

  • Your program must run on Try It Online
  • Programming languages with only a few permissible bytes anyway like Brainfuck's +-.,[]<>, are allowed, but officially considered boring

Apart from this, you can write anything.

Scoring

  • Hybrid of and "fewest-unique-bytes". Score is calculated as votes - unique_bytes
  • Unique bytes is based on bytes, not characters or whatever. You can calculate unique bytes using this Python snippet: len(set(b"your code here"))
| |
\$\endgroup\$
  • 4
    \$\begingroup\$ It's definitely too vague. "Interesting" could mean anything, and you'd have to argue with several people over whether their ignore-input-and-print-0 program counts as interesting before the challenge is closed as too broad or unclear. [popularity-contest] is also a dangerous tag, in that it's very hard to do well and has fallen out of favor long ago. This extends to all scoring systems that involve votes. \$\endgroup\$ – Zgarb Aug 21 at 19:33
  • 1
    \$\begingroup\$ I think this idea has been largely covered by Fewest (distinct) characters for Turing Completeness. Many languages require surprisingly few characters to run arbitrary code, so I expect there's not much interesting room for specific programs that use fewer characters than needed for that. \$\endgroup\$ – xnor Aug 21 at 22:39
  • 1
    \$\begingroup\$ As far as I remember, there exists a Lenguage quine (that uses only 1 unique byte). I think combining popularity-contest with something else is even worse than simply using popularity-contest. \$\endgroup\$ – the default. Aug 22 at 3:00
  • 1
    \$\begingroup\$ For future reference, start your sandbox entries with the title of your challenge rather than a generic "feedback wanted". It's the prevailing convention and doing something different is a little confusing to scroll past. \$\endgroup\$ – Beefster Aug 24 at 16:18
-3
\$\begingroup\$

Code-challenge: Guess my number

The challenge

You have a number from 1 to 10 in mind, and your program should ask questions to find out which number. These questions can be any questions, the program only has to find out the number as fast as possible.

Your program should ask a question, such as "Is the number a prime?", and the user must answer either y or n (yes or no). Ask questions until you know the number.

The scoring

To calculate the score, you need to take the sum of the question count for each number. For example, if you need 1 question to find the number 1, 2 questions to find the number 2, and so on, the score is 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, so the score is 55.

Important note: the question count for a specific number must always be the same. For example, if you need 4 questions to find out the number 10, then you have to ask always 4 questions to find out the number 10, otherwise it is impossible to calculate the score.

| |
\$\endgroup\$
  • 6
    \$\begingroup\$ boooring. The Huffman tree for a uniform set is any perfectly balanced tree. The question asks us to perform a binary search on the usr device. Is the number greater than 5? Is the number greater than 2? Is the number greater than 1? Hey' I think it's 1. \$\endgroup\$ – John Dvorak Jan 2 '14 at 11:49
  • 3
    \$\begingroup\$ Maybe if this were a pop-contest and the goal was to make the most original set of questions while still keeping the score at its theoretical minimum. \$\endgroup\$ – John Dvorak Jan 3 '14 at 5:28
-3
\$\begingroup\$

Bovine Ignorance

I'm curious about code which still works after being mangled by figlet, toilet, cowsay et al, but I'm not sure whether this in any way sane.

What I'm toying with is a challenge in which a participant may submit any program in any language. It should be possible to use this program's source code as input to cowsay or whatever, and the result should be another valid program in any language, which still does a similar thing. For instance, the following bf program prints Hello world! with no newline:

+++++ +++++
[
> +++++ ++
> +++++ +++++
> +++
> +
<<<< -
]
> ++ .
> + .
+++++ ++ .
.
+++ .
> ++ .
<< +++++ +++++ +++++ .
> .
+++ .
----- - .
----- --- .
> + .
+++++++++++++++++++++++++++++++++++++++++

Running cat ./prog.bf | cowsay -e .. -T $'>.' yields the following output:

 _________________________________________
/ +++++ +++++ [ > +++++ ++ > +++++ +++++  \
| > +++ > + <<<< - ] > ++ . > + . +++++   |
| ++ . . +++ . > ++ . << +++++ +++++      |
| +++++ . > . +++ . ----- - . ----- --- . |
| > + .                                   |
| +++++++++++++++++++++++++++++++++++++++ |
\ ++                                      /
 -----------------------------------------
        \   ^__^
         \  (..)\_______
            (__)\       )\/\
             >. ||----w |
                ||     ||

Which is itself a valid bf program which prints Hello world!!!, followed by a newline.

The problem with using bf here is that it ignores most of the cow, making this a bit too easy. The problem with using any other language is that it doesn't ignore most of the cow, making this far too difficult. Is there a sensible middle ground I could pick for this? I don't think it's impossible, I'm fairly sure you can exploit cowsay's behavior on one-liners to produce valid svgs, but I'm not sure how best to pose this challenge. Any ideas?

| |
\$\endgroup\$
  • 2
    \$\begingroup\$ I could not think of any language that falls in the middle ground. Even brainfuck is affected by the -----------------------------------------..>.---- inserted by cowsay. Most languages have strong parsing rules that would not cope with being post-processed by cowsay. The few exceptions for this will be either completely unaffected or badly affected, making the challenge uninteresting. \$\endgroup\$ – Victor Stafusa Feb 19 '14 at 12:32
  • \$\begingroup\$ Actually, you can't transform just any brainfuck program to cowsay-brainfuck. Namely those that can output fewer than three characters cannot be transformed at all. \$\endgroup\$ – John Dvorak Feb 19 '14 at 14:52
  • \$\begingroup\$ @JanDvorak, I was intending to allow competitors to choose the parameters of their calls to cowsay. For the uninitiated, -e controls the string used for eyes and defaults to oo, and -T controls the string used for the tongue, defaulting to ` U`. This is all yak-shaving, though, and having written this up and read the comments, I suspect that this idea has neither legs, horns nor udders. \$\endgroup\$ – ymbirtt Feb 19 '14 at 23:19
  • 2
    \$\begingroup\$ If I could propose a variant that is more feasible, you could do a challenge like "Write a program in your language of choice that draws ASCII art of a cow saying something (does not have to be identical or even similar to the cowsay art). The entire drawing must itself be valid source code that does something other than no-op. Post results of both programs." That gives people more leeway to work around the specific restrictions of their compiler. \$\endgroup\$ – Jonathan Van Matre Feb 21 '14 at 23:22
  • \$\begingroup\$ Ok, I found a language that falls within the middle ground: whitespace. Anyway, this question has a too narrow scope to develop an interesting challenge. \$\endgroup\$ – Victor Stafusa Feb 22 '14 at 18:31
  • \$\begingroup\$ @JonathanVanMatre That would be a subjective validity criterion, and would probably be closed as too broad. \$\endgroup\$ – wastl Jul 2 '18 at 13:55
-3
\$\begingroup\$

99 Bottles of Errors

While there are already many versions of "print 99 Bottles of Beer," I thought another one wouldn't hurt.


The challenge is fairly simple: print the lyrics to 99 bottles of Beer to STDERR. I don't care how you do it, so long as the entire lyrics show up. An entire program is required, so the following Java program would be invalid (even if it did do the correct thing):

System.out.println("99 Bottles of Beer on the Wall, take one down and pass it around...");

The scoring:

  • This challenge is , so shortest code by byte count wins.
  • If necessary, assume UTF-8 is the character encoding used.

The rules

  • All the code must be in one file.
  • Any language is allowed.
  • Reading input, whether it is from STDIN, a file, or the web, is not allowed.
| |
\$\endgroup\$
  • 6
    \$\begingroup\$ This is trivial in some languages (Java), where it reduces to a simple kolmogorov challenge, and impossible in others (those that have no distinct STDERR) \$\endgroup\$ – John Dvorak Mar 27 '14 at 7:42
-3
\$\begingroup\$

Create an Identicon Generator

The challenge is to create an identicon generator. The identicons must be randomly generated, so we get a new identicon for each key the program receives. You can input a key using std-in or you can use your language's random number generator for the key.

In order to make your identicon look reasonably nice, it must generate a picture, then rotate that picture around the bottom right corner, the way this mockup shows:

enter image description here

The output must be to a PNG file. Shortest code wins.

| |
\$\endgroup\$
  • 5
    \$\begingroup\$ Far too broad. As this stands I can create a 1-pixel image whose colour is just the key. I don't think this question will be ready to go until you've found a way to prevent me from making the images differ only in their palette (and to pre-empt, I think that adding a rule "Images may not differ only in their palette" isn't a real fix). \$\endgroup\$ – Peter Taylor Mar 28 '14 at 14:50
  • 5
    \$\begingroup\$ If you just ask for "random" images, you'll get images that are either hardly random at all (a solitary pixel in a random location), or completely random (noise). To get something "reasonably nice", you'll have to provide very clear instructions on how to produce these images. I suggest you try creating a few of these yourself, and find a minimal set of rules that produces results that look OK. Include requirements on dimensions (100x100px?), selection of colours (at least 2, not too similar), and drawing method (e.g., "five triangles with random vertices and a minimum area of 20 px²"). \$\endgroup\$ – r3mainer Mar 28 '14 at 15:25
  • 1
    \$\begingroup\$ How important is the PNG file output? This will be a challenge in itself for many languages. Would you accept an uncompressed non-interlaced format like PPM? \$\endgroup\$ – trichoplax Apr 16 '14 at 9:45
-3
\$\begingroup\$

Underhand Bejewled

Help me to write a game of bejewled, which cannot be lost!

Bejewled game rules

If you ever played bejewled, you can skip this, but for those who did not see it ever:

  • Playing field of 8*8 grid is filled in with gems of 7 different types randomly
  • By swapping two adjective stones, your goal is to create a line of at least three same type of stones in the either vertical or horizontal line
  • If did so, the gems will dissappear, points are added (say 20 points for a matching) and new gems are provided randomly from the top
  • image related:

enter image description here

Your challenge

Provide me a game which cannot be lost. In other words, the gems falling from the top are not random at all, but are falling in order that there is always at least one possibility to match three gems

But, from looking at the code at level of newbie programmer, it should look like that game acts as if it was random

Output

Playable game. As long as it is the grid of 8*8 filled in with 7 different types of "gems" the game is ok. It does not to have killer graphics, neither it does not need to be playable by mouse. (But in that case please make sure you show which "gem" is hovered and then selected)

Winning criteria

This is popularity contest. So highest rated game wins

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ I think this is too big a task to work well for an underhanded contest. The programs will be way too large for anyone to actually read the source and try to find what's underhanded about it. \$\endgroup\$ – Martin Ender Nov 11 '14 at 8:32
  • \$\begingroup\$ Thats what I was also afraid of. I will either take it as lesson to progress on my programming skill, or abandon the idea completly \$\endgroup\$ – Pavel Janicek Nov 11 '14 at 8:38
-3
\$\begingroup\$

Shortest Program that May or May not Terminate:

Write a program such that whether or not it terminates depends on the answer to an unsolved question in Computer Science or Mathematics. For example, your program might test the Goldbach conjecture for every N and quit if a counterexample is found, or hunt for odd perfect numbers. Please include an explanation of why your program may or may not terminate!

Note: assume infinite memory and stack size, because otherwise they all terminate. Your program must be self contained, take no input, and only use standard libraries. This is Codegolf, so shortest code wins!

| |
\$\endgroup\$
  • \$\begingroup\$ What about "unsolvable" problems, e.g. halting problem? Can I take another code as input and terminate if that terminates? Because that other program may or may not terminate, and there's no way to tell. \$\endgroup\$ – Martin Ender Nov 20 '14 at 18:03
  • \$\begingroup\$ The intention was that the program isn't allowed to take input. I'll be more specific. \$\endgroup\$ – QuadmasterXLII Nov 20 '14 at 18:50
  • 2
    \$\begingroup\$ Does this differ from this previous question in the sandbox? \$\endgroup\$ – trichoplax Nov 20 '14 at 19:34
  • \$\begingroup\$ (even if not the comments explaining why that one wouldn't work as a question may help Taylor this one) \$\endgroup\$ – trichoplax Nov 20 '14 at 19:35
  • \$\begingroup\$ The intent of this doesn't differ significantly from the question you linked, I searched posted questions but forgot to search the sandbox. \$\endgroup\$ – QuadmasterXLII Nov 20 '14 at 19:41
  • \$\begingroup\$ Infinite memory isn't required. \$\endgroup\$ – feersum Nov 20 '14 at 21:46
-3
\$\begingroup\$

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.

| |
\$\endgroup\$
  • 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
-3
\$\begingroup\$

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
    • ABBA ABBA CD CD CD
    • ABBA ABBA CDE CDE
    • ABAB ABBA EFEF GG
  • 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

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

Output

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.

Winner

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.
| |
\$\endgroup\$
  • 3
    \$\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
-3
\$\begingroup\$

This and this gave me an idea, but I'm not quite sure if this can be done at all, or if it is trivial. If it is, maybe point out how it could be changed to be interesting.

Anti golfing - Write the longest program not repeating any character

Well, it's just what the title says. Finally you're allowed to use as much bytes as possible.

Conditions

  • The code of the program or function should not use any character that is used in the code before.

  • Your program should print some sort of result to stdout, or into a file or return a value. You're not allowed to output or return the empty string or only a newline.

  • Other than that your program might do anything. Read input, print lots of output, or what you can think of, but you have to explain what it does, of course.

  • Only characters in the ASCII range [32 .. 126] and newlines are allowed, which limits the maximal code length to 96 bytes.

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

  • String literals or the like are forbidden. They could be used to hold the unused characters (though they would need two " in most languages anyway).

  • The same rule applies for similar literal constructs like blocks or what else is there in some languages.

  • Even if the length of a string literal would be used to generate a number, it is forbidden.

  • Variables can not just be declared and never be used. They have to be reflected in the output somehow.

  • If you've read and understood the above rules and still found a loophole and used it, you should go and stand in the corner for a while, thinking about what you've done.

So all in all, only use characters for actual code that does something generating the output, might it be calculating a value or formatting. And don't put unused characters somewhere in your code as a literal. Numbers are an exception, but I guess it's no problem to use them anyway.

I guess you should have a pretty good idea of what would be considered cheating here.

Example in awk

BEGIN{gsub(a,9);print $j-13+d^c/4*5678%20}

It prints 15.5, score is 42.

It replaces the empty string a with 9 in $0, which is the empty string in the beginning. So $0 becomes 9.

Then it prints the result of 9-13+1/4*5678%20.

($j is $0 (==9), because j is not defined

d^c ist 1, because c and d are not defined)

Please don't invent languages for this ;)

The longest code in bytes wins.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Are you sure you want to allow ASCII 127? That's the unprintable<DEL> character. The main problem with this challenge is "only use characters for actual code that does something". This is essentially unenforceable, because there may be arbitrarily complicated no-ops in the code. It's also why most code-bowling challenges fail to be popular/interesting. \$\endgroup\$ – Martin Ender Sep 14 '15 at 7:32
  • \$\begingroup\$ Well, I thought about making it a "most votes win" challenge, but I guess that would be unfair for less known users. I don't know what could be done with what you are pointing out. \$\endgroup\$ – Cabbie407 Sep 14 '15 at 7:51
  • 2
    \$\begingroup\$ I don't think this is a good candidate for a popularity contest. Popularity contests shouldn't be used as a cop out if the actual spec is a bit vague. They work best for challenges where the actual scoring criterion can be well specified but is more easily judged by humans than machines (e.g. "visually approximate a given image with these constraints..."). \$\endgroup\$ – Martin Ender Sep 14 '15 at 7:54
  • \$\begingroup\$ Yeah, it's hard to formulate the rules for this. But I think it's not always about finding a winner anyway. Thought this might be fun. Resolved the character 127 situation btw.. \$\endgroup\$ – Cabbie407 Sep 14 '15 at 7:57
  • \$\begingroup\$ How could I change that rule? I'm thinking about "only use code that contributes to the generation of the output" \$\endgroup\$ – Cabbie407 Sep 14 '15 at 8:02
  • 2
    \$\begingroup\$ How do you define "contribute"? E.g. this GolfScript program prints the length of the block in {...} which is a convenient way to stuff all characters except in '"# in there. Do all those random characters actually contribute? In Slashes everything which isn't an unescaped slash is printed to STDOUT, so as long as I put \/ together, I can put any characters I want there and they'll all contribute. \$\endgroup\$ – Martin Ender Sep 14 '15 at 8:07
  • \$\begingroup\$ Hmm, I thought this would be covered by forbidding string literals.. might think about extending that rule to blocks. Well, I'm not that fluent at esolangs. \$\endgroup\$ – Cabbie407 Sep 14 '15 at 8:10
  • \$\begingroup\$ It's trivial to use all possible 96 bytes. Trust me. If you really want to see the program I'm thinking of, I suppose I could write it, but I'm pretty sure it can be done. \$\endgroup\$ – mbomb007 Sep 16 '15 at 18:34
  • \$\begingroup\$ Yeah, I guess you're right. i have no idea how it would be done, but alright. \$\endgroup\$ – Cabbie407 Sep 16 '15 at 20:10
  • \$\begingroup\$ Not to mention this is pretty much a duplicate of codegolf.stackexchange.com/questions/30159/… \$\endgroup\$ – pppery Aug 6 '17 at 12:52
-3
\$\begingroup\$

Stop the dance!

Your sister was at the hospital, but now she's fine, awfully, you lost a day of work, one of your most important days.

You work at your local television, and they have a contest, called "Stop the dance!", what is it about?: People is dancing, they have a big screen in the wall, while it says "Dance!", they have to dance, if it says "Stop!", they must stop, if you move, you lose.

You don't have internet at the studio, so you use some strange offline data sharing method. The day you weren't there, another programmer came, such a silly programmer! He made a "Reciever" program, basically, gets data, processes data and prints data in the Big Screen Wall.

The programmer was bored, so he made a way to get data, well, you don't know what way he choose! (Author comment: Let's assume he made all the possible ways. Cya.) Now you have to make a sender program, in any language, that sends data to that program using the protocol specified under this section.

You are an expert code golfer, so you decide that you must make the shortest code possible. (Another author comment: Any lang is allowed. Cya.)

How did I came out with this idea?

Having a shower, my friend...

Your task

You must make the shortest (and winner) code possible, that sends data to the reciever, using this protocol:

The reciever must recieve:

$displaytext:"<text here>";$instnm:<integer here>;

$displaytext corresponds to what it is going to be displayed on the Big Screen Wall.

$instnm corresponds to the number of the instruction, the count of things displayed, starts from 1.

Your program may take an input, and send the data, in any way (except the ones in Rules) to the Reciever. Remember there's no internet.

The winner will be the user with shortest bytes of code.

Rules

As a good code golfer, you may not:

  • You can't use program arguments to send the data.
  • It must be an application.
  • If you apply for the bonus, mind you have to make both programs, if not, just the sender.
  • The string you have to send it has to be STRICT, no different ones, if not, unvalid answer. (I decided to call that "Strict JASON Protocol", get the joke?)

Bonus

You can make the reciever program, and you get -1 byte. Not much, but k. (In bytes, you must not decrement your byte result, you must do: "n Bytes + Bonus")

Example Input and Output

Input:

From Sender program:

Dance! or Stop!

Protocol:

Inbetween both commands

$displaytext:"Dance!";$instnm:5

Output:

In Reciever program:

Dance! (9) or Stop! (187)

Overall objective:

Send data between two programs, without internet connection.

Edit: i can't post an example answer, because then i can give ideas of how to do this codegolf/puzzle, while the ideas are limited, i'm finding for the creativity of the user.

| |
\$\endgroup\$
  • 9
    \$\begingroup\$ I have no idea what you're asking me to do. \$\endgroup\$ – Peter Taylor Feb 3 '16 at 21:26
  • \$\begingroup\$ It is pretty clear what is asking you to, is defined in Task (You must make the shortest (and winner) code possible, that sends data to the reciever, using this protocol), all the story and background is defined on Introduction. I dont see any hole on the post. \$\endgroup\$ – TheCrimulo Feb 3 '16 at 22:11
  • \$\begingroup\$ @TheCrimulo Example answer? \$\endgroup\$ – Xwtek Feb 7 '16 at 7:06
  • \$\begingroup\$ There is no Example, because you are just sending the same info you wrote in. If you type ´Dance!´, the output will be Dance! (n), n being the number of the sequence. The idea isn't to read input, and append (n) to it. You have to make it, in anyway (except command args/internet), dropping out the enoded data (input in the protocol), and, if necessary, make a reciever program, the reciever program its a bonus that discounts 1 byte, also, it can help you making your sender smaller. I can, i.e., make a file with the info on it. As explained, the reciever will read it. \$\endgroup\$ – TheCrimulo Feb 7 '16 at 15:54
-3
\$\begingroup\$

Biggest single character

This challenge is simple, its like the challenges we've had before where the goal is to produce the biggest output one can. But in this one, you can only use one character in your code.

You get no input, your code has to be a single character (not byte), and the person with the largest output in byte wins, ties broken by posting time.

| |
\$\endgroup\$
  • 5
    \$\begingroup\$ Doesn't this boil down to which language has the biggest output stored in a predefined variable? \$\endgroup\$ – Denker Apr 3 '16 at 20:50
  • \$\begingroup\$ @DenkerAffe true. maybe i should make it 2 byte src code. that might allow some interesting stuff \$\endgroup\$ – Maltysen Apr 3 '16 at 20:52
  • 1
    \$\begingroup\$ I think I would raise the char amount a bit more to allow for some competition between the same language. Also you should keep in mind that this rules out every non-golfing language. While this should be allowed per meta consensus, I am not sure how much the community likes this. \$\endgroup\$ – Denker Apr 3 '16 at 20:58
  • \$\begingroup\$ G for pyth wins :D :D \$\endgroup\$ – Leaky Nun Apr 4 '16 at 4:45
  • 3
    \$\begingroup\$ Befunge & co. would probably win via infinite output. If output has to be finite though, I wouldn't consider this a very interesting challenge since it would just be one big language hunt. \$\endgroup\$ – Sp3000 Apr 4 '16 at 10:27
  • \$\begingroup\$ Actually, N in Seriously wins. 11752 bytes output. \$\endgroup\$ – user45941 Apr 6 '16 at 4:06
  • \$\begingroup\$ @Mego Vitsy wins. 0 bytes, 11752 bytes of output. \$\endgroup\$ – Addison Crump Apr 7 '16 at 17:07
-3
\$\begingroup\$

Alphabetization 101 (popularity contest)

Your task is to use all 52 letters of both the uppercase and lowercase alphabet, ONCE and ONCE only, and make a program.

You are free to use any other ASCII character more than once, or use a letter of the alphabet more than once if it's required for the language to function.

Meta:

  • Not sure if this has been done before.
  • Any questions regarding the task?
| |
\$\endgroup\$
  • \$\begingroup\$ Not really meta: Is there any place I can go to (like a chat or something) to post a question about BF? StackOverflow probably isn't suitable. \$\endgroup\$ – clismique Apr 17 '16 at 6:48
  • 1
    \$\begingroup\$ Come to our chatroom! :) \$\endgroup\$ – Leaky Nun Apr 17 '16 at 6:50
  • 3
    \$\begingroup\$ I would vote to close this as too broad. It's not a particularly interesting restriction per se, and it certainly doesn't make a good question without some restriction on the task to be performed. \$\endgroup\$ – Peter Taylor Apr 17 '16 at 14:07
  • \$\begingroup\$ @PeterTaylor That's why it's a popularity contest, though - it lets the people decide whether the program made is good or not. What WOULD be a good restriction on the task? \$\endgroup\$ – clismique Apr 18 '16 at 1:40
  • \$\begingroup\$ The popularity-contest tag is not an excuse for a broad challenge. "Write a program that does anything..." is pretty much the definition of "too broad", regardless of any source code restriction put on the program. So at least you should choose a specific task. Could be anything really, but if it relates to the restriction it might be more interesting (e.g. a pangram checker). Even so, I agree with Peter that the restriction isn't particularly interesting. There are tons of languages where it's trivial to avoid unwanted letters and then include the remaining ones in a string or comment. \$\endgroup\$ – Martin Ender Apr 21 '16 at 7:04
-3
\$\begingroup\$

Why did I come to Sandbox?

I have a very specific challenge, and I wanted to see if it was too specific.

The challenge is to output "Valdosta ACM" using the shortest number of characters with the BrainF**k programming language.

I've noticed it isn't the norm to specify a programming language on this domain, so I've come here to get feedback on whether or not this is acceptable.


Introduction

As a challenge to the members of my local Association for Computing Machinery(ACM) chapter, I asked them to produce the shortest Brainf**k code that would output "Valdosta ACM".

This was a very fun challenge for all of our members, and we got very competitive! I was impressed with the solutions turned in, but I wondered if it was possible to beat our best solution. Surely it's possible, but who could do it?

Challenge

Output the string "Valdosta ACM".

Stipulations:

  • Use only the Brainf**k programming language (you can test your code here)

  • No input can be accepted by your program

  • Your program must halt

  • The space in the string must be ASCII character #032.

These are the ASCII values of each character, as they appear in the string, for convenience:

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

The winner is determined by the shortest code, by character count.

Example Input and Output

Input:

NO input is allowed

Output:

Valdosta ACM

| |
\$\endgroup\$
  • \$\begingroup\$ Welcome to Programming Puzzles & Code Golf! Thanks for using the Sandbox. :) A few things to note: 1.) Generally we discourage language-specific challenges, 2.) typically code golf is scored by bytes rather than characters, and 3.) printing a fixed string like this would be insufficiently different from the Hello, World! challenge to avoid it being closed as a duplicate. \$\endgroup\$ – Alex A. Apr 25 '16 at 3:38
  • \$\begingroup\$ Thanks Alex! Since I want to compare the results of my local competition with the results of the challenge here, is there anything I could change about the challenge to make it acceptable? I don't see a way to do this, but I was so excited about seeing if anyone here could do better than our coders. And thanks for the warm welcome! :) \$\endgroup\$ – Matt C Apr 25 '16 at 3:48
  • \$\begingroup\$ You could look at Brainf**k solutions to other challenges (like this one), and see if the techniques used there can help you improve your solution. \$\endgroup\$ – ugoren Apr 25 '16 at 7:09
  • \$\begingroup\$ We also have a tips question that may be of interest. \$\endgroup\$ – trichoplax Apr 26 '16 at 6:30
  • 2
    \$\begingroup\$ Although this particular challenge is probably too similar to "Hello, World!" (as Alex pointed out), if you had a different challenge that you wanted to see solutions for in a specific language, you can still post it but just allow all languages to compete. If you don't see solutions in your specific language you can post a bounty for that language to encourage it. \$\endgroup\$ – trichoplax Apr 26 '16 at 6:33
-3
\$\begingroup\$

The FitnessGram™ Code Golf Test

Same concept and rules to the well-known Rick Astley post a while back, only instead of using samples of various sizes, sample length is limited to what number sample it is. And different text for the program to write.
It's code golf, so standard loopholes apply, and fewest bytes wins.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Closed as a dupe. And/or unclear. \$\endgroup\$ – Rɪᴋᴇʀ May 19 '16 at 20:04
  • \$\begingroup\$ Paragraphs of text are boring for compression. Unless there's some particular structure in the text, the same techniques apply to all of them. \$\endgroup\$ – xnor May 19 '16 at 20:07
  • \$\begingroup\$ First off, thank you for using the Sandbox before posting on main. That said, I don't understand what your challenge is supposed to be: what is the sample length? What is a sample? In addition to that, if this challenge winds up being "print some fixed string" then it is a duplicate of the rick astley post, as the techniques used for compression will be identical. \$\endgroup\$ – FryAmTheEggman May 19 '16 at 20:09
  • \$\begingroup\$ we want to give them a challenge, not a flashback.... \$\endgroup\$ – user56309 Aug 4 '16 at 19:42
  • \$\begingroup\$ This sandbox post has had little activity in a while and little positive reception from the community. Please improve / edit it or delete it to help us clean up the sandbox. \$\endgroup\$ – programmer5000 Jun 9 '17 at 14:12
-3
\$\begingroup\$

Obfuscate your program

In this challenge, you must create a program which does something but you need to obfuscate it so that it becomes hard to understand (so don't explain it in your post).

It can accept anything as input and output anything.

Score

The shorter program (in bytes) which hasn't been understood wins.

Example

Can you guess what does this code calculate?

var t=1e5,s=t/1e4,n=s*0.1,i=n*s*7.5,r=!true,b=1,t='01'.split('').map(c=>parseInt(c)).concat(Array(i).join('.').split('.').map(m=>{a=r+b;(r=b)&&(b=a);return a})),t=t.join('').length,b=s,t=r,s=4+NaN;

Rules

  • You should say what language you used
  • You must not use any obfuscation tool
| |
\$\endgroup\$
  • 3
    \$\begingroup\$ At a minimum, you should state an actual objective: "obfuscate a program that does x". Otherwise it's just too broad and will likely be closed as such. You'll also need something else to explain the scoring, since "shortest that isn't understood" seems odd to me. Understood when? How do you show that it hasn't been understood? Do you mean something like Cops and Robbers?. \$\endgroup\$ – Geobits Jun 4 '16 at 19:06
  • \$\begingroup\$ This sandbox post has had little activity in a while and little positive reception from the community. Please improve / edit it or delete it to help us clean up the sandbox. \$\endgroup\$ – programmer5000 Jun 9 '17 at 14:12
-3
\$\begingroup\$

"01_firstHole" Challenge for Performance Golf

First there was code golf. Now, there is Performance Golf. FORE!

Motivations

This is a crowd-sourced approach to easier and better performance troubleshooting. Performance problems are everywhere, so java technicians need access to easy-to-use diagnostic tools at every step of the SDLC.

How to play?

  1. Start by installing the live demonstrations of Java Performance Problems in this repo.

  2. Pick one of the six holes of golf to play. You can do this by picking one of the six numbered folders in the repo. This particular codegolf.stackexchange.com challenge is for the 01_firstHole.

  3. One at a time, run the 'a' load test and the 'b' load test for the hole you selected. The a & b tests are two different implementations of the same REST/SOA service. See the 'installing' link, above, for how to run the tests.

  4. Compare the performance of the two tests, a & b. Which has better response time / throughput?

  5. Using the least amount of tooling/instrumentation, identify the performance problem of the slower test. Hook it up your self and run the tests.

  6. At codegolf.stackexchange.com, there is one "Stack Exchange Challenge" for each hole of golf. Post the following two things for your solution to that challenge:

    • Post a description of the tools/techniques you used to detect the performance problem. Must be detailed enough so that others can reproduce your work. Performance golf always compares two different loads -- a & b. The solution must identify the inefficient code in the slower of the two examples. It must also show the absence of that inefficient processing in the faster of the two examples.
    • Tally the number of strokes for your approach, using the "Scorecard" below. All solutions must specify the # of strokes incurred, and it must be specified in the answer heading/title.
  7. Upvote the solutions that best identify the performance problem and have the fewest strokes (see Scorecard, below). Similar solutions on different platforms (Mac/Linux/MS-Win) deserve roughly the same number of upvotes.

Scorecard

This scorecard determines the approach with the least amount of tooling/instrumentation. Lowest score wins!

  • 1 stroke if JVM restart is required to hook up your monitoring tool of choice.
  • 1 stroke for any tool with any $$ licensing cost.
  • 1 stroke for every separate install process. No strokes for JVM and pre-installed OS tools.
  • 1 stroke for tools/techniques specific to a particular Database vendor. Ex: Oracle AWR report. Even ‘EXPLAIN PLAN’ solutions are proprietary.

Example One -- zero strokes :-D

This example does not use this github repo, but it will give you the general idea.

This solution to solving a high CPU problem would get lowest=best instrumentatin score: zero strokes. Only JVM and OS tools are used (thread dump and top -H). There are no tool license costs and a JVM restart was not required for the thread dump.

Example Two -- 3 strokes :-(

This example also does not use this github repo, but it will give you the general idea of what we mean by the best troubleshooting with the least tooling/instrumentation.

A modern, commercial profiler (YourKit, JProfiler, etc...) would easily solve the high CPU problem in example 1. But look how many strokes (1+1+1=4!) are taken off with this approach: * 1 stroke because a JVM restart is required to hook up the tool * 1 stroke because there are licensing costs. * 1 stroke to install profiling the tool

| |
\$\endgroup\$
  • 2
    \$\begingroup\$ Answers in this site normally involve writing code, so this doesn't really appear to be on topic. \$\endgroup\$ – feersum Jun 16 '16 at 7:43
  • \$\begingroup\$ Thanks for using the sandbox! I do however, see some problems with this challenge. For one, I think you would need to clarify a lot of the stroke criteria, as something like "rarely used" is pretty subjective. In addition, there doesn't seem to be a way to enforce a person to not use a high level tool, and then after figuring out the problem finding it again with a more basic tool. Even further, why couldn't someone look at another answer and then reuse their data to get a better score? cont... \$\endgroup\$ – FryAmTheEggman Jun 16 '16 at 13:22
  • \$\begingroup\$ After all that, there doesn't seem to be an objective winning criterion, unless it is number of strokes. If number of strokes determines the winner, then won't there be many ties? I think you would need something more granular. \$\endgroup\$ – FryAmTheEggman Jun 16 '16 at 13:24
  • \$\begingroup\$ Sounds like I need to work on the "rarely used" part mentioned by @FryAmTheEggMan. Regarding the same commenter's comments about the high-level tool and the basic tool. That is part of the natural progression of monitoring. We learn to do it one way, then we learn a better, less intrusive, less expensive way. As long as the user of the basic tool is "detailed enough so that others can reproduce your work", who cares how much refinement was involved? \$\endgroup\$ – Erik Ostermueller Jun 16 '16 at 22:45
  • \$\begingroup\$ Regarding @FryAmTheEggman's question of "many ties". I look at auction sites like eBay as reasonable crowd-sourced arbiters of value of a given object for sale. I was hoping the voters would provide that kind of assessment, but I see where lack of objectivity could cause cronyism and perhaps other problems. Could someone point me to codegolf tolerance/lack of for ties? I'll try to work on that. \$\endgroup\$ – Erik Ostermueller Jun 16 '16 at 22:48
  • \$\begingroup\$ @FryAmTheEggman, you mentioned that my "rarely used" criteria was pretty subjective. That's a good call, so just edited / removed that. \$\endgroup\$ – Erik Ostermueller Jun 18 '16 at 21:36
  • \$\begingroup\$ @FryAmTheEggman, the "many ties" concern could also looked at from a different perspective -- that Performance Golf will provide a very useful "catalog" of answers. This "catalog" concept got 18 upvotes here. \$\endgroup\$ – Erik Ostermueller Jun 18 '16 at 21:43
  • 4
    \$\begingroup\$ The catalogue concept is a failed experiment, and your mention of it is one of the reason why. "It's a catalogue question" should not be used to justify why a question should be closed even though it's off-topic and wouldn't have an effective scoring mechanism even if it were on-topic. \$\endgroup\$ – Peter Taylor Jun 19 '16 at 13:31
-3
\$\begingroup\$

Make a Fork Bomb

under construction, please constructively (no pun intended) criticize

Create a program which forks itself at twice and exits, or forks itself once and idles. Whether it continues forever or exits is your choice. Forks can be OS forks or simply a command to relaunch the program.

Rules

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

Bash, 10 chars

./$0|./$0&

Acts as a standard punching bag for other solutions.


Microsoft Windows Batch file, 5 chars

 %0|%0

Anybody who beats this one gets a million internet points. (and maybe a bounty)

| |
\$\endgroup\$
  • 4
    \$\begingroup\$ I assume that the downvote is because someone considers that this violates our policy on malicious code. I think it's borderline, but if it's on the right side of the border then the question has other issues. 1. Why fork itself at least twice? Surely forking once is enough for a fork bomb? 2. Define "OS forks" in a way which doesn't rely on the OS being POSIX. Or, better, remove that requirement: it seems to me to limit the languages permitted more than necessary for no benefit. 3. What's a spoon bomb? Google is not being helpful. \$\endgroup\$ – Peter Taylor Jul 14 '16 at 13:49
  • \$\begingroup\$ @PeterTaylor 1. the chat said it was fine 2. If you only fork once and exit, you have a constant amount of processes 3. Good idea. Any tips for windows forks? 4. it's a joke \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Jul 14 '16 at 16:38
  • \$\begingroup\$ I'm downvoting because I think it's close enough to malicious. A fork bomb can hang a computer. \$\endgroup\$ – mbomb007 Jul 22 '16 at 19:27
-3
\$\begingroup\$

Stump The Golfing Languages

This is the seed of an idea. I'm unclear on the details that might make it work.

I want people to submit answers in the form of a program in a "normal" language (defined how?), such that reproducing its functionality in a golfing language isn't much smaller. That is, I want to find the algorithms that Jelly and Pyth and Matl and such are not optimized for.

I would appreciate suggestions on how to make this work. Maybe cops and robbers? Maybe each entry just contains two programs, and comments are given to help golf the smaller one?

| |
\$\endgroup\$
  • \$\begingroup\$ The only language that could possibly win is mathematica \$\endgroup\$ – Destructible Lemon Aug 23 '16 at 1:52
  • 2
  • 2
    \$\begingroup\$ It's very easy to come up with boring examples e.g. print this exact trace, reproduce the output of this random number generator, etc. I don't see any way to get interesting answers. \$\endgroup\$ – feersum Aug 23 '16 at 6:31
  • \$\begingroup\$ @feersum I'd probably disqualify errors and crashes and stacktrace outputs and such, and maybe all built-in non-trivial algorithms. Thanks for pointing those out. \$\endgroup\$ – Sparr Aug 24 '16 at 7:26
  • \$\begingroup\$ @DestructibleWatermelon you don't have to beat the golfing language to win. The winning entry will probably still have a shorter Jelly solution than Python (or whatever). \$\endgroup\$ – Sparr Aug 24 '16 at 7:27
  • \$\begingroup\$ I don't know of any golfing languages where creating a simple webserver is possible. All this would be is finding a task that isn't normally required for when doing code-golf \$\endgroup\$ – Blue Aug 24 '16 at 14:16
  • \$\begingroup\$ I'm thinking of restricting it to algorithms and output, not stuff like network and file access. \$\endgroup\$ – Sparr Aug 24 '16 at 22:11
-3
\$\begingroup\$

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.

Rules

  1. Have fun!
  2. You've to draw Stack Exchange, you can't use Paint or something like that, you can't use libraries.
| |
\$\endgroup\$
  • \$\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
-3
\$\begingroup\$

Open the browser, polyglot edition.

Your job is to open a browser window of the default browser to https://codegolf.stackexchange.com in as many languages as possible.

Your code must open the browser itself, and cannot rely on an open one.

Rules

  • Versions of the same language are considered a single language
| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Define "default browser" in the context of non-Windows OSes. \$\endgroup\$ – Peter Taylor Sep 25 '16 at 21:47
  • 3
    \$\begingroup\$ @PeterTaylor Whatever browser the open command works with. There was a previous version of this challenge, it worked then. \$\endgroup\$ – noɥʇʎԀʎzɐɹƆ Sep 25 '16 at 22:24
-3
\$\begingroup\$

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.

| |
\$\endgroup\$
  • 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
  • \$\begingroup\$ This sandbox post has had little activity in a while and little positive reception from the community. Please improve / edit it or delete it to help us clean up the sandbox. \$\endgroup\$ – programmer5000 Jun 9 '17 at 14:08
-3
\$\begingroup\$

Best n out of 2n - 1

Challenge:

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

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

given n as an input.

Input:

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

Output:

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

Rules:

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

Meta:

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

| |
\$\endgroup\$
  • 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
-3
\$\begingroup\$

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.

| |
\$\endgroup\$
  • \$\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
-3
\$\begingroup\$

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

| |
\$\endgroup\$
  • \$\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
-3
\$\begingroup\$

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:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.0 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkApplicationWindow">
    <property name="can_focus">False</property>
    <property name="title" translatable="yes">Remake me!</property>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkButton">
            <property name="label" translatable="yes">hello</property>
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="receives_default">True</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkLabel">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">world</property>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
      </object>
    </child>
    <child>
      <placeholder/>
    </child>
  </object>
</interface>

| |
\$\endgroup\$
  • \$\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\$ – Wheat Wizard Feb 18 '17 at 2:09

You must log in to answer this question.

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