Skip to content

Instantly share code, notes, and snippets.

@Knio
Created April 17, 2013 03:58
Show Gist options
  • Save Knio/5401695 to your computer and use it in GitHub Desktop.
Save Knio/5401695 to your computer and use it in GitHub Desktop.
#include <windows.h>
#define T for(x=0;x<4;x++)for(y=0;y<4;y++)if(((62194^P[i*4+r%4])>>(x+y*4))&1)
c;G(){c=kbhit()?((c=getch()),!c||c==224?256+getch():c):0;}q;p(int x,int y,int*s,
int k){SetConsoleCursorPosition(q,(COORD){2*x, y});SetConsoleTextAttribute(q,k);
puts(s);}short*P="òý¶¶òý¶¶’ô’ô’ô’ô’þ²Ô’þ²Ô2ôÒ´2ôÒ´ò¼²´²ü²¾’¶rü²6òÜ2¶ò|²–Òü";R;r;
t;i;B[80][24];px=4;py;w=1;v;n;x;y;nx;ny;nr;b;main(){q=GetStdHandle(-11);for(c=0;
c<408;c++)p(x,y,(B[x=c%17][y=c/17]=y-23?(!x|x>10?64:0):128)?"[]":" ",15);while(
w++){nx=px;ny=py;r=R;T p(px+x,py+y," ",0);if(w%5){G();c-328?:r++;c-336?:ny++;c-
331?:nx--;c-333?:nx++;}else ny++;v=0;T v|=B[nx+x][ny+y];v?:(px=nx,py=ny,R=r);T p
(px+x,py+y,"[]",t+5);if(!(w%5)&&v&128){T B[px+x][py+y]=128|(t+5);px=4;py=r=0;t=b
;i=b=rand()%7;T p(x+12,y+1,"[]",i+5);else p(x+12,y+1," ",0);i=t;for(y=22;y;){v=
0;for(x=1;x<11;)v+=B[x++][y]>>7;if(v==10)for(n=y;n;n--)for(x=1;x<11;x++)c=B[x][n
]=B[x][n-1],p(x,n,c&128?"[]":" ",c&63);else y--;}}Sleep(30);}} // Knio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment