Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!brl-adm!adm!hoey@nrl-aic.arpa
From: hoey@nrl-aic.arpa (Dan Hoey)
Newsgroups: comp.lang.c
Subject: Palindromic and portable automatic program
Message-ID: <2095@brl-adm.ARPA>
Date: Fri, 2-Jan-87 11:31:00 EST
Article-I.D.: brl-adm.2095
Posted: Fri Jan  2 11:31:00 1987
Date-Received: Fri, 2-Jan-87 20:43:19 EST
Sender: news@brl-adm.ARPA
Lines: 38

In message <761@tjalk.cs.vu.nl>, Robbert van Renesse sends us what he
calls a ``PORtable Self-Reproducing Obfuscated Palindrome.''  In an
effort to make his anagram palindromic, he commits an unfortunate
misnomer.  The program he sent is not portable, because it relies on
the ASCII encodings for double-quote, newline, and (!) comma.

Here is a 356-character self-reproducing palindrome without character
set dependencies.  The program contains no newlines, although I have
inserted a few here to avoid mailer difficulties:
================================================================
/**/main(){char*a=/*/};)q,q,a,q,q,811+a(ftnirp;'"'=q,/**/"
/**/main(){char*a=/*/};)q,q,a,q,q,811+a(ftnirp;'c%'=q,/**/c%
s%c%/**/,q='c%';printf(a+118,q,q,a,q,q);}/*/=a*rahc{)(niam/*
*/main(){char*a=/*/};)q,q,a,q,q,811+a(ftnirp;'%c'=q,/**/%c%s
%c/**/,q='%c';printf(a+118,q,q,a,q,q);}/*/=a*rahc{)(niam/**/
"/**/,q='"';printf(a+118,q,q,a,q,q);}/*/=a*rahc{)(niam/**/
================================================================
Some compilers may have problems with programs that do not end with
newline.  To avoid this difficulty, you may prefer the following
561-character self-reproducing palindrome.  This program is two lines
long, consisting of an empty line and a 559-character line; again I
have folded the long line.
================================================================

/**/main(){char*a=/*/};)n,s,s,s,q,q,a,q,q,s,s,s,n,191+a(ftnirp
;'n\'=n,'\\'=s,'"'=q,/**/"c%/**/main(){char*a=/*/};)n,s,s,s,q,
q,a,q,q,s,s,s,n,191+a(ftnirp;'nc%'=n,'c%c%'=s,'c%'=q,/**/c%s%c
%/**/,q='c%',s='c%c%',n='c%n';printf(a+191,n,s,s,s,q,q,a,q,q,s
,s,s,n);}/*/=a*rahc{)(niam/**/c%c/**/main(){char*a=/*/};)n,s,s,
s,q,q,a,q,q,s,s,s,n,191+a(ftnirp;'n%c'=n,'%c%c'=s,'%c'=q,/**/%
c%s%c/**/,q='%c',s='%c%c',n='%cn';printf(a+191,n,s,s,s,q,q,a,q
,q,s,s,s,n);}/*/=a*rahc{)(niam/**/%c"/**/,q='"',s='\\',n='\n';
printf(a+191,n,s,s,s,q,q,a,q,q,s,s,s,n);}/*/=a*rahc{)(niam/**/
================================================================
I would appreciate hearing of any improvements to these programs.

Dan Hoey
1U23R11R'''1U23R11R'''