
Quine Relay - codeulike
https://github.com/mame/quine-relay
======
danso
I know we shouldn't care about the source, crazy-insane as he obviously is,
but FWIW, the author is Yusuke Endoh, one of the Ruby core members. RubySource
had an interview with him here:

[http://rubysource.com/meet-fifteen-ruby-core-
committers/](http://rubysource.com/meet-fifteen-ruby-core-committers/)

He lists his "hobby in programming" as: "writing a Quine and enjoying esoteric
programming."

~~~
minikomi
Indeed, the Japanese ruby community has quite a few interesting characters
like this.. In fact, someone even wrote a book about using ruby as a base for
creating esoteric languages!
[http://www.amazon.co.jp/Ruby%E3%81%A7%E4%BD%9C%E3%82%8B%E5%A...](http://www.amazon.co.jp/Ruby%E3%81%A7%E4%BD%9C%E3%82%8B%E5%A5%87%E5%A6%99%E3%81%AA%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0%E8%A8%80%E8%AA%9E-~Esoteric-
Language~-%E5%8E%9F-%E6%82%A0/dp/4839927847)

~~~
adamnemecek
I really wish there was a translation of this.

------
scrumper
I feel awful for pointing this out, but the author spelled Copyright
incorrectly in the last line.

Fortunately, he can correct it without blowing out his Ascii art by deleting
the extra space between '##' and 'Quine'.

I'd issue a pull request myself, but it'd be like me putting soy sauce on a
piece of Jiro Ono's sushi. I am completely unworthy.

~~~
cbhl
Wouldn't you also need to fix src/QR.rb.gen.rb?

~~~
scrumper
Yeah. Like I said, not worthy :)

I've started looking through it. It's very clever, most of it beyond my ken,
but even the technique with the image template of '#'s is a treat when you
start to see how it works.

------
epidemian
Fascinating. Even the README generator is on another level of meta:
[https://github.com/mame/quine-
relay/blob/master/src/README.m...](https://github.com/mame/quine-
relay/blob/master/src/README.md.gen.rb)

~~~
polemic
And: [https://github.com/mame/quine-
relay/blob/master/QR.rb](https://github.com/mame/quine-
relay/blob/master/QR.rb)

This project isn't code, it's art.

Edit:

Heh, Brainfuck, Whitespace, Logo... and notice they're all in alphabetical
order?

~~~
quchen
Brainfuck is fairly practical compared to Unlambda and INTERCAL.

~~~
mbillie1
Perhaps my favorite paragraph on all of wikipedia:

INTERCAL has many other features designed to make it even more aesthetically
unpleasing to the programmer: it uses statements such as "READ OUT", "IGNORE",
"FORGET", and modifiers such as "PLEASE". This last keyword provides two
reasons for the program's rejection by the compiler: if "PLEASE" does not
appear often enough, the program is considered insufficiently polite, and the
error message says this; if too often, the program could be rejected as
excessively polite. Although this feature existed in the original INTERCAL
compiler, it was undocumented.

~~~
xyzzy123
COME FROM also allows elegant aspect-oriented programming :)

~~~
im3w1l
Sounds like a listener to me.

~~~
xyzzy123
Not quite, a listener isn't supposed to steal your thread of control
indefinitely...

