Live data from Hacker News

A Quine Puzzle

wgreenberg.github.io

1–10 of 36 posts

Re: A Quine Puzzle

#4

Spoiler: cmVwZWF0IDMgMgpwcmludCAyCnJlcGVhdCAzIDIKcHJpbnQgMgpyZXBlYXQgMyAyCg==

Variant that doesn't rely on potentially undefined behavior of asking "repeat" to repeat before the beginning:

cHJpbnQgMApwcmludCAyCnByaW50IDAKcHJpbnQgMgpwcmludCAwCnJlcGVhdCAzIDIKcHJpbnQgMgpyZXBlYXQgMyAyCnByaW50IDIKcmVwZWF0IDMgMgo=

Re: A Quine Puzzle

#5
My solution, featuring only 2 distinct commands, no NOPs, and not relying on `repeat` at the beginning: cHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcHJpbnQgMg0KcmVwZWF0IDMgMg0KcHJpbnQgMg0KcmVwZWF0IDMgMg0KcHJpbnQgMg0KcmVwZWF0IDMgMg==

Re: A Quine Puzzle

#7
A variant featuring only one number: cmVwZWF0IDQgNA0KcHJpbnQgNA0KcmVwZWF0IDQgNA0KcHJpbnQgNA0KcmVwZWF0IDQgNA0KcHJpbnQgNA0KcmVwZWF0IDQgNA0KcHJpbnQgNA0K

Re: A Quine Puzzle

#8
The 'repeat' command ("repeats the last M lines of output, starting N lines from the end") isn't very well described by the documentation, so some experimentation is required. 'repeat M N' will produce no output at all when the output is empty, but will always produce M lines of output, by repeatedly looping through the last (min(N, lines of output)) lines of the output, when the output is not. That's not very intuitive.

Re: A Quine Puzzle

#9

The 'repeat' command ("repeats the last M lines of output, starting N lines from the end") isn't very well described by the documentation, so some experimentation is required. 'repeat M N' will produce no output at all when the output is empty, but will always produce M lines of output, by repeatedly looping through the last (min(N, lines of output)) lines of the output, when the output is not. That's not very intuit…

Agreed, the descriptions could use some work. That said, I tried to strike a balance between correctness and simplicity when describing the commands so people could quickly get to trying stuff out.

I do show that particular edge case (along with "print 0") in the examples, though.

Post reply on HN