#include<time.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int e[256],Y[25],i[49]={4},I[10]={20};
int main()
{
textmode(C40);
_setcursortype(_NOCURSOR);
clock_t T;
srand(time(NULL));
printf("%c[3;28f Nivel=1",27);
char E,far*Q[250],far*q=1967+(char far*)0xB8000000;
char B[10][4][7][4]={"0000","0000","0000","0000","0000","0000","0000",
"1111","0100","0010","0110","0110","0100","0110",
"0000","0111","1110","0011","1100","1110","0110",
"0000","0000","0000","0000","0000","0000","0000"};
int X[]={10,1,-1,0},G[]={1,2,3,0};
int a,g,n,x,y,c=249,L=48,M=9,p=rand()%7;
e[77]=1;
e[75]=2;
e[72]=3;
for(y=25;y--;q-=60)
for(x=10;x--;q-=2)
if(*(q-1)=*(q+I[x]-1)=219)
*(Q[c--]=q)=*(q+I[x])=y%24<1||!x?8:0;
for(g=4;g--;I[0]=L=0)
for(a=7;a--;)
for(n=0,y=4;y--;)
for(x=4;x--;) if(B[g][y][a][x]=B[G[g]][x][a][3-y]-L)
B[9][n++][a][g]=x+10*y;
for(a=7;a--;)
for(g=4;g--;)
for(x=4;x--;){
if(x>2) for(y=G[g],n=4;n--;)
if(i[I[n]]--) i[I[n]=B[9][n][a][g]]++;
while(++n<4) if(i[c=B[9][n][a][y]+X[x]]) i[c]--;
else B[L++][x][a][g]=c;
B[8][x][a][y=g]=L;
while(n--) if(!i[c=I[n]]) i[c]++;
else B[3+L--][x][a][g]=c;
}
Inicio:
for(c=n=4;n--;) if(*(q=Q[B[9][n][a=p][g=0]+c])) break;
else if(*q=a+1) *(q+502)=0;
while (n+1) if(getch()==27)
return 0;
p=rand()%7;
while(++n<4) if(*(q=Q[B[9][n][p][0]]+510)=p+1)
*(--q)=219;
T=clock();
do{
while(E=kbhit()) getch();
do if(kbhit()) E=getch();
while(!E&&clock()-T<M);
if(E==27&&getch()==E) return 0;
if(E=='-') printf("%c[3;35f%u",27,10-(M+=M<10));
if(E=='+') printf("%c[3;35f%u",27,10-(M-=M>1));
for(y=n=B[8][x=e[E]][a][g];n--;)
if(*Q[I[n]=B[n][x][a][g]+c]) break;
if(n+1) continue;
while(y--) *Q[B[y+4][x][a][g]+c]-=*Q[I[y]]=a+1;
if(x>2) g=G[g];
else c+=X[x++];
T=clock();
}while(x);
for(n=4;n--;) Y[y=(B[9][n][a][g]+c)/10]++;
do while(Y[x=y]>8)
do for(c=10*x,L+=x--==y,n=9;n--;)
*Q[++c]=x?*Q[c-10]:0;
while(Y[x+1]=Y[x]);
while(Y[--y]);
printf("%c[5;28fLineas=%u",27,L);
goto Inicio;
}
Comentarios sobre la versión: 1.3 (0)
No hay comentarios