Last active
January 2, 2016 12:49
-
-
Save slacka/8306176 to your computer and use it in GitHub Desktop.
http://eigenstate.org/cable3-formatted.c
original see http://ioccc.org/2013/cable3/hint.html
pre-processor run: https://gist.github.com/peterc/8259713
win binary:http://sdrv.ms/1hodqjP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "SDL.h" | |
#define CX M+=(T%3+2*!(!T*t-6)) | |
#define x ,A=4*!T,O=t,W=h=T<3?u(Q?p:D(A+3),D(A),D(A+1)[i]+D(A+2)*g+):K(t),U=V=K(a),o?U=h,W=V:V, | |
#define y a(Z)Y[++O] | |
#define V(I,D,E)(O=a(I)h[r])&&!(A=(D)(V=(1[E+L]<<16)+*i)/O,A-(I)A)?1[E+L]=V-O*(*E=A):H(0) | |
#define R(O,M,_)(S=L?a(I Z)O:O,N=L?a(I Z)O M(f=a(I Z)_):(O M(f=a(I n)_))) | |
#define T(_)R(r[u(10,L=4,--)],=,_) | |
#define u(a,r,T)16*i[a]+(I Z)(T i[r]) | |
#define L(_)M(W,_,U) | |
#define M(S,F,T)R(r[S],F,r[T]) | |
#define A(_)(i[L=4]+=2,R(_,=,r[u(10,4,-2+)])) | |
#define c(R,T)(1[u=19,L+T]=(N=a(R)h[r]*(R)*T)>>16,*i=N,G(F(N-(R)N))) | |
#define h(_)(1&(L?a(Z)_:_)>>C-1) | |
#define e(_)v(F(40[L(_##=40[E]+),E]&N==S|_ N<_(int)S)) | |
unsigned char t,e,l[80186],*E,m,u,L,a,T,o,r[1<<21],X,*Y,b,Q=0,R=0; | |
unsigned short*i,M,p,q=3; | |
unsigned *localtime(),f,S,kb=0,h,W,U,c,g,d,V,A; | |
N,O,P=983040,j[5]; | |
SDL_Surface*k=0; | |
K(o) { | |
return P+(L?2*o:2*o+o/4&7); | |
} | |
D(o) { | |
return r[*(unsigned*)&E[259+4*o]+O]; | |
} | |
w(o) { | |
return i[o]+=~(-2*47[E])*~L; | |
} | |
v(o) { | |
return (z((f^=S^N)&16),G(N-S&&1&(40[E]^f>>8*-~L-1))); | |
} | |
J() { | |
V=61442; | |
for(O=9; O--;) | |
V+=40[E+O]<<D(25); | |
} | |
H(o) { | |
return (46[u=76,J(),T(V),T(9[i]),T(M),M(P+18,=,4*o+2),R(M,=,r[4*o]),E]=0); | |
} | |
s(o) { | |
for(O=9; O--;)40[E+O]=1&&1<<D(25)&o; | |
} | |
BP(o) { | |
return (*i+=262*o*z(F((*E&15)>9|42[E])),*E&=15); | |
} | |
SP(o) { | |
return (w(7),R&&--1[i]&&o?R++,Q&&Q++,M--:0); | |
} | |
DX() { | |
/* flush graphics output? */ | |
for(O=9,O*=27840; O--;) | |
O[(unsigned*)k->pixels]=-!!(1<<7-O%8&r[O/2880*90+O%720/8+(88+952[l]/128*4+O/720%4<<13)]); | |
SDL_Flip(k); | |
} | |
main(BX,nE) | |
char**nE; | |
{ | |
9[i=E=r+P]=P>>4; | |
for(O=9; q;) | |
j[--q]=*++nE ? open(*nE,32898) :0; | |
read(2[*(unsigned)*&i=*j?lseek(*j,0,2)>>9:0,j],E+(M=256),P); | |
for(O=9; Y=r+16*9[i]+M,Y-r; Q|R||kb&46[E]&&KB) | |
T=(O=(L=(X=*Y&7)&1,o=X/2&1,l)[32]=0,t=(c=y)&7,a=c/8&7,Y)[1]>>6, | |
g=~-T ? | |
y | |
: | |
(char)y,d=BX=y, | |
--l[64], | |
--l[64] | |
!(T*t-6&&T-2) ? | |
(T-1) ? | |
d=g : | |
0: | |
(d=y), | |
Q&&Q--, | |
R&&R-- | |
x | |
(O=*Y,O=u=D(51),e=D(8),m=D(14)), | |
e--||( O=*Y/2&7,M+=(char)c*(L^(D(m)[E]|D(22)[E]|D(23)[E]^D(24)[E]))), | |
e--||( L=*Y&8,R(K(X)[r],=,c)), | |
e--||( L=e+=3,o=0,a=X x a=m ), | |
e--||( T(X[i])), | |
e--||( A(X[i])), | |
e--||( a<2? | |
((M(U,+=1-2*a+,P+24), | |
v(f=1), | |
G(S+1-a==1<<8*-~L-1), | |
u=u&4) ? 19 : 57) : | |
a-6? | |
CX+2,a-3||T(9[i]),a&2&&T(M),a&1&&M(P+18,=,U+2),R(M,=,U[r]),u=67 : | |
T(h[r])), | |
e--||((W=U ), | |
a--||( u=m,M-=~L,R(W[r],&,d)), | |
a--||( 0 ), | |
a--||( L(=~)), | |
a--||( L(=-),S=0,u=22,F(N>S)), | |
a--||( L?c(unsigned short,i):c(unsigned char,E)), | |
a--||( L?c(short,i):c(char,E)), | |
a--||( L?V(unsigned short,unsigned,i):V(unsigned char,unsigned short,E)), | |
a--||( L?V(short,int,i):V(char,short,E)) | |
), | |
e--||(++e,h=P,d=c,T=3,a=m,M--), | |
e--||(++e,13[W=h,i]=(o|=!L)?(char)d:d,U=P+26,M-=~!o,u=17+(m=a)), | |
e--||( | |
(a=m ), | |
a--||( L(+=),F(N<S)), | |
a--||( L(|=)), | |
a--||( e(+)), | |
a--||( e(-)), | |
a--||( L(&=)), | |
a--||( L(-=),F(N>S)), | |
a--||( L(^=)), | |
a--||( L(-),F(N>S)), | |
a--||( L(=))), | |
e--||(!L?L=a+=8 x L(=):!o?Q=1,R(r[p=m x V],=,h):A(h[r])), | |
e--||( T=a=0,t=6,g=c x M(U,=,W)), | |
e--||((A=h(h[r]),V=m ? | |
++M,(char)g : | |
o ? | |
31&2[E] : | |
1) | |
&& | |
(a<4?V%=a/2+8*-~L, | |
R(A,=,h[r]): | |
0, | |
a&1? | |
R(h[r],>>=,V): | |
R(h[r],<<=,V), | |
a>3? | |
u=19: | |
0, | |
a<5? | |
0: | |
F(S>>V-1&1) | |
), | |
a--||( R(h[r],+=,A>>8*-~L-V), | |
G(h(N)^F(N&1))), | |
a--||( A&=(1<<V)-1, | |
R(h[r],+=,A<<8*-~L-V), | |
G(h(N*2)^F(h(N))) | |
), | |
a--||( R(h[r],+=(40[E]<<V-1)+,A>>1+8*-~L-V), | |
G(h(N)^F(A&1<<8*-~L-V)) | |
), | |
a--||( R(h[r],+=(40[E]<<8*-~L-V)+,A<<1+8*-~L-V), | |
F(A&1<<V-1), | |
G(h(N)^h(N*2)) | |
), | |
a--||( G(h(N)^F(h(S<<V-1)))), | |
a--||( G(h(S))), | |
a--||( 0 ), | |
a--||( V<8*-~L||F(A), | |
G(0), | |
R(h[r],+=,A*=~((1<<8*-~L)-1>>V)) | |
) | |
), | |
e--||((V=!!--1[a=X,i]),a--||( V&=!m[E]),a--||( V&=m[E]),a--||( 0 ),a--||( V=!++1[i]),M+=V*(char)c ), | |
e--||( M+=3-o,L?0:o?9[M=0,i]=BX:T(M),M+=o*L?(char)c:c ), | |
e--||( M(U,&,W)), | |
e--||( L=e+=8,W=P,U=K(X)), | |
e--||(!R|| | |
1[i]? | |
M(m<2?u(8,7,): | |
P,=,m&1?P:u(Q?p:11,6,)),m&1||w(6),m&2||SP(1):0 ), | |
e--||(!R||1[i]?M(m?P:u(Q?p:11,6,),-,u(8,7,)),43[u=92,E]=!N,F(N>S),m||w(6),SP(!N==b):0 ), | |
e--||( o=L,A(M),m&&A(9[i]),m&2?s(A(V)):o||(4[i]+=c)), | |
e--||( R(U[r],=,d)), | |
e--||( 986[l]^=9,R(*E,=,l[m?2[i]:(char)c])), | |
e--||( R(l[m?2[i]:(char)c],=,*E)), | |
e--||( R=2,b=L,Q&&Q++), | |
e--||( W-U?L(^=),M(U,^=,W),L(^=):0 ), | |
e--||( T(m[i])), | |
e--||( A(m[i])), | |
e--||( Q=2,p=m,R&&R++), | |
e--||( L=0,O=*E,F(D(m+=3*42[E]+6*40[E])),z(D(1+m)),N=*E=D(m-1)), | |
e--||( N=BP(m-1)), | |
e--||( 1[E]=-h(*E)), | |
e--||( 2[i]=-h(*i)), | |
e--||( 9[T(9[i]),T(M+5),i]=BX,M=c ), | |
e--||( J(),T(V)), | |
e--||( s(A(V))), | |
e--||( J(),s((V&~m)+1[E])), | |
e--||( J(),1[E]=V ), | |
e--||( L=o=1 x L(=),M(P+m,=,h+2)), | |
e--||(++M,H(3)), | |
e--||( M+=2,H(c&m)), | |
e--||(++M,m[E]&&H(4)), | |
e--||((c&=m)?1[E]=*E/c,N=*E%=c:H(0)), | |
e--||(*i=N=m&E[L=0]+c*1[E]), | |
e--||(*E=-m[E]), | |
e--||(*E=r[u(Q?p:m,3,*E+)]), | |
e--||( m[E]^=1 ), | |
e--||( E[m/2]=m&1 ), | |
e--||( R(*E,&,c)), | |
e--||((a=c ), | |
a--||( write(1,E,1)), | |
a--||( time(j+3),memcpy(r+u(8,3,),localtime(j+3),m)), | |
a<2? | |
*E=~lseek(O=4[E][j],*(unsigned*)&5[i]<<9,0)? | |
(a? | |
write : | |
read)(O,r+u(8,3,),*i) | |
:0 | |
:0), | |
O=u, | |
D(16)?v(0):D(17)&&G(F(0)), | |
CX*D(20)+D(18)-D(19)*~!!L, | |
D(15)? | |
O=m=N, | |
41[43[44[E]=h(N),E]=!N,E]=D(50) | |
: | |
0, | |
!++q ? | |
kb=1, | |
*l ? | |
SDL_PumpEvents(), | |
k=k ? | |
k | |
: | |
SDL_SetVideoMode(720,348,32,0), | |
DX() | |
: | |
k ? | |
SDL_Quit(),k=0 | |
: | |
0 | |
: | |
0; | |
} | |
jF(o) { | |
return 40[E]=!!o; | |
} | |
z(o) { | |
return 42[E]=!!o; | |
} | |
G(o) { | |
return 48[E]=o; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment