459
\$\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\$
  • \$\begingroup\$ How are tags added to questions? \$\endgroup\$ – guest271314 Jan 9 at 7:51
  • \$\begingroup\$ @guest271314 You can use this markup to create a tag in a draft: [tag:code-golf] \$\endgroup\$ – DJMcMayhem Aug 29 at 15:19
  • \$\begingroup\$ Why no featured anymore? Can't we have it auto-added or something? \$\endgroup\$ – JL2210 Sep 26 at 15:57
  • 1
    \$\begingroup\$ @JL2210 We now have a permanent info box that links to the Sandbox, so the featured tag isn't necessary \$\endgroup\$ – caird coinheringaahing Sep 29 at 13:43
  • \$\begingroup\$ I think the sentence 'replace the post here with a link to the challenge and delete it' may specify that the deletion should be done immediately . \$\endgroup\$ – AZTECCO Oct 5 at 19:39

2571 Answers 2571

-1
\$\begingroup\$

A Quine that Grows!

Challenge

Create a quine that, when run, outputs itself but copied larger in the next one. The output should be able to be run, and get larger each time the output is run. The output must consist only of characters from the original quine!

EX:

abc //original
abcabc //output

or

abc //original
aabcc //output

What not to do

abc //original
abcgef //output

abc //original
abcoooooooooooo //output

An example I created

Try it Online! It replicates pretty fast if I do say so myself!

Points

This challenge is meant to be a codegolf, but also emphasize on how fast it replicates. So perhaps something like the speed at which it gets bigger divided by the number of bytes.

I really don't want loopholes like just repetitively adding characters to a section of the code, making infinite loops, and things of the like.

Any input on how to make this a good challenge? I'm open to suggestions!!!

\$\endgroup\$
  • 1
    \$\begingroup\$ Related, related (probably a dupe) \$\endgroup\$ – Jo King Feb 10 at 10:25
  • \$\begingroup\$ @JoKing What about a polyglot that gets bigger? It runs, making another program that runs and outputs a bigger version of the original, and vice versa. \$\endgroup\$ – KrystosTheOverlord Feb 10 at 16:02
  • \$\begingroup\$ where's the polyglot part come from? otherwise that sounds like the second one \$\endgroup\$ – Jo King Feb 10 at 22:04
  • \$\begingroup\$ @JoKing The output has to be in a different programming language, and then create a larger version of the original, then this larger original makes a larger of second program etc... Also to prevent easy loopholes, no using program languages that are derivatives of eachother \$\endgroup\$ – KrystosTheOverlord Feb 10 at 22:32
-1
\$\begingroup\$

Just idea. Not sure what to do exactly.

Evolutionary Golf

Make simple (not golfed at all at first) code for (some program) with language (something).

Now, change a little bit (maximum 3 byte) of code to make it shorter.

Altered code must work properly (this is how evolution work).

(Maybe here will be starting code).

Sandbox

First. What program would be best? For example, 'Hello World' program is not proper, because it is too short, and can't golf that much.

Second. What language would be best? Esolang like BF? Or something like C?

