28
5
Pick a quote or phrase that is exactly 5 words long, such as Programming puzzles and code golf!
.
Write a program that, when appended to itself n times, outputs the first n + 1 words of your phrase in order.
For example, if your program code was MYPROG
and your phrase was Programming puzzles and code golf!
, running...
MYPROG
should outputProgramming
MYPROGMYPROG
should outputProgramming puzzles
MYPROGMYPROGMYPROG
should outputProgramming puzzles and
MYPROGMYPROGMYPROGMYPROG
should outputProgramming puzzles and code
MYPROGMYPROGMYPROGMYPROGMYPROG
should outputProgramming puzzles and code golf!
Appending more than 4 times is undefined, your program may do anything.
Rules
- Your phrase must be grammatical meaningful English. Ideally it should be properly capitalized and punctuated.
- Your phrase may be any length but its entropy, as calculated by http://www.shannonentropy.netmark.pl/, may not be less than 3.5.
(Paste in your phrase, hit Calculate and look for the last H(X).) - Your phrase can only contain printable ASCII characters (hex 20 to 7E). Your code can only contain printable ASCII and tabs and newlines.
- Your phrase must contain exactly 5 unique words and 4 spaces. All non-spaces count as parts of words. Spaces are the word boundaries. They may not be leading or trailing; there should be one after all but the last word.
- The output should contain one space between words as well. The output at each appending step may contain trailing spaces but not leading spaces.
- Output to stdout. There is no input.
Scoring
Your score is the length in bytes of your initial un-appended program. (e.g. MYPROG
scores 6)
As this is code-golf, the lowest score wins.
grammatical meaningful English Too unclear what is "grammatical meaningful English" due to different interpretations of grammatical and meaningful. – MilkyWay90 – 2019-06-24T03:03:37.393
21aww, the entropy and uniqueness requirements kill my idea of "buffalo " as an entry. – Sparr – 2014-08-03T05:16:30.480
4I was going to have so much fun in Piet until "Your code can only contain printable ASCII and tabs and newlines." :( – Sp3000 – 2014-08-03T07:27:42.783
3@Sp3000 You're welcome to put in an honorary answer. I'd love to see a Piet solution :) – Calvin's Hobbies – 2014-08-03T07:32:23.977
This is the only situation where Haskell's purity is exactly the problem... – Rhymoid – 2014-08-05T10:53:12.433