46
\$\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.

emanresu A
46.2k5 gold badges111 silver badges257 bronze badges
asked Feb 26, 2015 at 9:37
\$\endgroup\$
22
  • 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\$ Commented Feb 26, 2015 at 9:54
  • 16
    \$\begingroup\$ Shakespeare anyone? \$\endgroup\$ Commented Feb 26, 2015 at 9:57
  • 2
    \$\begingroup\$ @MartinBüttner, scrabblehelper.googlecode.com/svn-history/r20/trunk/… \$\endgroup\$ Commented Feb 26, 2015 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\$ Commented Feb 26, 2015 at 11:13
  • 7
    \$\begingroup\$ I'm still interested in a Shakespeare solution. \$\endgroup\$ Commented Feb 26, 2015 at 12:05

12 Answers 12

67
\$\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
answered Feb 26, 2015 at 11:58
\$\endgroup\$
9
  • \$\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\$ Commented Feb 26, 2015 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\$ Commented Feb 26, 2015 at 12:05
  • 2
    \$\begingroup\$ TIL "pa", "la" and "be" are valid words in Scrabble \$\endgroup\$ Commented Feb 26, 2015 at 12:17
  • 25
    \$\begingroup\$ Reading your program aloud makes me imagine what punch card computers must have sounded like. \$\endgroup\$ Commented Feb 26, 2015 at 19:35
  • 12
    \$\begingroup\$ I think you've stolen that program from the source of R2D2's operating system. \$\endgroup\$ Commented Feb 28, 2015 at 13:07
30
\$\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}
answered Feb 26, 2015 at 11:57
\$\endgroup\$
8
  • \$\begingroup\$ You don't need concatenation. {a`b"x.y~z"c}x.y~z \$\endgroup\$ Commented Feb 26, 2015 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\$ Commented Feb 26, 2015 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\$ Commented Feb 26, 2015 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\$ Commented Feb 26, 2015 at 19:38
  • 1
    \$\begingroup\$ @Claudiu that's a rule against languages, not solutions. That's why I asked. \$\endgroup\$ Commented Feb 26, 2015 at 19:55
30
\$\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.

answered Feb 26, 2015 at 22:31
\$\endgroup\$
4
  • 2
    \$\begingroup\$ This (and the Julia answer) border on trivially invalid. You can keep them here but no promises on accepting. \$\endgroup\$ Commented Feb 27, 2015 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\$ Commented Feb 27, 2015 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\$ Commented Feb 27, 2015 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\$ Commented Feb 27, 2015 at 3:36
18
\$\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.

answered Mar 1, 2015 at 5:15
\$\endgroup\$
0
13
\$\begingroup\$

R, 2 words + 1 replacement + 11 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
answered Feb 26, 2015 at 16:48
\$\endgroup\$
2
  • \$\begingroup\$ You were inspired by my cheaty 3-point solution, weren't you? ;-) \$\endgroup\$ Commented Feb 26, 2015 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\$ Commented Feb 26, 2015 at 16:53
11
\$\begingroup\$

Vyxal, 2 words + \1ドル^1 +1 = 4\$

`qUEued`qUEued

Try it Online!

Gosh this took ages to find.

Vyxal's a SBCS language, meaning most of its characters are unicode ones that we cannot use here. But it's still fairly usable without those.

The easiest way to make Vyxal quines is using the format `code`code, where the code prepends a backtick and doubles the result, or similar - this is pretty much exactly what the above program does.

`qUEued` # Data string
 q # Unevaluate; enclose in backticks
 U # Uniquify, removing the trailing backtick
 E # Evaluate as Python; NOP
 ue # Extend to length -1; NOP
 d # Double, creating the quine!
answered Mar 17, 2022 at 9:47
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Amazing!!!!!!!!!!!!!!!!!!!!!!!!!!!! \$\endgroup\$ Commented Mar 17, 2022 at 13:24
8
\$\begingroup\$

Julia, 1 word + 11 preceding = 2

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

:puppy
answered Feb 26, 2015 at 20:40
\$\endgroup\$
6
\$\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!

answered Feb 1, 2019 at 1:08
\$\endgroup\$
6
\$\begingroup\$

DOS command line, 10

& was unexpected at this time.

Error quine, not banned it seems

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

Pip, 8 words + (6 + 11) = 15

HA:saY"HA:saY eyRIE:HARPy"eyRIE:HARPy

Includes a trailing newline. Try it online!

Explanation

This is an expansion of the repr-based quine Y"Y yRsRPy"yRsRPy.

HA:saY"HA:saY eyRIE:HARPy"eyRIE:HARPy
HA:s Assign space character to the variable HA
 a No-op
 Y"HA:saY eyRIE:HARPy" Yank that string into the y variable
 e No-op
 yR In y, replace
 HA HA (space)
 IE: (and also assign space character to IE)
 RPy with the repr of y (in this case, y wrapped in quotes)
 Autoprint (implicit)

The trailing newline is necessary because autoprint outputs a trailing newline.

answered May 26, 2021 at 5:12
\$\endgroup\$
3
\$\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.

answered Jun 15, 2019 at 16:42
\$\endgroup\$
2
\$\begingroup\$

Actually, 10 + 9 + 1 = 20

"AB9FAce+AE;Ah+AL"AB9FAce+AE;Ah+AL

Try it online!

Invalid instructions do nothing in Actually, and removing them gives this:

"9FAc+;+"9FAc+;+
"9FAc+;+" # String literal
 9FA # Push abs(9th fibonacci number) = 34
 c # 34th ascii character is "
 + # Append the " to the start of the string
 ;+ # Append the string to itself
answered Mar 17, 2022 at 15:08
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.