------
Rabidgremlin
If anyone wants to give this a go. I have created a Vagrant config which
installs the OS, tools and runs the chain of programs. You can find it here:
[https://github.com/rabidgremlin/vagrant-quine-
relay](https://github.com/rabidgremlin/vagrant-quine-relay)

~~~
candeira
I installed it yesterday. It fails at the point of Jasmin:

jasmin QR.j QR.j:2: Warning - Syntax error.

^ QR.j:2: Error - Couldn't repair and continue parse.

^ QR.j: Found 2 errors

And then completely craps out at the badly generated Java. Any idea of what
goes?

------
vedant
I successfully compiled every intermediary, and posted all of the code in a
gzipped tarball here: [http://goo.gl/EBZFV](http://goo.gl/EBZFV).

I started a tiny stub post here, where I'd like to dig into the code over the
next couple of days: [http://vedantmisra.com/2013/07/yusuke-endohs-amazing-
quine-r...](http://vedantmisra.com/2013/07/yusuke-endohs-amazing-quine-relay/)

I also made an EC2 AMI, ID ami-744b351d, for anyone who would like to try this
themselves.

------
jcromartie
The code that generates the quine is included. There's still lots of super
impressive stuff here, but don't be intimidated thinking he wrote that monster
by hand!

[https://github.com/mame/quine-relay/blob/master/src/code-
gen...](https://github.com/mame/quine-relay/blob/master/src/code-gen.rb)

~~~
StavrosK
Anyone care to explain how it works? I can see how the first step "Ruby -> X"
is done, but what about "X -> Y"?

------
scott_karana
Fantastic!

Same fellow who did the "rotating globe" quine a few years back:

[http://mamememo.blogspot.ca/2010/09/qlobe.html](http://mamememo.blogspot.ca/2010/09/qlobe.html)

~~~
chii
i found that to be even more amazing! ;D

------
mncaudill
I wrote a post about how to do these multi-lingual quines a while back:
[https://nolancaudill.com/2011/01/01/how-to-build-a-
quine/](https://nolancaudill.com/2011/01/01/how-to-build-a-quine/)

------
barbs
Wow, even the source code of the original file is arranged to look like the
Star of David surrounded by the dragon-eel thing, Obfuscated-C-contest style:

[https://github.com/mame/quine-
relay/blob/master/QR.rb](https://github.com/mame/quine-
relay/blob/master/QR.rb)

~~~
newsoundwave
The dragon-eel thing is an Ouroboros.

[http://en.wikipedia.org/wiki/Ouroboros](http://en.wikipedia.org/wiki/Ouroboros)

------
jetru
My thoughts went from "This is amazing" to "But he must have taken a lot of
time and brainpower to do this" to "This is useless really" to "So what? If I
wanted to do that I would take a year perhaps if I ever could" to "This is
amazing"

~~~
boomlinde
As if in line with some sort of sick and twisted version of the Kübler-Ross
model

------
RyanZAG
That is both the most incredible thing I've ever seen, yet also by far the
saddest thing I've ever seen. Props to the author for taking dedication to a
whole new level.

Link to a description of what this actually is:
[https://github.com/mame/quine-relay](https://github.com/mame/quine-relay)

~~~
GuiA
I'm sorry, how is that sad?

~~~
hnriot
possibly that someone clearly very smart wasted his/her intellect doing this,
rather than advancing the species by curing obesity, heart disease and cancer?

~~~
wpietri
If I make a ranked list of all the ways that people spend their time, I cannot
imagine a sensible scoring algorithm that puts making a quine relay lower in
value than posting an internet comment bitching about somebody making a quine
relay.

~~~
aerolite
bitching about someone making a quine relay takes like 10 seconds, though.

~~~
saraid216
That's because there's only ten seconds' worth of intelligence going into the
bitching.

A truly worthwhile bitching would take at least an hour.

------
quchen
In case someone is able to run this beast, I'd appreciate an upload of the
intermediate source files.

~~~
SilasX
Working on it now. I started a repo where I document the things I had to do to
get it to work, i.e. where I had to do something other than what was in Mame's
README:

[https://github.com/SilasX/QuineRelayFiles](https://github.com/SilasX/QuineRelayFiles)

The intermediate source files I've been able to generate so far are in
/output_files:

[https://github.com/SilasX/QuineRelayFiles/tree/master/output...](https://github.com/SilasX/QuineRelayFiles/tree/master/output_files)

Edit: Direct link to the go file:

[https://github.com/SilasX/QuineRelayFiles/blob/master/output...](https://github.com/SilasX/QuineRelayFiles/blob/master/output_files/QR.go)

Edit2: I ended up copying so much of what was already there that I re-did this
as a fork, adding my contributions in two directories (installation and
intermediate):

[https://github.com/SilasX/quine-relay](https://github.com/SilasX/quine-relay)

So far I'm stuck at an issue with the Pascal compiler not accepting long
strings, which can be fixed either with a compiler switch or by editing the
source earlier in the relay.

[https://github.com/mame/quine-relay/issues/3](https://github.com/mame/quine-
relay/issues/3)

~~~
SilasX
Woot! Pascal issue fixed in a later commit:

[https://github.com/mame/quine-
relay/commit/5d8c1e61a5012b9b5...](https://github.com/mame/quine-
relay/commit/5d8c1e61a5012b9b532f72c49e15c33081eb278c#comments)

(Replying to self because I can't further edit that comment.)

------
NanoWar
The miracle happens here: [https://github.com/mame/quine-
relay/blob/master/src/code-gen...](https://github.com/mame/quine-
relay/blob/master/src/code-gen.rb)

Also the SVG to ASCII mapping is cool!

------
duggieawesome
Yeah this is crazy. Just a taste, this is "Hello, world!" in Intercal.

[https://en.wikipedia.org/wiki/INTERCAL#Hello.2C_world](https://en.wikipedia.org/wiki/INTERCAL#Hello.2C_world)

------
avivo
This should be in MOMA.

------
tome
Why's there a Star of David in the middle?

~~~
dragontamer
The symbol of note is not "The Star of David", but instead Ouroboros, the
eternal snake... symbolized by a snake eating his own tail.

I believe he chose the symbol Ouroboros to represent the "immortality through
change" of the code. In one story... Ouroboros was an immortal snake who
constantly shed his skin, and took on many forms.

Similarly, this code constantly changes form, yet is immortal. While it
changes form, it manages to keep its identity.

The Star of David is incidental. As far as I know... it was added to the
Ouroboros symbol in the anime/manga Full Metal Alchemist, but that rendition
is perhaps the most famous artistic rendition of Ouroboros in recent culture.

Ouroboros had some connotations in the classical psudo-science of Alchemy as
well. So perhaps there is an earlier version of Ouroboros + Star of David.

~~~
recuter
> The Star of David is incidental. As far as I know... it was added to the
> Ouroboros symbol in the anime/manga Full Metal Alchemist, but that rendition
> is perhaps the most famous artistic rendition of Ouroboros in recent
> culture.

Wheel of Time series begs to differ.

~~~
dragontamer
The Great Serpent Ring does seem to be Ouroboros indeed... but it does not
have the Star of David on it. :-p

------
dpayne
Here's another one of his projects where you can write ruby script using just
underscores. [https://github.com/mame/_](https://github.com/mame/_)

------
_pmf_
Day 5462 on the internet.

Today, I have seen true madness.

------
codeulike
NB: I originally posted this with the link pointing to the QR.rb file, which
is the main code file and also a piece of Ascii art. Looks like the mods
switched the link back to the main project to provide more context. But to
have people looking at QR.rb first and then reading about what it does
afterwards was the idea. Amazing piece of work by @hirekoke.

[https://github.com/mame/quine-
relay/blob/master/QR.rb](https://github.com/mame/quine-
relay/blob/master/QR.rb)

------
zw123456
This reminds me very much of the various types of mathematical exercises that
seem to be very esoteric and academic but turned out to be very useful in some
solution in physics (eg. lorentz contractions). I would not be surprised if
some insight indirectly comes from this insanely amazing exercise.

~~~
GhotiFish
It terrifies me what this insight might be.

------
zabcik
The best part is that the cycle is in alphabetical order.

------
e3pi
Molecular biology?

If computer languages were evolving organisms, may this be a metaphor how
genetic/chromosome encoding reshuffles itself, and this approximates some
common minimalist packaging of the DNA among all these fifty(++?) programming
languages? Can we consider this Quine Relay as a `prequel' ancestral "Hello
Dad" gene, and also, how its wonderful aesthetic creativity, familiar
layperson recognizable and understandable information and charming symbols at
myriad representation levels, is enhancing its survival as a persistent
executable(living?) `gene-meme'? Eg, is anyone else posting some of this on
Facebook?

------
terabytest
Anyone care to explain how this actually works?

~~~
SilasX
Per the explanation linked in the discussion [1], the initial file generates
code in another language. That code, when executed, generates code in yet
another language. The process continues until the output is the code of the
original file.

[1] [https://github.com/mame/quine-relay](https://github.com/mame/quine-relay)

~~~
terabytest
What is unclear to me is how the final program manages to represent the entire
code (thus the entire language loop). Wouldn't doing that make the source code
recursive and infinite? Or am I missing something important?

~~~
recuter
[https://github.com/mame/quine-relay/blob/master/src/code-
gen...](https://github.com/mame/quine-relay/blob/master/src/code-gen.rb)

This is a neat project but somehow the implementation is a lot less mind
bending than the definition. Which is rather the opposite of what I
experienced when I first heard of a Quine and figured out how to write one
([http://en.wikipedia.org/wiki/Quine_(computing)](http://en.wikipedia.org/wiki/Quine_\(computing\)),
Turbo Pascal in my case, heh).

This smacks of something else, perhaps art.

~~~
woobles
Look at that Wikipedia article under "Multiquines"

------
inaudible
Awe inspiring stuff! But as a Ruby illiterate, I am left wondering what it is
about the Ruby language that draws in such a level of creative / abstract /
esoteric genius to use it as a starting point. Is there something about Ruby
in particular, or is just a case of an individual obsessing over a craft?

------
memming
Oh. My. God.

------
sold
See also [http://blog.sigfpe.com/2011/01/quine-
central.html](http://blog.sigfpe.com/2011/01/quine-central.html)

That post discusses six languages but others can be easily added.

------
zerr
This is cool of course, but we are even more interested in knowing the
mechanics and how it is done.

This is relevant to any similar cool thing what gets submitted on HN.

"what" is interesting, "how" is much more interesting.

------
cbrauchli
He should add Subleq or some other OISC!
[http://en.wikipedia.org/wiki/One_instruction_set_computer](http://en.wikipedia.org/wiki/One_instruction_set_computer)

------
e3pi
Remember those delightful self-referential Scott Kim creations in Godel Escher
Bach? Here, made alive, and becomes most everything in the known coder's
world. A super-chameleon quine mime.

------
minikomi
I love his sense of humor too: [https://github.com/mame/quine-
relay/issues/10](https://github.com/mame/quine-relay/issues/10)

------
isomorph
Welcome to social coding: [https://github.com/mame/quine-
relay/issues](https://github.com/mame/quine-relay/issues)

------
martin_
The arrangement of the languages is alphabetical, did this complicate things
at all? Would it have been simpler in a different order (though less elegant)?

------
k-mcgrady
This is really cool. Considering installing Ubuntu to give it a try (don't
think I could be bothered trying to get all those packages manually).

~~~
Axsuul
Someone should create a vagrant box for this.

------
tomasien
This is amazing. Think the concept can be taken to another level in some way?
Begin a universal translator of some small level?

------
arde
What, no Erlang? Sheesh! Amazing work.

------
joeblau
Holy crap. Codeception, now I can write in one language and run in every
language :)

------
codereflection
If someone tries this, please post a video from start to finish. This is
incredible.

------
EGreg
Well, someone clearly paid attention in Programming Languages class :)

------
mrwnmonm
why did you choose that order, is there a reason for it?

~~~
srin
I think it's just alphabetical, so no particular path through the languages
that he saw as easier/harder

~~~
ionforce
I think the code has a generator framework, so the fact that they are
alphabetical may just be convenient/arbitrary; the code could be generated to
run in any order (I think).

------
karangoeluw
How does one debug code like this?

~~~
chii
you dont. When you reach level zen, you write code that's already bug free :]

~~~
karangoeluw
That 'level zen' sounds like a state that doesn't exist.

------
soheil
meta(N^K)

------
JimmaDaRustla
If you could go ahead and explain WHY...that'd be grreeeaaaat!

------
celwell
I now know what a quine is. And learned of about 15 new programming languages.

