3 ms·
Wikipedia's specific radiation-hardened example looks like goobly-gook to me, could you explain it in principle? Also does it only compensate for removed chara
by rkagerer 2y ago
Wikipedia's specific radiation-hardened example looks like goobly-gook to me, could you explain it in principle? Also does it only compensate for removed characters, or also for "bit flips" i.e. a changed character?
- lifthrasiir 2y agoThe basic principle of radiation-hardened programs is to have as many safety nets as possible. The particular example in Wikipedia does this by, at the topmost layer for example, having two same string literals and `eval`-ing the longer literal (which would then use that literal to complete the quine). Since this `eval` call can be disrupted instead, it first checks whether two literals are same and calls a dedicated code path: /#{eval eval if eval==instance_eval}}/.i rescue##/ This code path is carefully designed so that it always remains a valid Ruby code in any case and will execute the following line only when `eval` was not called. This kind of principle drives the entire source code. > also for "bit flips" i.e. a changed character? No. You can trivially make it invalid by changing the first character (`e`) to, say, `%` or 0xE5. It will be generally impossible to make such program for many languages with fixed classes of code characters.
- rkagerer 2y agoThanks! I also found this article[1] helpful, particularly the section describing what happens if parts of the Outside Wrapper get deleted. [1] https://codegolf.stackexchange.com/a/100785 https://codegolf.stackexchange.com/a/100785