41
\$\begingroup\$

Write a quine that consists of real English words separated by single spaces. A "word" is defined as a string containing only lowercase and uppercase letters (/[a-zA-Z]+/ in regex). To be "real" your word must be recognized by the official Scrabble dictionary.

I'm using the Scrabble dictionary since it gives a definitive answer on what is and isn't valid. There are too many gray areas with a normal dictionary. Note that "A" and "I" (not to mention "quine") are not valid scrabble words.

Since writing a quine only using letters and spaces is close to impossible in most programming languages, you have the option to replace the single spaces between words with a character of your choice. You also have the option to append characters to the front of the first word and the end of the last word. These added characters may be anything (including newlines and non-ASCII) except letters (a-z, A-Z). There is a penalty for adding them though (see Scoring.)

Details

  • As usual, the quines may not read or access their own source code. (I'd say that HQ9+'s Q command violates this.)
  • Output should go to stdout or a similar alternative. There is no input.
  • The words do not need to be capitalized correctly. They can have caps and lowercase anywhere. The sequence of words does not need to make any sense.
  • No word may be used more than 3 times in your program. Differently capitalized words are still the same word (e.g. 'DOG', 'dog', and 'dOg' are all the same word).
  • Using languages like PHP or HTML that can just cat out their contents is considered a trivial loophole and is not allowed.
  • The program must contain at least one word.

Scoring

