Author: Jeremiah Penery
Date: 23:23:57 01/19/00
Go up one level in this thread
On January 19, 2000 at 22:07:01, James Swafford wrote:
>Forgive the off topic post; I thought it was hilarious. :-)
<"Hello, World!" programs>
How about these, they are all from the Obfuscated C contest:
----
main(v,c)char**c;{for(v[c++]="Hello,
world!\n)";(!!c)[*c]&&(v--||--c&&execlp(*c,*c,c[!!c]+!!c,!c));**c=!c)write(!!*c,*c,!!**c);}
int i;main(){for(;i["]
cat =13 /*/ >/dev/null 2>&1; echo "Hello, world!"; exit * * This program works
under cc, f77, and /bin/sh. * */; main() { write( cat-~-cat /*,'( */ ,"Hello,
world!" , cat); putchar(~-~-~-cat); } /* ,)') end */
#include "stdio.h" #define e 3 #define g (e/e) #define h ((g+e)/2) #define f
(e-g-h) #define j (e*e-g) #define k (j-h) #define l(x) tab2[x]/h #define m(n,a)
((n&(a))==(a)) long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L }; int tab2[]={
4,6,10,14,22,26,34,38,46,58,62,74,82,86 }; main(m1,s) char *s; { int
a,b,c,d,o[k],n=(int)s; if(m1==1){ char b[2*j+f-g]; main(l(h+e)+h+e,b);
printf(b); } else switch(m1-=h){ case f: a=(b=(c=(d=g)<=e)for(b=g<<
char*He="llo world.\n";
char*_="Hello world.\n";
#define f 000: char *s,* t,v; char _ [ 999] ,x [ 999] ,*p= x ; char *av[ ]= {
"W", "H", "o", "l", "N", "e", " ", "r", "d", ".", "m", "s", "g", "!", "*", "\n"
} ; int n= 0 ;int __ = 0,i= 000; main () { #define f 001: #define F 042: #define
f 100: _[i-- #define f 126: #define f 132: #define f 103: #define f 202: #define
f 666: #define f 77:: #define f 101: ]=0 #define f 232: #define f 151: ;if(
#define f 256: !i){ puts ("I" "BM" " S" "UX" );;; ;;;} ;for ( ; gets (_); ) {
for( #define f 301: t=_, #define f 700: #define f 999: s=t, #define f 77 :
#define f 300: s=t; #define f s=t; #define f 123: #define f 127: *t&& !(!( *t <
'0' ||*t >'9' )&&! ((t[ 1] ^ ':') &&(t [1]^ '.') )) ; t++) #define f 137:
#define f 133: ;if( #define f 111: #define f 220: v^*t &&*t ){v= *t;; n=n* 2+(1
&*t) ;__= (__+ 1)&3 ; __ ||(( n<15 &&(* p=* av[n ] ) , #define f 2+2: p++ ) ,
n=0 ) ;}} #define f==4: ;*p='\0' ;;;; #define f puts puts ( x ) ; s=t; #define f
s=5; s=t; #define f s=5: s=t; #define f 445: #define f 113: #define f 900: s=t;
#define f n22: #define f n40: s=t; #define f nn6: s=t; #define f nn1: #define f
0:-- s=t; #define f 19:- #define f x2:x s=t; #define f x1:x s=t; #define f y2:x
#define f y7:y s=t; #define f 1::: s=t; #define f @3:@ #define f 10:0 #define f
x+1: s=t; #define f 2::: #define f 3::: #define x 7::: #define y 3::: #define z
990: #define Z 47:: ;;;}>
And some chess-related ones:
v,i,j,k,l,s,a[99]; main() {
for(scanf("%d",&s);*a-s;v=a[j*=v]-a[i],k=i<=s*k&&++a[--i]) ; }
(solves the N-Queens problem - how to place N queens on a chessboard of NxN, so
that no queen attacks another queen)
#include ; m(x)(x<0?-1:!!x) ; g tj( ) -J ; a( x ) ( x><0?-x:x) ; h( x ) ( ( x
)><=K?x:N-(x)) ; f 9999 ; A return ; H printf{ ; R double ; U int ; V for ; b
else ; u while ; B if U v,w,Y} -1,W,J,p,F,o} f,M,N,K,X,YY,_,P[f],s{ } ; typedef
U{ *L} { } ; L q[f]; tj{ } { U S} m{ v} +{ m{ w} <1||w-Y||!q[J]:{ w-Y&&{
w-Y*2||q[W+Y*{ N+1} ]|| { J>>K} -K+{ Y-1} / 2} } ||q[J]; } z{ } { _} 5; A
v*w||g; } e{ } { _} -2; A{ v*v*v-v||w*w*w-w} &&{ J-W-2||{ W&N} -4||{ W>>K!} {
Y-1?N:0} } || q[W+1]||q[W+2]||q[W+K]!} z||P[W+K]*Y<0} ; } R VR{ } { int PZ}
0x7fff; A{ R} { rand{ } &PZ} /{ R} PZ; } l{ } { _} K+1; A{ v*w&&a{ v} -a{ w} }
||g; } R UC{ } { R { } 0 , d; u{ { { +} d} VR{ } }><1.0} ; A d; } c{ } { _} -11;
A a{ v} -a{ w} ||g; } I{ ur , n , x} { W} ur; J} n; B{ P[W]!} Y||P[J]} } Y} A
J+1; v} { J&N} -{ W&N} ; w} { J>>K} -{ W>>K} ; A q[W]{ } ||{ x&&QL{ W,J,s} } ; }
TT{ W} { v} w} 0; A q[W]{ } +K; } s{ } { U j} -1,{ ; Y} -Y; V{ { } 0; { <0&&P[{
]} } -Y&&TT{ { } &&_} } -2} { j} { ; { } -1; } b B{ j>} 0&&!I{ { ,j,0} } A Y}
-Y; } A!{ Y} -Y} ; } bb{ } { _} 1; A a{ v*w} -2; } uv{ } { V{ v} 0; v>K} } } 0}
{ U S} h{ v&N} ; q[v]} !S?z:{ S} } 1?bb:{ S} } 2?c:{ v&N>K?l:e} } } ; } b B{ h{
v>>K} } } 1} q[v]} k; b q[v]} 0; P[v]} !!q[v]*{ 28-v} ; } } y{ } { U G} Y,{ ; J}
0; V{ { } 0; { >K} } } 0} q[J]} l; B{ q[W]} } e} B{ J-W} } 2} O{ J+1,J-1} ; b B{
W-J} } 2} O{ W-1,W+1} ; P[J]} P[W]; q[W]} 0; P[W]} 0; } QL{ W,J,D} L D; { U HQ}
P[J],YX; L AJ} q[J],XY} q[W]; O{ W,J} ; YX} D{ } ; O{ J,W} ; q[J]} AJ; q[W]} XY;
P[J]} HQ; A YX; } C{ } { U { ,j,BZ} 0; V{ { } 0; { >K} +h{ { &N} ,G} Y, S} Z} }
z?88:{ Z} } k?11 +r+{ P[{ ]<0?N-{ {>>K} :{ { >>K} } : { Z} } l?124-{ { YY<8&&{ {
{ &N} !} K|| { {>>K} !} { P[{ ]>0?0:N} } } ?M:0} : { Z} } c?41+r:{ Z} }
e?f-r-r:36+r+r} } } } ; Y} P[{ ]; V{ j} 0; j>K+K,{ &M-1,1} } { Y} -Y; o} -E; t}
-QL{ { >>K+K,{ &M-1,PX} ; Y} -Y; B{ t>E} { ++XP; Q} { ; E} t; B{ E>} S} A++F,E;
} } B{ !XP} E} s{ } ?-f+1:0; p} Q; A++F,E; } RZ{ } { U { ,j,T} 0; V{ ; ; } { y{
} ; o} f; do{ H"\n%d %d %d %s ",X,T,C{ } ,s{ } ?"!":">"} ; fflush{ stdout} ; }
u{ scanf{ "%o%o",&{ ,&j} !} 2||I{ { ,j,1} } ; O{ { ,j} ; y{ } ; X} 0; ++YY; Y}
-Y; T} PX{ } ; { } p>>{ K<<1} ; j} p&{ M-1} ; B{ I{ { ,j,1} } { H"Rats!\n"} ; A;
} O{ { ,j} ; Y} -Y; B{ T>M*M} H"\nHar har.\n"} ; } } main{ ac,av} char**av; {
long time{ } ,j} time{ &j} ; R { } 0; srand{ { U} j} ; V{ M} 0; M<} f; ++M} { +}
UC{ } ; M} { /100; B{ M&3} ++M; B{ M&1} --M; V{ N} 1; N*N>1?atoi{ av[1]} :2; uv{
} ; RZ{ } ; }
(The above simply plays chess. :)
-------------
Jeremiah
This page took 0.01 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.