\$\endgroup\$
  • \$\begingroup\$ If I understand the challenge idea correctly you will post an ungolfed answer that does something in some (probably verbose) language (i.e. FizzBuzz in C#). And then answers after that should have a Levensteihn distance change \$c\$ where \$1\leq c\leq3\$ (at least 1 delete) that does the same thing (in any language). And the shortest answer that's at the end of the answer chain wins if no other answers are posted within 2-3 weeks (which is usually the case with answer-chaining challenges)? Or do you mean that anyone can post an ungolfed program, and others using the same language chain it? \$\endgroup\$ – Kevin Cruijssen Jun 26 at 9:04
  • \$\begingroup\$ @KevinCruijssen I'm thinking of both. This is just brief outline, so everything can be changed. \$\endgroup\$ – LegenDUST Jun 26 at 12:10
  • \$\begingroup\$ this is just game of nim with extra steps \$\endgroup\$ – Kenneth Taylor Aug 2 at 17:51
-1
\$\begingroup\$

Print all the commands

META Just a rought idea, needs to be worked out.

Write a program that prints all the keywords and commands that are available in your langauge when you do not import/add anything

Details

  • require full program or standard code-golf?
\$\endgroup\$
  • 2
    \$\begingroup\$ Understanding that this is a rough idea, what happens in languages without commands corresponding to single tokens e.g. ///? \$\endgroup\$ – lirtosiast Jul 18 at 15:49
  • 7
    \$\begingroup\$ It is my opinion that this sort of challenge will likely never be clear. \$\endgroup\$ – Wheat Wizard Jul 18 at 16:08
  • \$\begingroup\$ I'd imagine for /// you'd output all valid non-text characters, so \ /. \$\endgroup\$ – bigyihsuan Jul 18 at 17:08
  • 1
    \$\begingroup\$ Another thing is that language version would be specified. For example, Python 2 has print as a keyword, while Python 3 has print() instead. \$\endgroup\$ – bigyihsuan Jul 18 at 17:10
  • \$\begingroup\$ Pretty sure this (or something similar enough to be a dupe) has been done before. Lemme see if I can find it .... \$\endgroup\$ – Shaggy Jul 21 at 21:11
  • \$\begingroup\$ Found it! codegolf.stackexchange.com/q/162384/58974 \$\endgroup\$ – Shaggy Jul 21 at 21:13
  • \$\begingroup\$ One way to do this might be to make it language specific? While that isn't usually popular, outputting all of, say, Python's commands in most languages besides python is a dupe of the Rickroll challenge. However, in python itself that isn't the best approach. I can't say how well reveived it'd be, but you could try "output these MATLAB commands in MATLAB" and see what people think. \$\endgroup\$ – FryAmTheEggman Jul 23 at 19:45
-1
\$\begingroup\$

Here's a challenge I'd like post because I'm curious to see what people will come up with. It's a bit of an anti-code-golf question because the code should look normal.

Is it clear what the constraints? Did I miss anything?


Introduction

Write a piece of unsuspicious code that does the following:

Let's say you've written a parser that parses it's input line by line and somewhere in your code is

find_string(line, "[start]", "[end]") // returns string between [start] and [end]

This program, when given it's own source code plain text as input, will match that line (twice actually); but we don't want that. It should still parse what it was designed for but not match any line of it's own source code.

Rules

  • It's preferred that your code makes it obvious that one of it's intended uses is to parse (and not match) itself. This is so anyone 'refactoring' the code will not accidentally undo the trick that made it work.
  • Your source code as input will be reduced to a single line.
  • Your program should be able to handle large input (~10mb) and perform reasonably (for your chosen language).
  • Your program does not need to parse the input line by line but that just seems like something reasonable code would do.
  • Points are awarded for code that looks like a normal parser and contains as little assumptions about the input as possible. Bonus points for solutions that contain the start and end delimiters in that order.

Easy solutions are to swap the start and end token arguments or to pre-treat the tokens in some way but that would look suspicious. Someone will come along and refactor your code and break the 'trick'.

I'm interested in reasonable solutions because this is a reduction of a real life problem.

Example Input and Output

  • Input lines may or may not contain [start] or [end], only return it in the output when it occurs in a pair.
  • Input lines will never contain more than one pair of [start] and [end] tokens.
  • Input lines may contain additional content before [start] or after [end]
  • Your source code plain text will be inserted at a random line in the input.

Input #1:

[start]hello[end]
<<your source code plain text>>
dont output this[start]world[end]

Output #1:

hello world

Input #2:

lorem[start]i solemnly[end]
[start]false start
[start]swear[end]
ope, sorry just passing through
this is not the[end]
[start]that i'm up to[end]ipsum
[start]no[end]dolor
<<your source code plain text>>
[start]good[end]

Output #2:

i solemnly swear that i'm up to no good
\$\endgroup\$
  • \$\begingroup\$ What is the objective winning criterion? \$\endgroup\$ – Unrelated String Aug 9 at 5:16
  • 1
    \$\begingroup\$ This could be a good challenge if it was just 'Write a program that takes a line of input and returns the concatenation of anything between [start] and [end] on each line, otherwise an empty string', with the restriction that if it was fed itself, it wouldn't return anything \$\endgroup\$ – Jo King Aug 9 at 6:05
  • \$\begingroup\$ I'm a little confused about what Bonus points for solutions that contain the start and end delimiters in that order. means, since I thought the point was that we're not allowed to have that? \$\endgroup\$ – Jo King Aug 9 at 6:07
  • 2
    \$\begingroup\$ "unsuspicious code" will raise red flags in the minds of a number of old-timers, for historical reasons which I won't explain in detail. What I will say is that unsuspicious is subjective, and we insist on objective criteria. In terms of actual reasonable solutions to the real world problem: don't use magic strings. If "[start]" and "[end]" are both constants and defined on separate lines, the problem is averted, and anyone who refactors to inline them deserves all the bugs that causes. \$\endgroup\$ – Peter Taylor Aug 9 at 10:45
-1
\$\begingroup\$

Make it improbable... BUT NOT IMPOSSIBLE

You must make a program that outputs truly once in a while. However, making it have output falsy all the time is not acceptable.

Rules

  • Standard loopholes are forbidden.
  • You may use any of accepted I/O formats.
  • Your program must be possible to output a truly value.
  • When not outputting a truly value, you may either output a falsy value or not output anything at all.
  • You may output two or more values, however if it contains a truly value, then the output is considered truly.
  • The probability of outputting a truly value must be at most 1/2.
  • Your program must not take/use an input.
  • Using non-deterministic but non-random(Such as getting the time) is prohibited. However, if date etc. is used in the builtin random function, it is allowed.
  • The program must theoretically always terminate or stop outputting anything.
  • You may assume that you have a fast enough computer and large enough memory.
  • Your program should not be affected by raising the maximum value of a data type. You may still use unaffected constants.
  • Data types must be following its spec: ie. for an unbounded arbituary precision integer type, you may assume that it can go as high as you want(but you are not allowed to increment until an error as in the rule above), but a double-precision floating-point format still has 22-bit fraction and 8-bit exponent.
  • Score is calculated as: Pl-1.5l, where P is the probability and l is the byte length.

Example(s)

JavaScript
alert(Math.random()<0.1)
P=0.1, l=24 => Score=23.534

The lowest score wins!

\$\endgroup\$
  • \$\begingroup\$ So is it acceptable for just a program that always outputs truly? You need to define improbable. (I assume this probability must be at least lest than 1/2.) Providing a few examples will be helpful. So is there only output and no input? In addition, you need an objective winning criterion, which is a criterion that posts for this challenge will need to comply in order for it to be a valid answer. (Usually this criterion is making the source code shortest.) \$\endgroup\$ – A _ Sep 24 at 13:37
  • \$\begingroup\$ Sorry, I posted this incomplete. \$\endgroup\$ – Naruyoko Sep 24 at 16:14
  • \$\begingroup\$ I don't think your scoring method works particularly well, unless I'm making an error. For any \$ l > 1 \$ your score cannot be less than 1. Achieving a score arbitrarily close to 1 is relatively easy. So the only way to beat that is to have a one or zero byte solution. It is easy to make the probability increase exponentially with linear code additions. It might be necessary to penalise length massively, like \$ P \times e^{l!} \$, to avoid similar problems. \$\endgroup\$ – FryAmTheEggman Sep 24 at 18:39
  • \$\begingroup\$ I see. I guess P^l^k is too penalizing but Pk or Pe^k is too forgiving. Pe^l! looks simple enough but is is the middle so it may work. \$\endgroup\$ – Naruyoko Sep 24 at 20:11
  • 1
    \$\begingroup\$ The problem with any of scoring methods for this challenge is that it is possible for any increasing computable function f, a program with length l can have P around 1/f(l). The only non-broken formula could be uncomputable, i.e. P/BB(l), where BB is the busy beaver function. \$\endgroup\$ – Naruyoko Sep 24 at 20:15
-1
\$\begingroup\$

Title: Transposition

** The challenge **

Given a set of notes (as a string, or a list, or any other reasonable input - but as letters and accidentals, not a numerical equivalent), the key those notes are in, and a target key; output the notes transposed into the new key. Some of the notes may not exist in the scale for the given key (e.g Eb in the key of C).

** Inputs **

The complete set of input notes for this challenge will use the English naming convention, and so are as follows:

Ab,G##,A,A#,Bb,B,C,C#,Db,C##,D,D#,Eb,E,F,F#,Gb,F##,G,G#

where "b" represents a flattened note (down one semitone per b), and # represents a sharpened note (up one semitone per #). Theoretically all notes can be extended further with more #s and bs; but for the purposes of this program that won't happen beyond what is already given.

** What is transposing? **

Transposing a song involves "moving" the song into a different key, by finding the equivalent note of the scale in that key.

We will assume Major scales for the purposes of this challenge.

** Scales **

The scales for this challenge are officially as follows:

  • C: C, D, E, F, G, A, B, C
  • C#: C#, D#, E#, F#, G#, A#, B#, C#
  • Db: Db, Eb, F, Gb, Ab, Bb, C, Db
  • D: D, E, F#, G, A, B, C#, D
  • D#: D#, E#, F##, G#, A#, B#, C##, D#
  • Eb:Eb, F, G, Ab, Bb, C, D, Eb
  • E: E, F#, G#, A, B, C#, D#, E
  • F: F, G, A, Bb, C, D, E, F
  • F#: F#, G#, A#, B, C#, D#, E#, F#
  • Gb: Gb, Ab, Bb, Cb, Db, Eb, F, Gb
  • G: G, A, B, C, D, E, F#, G
  • G#: G#, A#, B#, C#, D#, E#, F##, G#
  • Ab: Ab, Bb, C, Db, Eb, F, G, Ab
  • A: A, B, C#, D, E, F#, G#, A
  • A#: A#, B#, C##, D#, E#, F##, G##, A#
  • Bb: Bb, C, D, Eb, F, G, A, Bb
  • B: B, C#, D#, E, F#, G#, A#, B

For simplicity, we can assume that both notes in the pairs A#/Bb, C#/Db, D#/Eb, F#/Gb, G#/Ab, C##/D, F##/G, G##/A are enharmonically equivalent (i.e. interchangeable - although they're not, always).

For scales with double-sharps, I will accept the enharmonic equivalents as an alternative implementation:

  • D#: D#, E#, G, G#, A#, B#, D, D#
  • G#: G#, A#, B#, C#, D#, E#, G, G#
  • A#: A#, B#, D, D#, E#, G, A, A#

but for all other notes in the scale, they must match. If the note isn't in the scale, either can be used.

e.g.

  • F in the key of C should transpose to F# in the key of C#, and not to Gb, because that option in the pair is explicitly in the scale
  • but D in the key of C# could transpose to either C# or Db in the key of C, because it's an incidental anyway and so there's no easy rule to determine which it should be.

BONUS feel-good points *: normally it's # if you're going up, and a b if you're going down - feel free to implement this if you want!

For double-sharps (e.g F##) in all cases, It's OK if the program "resolves" these (e.g.to G in that case) even if they are in the scale; but again, some BONUS feel-good points * if you keep the double-sharps in.

Examples

  • CDEFGABC in C to A -> ABC#DEF#G#A
  • C# in C to A -> A# OR Bb
  • ABCDEFGBAF#Bb in Bb to Gb -> FGAbBbCDbEbGFDGb
  • CCGGAAAAGFFEEDDCGGGFFEEEDCGGGFFFFEEED in C to G# -> G#G#D#D#E#E#E#E#D#C#C#B#B#A#A#G#D#D#D#C#C#B#B#B#A#G#D#D#D#C#C#C#C#B#B#B#A#

Websites like http://www.logue.net/xp/ can be used to test your answers to other inputs

* Bonus feel-good points don't get you anything extra, unless someone can come up with a quantifiable difference that it should make to the score?

\$\endgroup\$
  • \$\begingroup\$ This is kind of similar but doesn't use scales and has a different set of chords, so I think this is effectively different? \$\endgroup\$ – FryAmTheEggman Sep 24 at 18:47
  • \$\begingroup\$ Yes, I agree it's similar but doing a different thing to me (they're using chords, and so have the extra text to worry about; but I'm doing notes, like sheet music; and so you have accidentals to worry about) \$\endgroup\$ – simonalexander2005 Sep 25 at 8:48
-2
\$\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\$
  • 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\$ – ASCIIThenANSI Apr 7 '15 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 '15 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\$ – ASCIIThenANSI Apr 8 '15 at 2:00
  • \$\begingroup\$ @ASCIIThenANSI Not at all. \$\endgroup\$ – randomra Apr 8 '15 at 2:01
  • \$\begingroup\$ @ASCIIThenANSI Where did you post it? \$\endgroup\$ – wizzwizz4 Jul 24 at 13:33
  • \$\begingroup\$ @ASCIIThenANSI I am also curious \$\endgroup\$ – MilkyWay90 Aug 27 at 23:41
-2
\$\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\$
  • \$\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
-2
\$\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\$
  • 2
    \$\begingroup\$ I think without dictionaries for rhymes and stresses this is probably not a good idea. Of course you can use some sort of accuracy ratio, but then you also need false positives, and you need a lot more examples than the few on the pages you've linked. But if you do this there's no requirement to actually recognise the sonnets by their rhymes and stresses - instead, I'm pretty sure, people will just regex golf the test sets. \$\endgroup\$ – Martin Ender Mar 24 '15 at 19:36
  • \$\begingroup\$ @MartinBüttner I updated the requirements with an accuracy percentage, and added the option to use an API to look up terms from a dictionary. \$\endgroup\$ – HSchmale Mar 24 '15 at 19:57
  • 1
    \$\begingroup\$ 1. Test data which only covers one possible output isn't test data. I can write a program which always outputs Y in as little as one byte and it will pass all of the linked "test data", but it comes nowhere near to meeting spec. 2. Unless you specify which rhyme/stress dictionary to use, you can't guarantee that the test data is "correct". \$\endgroup\$ – Peter Taylor Mar 24 '15 at 20:20
  • \$\begingroup\$ @PeterTaylor I added examples of what is not a Sonnet. \$\endgroup\$ – HSchmale Mar 24 '15 at 20:32
  • 1
    \$\begingroup\$ I'm not sure how to say this, but it feels as though this task has a lot of individual parts, each of which could be quite tricky. Especiallly detecting rhymes/syllables/stresses, since words can be pronounced/stressed differently based on context. Also if you're using Shakespeare's sonnets I have no idea where to get rhyming and stress dictionaries for Elizabethan English... \$\endgroup\$ – Sp3000 Mar 25 '15 at 14:18
  • \$\begingroup\$ To make this interesting, you'll need some interesting near-misses: non-sonnets that can't be detected by something simple like counting lines or words per line. \$\endgroup\$ – xnor Mar 25 '15 at 20:59
  • \$\begingroup\$ @xnor You mean a file with a that looks like a sonnet but has no rhyme. \$\endgroup\$ – HSchmale Mar 25 '15 at 21:04
  • \$\begingroup\$ Yes, for example. Or, one with rhyme by wrong rhythm. Or, one with nonsense characters that seem to "rhyme". \$\endgroup\$ – xnor Mar 25 '15 at 21:06
  • \$\begingroup\$ @Sp3000 You can just use modern english, or just base it on words that have similar endings. \$\endgroup\$ – HSchmale Mar 25 '15 at 21:11
-2
\$\begingroup\$

Create a Drawing Guide for a Polygram

Poor old Jim, he's just terrible at drawing polygrams, and he's asked you to create a "drawing guide" for him - an ascii polygram with numbered edges, so he can follow the instructions.

Challenge

Write a program to produce an ascii polygram with P <= 10; each edge of the polygram should be made of a single digit 0-9, showing the order in which the edges should be drawn.

Input

Your program should receive (via STDIN, as function arguments, or some other language-appropriate method): P, the number of edges/vertices of the polygram, and Q, the spacing. In the notation as per the Wikipedia link, you'll be drawing a {p/q} polygram.

Output

Either print to STDOUT or return (or something else language-appropriate) a multiline string showing the drawing guide for the given polygram. The string can be any size you like, as long as it's large enough to display a clear polygram.

Notes

Your code should be able to handle compound regular polygons as well as regular regular polygons, and also inputs of q > p/2 (poor old Jim doesn't realize that the polygram for {p/q} is the same as for {p/p-q}).

Example Output for {10,3}

              5              
             5 4             
                4            
     21     5        888     
     2 11115     8888  7     
     2    5111888 4    7     
     2     888111  4   7     
     2  888      111   7     
     8885           4117     
  8882               4 711   
 8   2 5               7  111
     25               47     
 9   5                 7    0
  9  2                 74  0 
    52                 7  0  
   9 2                 7 4   
  5 92                 7 04  
     9                 70  4 
 5   2                 7     
5    29                7    4
6666 2 9              07   33
    666              0 7333  
     2 696           337     
     2   9666     333  7     
     2    9  66633 0   7     
     2      333 666    7     
     2   339       666 7     
     2333   9    0    67     
             9  0            
               0 

Scoring

This is code-golf, so shortest in bytes wins. Tiebreaker goes to the most votes.

\$\endgroup\$
  • \$\begingroup\$ I have a python solution to this which is ~600 bytes, so it's definitely doable, and it's not easy... \$\endgroup\$ – sirpercival Apr 27 '15 at 4:31
  • 5
    \$\begingroup\$ I think the spec needs to be more prescriptive for this to make a good question, especially since the example seems to indicate that you're not currently even prohibiting the lines from having gaps. At a minimum I would say that you should require the lines to be equivalent to those produced by Bresenham's algorithm, and specify how overlaps should be handled; at the extreme, you could tie it down so tightly that it becomes a parameterised kolmogorov-complexity. \$\endgroup\$ – Peter Taylor Apr 27 '15 at 9:34
-2
\$\begingroup\$

Pointer to pointers to pointers to pointers

You should choose a language supporting pointers like C. And your task is simple: demonstrate a legitimate use of the most level of pointers.

You should justify your code by describing an algorithm that:

  • Has only plain text, number or an array of those as input and output.
  • You think it will make things easier to write those code as a part of the implementation of this algorithm.
  • This implementation would have optimum memory usage (only declared variables and parameters, explicitly allocated space, and the return addresses for recursive functions count).

Other rules:

  • They must be pointers to pointers directly, i.e. a pointer to an object containing a pointer doesn't count. It's better if nobody using this code will want to extend some pointer to an object later.
  • Each pointer must have a different type (if your language can somehow make them the same type).
  • You should create at least one pointer, and either dereference or compare two non-null pointers once in each level.
  • Using pointers as arrays is only half as interesting.
  • Iterators, etc, are considered in essence pointers and allowed in this challenge. But you can't define new types implementing iterators for this purpose.

\$\endgroup\$
  • 3
    \$\begingroup\$ Could you specify "legitimate"? This sounds a bit like code bowling (and seems to have the same issues). With enough imagination I'm sure I can justify any depth of pointers. \$\endgroup\$ – Martin Ender Apr 30 '15 at 17:43
  • \$\begingroup\$ @MartinBüttner Edited but, basically, it is subjective. \$\endgroup\$ – jimmy23013 Apr 30 '15 at 17:57
  • \$\begingroup\$ @MartinBüttner Added a restriction to have optimum memory usage. I'm not sure whether it works. \$\endgroup\$ – jimmy23013 Apr 30 '15 at 18:19
-2
\$\begingroup\$

Winning Tic-Tac-Toe lines

For a given tic-tac-toe board of size N**D (for example, a normal tic-tac-toe game is 3**2), the number of winning lines of length N is given by the expression:

$$ 2^{D-1} + \sum_{S=1}^{D-1}2^{S-1}DN^{D-S} $$

(Basically, you are summing the number of lines in each S-dimensional slice of the board.)

The challenge:

Given N and D, your answer should output a list of D-dimensional coordinates for each winning line. Input and output are any reasonable format. You can assume that both N and D are positive integers, with N > 1. (Degenerate cases of N=1, D>1 not included.)

Since this is , fastest answer wins. Please explain your algorithm!

\$\endgroup\$
  • \$\begingroup\$ How do you intend to determine which of two answers is fastest? \$\endgroup\$ – Peter Taylor May 12 '15 at 19:37
  • \$\begingroup\$ yes, @randomra made the same point on chat. i'll edit this in, but i guess... i'll put together some test cases and then time them? i dunno, i was going back and forth between this and code-golf, but i'd prefer interesting and readable algorithms. \$\endgroup\$ – sirpercival May 12 '15 at 20:10
  • \$\begingroup\$ i posted this here because i really want the answer, and i hate coming up with brute force solutions... :D \$\endgroup\$ – sirpercival May 12 '15 at 20:16
  • 2
    \$\begingroup\$ Um. Given that you're asking people to enumerate an exponentially large set, in what sense will the answers not be brute force? \$\endgroup\$ – Peter Taylor May 12 '15 at 20:28
  • \$\begingroup\$ well, there's brute force and then there's brute force. but really it's because i don't want to do it myself, haha. \$\endgroup\$ – sirpercival May 12 '15 at 20:34
  • \$\begingroup\$ also, making use of symmetry can severely reduce the computation. \$\endgroup\$ – sirpercival May 12 '15 at 20:40
  • 1
    \$\begingroup\$ I imagine that the runtime in any such algorithm will be basically proportional to the number of things you print, so there won't be any good way to improve by algorithm and the speed will be very platform-dependent. \$\endgroup\$ – xnor May 12 '15 at 23:40
-2
\$\begingroup\$

Ayn Random number generator


Inspired by xkcd 1277:

enter image description here

Write a random number generator that takes no input and generates a random integer between 1 and 100. When run less than 200 times, the frequency of all numbers needs to be between 0 and 2, but when it's ran 50 000 times, the number 42 (obviously) should have a frequence that's more than 4 standard deviations higher than the mean.

Format is code-golf. Your score is the bytecount of your code.

\$\endgroup\$
  • 1
    \$\begingroup\$ 1. I think it's difficult to decide objectively whether a PRNG appears to be fair at first sight. 2. The term more often should probably be quantified. \$\endgroup\$ – Dennis May 18 '15 at 21:49
  • \$\begingroup\$ I see lots of C rand()%1000 and the like incoming... \$\endgroup\$ – rorlork May 18 '15 at 22:05
  • \$\begingroup\$ @Ypnypn I have changed the criteria to have much lower numbers so they're easier to verify. \$\endgroup\$ – Nzall Jun 6 '15 at 13:04
  • 1
    \$\begingroup\$ @Dennis I have rewritten the question to clarify what "being fair" is and what "more often" actually entails. \$\endgroup\$ – Nzall Jun 6 '15 at 13:05
  • 1
    \$\begingroup\$ 1. Are you thinking of a standalone program that you run multiple times or a function that is allowed to keep a state? In the first case, not even a perfect RNG will, with overwhelming probability, satisfy the first condition. 2. Do you mean the mean and standard deviation of a perfect, uniform RNG or the one the code implements? \$\endgroup\$ – Dennis Jun 6 '15 at 23:44
  • \$\begingroup\$ @Dennis I'm thinking of just a function AynRandom() that gets called. The frequency of numbers with a small number of iterations is subject to change, maybe from 0 to 4. The mean and Standard Deviation must be the one the code implements. \$\endgroup\$ – Nzall Jun 7 '15 at 9:49
  • \$\begingroup\$ between 0 and 2 ? so print 42 would be a valid program ? \$\endgroup\$ – Falco Jun 11 '15 at 15:32
  • \$\begingroup\$ @Falco No, because 42 would appear more than 2 times (unless you only run it twice). The problem is that I need a way to indicate that the RNG is fair with a low iteration count, but unfair with higher iteration counts. The only way I can make it work is by stating that with low iteration counts, all numbers should appear about equally often, which is either 0, 1 or 2 times. \$\endgroup\$ – Nzall Jun 11 '15 at 15:36
-2
\$\begingroup\$

Please nitpick this. If there's anything that wouldn't work or would be inconvenient, however small of an issue it is, tell me about it!
Also, suggestions for [adjective] are more than welcome.


Determine how [adjective] a number is ()

A number would be considered [adjective] if 0 is the result of multiplying its digits together, then multiplying the digits of the resulting number, then repeating until a single-digit number is produced. The more steps it takes to reach 0, the more [adjective] the number is; if the resulting number is not 0, though, the number is not [adjective] regardless of how long it took to finish.
The formula used to determine [adjective]-ness is 10-10/T where T is however many numbers it took to reach 0 (including 0 and the initial input)

Your goal is, as the title says, to write a program or function that determines how [adjective] a number is, and prints every iteration along the way. Here are some example inputs/ouputs:

in: 879
out: 879    <-       (T=1)
     504    <- 8*7*9 (T=2)
     0      <- 5*0*4 (T=3)
            <- optional newline
     6.6... <- 10-10/3 (repeating decimals can be expressed in any way you want)

in: 2468
out: 2468   <-  T=1
     96     <- (T=2) 2*4*6*8
     54     <- (T=3) 9*6
     20     <- (T=4) 5*4
     0      <- (T=5) 2*0

     8      <- 10-10/5

in: -888
out: -888  
     -512   <- -8*-8*-8
     -10    <- -5*-1*-2
     0      <- -1*0

     6.6... <- 10-10/3

in: 1344
out: 1344
     48
     32
     6

     0    <- did not produce 0, so the prog/func returns 0

Your program must follow these rules:

-Takes input from STDIN.
-Throws an "error" (printed to STDOUT) and halts immediately after input if the input has one or more 0s in it or if it's less than three digits in length. The error must be a string, and as it's supposed to be printed to stdout, cannot be one generated by the language itself (eg 1/int(min(input())) to check if it's zero). Lastly, the error message has to clearly define what the error is; ERR:0 and ERR:LEN, for example, would suffice.

Bonuses/Penalties:

-25 if it properly handles decimals. For instance, an input of 99.22 would first turn into 9*9 + 0.(2*2), or 9*9 + 0.4, and so on.


This is , so the shortest answer in bytes wins.

\$\endgroup\$
  • 4
    \$\begingroup\$ I don't like the +15 penalty. Whether strings are used is vague in some languages. The constant amount +15 is too little deterrent for some languages but huge for very concise ones. The fact that you've found a short solution you don't like is sign you should rethink the problem, not try to plug the hole. \$\endgroup\$ – xnor Jun 17 '15 at 7:48
  • \$\begingroup\$ @xnor that's reasonable. I suppose it is a valid way of doing it, anyway, so I removed all mention of strings in that section. Should I also inc/decrease the bonus for decimals? \$\endgroup\$ – M. I. Wright Jun 17 '15 at 22:29
  • \$\begingroup\$ The programming languages I know either don't allow throwing user-defined errors or print them to STDERR. Now, if you just want us to print a message and exit immediately... \$\endgroup\$ – Dennis Jun 17 '15 at 23:32
  • \$\begingroup\$ ...and should be printed to STDOUT. I had a feeling that wasn't clear; I edited it, is it better now? \$\endgroup\$ – M. I. Wright Jun 17 '15 at 23:33
  • \$\begingroup\$ It's the word throw that throws me off (no pun intended). To throw an error usually means something rather specific. Print an error message to STDOUT (or closest alternative) would be less confusing in my opinion. Also, since this is code golf, I think you should require specific error messages. There's no fun in losing a contest because you chose ERR:LEN and somebody else got away with EL. \$\endgroup\$ – Dennis Jun 18 '15 at 3:16
  • 5
    \$\begingroup\$ Remove bonuses altogether. It's in the list of things to avoid. \$\endgroup\$ – mbomb007 Mar 1 '16 at 21:31
  • \$\begingroup\$ The error if the input contains a zero seems like a separate challenge. It may be better received if there is only one challenge. There is community support for avoiding Chameleon challenges. \$\endgroup\$ – trichoplax Aug 10 '16 at 11:40
-2
\$\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\$
  • \$\begingroup\$ This is a great challenge... whoever downvoted this has to rethink their concept of code-restriction challenges... \$\endgroup\$ – WallyWest Jul 15 '15 at 22:49
  • \$\begingroup\$ Ah, thank you. :) \$\endgroup\$ – Florrie Jul 15 '15 at 23:28
  • \$\begingroup\$ Updated again with negative numbers added (-25), as well as 1 and 0. \$\endgroup\$ – Florrie Jul 15 '15 at 23:33
  • \$\begingroup\$ @Sp3000 8 unique chars, not 8 total. \$\endgroup\$ – isaacg Jul 16 '15 at 10:04
  • \$\begingroup\$ @isaacg Didn't I state that? \$\endgroup\$ – Florrie Jul 16 '15 at 11:11
  • \$\begingroup\$ @liam_ You did, the person I was responding to who deleted their comment missed it. \$\endgroup\$ – isaacg Jul 16 '15 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\$ – Peter Taylor Jul 17 '15 at 16:19
-2
\$\begingroup\$

Wrong tool for the task

Task

Write two full programs in the same programming language that solve the following two tasks:

  1. Read two positive integers from STDIN and print their sum to STDOUT.

  2. Read two positive integers from STDIN and print their product to STDOUT.

Additional details:

  • Given enough time and memory, your programs has to support arbitrarily large integers.

  • All integers (input and output) use standard decimal notation, have no leading zeroes and are followed by a single linefeed.

Scoring

The first task is code golf, so your objective is to make your program as short as possible.

The second task is code bowling, so your objective is to make your program as long as possible.

Your score is defined as follows:

score formula

The highest score wins!

Robbing a language

There's a catch! Only the submission with the shortest program in a particular language will be considered valid for task 2, so there can only be one valid answer per language.

This means that you cannot deliberately write a huge program for task 2; you actually have to pick the "wrong tool" for the task.

Additional details:

  • Task 1 exists merely to provide the proper denominator for the score (and robbers have no moral anyway), so byte-per-byte copies of somebody's program for task 1 are allowed.

  • If two answers use the same language and have programs of the same length for task 2, the answer that achieved that length first will be considered valid.

  • If somebody invalidated your answer, you may attempt to golf your answer to revalidate yours and invalidate his.

\$\endgroup\$
  • \$\begingroup\$ I suspect this will come down to people writing code in unary and disagreeing on what input/outputs formats are valid for such a language. \$\endgroup\$ – xnor Jul 20 '15 at 20:17
  • \$\begingroup\$ @xnor I'm not sure I understood your comment. The format for I/O is purposedly restrictive, so an answer's validity should be clear-cut. \$\endgroup\$ – Dennis Jul 20 '15 at 20:25
  • \$\begingroup\$ @feersum I think the log scoring does benefits unary. Say (making up numbers) task 1 takes 100 chars of BF and task2 takes 150 chars. Then, those are translated to 300 chars and 450 chars of binary, and so 2^(300) and 2^(450) chars of unary, giving a score of 1.5. In comparison, if the tasks take 20 chars and 50 chars in another language, that's about a score of 1.3. I guess this is surmountable though (20 and 100 gives 1.5). \$\endgroup\$ – xnor Jul 20 '15 at 20:33
  • \$\begingroup\$ Are the inputs decimal numbers? For a language like BF, can the numbers be taken as byte values rather than characters? What separator should be used between the numbers? Are leading zeroes OK in the output? I think you'll have to be pedantic and precise about everything given how much of the character count may depend on details, but it's doable. \$\endgroup\$ – xnor Jul 20 '15 at 20:35
  • \$\begingroup\$ Yeah that's right, it is only for Unary. \$\endgroup\$ – feersum Jul 20 '15 at 20:37
  • \$\begingroup\$ @xnor All integers (input and output) use standard decimal notation, have no leading zeroes and are followed by a single linefeed. \$\endgroup\$ – Dennis Jul 20 '15 at 20:42
  • \$\begingroup\$ @Dennis Wow, you anticipated everything and I missed it. I take it then that input must be as a string of numerical characters? Also, do I understand right that you have to print a newline for output (say, print a+b,"\n" in Python)?. \$\endgroup\$ – xnor Jul 20 '15 at 20:45
  • \$\begingroup\$ @xnor Yes to both. The newline is required and you have to use numerical characters. I'd specify the exact character range, but I don't want to exclude non-ASCII languages.I'll think of a way to make it clearer. \$\endgroup\$ – Dennis Jul 20 '15 at 20:51
-2
\$\begingroup\$

GitHub Gist command-line client

Create a command-line tool that publishes a list of files as one public GitHub Gist.

Specification

The following bullet points describe the behavior of the program. If a bullet point has "must", you must implement that point. If a bullet point has "can optionally" or "should optionally" you can implement that point on your own volition.

  1. It must be a complete command-line program.
  2. It must use the GitHub Gists API.
  3. It must post an anonymous Gist (that is, not as a GitHub user).
  4. Gisted files must use the filename provided on the command-line.
  5. The command-line must accept multiple positional arguments.
  6. If no arguments are specified, it must print this usage to STDOUT: gist: usage: <file> [file...] verbatim then exit with code 0.
  7. If something else goes wrong, it must print this message to STDERR: gist: unable to gist =( verbatim then exit with code 1.
  8. If everything is successful it must print the Gist's HTML URL to STDOUT.
  9. It can optionally accept a flag for description -d <description. floor(score * .9)
  10. It can optionally accept a flag for private gisting -p. floor(score * .9)
  11. In the case that a description flag is not used or implemented it must set the description to an empty string.

Example Input/Output

The number before the prompt is the exit code of the previous command.

0 $ gist
gist: usage: <file> [file...]
0 $ gist no-such-file.txt
gist: unable to gist =(
1 $ gist hello.txt
https://gist.github.com/anonymous/1e645596ce7bceeb1ec9
0 $

Scoring

This is a so shortest answer wins. As stated above, the following multipliers are in effect:

  • (9): score = floor(score * .9)
  • (10): score = floor(score * .9)
  • Both (9) & (10): score = floor(floor(score * .9) *.9)
\$\endgroup\$
  • \$\begingroup\$ What's up with the Example Input/Output code snippet? The editor's preview displays it correctly. \$\endgroup\$ – Winny Jul 27 '15 at 20:17
  • 2
    \$\begingroup\$ For the usage, should those literal strings be used regardless of the name and invocation of the program, or should it substitute the correct invocation for the leading gist? I'm thinking particularly of cases like Java, which doesn't support hashbangs. \$\endgroup\$ – Peter Taylor Jul 27 '15 at 20:32
  • \$\begingroup\$ Literal string, I think. \$\endgroup\$ – Winny Jul 27 '15 at 20:34
  • \$\begingroup\$ That's a good point about Java. I think I'll remove the item about shebangs since it's unfair. \$\endgroup\$ – Winny Jul 27 '15 at 20:41
  • \$\begingroup\$ If both bonuses are done, is it floor(score * .9 * .9), or floor(floor(score * .9) * .9)? \$\endgroup\$ – Maltysen Jul 27 '15 at 23:48
  • \$\begingroup\$ Also, if the bonuses are done, do we have to make the usage string reflect that, or just print it verbatim? \$\endgroup\$ – Maltysen Jul 27 '15 at 23:50
  • \$\begingroup\$ Output strings verbatim. And floor(floor(score * .9) * .9) for both. I'll update the question momentarily. \$\endgroup\$ – Winny Jul 28 '15 at 2:07
  • \$\begingroup\$ I'm curious why this challenge is being downvoted. \$\endgroup\$ – Winny Jul 28 '15 at 2:28
-2
\$\begingroup\$

Golf these arrays

Your task is to output these 128 arrays: http://pastebin.com/UeBMJfv7

Gzip base64: (too long, will be added if I'll post this question).

Rules

  • You don't have to output them all. And you can output the arrays in any order. But the order of items in the arrays must be kept as is.
  • You can print other arrays, which wouldn't be counted towards your score. The number of arrays you print must be no more than 10,000, and the total number of arrays, subarrays and numbers must be no more than 10,000,000.
  • You can use any convenient format to represent the arrays (and the list of outputted arrays).

Scoring

If your program or function has n bytes, and it printed k distinct arrays from the above list, your score would be n*(128/k)2. Lowest score wins.


Problems

It looks too boring.

\$\endgroup\$
  • \$\begingroup\$ It also looks too broad. \$\endgroup\$ – Peter Taylor Aug 8 '15 at 7:55
-2
\$\begingroup\$

The Perfect Keyboard

Back in the 1970s, keyboard designers respected the needs of programmers and languages. For example, see the IBM 2741 keyboard, designed for APL (from Wikipedia):
enter image description here

Today, sadly, most code golfers are forced to struggle with standard keyboards, which are badly suited to the needs of their language. This has to change!

The challenge

  1. Choose a programming language.
  2. Design a keyboard, which would best suit the needs of a developer (or specifically a code golfer) in said language.
  3. Post the keyboard layout as an answer.
  4. Explain how your keyboard enhances the programming experience.
  5. Start counting votes for 7 days, until I acceopt the winning answer (the answer with most votes).
  6. Optional - if you are the winner, start a Kickstarter project to build the thing.

Expected Answers

This section is, of course, for the sandbox only.

I don't really expect a keyboard design which would actually improve functionality of programs in an actual serious language. I'd expect fun answers, where the keyboard design highlights soemthing fun/interesting/absurd about the language. But my expectations don't matter so much, because it's not me rating the answers, but the other users.

Example (not very good ones):

  1. A Brainfuck keyboard with only 4 keys.
  2. A Lisp keyboard where half the keys are parentheses.
  3. A Piet keyboard - I'm sure someone will come up with something nice.

\$\endgroup\$
  • 6
    \$\begingroup\$ I'm note sure if it's a valid challenge since there is no programming actually involved in answering this \$\endgroup\$ – Fatalize Sep 3 '15 at 9:28
  • \$\begingroup\$ @Fatalize, You're right, but it is a programming-related challenge. It requires knowledge of programming languages and people may find it interesting or amusing. I may be pushing the boundaries, I don't know. \$\endgroup\$ – ugoren Sep 3 '15 at 9:45
  • 2
    \$\begingroup\$ I would personally be ok with that challenge but I don't know if other, more prominent users would find this challenge off-topic. \$\endgroup\$ – Fatalize Sep 3 '15 at 9:48
  • 2
    \$\begingroup\$ Judging from this Meta post, there seems to be a fairly clear consensus that a question must involve programming to be on topic, not merely be programming related. So this question is fairly clearly not valid. \$\endgroup\$ – isaacg Sep 3 '15 at 10:08
  • \$\begingroup\$ You could always include programming the driver or some kind of special interface for the keyboard \$\endgroup\$ – Beta Decay Sep 3 '15 at 10:28
  • \$\begingroup\$ @BetaDecay, This challenge is about crazy creative answers. Requiring a driver implementation seems to me like a way to kill this creativity. \$\endgroup\$ – ugoren Sep 3 '15 at 11:01
  • \$\begingroup\$ @isaacg, trichoplax writes "I judge it by whether the answers to it demonstrate skill and determination, or just aesthetic style" - I think a good answer to this challenge requires undestdanding a language and designing something that relates to its properties. Does it qualify as "skill and determination"? I can't say I'm sure. \$\endgroup\$ – ugoren Sep 3 '15 at 11:06
  • 1
    \$\begingroup\$ The art/programming debate was specifically about popcon questions where the answers were programs. There's no doubt whatsoever that a popcon where the answers are just images would be an art question rather than a programming question. On the same basis, this is not a programming question, and does not belong on this site. \$\endgroup\$ – Peter Taylor Sep 4 '15 at 13:58
  • \$\begingroup\$ @PeterTaylor - I don't think it's an art question. The challenge isn't to get a pretty picture of a keyboard, but to design something that suits the language in an interesting way. But I posted it here to get the communities opinion, and it seems quite clear what it is. \$\endgroup\$ – ugoren Sep 5 '15 at 19:00
  • \$\begingroup\$ Since I wrote that meta answer the rules on popularity contests have been tightened up, and I think that is a good thing. I stand by my answer, but I think it is right that popularity contests be judged strictly, to reflect the fact that it is very difficult to write one that is a good fit for the site. \$\endgroup\$ – trichoplax Sep 4 '16 at 11:56
  • \$\begingroup\$ Although it's possible someone will come up with an ingenious approach to designing a keyboard, the challenge itself seems to lean towards "make me laugh" rather than "impress me". This is why I don't think this is a good fit for the site. \$\endgroup\$ – trichoplax Sep 4 '16 at 12:03
  • \$\begingroup\$ I'd love to see what keyboards the community comes up with, but I think it would need to be hosted somewhere other than main. For things which are appealing to the PPCG community, but not quite a fit for main, there's Code Golf Chat. People often post "mini challenges" which aren't well specified enough to be challenges on main, but can end up inspiring people to write a full challenge. \$\endgroup\$ – trichoplax Sep 4 '16 at 12:06
  • \$\begingroup\$ I think it's important to keep testing the boundaries of existing winning criteria, and to try to come up with new ones. The people who put the effort into this will have a long run of rejections, but I really hope these don't come across as "don't try". \$\endgroup\$ – trichoplax Sep 4 '16 at 12:19
-2
\$\begingroup\$

Technologic - Now what's THAT command do??

Daft Punk's song "Technologic" is all about actions that a user or computer does when it's working and being used. You goal is to write a program that has one command we will call the Technologic Command. This command will executes all of the actions like "buy it", "lock it", "code it", and "write it" in the order the lyrics are written on 'it'. What 'it' is is up to you, but you gotta let me know.

Rules

  • Any language can be used.
  • The song refers to an 'it'. That can be a block a memory, algorithm, function, file, or anything else a computer can manipulate directly or indirectly.
  • You must specify what 'it' is you will be performing these actions on. If you don't, you can only earn a maximum of 160 points.
  • Points will be deducted otherwise if a command is not used.
  • I'm not aware of any 'buy' command, method, function, subroutine or instruction so use a thesaurus and find the closest word you can actually program. I don't expect the program to actually buy or snap anything. Other words like mail and fax are possible, but not recommended.
  • If you have to use a synonym, you are not allowed to use that command again
  • Encompassing multiple objects into one artifact does not count. For example, taking the command "name it" literally means you won't be able to name an array of bytes, but you can name a file. Creating an object that holds both a file and an array of bytes is not allowed. That would make this too easy to get the maximum amount of points.

Scoring

  • There are 16 commands with a total possible score of 190 points.
  • 10 points for executing a command on the specified 'it' of your choosing (160 total)
  • 2 points for executing each command consecutively that references your 'it' (30 total)
  • 5 points for executing a command on something other than your 'it'
  • -3 points for every command skipped.

Command List

lyrics

Buy it, use it, break it, fix it,
Trash it, change it, mail - upgrade it,
Charge it, point it, zoom it, press it,
Snap it, work it, quick - erase it,
Write it, cut it, paste it, save it,
Load it, check it, quick - rewrite it,
Plug it, play it, burn it, rip it,
Drag and drop it, zip - unzip it,
Lock it, fill it, call it, find it,
View it, code it, jam - unlock it,
Surf it, scroll it, pause it, click it,
Cross it, crack it, switch - update it,
Name it, rate it, tune it, print it,
Scan it, send it, fax - rename it,
Touch it, bring it, pay it, watch it,
Turn it, leave it, start - format it.

\$\endgroup\$
  • \$\begingroup\$ This conversation has been moved to chat. \$\endgroup\$ – Dennis Sep 17 '15 at 21:06
  • \$\begingroup\$ I count way more than 16 commands here. There are 16 lines each with several commands on them. If we cound the hyphenated commands as two, there are 16 x 4 = 64 commands. \$\endgroup\$ – Level River St Sep 22 '15 at 22:01
  • \$\begingroup\$ @steveverrill A slight oversight. haha. I must've counted the lines knowing there were 4 commands on each line and didn't multiply the two together. \$\endgroup\$ – Luminous Sep 23 '15 at 12:31
-2
\$\begingroup\$

Just Golf 2016

(Related: A Kingdom Hearts VGM challenge) Sandbox note: potential duplicate?

Just Dance 2016 is coming out soon, and I know I'm definitely excited! However, let's take a quick trip back to 2009, when the original Just Dance was released. There are a lot of great songs, but I don't know who sung half of them!

The Challenge

Write a program that accepts a Just Dance song name from input and outputs the song's artist (as credited in-game.)

Here is the list of all songs and artists from Just Dance 1:
list pending

Rules and Assumptions

  • You may assume that the song will always be valid.
  • The song's title and artist must be properly capitalized.
  • You may not read any external files - the song data must be hardcoded.
  • If a song is covered (which several have been for various reasons), the program should return the cover artist (as they are credited in the game.)

Test Cases

Input: Eye of the Tiger
Output: Survivor

Input: Fame
Output: Irene Cara

Bonuses

  • Each game has had one song everyone was really excited about. This year, it's Ievan Polkka by Hatsune Miku. You get a bonus of -50 points if you accept this song as valid input.

  • Just Dance is fun, but why should we stop there? If you additionally accept songs fron the rest of the main series (Just Dance 2, 3, Greatest Hits/Best Of, 4, 2014, and 2015, not including DLC and skipping over any duplicates), you get a whopping -2009 points. Here is the full list for those games:
    list pending

    • Note that this doesn't include Just Dance 2016 songs.
    • This can be combined with the other bonus to get a total of -2059 bytes.

Meta Questions

  • Are the bonuses too big? (I'm mainly talking about the -2009 point bonus for including every song.)
  • Has anything been left out?
  • Is this enough of a challenge?
\$\endgroup\$
  • 1
    \$\begingroup\$ This looks like a dupe of codegolf.stackexchange.com/q/53678/194 . \$\endgroup\$ – Peter Taylor Sep 24 '15 at 20:24
  • \$\begingroup\$ @PeterTaylor I would say it isn't, that one asks for input in the form of a game and boss and returns a song, mine asks for a song and returns an artist. That one also has different scoring rules, and mine requires all items to be implemented. \$\endgroup\$ – ASCIIThenANSI Sep 25 '15 at 13:51
  • \$\begingroup\$ They're both "golf this given map / dictionary / associative array". Why would the techniques used be any different? \$\endgroup\$ – Peter Taylor Sep 25 '15 at 15:22
  • \$\begingroup\$ @PeterTaylor According to this meta post, the main qualification for duplicates is "Can answers from one question be copied over to the other with little or no modification and still be competitive?". I looked at the answers for the question you linked, and it doesn't seem like either would do very well if those techniques were used in this challenge. \$\endgroup\$ – ASCIIThenANSI Sep 25 '15 at 15:35
  • \$\begingroup\$ Would this be kolmogorov-complexity? \$\endgroup\$ – LegionMammal978 Sep 26 '15 at 17:16
  • \$\begingroup\$ @LegionMammal978 Yes. \$\endgroup\$ – ASCIIThenANSI Sep 27 '15 at 14:48
-2
\$\begingroup\$

Literally just printing the source code

Wait a second. We already have a contest where you print the source code. Right? Wrong.

The challenge

Print out the source code. Not to STDOUT, but to a physical printer.

The rules:

  • You must write a complete program that prints out its own source code with a printer connected to the computer.
  • No STDIN (or input of any kind), STDOUT, or STDERR.
  • No standard loopholes (includes no file input). No using lp(r/d) or similar commands.
  • The printed code should be a reasonable size (between size 8 and 18) and a legible font (pretty much means no wingdings).
  • You may assume that the user doesn't cancel the process and answers affirmatively to any system print dialogs.
  • You can assume that the printer works, is ready, doesn't need new ink/paper, etc.
  • If the language doesn't support printing, it is ineligible.
  • This is so shortest code, in bytes, wins.
\$\endgroup\$
  • \$\begingroup\$ This is a trivial extension of the quine challenge. All you have to do is say you're running it on Unix/Linux and pipe the output to lpr. \$\endgroup\$ – Mego Nov 1 '15 at 22:21
  • \$\begingroup\$ This needs a much tighter spec on the hardware. E.g. I assume you would consider it cheating to post an ordinary quine and say "On this computer, all console output is also logged to a continuous print spool", but there are computers which are configured like that for audit reasons. \$\endgroup\$ – Peter Taylor Nov 2 '15 at 14:39
-2
\$\begingroup\$

Print a sourcecode

Given 2 inputs(First input is truthy/falsy, second input is program in same language as submission):

  1. If the first input is truthy then transform the second input into same program but printing the source code(After modification) first.
  2. If the first input is falsy then transform the second input into same program but after the program finished it prints the source code(After modification). If the program doesn't halt, you may or may not modify the program.

It's code-golf, so the shorter answer is the winner.

For example in CJam, I don't write the program to do this. (> means output)

0 q
>{"_~"q}_~
0 0 1{_@+}11*;
>{"_~"0 0 1{_@+}11*;}_~
1 q
> {q](\o"_~"}_~
\$\endgroup\$
  • 7
    \$\begingroup\$ Sorry, I'm not quite sure what this question is asking. Would it be okay if you posted examples? \$\endgroup\$ – Sp3000 Nov 5 '15 at 14:29
  • \$\begingroup\$ @Sp3000 Please undo your downvote. The example is fixed. \$\endgroup\$ – Akangka Nov 7 '15 at 7:39
  • 3
    \$\begingroup\$ I didn't downvote though... \$\endgroup\$ – Sp3000 Nov 7 '15 at 8:13
-2
\$\begingroup\$

Restricted "Hello, World!"

The task is very simple, output Hello, World! to STDOUT. The thing that makes this different are the rules:

  • You need to provide a full functioning program, taking no input and outputting via STDOUT.
  • The program must not write anything to STDERR
  • The maximum amount of bytes you can use is 50
  • The program may only contain printable ASCII characters. Programs using CP437 and other encoding systems are not allowed
  • If a programming language is already used, you cannot use this same language again.
  • You cannot use any character of the prohibited character list. This is the twist:

Prohibited character list (PCL):

The prohibited character list is a list full of characters, which cannot be used in the following programs. For example:

If the list was: He\., you need to create a program, without the characters H, e, \ and .. These are not case-sensitive.

If you succesfully manage to write a program that doesn't use any characters, you may add new one character to the prohibited character list.

e.g.

If the old PCL was He\., and you managed to write a program that doesn't use any of these characters, you may add a new character to this list. For example (whitespace). The new PCL will be He \. (notice that the whitespace character is added).

Posting Snippet:

This might help you wit posting your submission:

#[Language Name], N bytes

 [code]

 (explaination etc.)

 Added character: [char]

 New PCL: [list + new char]

In the beginning, the PCL is empty. The last person who managed to create a program without a new program made in 2 days, wins!


I'm not really sure if it is flawed or not. If you have any suggestions or comments, feel free to post them below in the comment section :)

\$\endgroup\$
  • 2
    \$\begingroup\$ Already exists. \$\endgroup\$ – Arcturus Nov 22 '15 at 23:38
-2
\$\begingroup\$

What day of the week is Christmas?

Christmas is coming quickly, which leads to the question, what day of the week is Christmas this year? But what day of the week is Christmas for any year? Write a program that can do this. This is code golf, so the shortest code wins!

However, there is a major twist. No builtin functions to do this task is allowed!

Bonuses:

  1. If the program can handle B.C. years as negative numbers, then -25%
  2. If the program prints "The first Christmas!" for an input of -4 (4 B.C. is assumed to be when Jesus Christ was born), then -30 bytes
  3. If, for some reason, you really like builtins, +90%! So try NOT to use it!
\$\endgroup\$
  • \$\begingroup\$ The bonus for printing extra should be steeper, or no esolangs are going to go for it. \$\endgroup\$ – Addison Crump Nov 29 '15 at 1:45
  • \$\begingroup\$ @VoteToClose so more like 25% as well? \$\endgroup\$ – TanMath Nov 29 '15 at 1:48
  • \$\begingroup\$ No - I'd go static. Plus, this is really close to being a dupe... \$\endgroup\$ – Addison Crump Nov 29 '15 at 1:51
  • 2
    \$\begingroup\$ Near dupe of codegolf.stackexchange.com/questions/1003/… \$\endgroup\$ – Calvin's Hobbies Nov 29 '15 at 1:52
  • \$\begingroup\$ It's unspecified what format we should output in or what calendar we should use, and whether -4 should mean 4 BC or 5 BC. \$\endgroup\$ – lirtosiast Nov 30 '15 at 5:57
  • \$\begingroup\$ @ThomasKwa it should be obvious from the sentence that 4 B.C. is -4. Use the Gregorian calendar, output can be in MMDDYY \$\endgroup\$ – TanMath Nov 30 '15 at 6:09
  • \$\begingroup\$ How is MMDDYY a day of the week? \$\endgroup\$ – lirtosiast Nov 30 '15 at 16:32
  • \$\begingroup\$ @ThomasKwa sorry, it was pretty late when I wrote that so I mistakenly wrote MMDDYY. Just printing the day of the week is fine i.e. print "Sunday", "Monday", "Tuesday", etc. \$\endgroup\$ – TanMath Nov 30 '15 at 19:57
-2
\$\begingroup\$

Broken FizzBuzz - Greg Is Confused

(FizzBuzz suggested by quartata in chat)

(Related: Deletion of a blank line in source code which causes unexpected functionality, What? No error?, and Write a line in program that looks useless)

Meet Greg. Greg is the new debugger at your company, and he deals with checking programs to see if they work. If they don't, he tries to find out why and fix them.

Greg is rather new to programming and understands the basics, but still gets tripped up by some advanced things. Sometimes, programs don't work and he doesn't know why.

You don't really like Greg, so you decide to play a game. You create two nearly-identical FizzBuzz-style programs - one which works, and one which doesn't.

For example:

n = input()
if (n % 3 == 0) {
 print "Fizz"
}
if (n % 5 == 0) {
 print "Buzz"
}

works, but

n = input()
if (n % 3 = 0) {
 print "Fizz"
}
if (n % 5 == 0) {
 print "Buzz"
}

doesn't. Greg is confused (but not by something as simple as this).

And because Greg has a desk only a few feet away from you, your code must be as small as possible, so he doesn't catch on.

Rules

  • Your correct program must accept an integer as input and return output as specified below, and your incorrect program must do something else (such as throwing an error or giving invalid output).
    • The valid program's output must print "Fizz" if the number is divisible by 3, "Buzz" if it divisible by 5, "FizzBuzz" if it divisible by both 3 and 5, and nothing if it isn't divisible by 3 or 5.
    • The invalid program's output may do anything else.
  • Greg knows all programming languages to date, including super-obscure ones. Therefore, your answer may be in any language you choose (providing it was created before this challenge was posted.)
  • You MUST have the two programs be nearly identical, except for one small change. The more concealed or insignificant-looking, the better.
  • Greg uses PPCG and has participated in underhanded challenges before, so he knows about the C trigraph (??/). You can't trick him with it.
  • Greg has also seen replacing ASCII characters with nearly-identical Unicode or abusing fonts, meaning that won't work either. Therefore, your program's change must work with all fonts, any may not exploit visual similarity between characters with different code-points.
    • Changing an a to an A is allowed, as long as it's not obvious that that's what broke the program. However, changing a to <unicode character that looks exactly the same> is forbidden.
  • Both programs must be written in the same language with the same version.
  • Your answer must include:
    • The language both programs are written in
    • Two programs: one FizzBuzz program, and another that is broken
    • How to run both of them (the commands must be identical with identical arguments)
    • Why one doesn't work (in spoilertext)
    • The output of the broken one
  • Your programs must have a Levenshtein distance of no more than 10 from one-another. (Meaning that you may add, delete, or change up to 10 characters in the broken code from the correct one.)
  • Your score is the total bytecount of both of your programs.
  • The winner is the post with the smallest score over 20 votes.

Meta Questions

  • Is 10 too small a maximum Levenshtein distance? I was also considering 15.
  • Are any of my rules already forbidden by the standard loopholes? I'd like to remove them if possible to make the post shorter.
  • Similarly, should I remove or change any of my rules?
  • This is a code-golf version of this previous edit. Should I keep it as code-golf or change it back?
\$\endgroup\$
  • 1
    \$\begingroup\$ "replacing ASCII characters with nearly-identical Unicode" doesn't really express what that old chestnut does. "Exploiting visual similarity between characters with different code-points" is more accurate. Although it's arguable whether that covers e.g. switching space for non-breaking space, and I don't think it covers using non-whitespace non-printable characters (which with the right font are invisible). \$\endgroup\$ – Peter Taylor Dec 16 '15 at 16:44
  • 4
    \$\begingroup\$ I think there is something interesting here in making seemingly equivalent programs behave very differently. But I'm generally sceptical of underhanded pop-cons, because they're usually way too broad and this one doesn't seem to be an exception. The primary cause is probably that there's no actual task that the program should accomplish. That means you can literally write any code that leads to failure from a small change (which is probably most code although the failure will not be surprising for most of those changes). I'd recommend giving a task for at least one of the two programs. \$\endgroup\$ – Martin Ender Dec 16 '15 at 16:49
  • \$\begingroup\$ @PeterTaylor Maybe something like "Your program's change must work with all fonts, any may not exploit visual similarity between characters with different code-points"? \$\endgroup\$ – ASCIIThenANSI Dec 16 '15 at 16:53
  • \$\begingroup\$ @MartinBüttner I've changed it to two programs that should print "Hello, world!" (only the correct program will work). How does this look? \$\endgroup\$ – ASCIIThenANSI Dec 16 '15 at 16:57
  • 1
    \$\begingroup\$ There are some very closely related underhanded challenges: codegolf.stackexchange.com/q/31647/8478 codegolf.stackexchange.com/questions/23250/what-no-error codegolf.stackexchange.com/questions/19379/… \$\endgroup\$ – Martin Ender Dec 18 '15 at 16:37
  • \$\begingroup\$ @MartinBüttner I've added them in. Do you think they're close enough to be duplicates? \$\endgroup\$ – ASCIIThenANSI Dec 18 '15 at 16:42
  • \$\begingroup\$ @ASCIIThenANSI I can't predict how the community will vote, but I wouldn't mod hammer it. \$\endgroup\$ – Martin Ender Dec 18 '15 at 16:45
-2
\$\begingroup\$

Golf A Wiki

The Challenge

Golf a wiki. A wiki, for the purposes of this contest, is defined as a website with:

  • Content editable by all
  • Easy CamelCase (defined as a word with two capitals) linking
  • Different pages or articles that are the targets of the links

Your wiki can be a self-contained HTML file (e.g. TiddlyWiki), or a cgi-bin script (e.g. SigWik).

Scoring

Your score is the size of your program in bytes, divided by the number of extra features implemented plus one.

The possible extra features are:

  • Page history
  • Syntax for "nowiki", that is, something like <\noscript> in HTML that makes the text inside it not be wiki syntax.
  • A page list
  • A find page facility
  • Usernames and passwords (with registering)
  • Security levels (requires usernames and passwords, or possibly IPs?)
  • Delete pages
  • Change page titles
  • Redirects
  • Random page
  • Non-HTML formatting that is not just links [Should I remove this? I doubt it will be done.]

Lowest score wins, as this is code golf.

DISCLAIMER

ANSWERS WILL PROBABLY CONTAIN MAJOR SECURITY FLAWS. ONLY USE ON PRIVATE PORTS, UNLESS YOU WANT YOUR COMPUTER AND VERY POSSIBLY YOUR WHOLE NETWORK TO GET DESTROYED (FIGURATIVELY). [Is this too forceful?]

\$\endgroup\$
  • 3
    \$\begingroup\$ I would vote to close this as too broad. Among the problems I see: 1. The two given examples don't seem to be the same thing as each other 2. The complete lack of constraints mean that I could just automatically make every word a link. (This could be fixed by specifying one link syntax: for golfing I quite like the UseModWiki use of CamelCase for links). 3. I think I can get the "text formatting" feature for free by not escaping HTML characters. 4. Needs a big warning "Answers will likely contain major security flaws and should not be used on ports which are publicly visible" \$\endgroup\$ – Peter Taylor Dec 30 '15 at 10:49
  • 1
    \$\begingroup\$ Ok, thanks, I'll edit when I have time today. \$\endgroup\$ – Hipe99 Dec 30 '15 at 21:27
-2
\$\begingroup\$

Progress 100%

I am building a download manager and I need to show a progress of all my files been downloaded.

For that I created an event mechanism that reports on the progress of each individual file. It sends me the information on how many bytes B have been downloaded of file T total.

Please help me show the average progress of all the files.

Input

Integer C between 1 to 100, followed by new line, followed by C progresses separated by new line. Each progress is constructed of two numbers with the maximum size of 64 bits: B T, separated by space.

Input options

The input is a String available from the following options

  • file
  • stdin
  • method parameter

Output

Floating number between 0 to 1, the average of all the progresses. It must be displayed to 11 decimal places, floored.

Criterial

Shortest code wins

Example

Input file:

3
5 10
1024 1024
20 100

Output

0.56666666666

Explanation

((5/10) + (1024/1024) + (20/100)) / 3 = 17/30

Example2

Input file:

1
2 10

Output

0.2

Example3

2  
Long.MAX_VALUE Long.MAX_VALUE  
5 10

Explanation In this example Long.MAX_VALUE represent the maximum 64 bit value, so if you use 64 bit value for storing the sum of the averages it will not work in this case.

Output

0.66666666666
\$\endgroup\$
  • \$\begingroup\$ 1. It's not clear from your specification how the result should be computed. The "total progress" implies to me that I should figure out how many bytes have been downloaded of the total, i.e. sum(B)/sum(T). However, your first example suggests, that we should actually compute the arithmetic mean/average of the individual progresses. If so, please state this clearly. 2. By requiring 11 digits of accuracy, you require 64-bit floats (double precision), because 32-bit floats only have 7.something decimal digits. Is this intentional? (seeing your input is only 32 bits) \$\endgroup\$ – Martin Ender Apr 1 '15 at 20:39
  • \$\begingroup\$ @MartinBüttner how about now? I do want the high precision \$\endgroup\$ – Ilya Gazman Apr 1 '15 at 21:24
  • \$\begingroup\$ My first point still stands. It's not clear from the specification how the result should be computed. \$\endgroup\$ – Martin Ender Apr 1 '15 at 21:27
  • \$\begingroup\$ @MartinBüttner I expect you to process all the progresses and find the average one, not sure how to say it right. \$\endgroup\$ – Ilya Gazman Apr 1 '15 at 21:28
  • \$\begingroup\$ Just like that, but as far as I can see your challenge currently doesn't mention "average" or "arithmetic mean" anywhere. \$\endgroup\$ – Martin Ender Apr 1 '15 at 21:32
  • \$\begingroup\$ @MartinBüttner Anything else? \$\endgroup\$ – Ilya Gazman Apr 1 '15 at 21:40
  • \$\begingroup\$ Why did you remove it again? And what's the purpose of the hint? \$\endgroup\$ – Martin Ender Apr 1 '15 at 21:43
  • \$\begingroup\$ @MartinBüttner sorry had 2 windows opened. The hint helps you to understand that you cannot store the sum of all the progresses in 64 bit value. \$\endgroup\$ – Ilya Gazman Apr 1 '15 at 21:45
  • \$\begingroup\$ What does "up to 11 digits of accuracy mean"? That I can supply only 3 digits, but I may not supply 12? And what counts as a "digit of accuracy", anyway: are you talking decimal places or significant figures? And if significant figures, what is the correct output if the average progress is exactly 0? \$\endgroup\$ – Peter Taylor Apr 1 '15 at 22:37
  • \$\begingroup\$ @PeterTaylor I want an 11 digits after the dot of accuracy in the output. So 3/10 will produce 0.33333333333 and 0/10 will produce 0. Maybe you can suggest a better way of writing it down. \$\endgroup\$ – Ilya Gazman Apr 1 '15 at 22:40
  • \$\begingroup\$ I've edited in some changes. I would suggest also deleting the hint and replacing it with a test case. It would also be good to describe a test case (it will probably be too long to post) which demonstrates that it's not sufficient to use IEEE754 double-precision. \$\endgroup\$ – Peter Taylor Apr 2 '15 at 7:35
  • \$\begingroup\$ @PeterTaylor is it ready now? \$\endgroup\$ – Ilya Gazman Apr 2 '15 at 14:09
  • \$\begingroup\$ It would also be good to describe a test case (it will probably be too long to post) which demonstrates that it's not sufficient to use IEEE754 double-precision. \$\endgroup\$ – Peter Taylor Apr 2 '15 at 19:28
  • \$\begingroup\$ @PeterTaylor I don't understand what you are saying, can you please explain it a little bit more \$\endgroup\$ – Ilya Gazman Apr 2 '15 at 20:15
  • \$\begingroup\$ Since you're requiring programs to support averaging 2^31 numbers and you want output to a precision of about 35 bits, a naïve solution with 64-bit floating point will be incorrect, but that might not be obvious to everyone who would attempt an answer. \$\endgroup\$ – Peter Taylor Apr 2 '15 at 20:23
-2
\$\begingroup\$

There's an App SE Site for that

Oftentimes, when searching through StackExchange, I find myself seeking to post a question about something or another, but not knowing where to post it. That's where you come in.

The Challenge

Write a full-functioning program that does the following:

  1. Takes an input string
  2. Attempts to find suitable SE sites relevant to the input string (this is very flexible, but should not be returning English.SE for questions about Coffee, for example)
  3. Attempts to find 3 questions on each suitable site that may relate to the input string (should match the list of questions if I searched in the search bar of each site, sorted by number of votes)
  4. "Output" is a folder tree written to disk with the following qualities:
    • The highest folder of the tree should be named the input string.
    • The second-highest layer should consist of folders named the same as the sites on which the input string was found suitable.
    • The third layer should be <=3 .md files that are named the same as the questions found when searching through the suitable sites, the contents of which are the question's markup content.

Rules

  • You MUST query for this information. I don't want 50EB solutions.
  • "Suitable sites" are defined as the keyword appearing in the site description.
  • Run time should be <5 minutes for >3 MB internet speed.

Bonuses

There are no bonuses.

Remember - SE is a big place now, and, as of such, we must compensate with short code. This is , everybody, so the shortest solution wins!

\$\endgroup\$
  • 5
    \$\begingroup\$ "Whatever defines "suitable" for your code is up to you" is too broad IMO. \$\endgroup\$ – Peter Taylor Jan 25 '16 at 14:35
  • \$\begingroup\$ @PeterTaylor Refined. Please see edit. \$\endgroup\$ – Addison Crump Jan 29 '16 at 17:50
  • \$\begingroup\$ @RikerW I don't know what you're saying. \$\endgroup\$ – Addison Crump Jan 29 '16 at 17:57
  • \$\begingroup\$ Me neither. lol \$\endgroup\$ – Rɪᴋᴇʀ Jan 29 '16 at 17:58
  • 2
    \$\begingroup\$ What's the yardstick for whether two words are synonyms? If that's up to answers to decide, no-one will waste any bytes on it, so you should simplify the question by removing the mention of synonyms. Otherwise you need to add a source (and risk the question being largely a kolmogorov-complexity for that list). \$\endgroup\$ – Peter Taylor Jan 29 '16 at 19:48
  • \$\begingroup\$ @PeterTaylor Fixed. \$\endgroup\$ – Addison Crump Jan 29 '16 at 20:45
-2
\$\begingroup\$

Write a polyglot (a program that works on several languages) that produces the // this is a comment output.

Example (JS + Plain PHP + Plain HTML) (74 / 3 = 24.66 points)

// this is a comment<?php ob_start();?><!--
alert("// this is a comment");

Another Example (CoffeeScript + CJam + brainfuck) ()

e###-[----->+<]>----..+[--->++<]>.---[->++++<]>.------------.+.++++++++++.+[---->+<]>+++.-[--->++<]>-.++++++++++.+[---->+<]>+++.[->+++<]>+.-[->+++ <]>.+[->+++<]>.++++++++++++.--..--------.+++++++++.++++++.
"// this is a comment"
e### alert "// this is a comment"

Scoring

Your score will be code byte length / num langs

The smallest score wins!

\$\endgroup\$
  • \$\begingroup\$ Is there anything that makes this significantly different than polyglot Hello World? \$\endgroup\$ – Geobits Feb 1 '16 at 14:03
  • \$\begingroup\$ @Geobits this is more easy, really \$\endgroup\$ – username.ak Feb 1 '16 at 14:37

You must log in to answer this question.

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