Your score is the number of "real words" in your program plus these penalties:

  • +1 for every space that was replaced with another character
  • nn for every n characters you added before the first word (yes, that's n to the power n)
  • nn for every n characters you added after the last word

For example, the program

We all LIKE PROgraMmING

would score 4 because it contains 4 words; no characters were added or replaced any spaces. It's output would of course be We all LIKE PROgraMmING.

The program

!We@all LIKE#PROgraMmING- =

would score 4 + 2 + 1 + 27 = 34; 4 for the words, 2 for the replaced spaces, 1 for the ! at the front, and 27 for the - = at the end. It's output would of course be !We@all LIKE#PROgraMmING- =.

The lowest score wins. Tiebreaker goes to the answer with the fewest penalty points. If there's still a tie the highest voted answer wins.

\$\endgroup\$
  • 1
    \$\begingroup\$ Does that dictionary also exist as a list? That would be a lot more helpful to browse through than having to check each word individually. \$\endgroup\$ – Martin Ender Feb 26 '15 at 9:54
  • 16
    \$\begingroup\$ Shakespeare anyone? \$\endgroup\$ – dwana Feb 26 '15 at 9:57
  • 2
    \$\begingroup\$ @MartinBüttner, scrabblehelper.googlecode.com/svn-history/r20/trunk/… \$\endgroup\$ – Peter Taylor Feb 26 '15 at 10:23
  • 1
    \$\begingroup\$ @JanDvorak I don't think so... The fact that I can't write anything like this shouldn't make other people see this as a bad question, it's a valid, although pretty difficult, challenge, is it not? \$\endgroup\$ – rorlork Feb 26 '15 at 11:13
  • 7
    \$\begingroup\$ I'm still interested in a Shakespeare solution. \$\endgroup\$ – John Dvorak Feb 26 '15 at 12:05
25
\$\begingroup\$

golfscript, 8 words + 8 symbols = 20 16 (3?)

{four"words.written~twice"four}words.written~twice

The words are just a filler, the core is a tiny quine core:

{".~"}.~

Duplicates and evaluates a function that just appends the instructions to duplicate and evaluate itself. When a function is printed, it is stringified automatically. This is the smallest quine that does something.

Or we could just use a function literal that never gets evaluated. But it feels like cheating...

{whatever}
\$\endgroup\$
  • \$\begingroup\$ You don't need concatenation. {a`b"x.y~z"c}x.y~z \$\endgroup\$ – Dennis Feb 26 '15 at 15:47
  • \$\begingroup\$ @Dennis I don't even need the inspection in that case. Thanks! I feel like I need to ask the OP something... \$\endgroup\$ – John Dvorak Feb 26 '15 at 16:36
  • 8
    \$\begingroup\$ @Cephalopod I don't read my own source code. I'm just pushing a function onto the stack and the runtime prints it out for me, blissfully unaware of the fact that the entirety of my source code is a function literal. \$\endgroup\$ – John Dvorak Feb 26 '15 at 16:41
  • 1
    \$\begingroup\$ I think the {whatever} would violate the too-trivial rule ("Using languages like PHP or HTML that can just cat out their contents is considered a trivial loophole and is not allowed.") \$\endgroup\$ – Claudiu Feb 26 '15 at 19:38
  • 1
    \$\begingroup\$ @Claudiu that's a rule against languages, not solutions. That's why I asked. \$\endgroup\$ – John Dvorak Feb 26 '15 at 19:55
54
\$\begingroup\$

><>, 25 words + (22 + 11 + 11) extra = 57 49

Oh god, my brain.

'brr3deep*clap6beep+orb5flap*leap4deep+clap5beep5flap*leap9deep9clap*beep+flap0placed apple alp0leap=clip?lob8blip*flip0clip.

Since the rules state "There is no input.", for this program to work you'll need to pipe in an empty file.

Oh and yes, brr is a valid Scrabble word, as are tsktsk and pfft.

Explanation

First of all, the following words are no-ops:

deep clap beep flap leap clip blip flip

This is because of two reasons:

  • abcdefl push numbers (10, 11, 12, 13, 14, 15 and the length of the stack respectively). In addition, i pushes -1 if EOF is met, seeing as there is no input.
  • The p command pops three chars v,y,x and places v at the position x,y.

Yes, ><> lets you modify the source code on the fly! We don't really make use of that though, as we only need the p for popping.

If we get rid of these no-ops, we get:

'brr3*6+orb5*4+55*99*+0placed apple alp0=?lob8*0.

In a similar way, the laced app part of placed apple and the e alp part of apple alp are also no-ops, and the rr of brr just reverses the stack twice, which we can also remove:

'b3*6+orb5*4+55*99*+0pl0=?lob8*0.

Finally, something that looks like a regular ><> program! The idea is to make use of the standard ><> quine, which works like so:

  • The initial ' starts string parsing, pushing every char met until we hit another '
  • We keep pushing chars until the end of the line, at which point we wrap the instruction pointer back to the start (since ><> is toroidal)
  • We land on the initial ' again, and stop string parsing. The result is that we've pushed every single char in the program (except the initial ') onto the stack.

Then the following happens:

b3*6+o                Print the initial ' quote (ASCII 39)
r                     Reverse the stack
b5*4+                 Push a ';' (ASCII 59)
55*99*+0p             Replace the 'l' of 'lob' with ';'

(print loop)
l0=?;                 If the stack is empty, terminate. Otherwise...
o                     Print the top of the stack
b8*0.                 Jump back to the beginning of the loop
\$\endgroup\$
  • \$\begingroup\$ "No word may be used more than 3 times in your program. Differently capitalized words are still the same word (e.g. 'DOG', 'dog', and 'dOg' are all the same word)." Anyway you get an upvote from me, sir. \$\endgroup\$ – rorlork Feb 26 '15 at 12:01
  • \$\begingroup\$ @rcrmn I kept adding so many words I completely forgot about that rule! Fixed now, although I did want to avoid having to use i. \$\endgroup\$ – Sp3000 Feb 26 '15 at 12:05
  • 1
    \$\begingroup\$ TIL "pa", "la" and "be" are valid words in Scrabble \$\endgroup\$ – John Dvorak Feb 26 '15 at 12:17
  • 20
    \$\begingroup\$ Reading your program aloud makes me imagine what punch card computers must have sounded like. \$\endgroup\$ – Calvin's Hobbies Feb 26 '15 at 19:35
  • 10
    \$\begingroup\$ I think you've stolen that program from the source of R2D2's operating system. \$\endgroup\$ – ceased to turn counterclockwis Feb 28 '15 at 13:07
21
\$\begingroup\$

Chicken, 1 word

I'm not normally into esolangs, but this one seemed perfect for this. I think this is a true quine:

chicken

Pushes 1 chicken to the stack. The stack is then displayed.

\$\endgroup\$
  • 1
    \$\begingroup\$ This (and the Julia answer) border on trivially invalid. You can keep them here but no promises on accepting. \$\endgroup\$ – Calvin's Hobbies Feb 27 '15 at 0:05
  • \$\begingroup\$ @Calvin'sHobbies In the interests of fairness I will happily delete this if you feel it is too loopholey - Your call. I was working on an applescript solution, but got frustrated by the "No word may be used more than 3 times" rule which seems to make this especially hard. So I went for the cheap trick instead :-) \$\endgroup\$ – Digital Trauma Feb 27 '15 at 0:45
  • \$\begingroup\$ @Calvin'sHobbies: I'm the author of the Julia submission. I ditto DigitalTrauma's sentiment on removing my post if you feel it's too borderline. I also did R. Is that too close as well? \$\endgroup\$ – Alex A. Feb 27 '15 at 3:30
  • \$\begingroup\$ @Alex and DT: It's up to you guys. I probably won't accept either answer but I don't mind them being here. I'm still kinda torn on the R answer, though the idea is pretty much the same as the Julia one... \$\endgroup\$ – Calvin's Hobbies Feb 27 '15 at 3:36
12
\$\begingroup\$

R, 2 words + 1 replacement + 1¹ trailing = 4

Objects which aren't assigned to anything are just printed to stdout. Since an expression is an object, the following code prints itself:

expression(puppy)

Previous submission, 5 points:

function(hello)hello
\$\endgroup\$
  • \$\begingroup\$ You were inspired by my cheaty 3-point solution, weren't you? ;-) \$\endgroup\$ – John Dvorak Feb 26 '15 at 16:51
  • 1
    \$\begingroup\$ @JanDvorak: I actually didn't see that before I posted this, but it is now a retrospective source of inspiration. \$\endgroup\$ – Alex A. Feb 26 '15 at 16:53
12
\$\begingroup\$

Python 2, 58 = 37 words + 21 punctuation marks

programming=puzzle=hash and'fear=coerce and"programming=puzzle=hash and%rif reload else fire;exec prog"or English;ramming=None or"ramming"if license else pirate;print fear%puzzle+ramming'if reload else fire;exec programming

With some newlines added:

programming=puzzle=hash and'fear=coerce and"programming=puzzle=hash
and%rif reload else fire;exec prog"or English;ramming=None or
"ramming"if license else pirate;print fear%puzzle+ramming'
if reload else fire;exec programming

The three uses per word restriction was what made this one difficult to write. I wanted to use the string with all the code more than 3 times, and every string had to be insulated with if else and or operators which I only had a limited supply of.

\$\endgroup\$
  • \$\begingroup\$ @user23013 Oops, forgot to replace it with a random identifier. \$\endgroup\$ – feersum Mar 1 '15 at 5:46
7
\$\begingroup\$

Julia, 1 word + 1¹ preceding = 2

Julia has objects called symbols which are defined using a preceding :. Much like my R solution, this just prints when submitted.

:puppy
\$\endgroup\$
5
\$\begingroup\$

DOS command line, 10

& was unexpected at this time.

Error quine, not banned it seems

\$\endgroup\$
  • 1
    \$\begingroup\$ This code doesn't "encode" any part of the code. See our definition for a quine \$\endgroup\$ – MilkyWay90 Jan 31 at 3:49
  • \$\begingroup\$ @MilkyWay90 Using the definition & encodes the whole code and stop outputting \$\endgroup\$ – l4m2 Jan 31 at 8:35
  • \$\begingroup\$ Oh, can you edit the answer so I can remove my downvote \$\endgroup\$ – MilkyWay90 Jan 31 at 14:06
  • 1
    \$\begingroup\$ Interesting loopholey answer...is & a word, though? \$\endgroup\$ – Redwolf Programs Jan 31 at 21:20
  • \$\begingroup\$ @RedwolfPrograms no, but & is two symbols. 5 (words) + 1 (trailing) + 2^2 leading = 10. \$\endgroup\$ – Draco18s Feb 1 at 1:30
3
\$\begingroup\$

Runic Enchantments, Score 4+3+11+11 = 9

"hOt3OX4NOt+kNOt@

Try it online!

Words: hot ox not knot (4)
Replacements: 3 4 + (3)
Before: " (1)
After: @ (1)

All of the characters GNOQWghtxz are no-op in Runic (as well as space and period, but more spaces doesn't help scoring). Including the X and k required for functionality, this gives the following available word list:

5 Letter Word(s)
  thong
4 Letter Word(s)
  gong goth gowk gown hogg hong honk howk knot know nogg nowt tong town wonk wont zonk
3 Letter Word(s)
  got gox hog hon hot how nog noh not now nth own tho tog ton tow two who wok won wot
2 Letter Word(s)
  go ho no oh on ow ox to wo

I cherry picked based on the needs of the space it was going into and making it sound funny.

Removing all NOP characters gives the following quine:

"3X4+k@

Try it online!

\$\endgroup\$
0
\$\begingroup\$

huh? - 1 word + 1**1/1^1=1 char after the word = 2 total score.

Ouch!

Ouch! is a valid quine in huh?

Run it like pythuhn.py Ouch!, and there cannot be a file named Ouch! in the current directory.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.