Date: Fri, 18 Mar 2005 12:06:12 +1030 From: Greg 'groggy' Lehey <grog@FreeBSD.org> To: Roman Kurakin <rik@cronyx.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: style(9) example :-) Message-ID: <20050318013612.GO65340@wantadilla.lemis.com> In-Reply-To: <4239B16E.8080502@cronyx.ru> References: <4239B16E.8080502@cronyx.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
--N5iGxCIPT7YMRg16
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thursday, 17 March 2005 at 19:33:50 +0300, Roman Kurakin wrote:
> Hi,
>
> I was unable to refrain from posting this :-)
>
> int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
> o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
There used to be a whole culture of this sort of thing. My favourite
one is an anagram generator:
#include <stdio.h>=20
long a
[4],b[
4],c[4]
,d[0400],e=3D1;
typedef struct f{long g
,h,i[4] ,j;struct f*k;}f;f g,*
l[4096 ]; char h[256],*m,k=3D3;
long n (o, p,q)long*o,*p,*q;{
long r =3D4,s,i=3D0;for(;r--;s=3Di^
*o^*p, i=3Di&*p|(i|*p)&~*o++,*q
++=3Ds,p ++);return i;}t(i,p)long*p
;{*c=3Dd [i],n(a,c,b),n(p,b,p);}u(j)f*j;{j->h
=3D(j->g =3Dj->i[0]|j->i[1]|j->i[2]|j->i[3])&4095;}v(
j,s)f* j; {int i; for(j->k->k&&v(j->k, ' '),fseek(
stdin, j->j, 0);i=3Dgetchar(),putchar(i-'\n'?i:s),i-
'\n';);}w(o,r,j,x,p)f*o,*j;long p;{f q;int=20
s,i=3Do->h;q.k=3Do;r>i?j=3Dl[r=3Di]:r<i&&
(s=3Dr&~i)?(s|=3Ds>>1, s|=3Ds
>>2,s|=3Ds>>4,s
|=3Ds>>8
,j=3Dl[r
=3D((r&i
|s)&~(s>>1))-1&i]):0;--x;for
(;x&&!(p&i);p>>=3D1);for(;!x&&j;n(o->i,j->i,q.
i),u(&q),q.g||(q.j=3Dj->j,v(&q,'\n')),j=3Dj->k);for(;x;j=3Dx
?j->k:0){for(;!j&&((r=3D(r&i)-1&i)-i&&(r&p)?2:(x=3D0));j=3Dl[r]);!
x||(j->g&~o->g)||n (o->i,j->i,q.i)||(
u(&q), q.j=3Dj ->j,q.g?w(&q
,r,j->k,x ,p):v(&q,
'\n')); }}y(){f
j;char *z,*p;
for(;m ? j.j=3D
ftell( stdin)
,7,(m=3D gets(m ))||w(
&g,315 *13,l[ 4095]
,k,64* 64)&0: 0;n(g
.i,j.i, b)||(u (&j),j.
k=3Dl[j.h],l[j.h]=3D &j,y())){for(z=3D p=3Dh;*z&&(
d[*z++]||(p=3D0)););for(z=3Dp?n(j.i ,j.i,j.i)+h:"";
*z;t(*z++,j.i));}}main(o,p)char** p; {for(;m =3D *++p;)for(;*m-
'-'?*m:(k=3D -atoi(m))&0;d[*m]||(d[*m ]=3De,e<<=3D1),t(*m++,g.i)); u(&
g),m=3Dh
,y();}
To run it, you need a dictionary such as /usr/share/dict/web2. For
example:
gson free software foundation < /usr/share/dict/web2
gson obfuscated c contest < /usr/share/dict/web2
gson unix international < /usr/share/dict/web2
gson george bush < /usr/share/dict/web2
gson bill clinton < /usr/share/dict/web2
gson ross perot < /usr/share/dict/web2
gson paul e tsongas < /usr/share/dict/web2
Greg
--
See complete headers for address and phone numbers.
--N5iGxCIPT7YMRg16
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (FreeBSD)
iD8DBQFCOjCMIubykFB6QiMRAi/ZAKChSm/I6J9YhnpRZuwNNFiV3gxndwCfeL2Z
GvdncGA/yLcgizj7XVXNIzI=
=gfd7
-----END PGP SIGNATURE-----
--N5iGxCIPT7YMRg16--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050318013612.GO65340>
