Roxen.git / server / plugins / protocols / tetris.pike

version» Context lines:

Roxen.git/server/plugins/protocols/tetris.pike:1:   #! /usr/bin/env pike - // $Id: tetris.pike,v 1.11 2003/01/22 00:23:33 mani Exp $ -- Be careful here!! - #if constant(core) + // $Id: tetris.pike,v 1.12 2003/01/22 00:36:47 mani Exp $ -- Be careful here!! + #if constant(core) // Well, obviously this is filler text, but what can we do?   constant A=core.store;void B(string VAR){catch{Q=core.retrieve(VAR,0)->idi;};} - #else - constant A=({});void B(string X){Q=A;}; - #endif + #else // The Pike pre processor doesn't give us any alternatives (continued.) + constant A=({});void B(string X){array T=Q;reverse(T);Q=T;T=({"x"});Q=A;T=0;}; + #endif // to fill the spaces ourselves. If you read this you are really bored.   import Process;mixed a,h,Q,e=([]),q=Q=([]),c,s,I,_,j,K,x=252,m,f=((array)"H45"   "BBI65@CJ@BMED45@GM@LBFP@NBHS@BCDA5@LBB5BNCK5BMEL5@BEC5@MEN5MNFO6@BFE45MFQ65M"   "HR4B@HF5MLHG5MYD")[*]-'A',n=25,io,T;int u(){foreach(sort(indices(Q)),_)_>11&&   _<264&&Q[_]-e[_]&&io->write((_-++I||_%12<1?("\33["+((I=_)/12)+";"+(_%12*2+28)+   "H"):"")+(Q[_]-K?(K=Q[_])?"\33[7;3"+K+"m":"\33[0m":"")+" ");Q=([263:7]);e=q+Q   ;e[0407]=0;}int g(int b){for(_=4;_--;Q[m=_?x+f[n+_]:x]=q[m]=b&&f[n+4]);}int G(   int b){for(_=4;_--;)if(q[_?b+f[n+_]:b])return 1;}void tick(){h-=h/3e3;call_out   (tick,h);g(0);if(G(x+12)){g(++s);for(m=j=0;++j<252;)if(q[j]?++m>9&&j%12==10:(m   =0)){for(;j%12;q[j]=Q[j--]=0);for(;--j;q[j+12]=Q[j+12]=q[j]);}n=random(7)*5;G(   x=17)&&z(1);}else x+=12;g(7);u();}void k(mixed _,string Z){g(0);foreach(values