6 ms·
This comes from the same dev known for the 128-language quine relay, where each of the 128 languages prints a program in the next one, looping all the way to th
by purkka 3y ago
This comes from the same dev known for the 128-language quine relay, where each of the 128 languages prints a program in the next one, looping all the way to the original one. In alphabetical order and as ASCII art, no less.
https://github.com/mame/quine-relay https://github.com/mame/quine-relay
- asicsp 3y agoDiscussion for 'quine-relay': https://news.ycombinator.com/item?id=33105706 https://news.ycombinator.com/item?id=33105706 (350 points | 7 months ago | 56 comments)
- swyx 3y agoi just want to know what possesses a man to do such a wonderful thing, and to even know if such a thing is possible before pursuing it i would also watch a 128 hour livestream of him coding it because how do you even start
- Semaphor 3y ago> i just want to know what possesses a man to do such a wonderful thing My impression is, that they are an artist who just happens to use a medium not normally (directly) used for art: Code.
- mtreis86 3y ago> and to even know if such a thing is possible before pursuing it I'm not the creator of that magnificent piece of programmatical art. But I can take a stab at this. As long as the languages are Turing complete it is possible. Any Turing machine can simulate any other Turing machine so once you step up to that level the challenge is keeping your head through the maze of nuances between many of those languages. I think the logic behind it goes something like this, if a language is complete (eg in the Gödel sense) then you can have it produce things that are nonsense in its own language. Anyways I would expect the bulk of the work to be making those incremental step of going from each language to the next. In terms of data shape, I am thinking a linked list. So the final step is to call them all in a nested fashion, bootstrapping each up onto the top of that stack as you go.
- internetter 3y agoOh huh you're absolutely right. Start at the bottom, work your way up
- BoppreH 3y agoThe quines are not simulating each other, they are just printing a string after some formatting (which usually involves embedding a copy of the string into itself). There's no Turing completeness needed (most of the quines don't even have branches), much less Gödel encodings.
- Izkata 3y ago> they are just printing a string after some formatting There's (at least) one language in quine-relay that's not that simple: Piet. It's a visual 2D language written as an image file. https://www.dangermouse.net/esoteric/piet/samples.html https://www.dangermouse.net/esoteric/piet/samples.html
- rattray 3y agoHe's got a book! ...in Japanese. I hope someone can help him translate it into English so more people can learn about this kind of thing and he can be rewarded for his adventures.
- riffraff 3y agomame (yusuke endoh) also has a pretty awesome youtube channel which is basically just showing their hacks https://www.youtube.com/@YusukeEndoh https://www.youtube.com/@YusukeEndoh
- deleted 3y ago[deleted]
- BoppreH 3y agoThis project has always fascinated me, so I tried making a tiny uroboros quine with Python -> Javascript -> Python -> etc. I started with a quine for each language, and tried inserting them into each other, but the output always grew exponentially. py_quine_template = "s = {}; print(s.format(repr(s)))" py_quine = py_quine_template.format(repr(py_quine_template)) js_quine_template = "s = {}; console.log(s.replace('{}', JSON.stringify(s)))" js_quine = js_quine_template.format(repr(js_quine_template)) py_js_quine = py_quine_template.format(repr(js_quine_template)) ??? So I checked how it's done in the Github repo[1], but the language snippets only seemed to be quoting and printing without any self-references like you'd expect in a quine... Then it hit me. You only need the quine machinery in one language. If I can make a Python script that has a string with its own source code, then the Javascript code will simply be `console.log(py_source)`, no manipulation necessary. So here's my Python/Javascript uroboros quine: s = "s = {}\npy_source = s.format(repr(s))\nprint('console.log('+repr(py_source)+')')" py_source = s.format(repr(s)) print('console.log('+repr(py_source)+')') If there were more languages, then it'd be `console.log("System.out.println({python_source})")`, etc. The problem then becomes escaping inner quotes, and escaping the escape characters themselves. I managed to sidestep the issue by using two types of quotes, and relying on Python's `repr` also giving valid JS strings, but if I had to add just one more language I'd need a lot more scaffolding. I still think the Quine Relay is a tour de force, but now for different reasons. It's not 128 quines in different languages, but an incredibly robust system for escaping strings in 128 wildly different languages. [1] https://github.com/mame/quine-relay/blob/master/src/code-gen.rb https://github.com/mame/quine-relay/blob/master/src/code-gen...
- saalweachter 3y ago> but an incredibly robust system for quoting and escaping strings in 128 wildly different languages I'm getting a tension headache just thinking about it.
- juliusgeo 3y agomame is also very well known for their IOCCC submissions. My favorite is https://www.ioccc.org/2012/endoh1/hint.html https://www.ioccc.org/2012/endoh1/hint.html.