3
\$\begingroup\$

ROT-128 is a variant of ROT-13, where instead of cycling through the 26 letters, you cycle through the 256 possible bytes. Your task is to create a program that outputs the ROT-128 of its own source. The outputted program must also be a valid program and output the original program.

Scoring

This is code golf, so least number of bytes wins! Ties are broken by number of votes.

\$\endgroup\$
1
  • 4
    \$\begingroup\$ In the interest of searchability, I think these are usually called "mutual quines" (at least that term has been used for several challenges on the site, iirc). \$\endgroup\$ Feb 19, 2016 at 6:25

2 Answers 2

5
\$\begingroup\$

GolfScript, 64 48 bytes

{ºî»`'.~'+.{128^}%\](}.~û:n;৮þ§«®û±²¸Þý¥Üݨý®þ

Thanks to @MartinBüttner for golfing off 16 bytes!

Try it online!

Output

û:n;৮þ§«®û±²¸Þý¥Üݨý®þ{ºî»`'.~'+.{128^}%\](}.~

Try it online!

Verification

$ LANG=en_US

$ cat quine.gs
{ºî»`'.~'+.{128^}%\](}.~û:n;৮þ§«®û±²¸Þý¥Üݨý®þ
$ golfscript quine.gs
û:n;৮þ§«®û±²¸Þý¥Üݨý®þ{ºî»`'.~'+.{128^}%\](}.~
$ golfscript quine.gs | golfscript
{ºî»`'.~'+.{128^}%\](}.~û:n;৮þ§«®û±²¸Þý¥Üݨý®þ
$ diff -s quine.gs <(golfscript quine.gs | golfscript)
Files quine.gs and /dev/fd/63 are identical
\$\endgroup\$
0
4
\$\begingroup\$

Self-Modifying Brainf*ck, 74 bytes

<[<]>[<++++[>++++<-]>[<++++++++>-].>]

(The second half of the program is the same as above, except in ROT-128)

Just thought I would post this as a) a kickstart for ideas, and b) showing that it is possible to do without an insanely large program.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.