#!/usr/bin/perl -w use strict; my $text = (' ' x (79 - length('#include'))) . '#include' . 'typedef int O;' . 'void o(O _){putchar(_);}' . 'O main()' . '{' . 'O*_[512],**p=_,**d,b,q;' . 'for(b=0;b++<512;p=_+q)' . '_[q=(p-_+1)*9%512]=(O*)p;'; my $p = 0; my $parity = 0; my @c = ('p', 'd'); while( <> ) { foreach (unpack 'C*') { my $q = $p; my $steps; for($steps = 512; abs($p - $q) != $_; $steps--) { $q = ($q + 1) * 9 % 512; } $text .= "o(" . ($p > $q ? "$c[$parity]-" : "") . "(" . $c[$parity ^ 1] . "=" . ('*' x $steps) . '(O**' . ('*' x $steps) . ")$c[$parity])" . ($p > $q ? "" : "-$c[$parity]") . ");"; $parity ^= 1; $p = $q; } } while( length($text) % 79 > 79 - length("return") ) { $text .= "{;}"; } $text .= "return+0;}"; while( length($text) > 79 ) { print substr($text, 0, 79), "\n"; $text = substr($text, 79); } print "$text\n";