Live data from Hacker News

Radiation-hardened quine

github.com

41–50 of 76 posts

Re: Radiation-hardened quine

#41

Depends on how you define "works." The program continues to output the original source code after the deletion, and ceases to be a quine. Still a very cool trick though :)

But reverting to the original source gives the program a stability property that will maintain functionality through multiple generations. Outputting the modified source would cause the program to accrue errors over time, meaning eventually entropy would win.

Re: Radiation-hardened quine

#43

  $ git clone the_quine
  $ cd the_quine
  $ ruby the_quine
  The program 'ruby' can be found in the following packages:
   * ruby1.8
   * ruby1.9.1
  # shit I don't have ruby
  $ sudo apt-get install ruby1.9.1
  # 200 bytes/s, terrible
  # ... what's going on? Ah finally.
  $ touch output
  $ ruby rbquine.rb > output
  $ diff rbquine.rb output
  # nowt

Re: Radiation-hardened quine

#45
post #38

Earlier quoted context omitted.

Since we're being technical, Japanese does not have any alphabet as such; an alphabet has, by definition, a 1 to 1 correspondence between a single character and a sound. Japanese uses syllabaries ('kana' in Japanese), where almost all characters represent more than 1 sound. Hiragana is typically used to write Japanese words and grammatical particles, while katakana is typically used to write foreign words and for spe…

> an alphabet has, by definition, a 1 to 1 correspondence between a single character and a sound. Do any languages have an alphabet according to this definition?

Korean?

Re: Radiation-hardened quine

#46
post #41

Depends on how you define "works." The program continues to output the original source code after the deletion, and ceases to be a quine. Still a very cool trick though :)

But reverting to the original source gives the program a stability property that will maintain functionality through multiple generations. Outputting the modified source would cause the program to accrue errors over time, meaning eventually entropy would win.

Good point :)

Re: Radiation-hardened quine

#47

Fascinating exercise. "Deleting one character" seems a phenomenally unlikely outcome of radiation, though.

I agree, flipping random bit is more likely. I.E. mutating random character into some other random character (does not have to be printable one). This also has a pretty strong assumption that Ruby itself is not corrupted.

Re: Radiation-hardened quine

#48

Interesting! Does anyone know of a language or operating system that uses Reed–Solomon error correction on every file? https://en.wikipedia.org/wiki/Reed–Solomon_error_correction Or to top that, imagine a computer where the entire memory space, perhaps shared with persistent flash memory, was encoded in this manner, so that even the filesystem was protected against bit flips. When I was doing Mac repair a few years b…

> Does anyone know of a language or operating system that uses Reed–Solomon error correction on every file?

A while back, after losing some personal photographs to bit rot, I became curious about this and did some experimentation with RS. The biggest drawback I found was that even with a relatively fast processor it is slow compared to typical disk read/write speeds. I concluded that the ZFS approach of RAID + checksums would be preferable.

Re: Radiation-hardened quine

#49
I was curious how well this quine would withstand having more than one character removed, so I performed a test. I did 1000 iterations removing 2 characters each time, then 1000 more removing 3 characters each time, and so on.

Here are the results up to 23 removals: http://i.imgur.com/PwWN7Z7.png

Re: Radiation-hardened quine

#50
Nice!

This reminds me of a work I did as an undergrad which landed in a paper called "Can a Program Reverse-Engineer Itself?". The idea is to take any program/function and make it a quine so you can retrieve its original code even if it has been obfuscated. You can find the paper here: http://pablo.rauzy.name/research.html#imacc11.

Post reply on HN