568
\$\begingroup\$

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

Sandbox FAQ

Posting

To post to the sandbox, scroll to the bottom of this page 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, though you can optionally add a title at the top. You may also add some notes about specific things you would like to clarify before posting it. Other users will help you improve your challenge by rating and discussing it.

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

Discussion

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

  • Parts of the challenge you found unclear
  • Comments addressing specific points mentioned in the proposal
  • Problems that could make the challenge uninteresting or unfit for the site

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

If you think one of your posts requires more feedback, but it's been ignored, you can ask for feedback in The Nineteenth Byte. It's not only allowed, but highly recommended! Be patient and try not to nag people though, you might have to ask multiple times.

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

Other

Search the sandbox / Browse your pending proposals

The sandbox works best if you sort posts by active.

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

\$\endgroup\$
0

4552 Answers 4552

1
146 147
148
149 150
152
-2
\$\begingroup\$

ABACABA pattern without recursion

ABACABA pattern on Wikipedia

Taking a number n as input, generate the ABACABA pattern with n symbols as stated in the above page, without using any form of recursion in your code. You can use any output method; characters, a list of numbers, an image, whatever is possible.

If taking input is not possible in your programming language, output the pattern forever. E.g.: ABACABADABACABAE...

Test cases:

input => output

1 => A / 1
2 => ABA / 1, 2, 1
3 => ABACABA / 1, 2, 1, 3, 1, 2, 1
4 => ABACABADABACABA / 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1
5 => ABACABADABACABAEABACABADABACABA / 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, 5, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1
```
\$\endgroup\$
3
  • \$\begingroup\$ Please add some information on what exactly the ABACABA pattern is. \$\endgroup\$
    – Ginger
    Jan 7 at 19:25
  • 1
    \$\begingroup\$ Also, "no recursion" is an unobservable requirement. \$\endgroup\$
    – Ginger
    Jan 7 at 19:26
  • \$\begingroup\$ Related \$\endgroup\$
    – l4m2
    Jan 13 at 4:56
-2
\$\begingroup\$

Detect if a variable is declared

Create an expression which detects if a variable (named whatever you wish) has been declared yet. For languages that set undeclared variables to a type that can not be differentiated from a declared variable set to that type (e.g. nil in Lua), just detecting that type is enough. If the variable exists, the expression should return a truthy value, and if it doesn't it should return a falsy value. It should not output anything.

For example, the following expression in D detects if a variable named x has been declared in the current scope or not:

__traits(compiles, x)

PS: this challenge definitely wouldn't work for stack-based or assembly languages, and I'm also not sure if marking this as code-golf or popularity-contest would be better.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ code-golf is nearly always better. popularity-contests are really hard to write properly. Also, note that some stack based languages do have variables \$\endgroup\$
    – Seggan
    Jan 21 at 22:57
  • \$\begingroup\$ For languages that set undeclared variables to a type that can not be differentiated from a declared variable set to that type (e.g. nil in Lua), just detecting that type is enough. What does this mean? Are you saying a variable with a value of nil should return false, and a variable with a value of anything else should return true? If so, there are probably better ways to word it. \$\endgroup\$
    – chunes
    Jan 23 at 7:04
-2
\$\begingroup\$

PHPFuck Golf - Hello World

Like this

PHPFuck is an esoteric language in which any PHP statement can be accurately reproduced into another valid PHP program that uses only the 5 characters (^.9).

The PHPFuck converter, when given an input of echo "Hello World!", produces a block of code that is 74,450 characters long. Because the program used a lot of automatic conversions to create that block, I believe that the code can be made a lot shorter using manual optimizations.

Your task is to build a PHP program that performs the task echo "Hello World!", using only the characters (^.9). The shortest code to do so wins.

\$\endgroup\$
-2
\$\begingroup\$

Polishing off a Sudoku

Given a set of 8 numbers as input, output the missing one.

Examples

12346789 -> 5

94351726 -> 8

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I am fairly certain this is a dupe of a more general question. This was the first I could find, though I feel like there was one with an arbitrary range too. \$\endgroup\$
    – Giuseppe
    Feb 10 at 1:51
-2
\$\begingroup\$

Print the input times infinity

Make a program/function that prints the input of the function infinite times, separated be a line break. Do note that the output must be to stdout.
tags:

\$\endgroup\$
5
  • \$\begingroup\$ Might get marked as duplicate of Implement a truth-machine or Simple cat program \$\endgroup\$
    – noodle man
    Jun 14 at 22:41
  • \$\begingroup\$ Why? It endlessly returns the input with a newline regardless of what it is \$\endgroup\$
    – Dadsdy
    Jun 15 at 7:02
  • 1
    \$\begingroup\$ It’s not the same challenge, but I think it’s likely to be marked as a dupe of one of those since most answers to that can be easily ported to your challenge (this practice of handling duplicates is fairly common on this site) \$\endgroup\$
    – noodle man
    Jun 15 at 12:14
  • \$\begingroup\$ @noodleman Really? My answer (in (,)) was very different. \$\endgroup\$
    – Dadsdy
    Jun 15 at 18:18
  • \$\begingroup\$ Exact dupe restricted-source version fastest-code version \$\endgroup\$ Jul 19 at 3:57
-2
\$\begingroup\$

That is disproportionate!

You want to overwhelm your nasty boss with an error message so large that they quit their job. But your boss will fire you instead if it's too long.


Challenge

In this challenge, you have to write code that is more than 0 bytes long that produces the longest error message possible.

Scoring

Answers will be scored using this formula: $$\frac{\text{Error message length in bytes}}{\text{Programme length in bytes}}$$

Other

All answers must include the answer score, source code and error message.



Meta

  • Is this a duplicate?
  • Any other appropriate tags?
  • Anything else?
\$\endgroup\$
1
-2
\$\begingroup\$

KCMCK

Print this ASCII art:

  +--------------  +-+                   +-+   +--------------  |
 ++                | |                   | |  ++                |
 |                 |  \                  / |  |                 |
 |                 |   \                /  |  |                 |
 |                 |    \              /   |  |                 |
 |                 |     \            /    |  |                 |
 |                 |      \          /     |  |                 |
 |                 |       \        /      |  |                 |
 |                 |        \      /       |  |                 |
 |                 |         \    /        |  |                 |
 ++                |          \  /         |  ++                |
  +--------------  |           \/          |   +--------------  |
________________________________________________________________|
________________________________________________________________|

Shortest code in characters wins!

  • Any leading whitespace must be the same on every line.
  • No restrictions on trailing whitespace.
\$\endgroup\$
-2
\$\begingroup\$

Be a cat

I have not found a single challenge that asks for a plain cat programme. The closest I have found requires you to print cat goes meow when the input is cat.


In this challenge, you must read everything from STDIN, or an acceptable alternative, and print the exact text to STDOUT, or an acceptable alternative, with only the leading and trailing whitespace in the input.


Meta

  • Have I been so silly that I missed a duplicate?
\$\endgroup\$
1
-2
\$\begingroup\$

Type annotation

Given a function definition and a list of types, both valid in your language, output the function annotated with those types. Shortest code wins, since this is .

Meta

  • Is it a duplicate?
  • How should I include languages without type annotation support?
  • Does it need to be explained better?
  • Anything else?
\$\endgroup\$
-2
\$\begingroup\$

Execute... yourself!

Almost a duplicate, but only requires you to compile a subset, and is closed.


You work at a compiler factory, making compilers tailored to your customers.


Challenge

In a programming language of your choice, write a program that executes code in the chosen language. Snippets are allowed, but you may not hardcode the input.

This is , so shortest code wins!


Meta

  • To deal with languages like No, should I change it to a , or disallow languages like that completely?
  • Is it clear enough?
  • Are there any unclosed challenges this duplicates?
  • Anything else?

\$\endgroup\$
4
-2
\$\begingroup\$

Optimal Span for Multiple Byte Ranges [Draft]

I recently ran into the following challenge, you have a list of common crawl URL indexes that have the setup below. Each of the GZ files are ~1.2GB, the challenge would be to design the most efficient solution that can respond with the decrypted byte span. If this if of interest, I'll revise this to flush out more details.

In the real world, some considerations are:

  1. Cache vs HTTP fetch byte range
  2. Minimizing number of requests by making requests spanning multiple offsets
  3. Decrypting entire file for multiple offsets vs decrypting offsets individually
  4. Trade off between # of connections, download time, local storage space, decryption time

Example:

FileName.gz Offset Length CONTENT_DIGEST
crawl-data/CC-MAIN-2023-23/segments/1685224648465.70/warc/CC-MAIN-20230602072202-20230602102202-00011.warc.gz 755688583 1327 123456789
crawl-data/CC-MAIN-2023-23/segments/1685224648465.70/warc/CC-MAIN-20230602072202-20230602102202-00011.warc.gz 86276364 3404 ABCDEFGHI
crawl-data/CC-MAIN-2023-23/segments/1685224648465.70/warc/CC-MAIN-20230602072202-20230602102202-00011.warc.gz 963176585 1294 987654321
\$\endgroup\$
-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\$
3
  • 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\$ Jan 2, 2014 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\$ Jan 3, 2014 at 5:28
  • \$\begingroup\$ This is off-topic and AI is off-topic for this site \$\endgroup\$
    – Fmbalbuena
    Nov 12, 2021 at 17:39
-3
\$\begingroup\$

Popularity Contest: Implementation of a Hash Table

Create a class in some OOP language for a hash table that supports getting, setting, and removing values. You can't use the built in hash table/dictionary/map implementation. Highest votes in one week wins.

A key is any valid string. A value is any valid string, number, or boolean.

Example functionality:

hash.set("key","value");
hash.get("key"); // returns "value"
hash.set("key", 1234);
hash.get("key"); // returns 1234
hash.set("key2",hash.get("key"));
hash.get("key2"); // returns 1234
hash.delete("key");
hash.get("key"); // returns null/undefined/none/etc. or throws an error
hash.get("key2"); // still returns 1234

Definition of a hash table (from Wikipedia):

In computing, a hash table (also hash map) is a data structure used to implement an associative array, a structure that can map keys to values. A hash table uses a hash function to compute an index into an array of buckets or slots, from which the correct value can be found.

The hash table cannot be simply an array that is searched in linear time. It must be an actual hash table that uses a hash function to map the keys to the value.

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Popularity contest and shortest don't mix. That aside, the spec is too vague. What is a "value"? What assumptions can be made about hashcodes? If the language makes all types nullable, should null be permitted as a key? What should the type be in languages which have co- and contravariance? And for that matter, what qualifies as a "hash table", bearing in mind that people will try to exploit any loophole? \$\endgroup\$ Jan 2, 2014 at 23:16
  • \$\begingroup\$ @PeterTaylor Thank you for the feedback! Please see my edits, and let me know what you think. Could you meant about co/contravaraince? I looked at the wikipedia article about it but I'm not really sure how that has anything to do with this question. \$\endgroup\$
    – hkk
    Jan 2, 2014 at 23:37
  • \$\begingroup\$ I think it's still vulnerable to the loophole of "I have a hashtable with one bucket" (i.e. it's really a list of (key, value) pairs which I traverse in linear time). The thing about variance is to do with static typing of the elements of the map. E.g. in Java Map<String, Integer>'s get method has signature public Integer get(Object); in C#, a Dictionary<string, int>'s Get method has signature public int Get(string). The edited version makes it clear enough that the hashtable isn't expected to be genericised. \$\endgroup\$ Jan 3, 2014 at 0:08
-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\$
6
  • 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\$ Feb 19, 2014 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\$ Feb 19, 2014 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, 2014 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\$ Feb 21, 2014 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\$ Feb 22, 2014 at 18:31
  • \$\begingroup\$ @JonathanVanMatre That would be a subjective validity criterion, and would probably be closed as too broad. \$\endgroup\$
    – wastl
    Jul 2, 2018 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\$
1
  • 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\$ Mar 27, 2014 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\$
3
  • 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\$ Mar 28, 2014 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, 2014 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\$ Apr 16, 2014 at 9:45
-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\$
6
  • \$\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\$ Nov 20, 2014 at 18:03
  • \$\begingroup\$ The intention was that the program isn't allowed to take input. I'll be more specific. \$\endgroup\$ Nov 20, 2014 at 18:50
  • 2
    \$\begingroup\$ Does this differ from this previous question in the sandbox? \$\endgroup\$ Nov 20, 2014 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\$ Nov 20, 2014 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\$ Nov 20, 2014 at 19:41
  • \$\begingroup\$ Infinite memory isn't required. \$\endgroup\$
    – feersum
    Nov 20, 2014 at 21:46
-3
\$\begingroup\$

Every number is interesting

We know that every number is interesting but how?

You should write a program or function which:

  • takes a list of N positive integers (>0 and <2^31)
  • outputs N lines each of them showing how the corresponding input number is interesting
  • is not longer than 1024 bytes
  • uses no more than 1 second per number
  • doesn't use external sources

Examples

172: 444 in base6
5776: 76*76
9801: 9 * 1089 (reverse)
68101: no 11 in base2 (10000101000000101)
491033: 317 * 1549 (product of 2 big primes)
467808816: no digit 5 from base6 to base10

Inputs

You should include the output for the following input in your post:

58 92 120 224 358 490 912 1578 7812 222008 1645060 19796411 550453633 

If you care to run your program on a bigger sample and share the result with us use this input data (2500 numbers). (You can upload your output to e.g. pastebin.)

This is a popularity-contest so highest voted answer wins.

Tags: popularity-contest, number

\$\endgroup\$
7
  • 1
    \$\begingroup\$ What sort of criteria are necessary for defining a number as 'interesting'? I see things like square numbers, other bases, etc. But are there any specifics? I'm interested in this challenge (but worried it might be closed as too broad). \$\endgroup\$ Apr 7, 2015 at 13:18
  • \$\begingroup\$ @ASCIIThenANSI There wasn't a clear definition. That's part of the reason why I abandoned the challenge. \$\endgroup\$
    – randomra
    Apr 8, 2015 at 1:55
  • 1
    \$\begingroup\$ Would you mind if I tried taking it up? I would have to post as a new answer, because I can't directly edit. \$\endgroup\$ Apr 8, 2015 at 2:00
  • \$\begingroup\$ @ASCIIThenANSI Not at all. \$\endgroup\$
    – randomra
    Apr 8, 2015 at 2:01
  • \$\begingroup\$ @ASCIIThenANSI Where did you post it? \$\endgroup\$
    – wizzwizz4
    Jul 24, 2019 at 13:33
  • \$\begingroup\$ @ASCIIThenANSI I am also curious \$\endgroup\$
    – MilkyWay90
    Aug 27, 2019 at 23:41
  • \$\begingroup\$ I don't think he posted it or at least with this account. (he only has asked 1 question and it is not this one). \$\endgroup\$
    – Bjop
    Sep 9, 2022 at 10:58
-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\$
2
  • 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, 2015 at 4:07
  • 1
    \$\begingroup\$ 2) What's the winning criterion? Popularity contest? Code golf? \$\endgroup\$
    – Sp3000
    Feb 24, 2015 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\$
9
  • 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\$ Mar 24, 2015 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, 2015 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\$ Mar 24, 2015 at 20:20
  • \$\begingroup\$ @PeterTaylor I added examples of what is not a Sonnet. \$\endgroup\$
    – HSchmale
    Mar 24, 2015 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, 2015 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, 2015 at 20:59
  • \$\begingroup\$ @xnor You mean a file with a that looks like a sonnet but has no rhyme. \$\endgroup\$
    – HSchmale
    Mar 25, 2015 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, 2015 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, 2015 at 21:11
-3
\$\begingroup\$

Represent a Number in the Strangest Way You Can Think Of.. while staying under 8 unique characters

Your goal is to represent some numbers in the strangest way possible.

Rules:

  • The result must be a number that can be used in the programming language like any other ordinary number. For instance, <my expression> + 3 should return 3 more than the value of <my expression>.
  • The code must be under 20 kilobytes. That's a rather large size for a number so you should be all set.
  • The expression must have under 8 unique characters! The length of it can be as long you want, just keep it under 8 unique characters. aaaaaaaaaaaaaaaaaa is valid (if it works in the programming language) but abcdefghijklm isn't valid because it uses 8 or more unique characters.

Guidelines:

  • The goal here is to represent a number in the strangest and most interesting way possible, so if I ask you to represent the number 35 it would be a good idea to respond with something more interesting than 35 or 12 + 23.
  • This isn't a ! Feel free to make your code as long as you want, so long as it's under 20 kilobytes. Fancy code can look nice!
  • The code doesn't need to support decimals (floats) but if it does, it will get 10 extra points (see below).
  • The code also doesn't need to support negative numbers (for instance -37) but if it does, it will get 10 extra points (see below).
  • Try to make your post follow the below:

Post format:

Language

Description

0

...

1

...

30

...

108

...

1337

...

1234567890

...

3.1415 [10 bonus points if you can get this!]

...

-25 [10 bonus points if you can get this!]

...

Bonus numbers:

...

The points is equivalent to the number of votes on the answer plus 10 if it supports decimals with 10 more points if it supports negative numbers. Whoever has the highest points is considered the current winner. Have fun!


This is my first go at making a popularity contest so if you have any tips those would be appreciated.. :)

\$\endgroup\$
7
  • \$\begingroup\$ This is a great challenge... whoever downvoted this has to rethink their concept of code-restriction challenges... \$\endgroup\$ Jul 15, 2015 at 22:49
  • \$\begingroup\$ Ah, thank you. :) \$\endgroup\$
    – Nebula
    Jul 15, 2015 at 23:28
  • \$\begingroup\$ Updated again with negative numbers added (-25), as well as 1 and 0. \$\endgroup\$
    – Nebula
    Jul 15, 2015 at 23:33
  • \$\begingroup\$ @Sp3000 8 unique chars, not 8 total. \$\endgroup\$
    – isaacg
    Jul 16, 2015 at 10:04
  • \$\begingroup\$ @isaacg Didn't I state that? \$\endgroup\$
    – Nebula
    Jul 16, 2015 at 11:11
  • \$\begingroup\$ @liam_ You did, the person I was responding to who deleted their comment missed it. \$\endgroup\$
    – isaacg
    Jul 16, 2015 at 11:32
  • 1
    \$\begingroup\$ TBH, I think this is such a poor popcon that it can't be rescued, but if you want to at least make it clear what you're asking then: 1. You talk about representing "a" number, but also about "support[ing] decimals" and "support[ing] negative numbers". What exactly do you want? A function which maps numbers to code? But if so, the "Post format" makes no sense. 2. What is the code which has a 20kB limitation? Total for all the numbers listed in the "Post format"? Each individual number listed in the "Post format"? Something else? 3. Are the 8 distinct characters per number or for all numbers? \$\endgroup\$ Jul 17, 2015 at 16:19
-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\$
4
  • 9
    \$\begingroup\$ I have no idea what you're asking me to do. \$\endgroup\$ Feb 3, 2016 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, 2016 at 22:11
  • \$\begingroup\$ @TheCrimulo Example answer? \$\endgroup\$
    – Xwtek
    Feb 7, 2016 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, 2016 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\$
7
  • 5
    \$\begingroup\$ Doesn't this boil down to which language has the biggest output stored in a predefined variable? \$\endgroup\$
    – Denker
    Apr 3, 2016 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, 2016 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, 2016 at 20:58
  • \$\begingroup\$ G for pyth wins :D :D \$\endgroup\$
    – Leaky Nun
    Apr 4, 2016 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, 2016 at 10:27
  • \$\begingroup\$ Actually, N in Seriously wins. 11752 bytes output. \$\endgroup\$
    – user45941
    Apr 6, 2016 at 4:06
  • \$\begingroup\$ @Mego Vitsy wins. 0 bytes, 11752 bytes of output. \$\endgroup\$ Apr 7, 2016 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\$
5
  • \$\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, 2016 at 6:48
  • 1
    \$\begingroup\$ Come to our chatroom! :) \$\endgroup\$
    – Leaky Nun
    Apr 17, 2016 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\$ Apr 17, 2016 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, 2016 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\$ Apr 21, 2016 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\$
5
  • \$\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, 2016 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, 2016 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, 2016 at 7:09
  • \$\begingroup\$ We also have a tips question that may be of interest. \$\endgroup\$ Apr 26, 2016 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\$ Apr 26, 2016 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\$
5
  • 1
    \$\begingroup\$ Closed as a dupe. And/or unclear. \$\endgroup\$
    – Riker
    May 19, 2016 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, 2016 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\$ May 19, 2016 at 20:09
  • \$\begingroup\$ we want to give them a challenge, not a flashback.... \$\endgroup\$
    – user56309
    Aug 4, 2016 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\$
    – user58826
    Jun 9, 2017 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\$
2
  • 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, 2016 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\$
    – user58826
    Jun 9, 2017 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\$
8
  • 2
    \$\begingroup\$ Answers in this site normally involve writing code, so this doesn't really appear to be on topic. \$\endgroup\$
    – feersum
    Jun 16, 2016 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\$ Jun 16, 2016 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\$ Jun 16, 2016 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\$ Jun 16, 2016 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\$ Jun 16, 2016 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\$ Jun 18, 2016 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\$ Jun 18, 2016 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\$ Jun 19, 2016 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\$
3
  • 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\$ Jul 14, 2016 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\$ Jul 14, 2016 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, 2016 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\$
7
  • \$\begingroup\$ The only language that could possibly win is mathematica \$\endgroup\$ Aug 23, 2016 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, 2016 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, 2016 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, 2016 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, 2016 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, 2016 at 22:11
1
146 147
148
149 150
152

You must log in to answer this question.

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