#include<dos.h>
#include<time.h>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
_AX=0x13;
geninterrupt(0x10);
clock_t T=clock();
srand(time(NULL));
char E,far*Q=(char far*) 0xA0000000L;
int A[][12]={0,0,0,0,0,0,1,1,1,1,0,0,
0,0,0,0,2,0,2,2,2,0,0,0,
0,0,0,3,0,0,0,3,3,3,0,0,
0,0,0,4,0,0,4,4,4,0,0,0,
0,0,0,0,5,5,0,5,5,0,0,0,
0,0,6,6,0,0,0,6,6,0,0,0,
0,0,0,7,7,0,0,7,7,0,0,0};
int B[]={6,2,10,7,3,0,11,8,4,1,9,5};
int N[]={1,2,11,12,13,14,22,23,24,25,34,35};
int e[49],i[275],C[12],D[12],Y[25];
int c,d,n,x,y,a=6,L,I=433,M=9;
for(c=49;c--;) e[c]=c/7*320+c%7;
for(L=y=0;y<25;y++,I+=2472)
for(Y[y]=x=0;x<11;x++,I+=8)
for(n=x*y<1||y>23||x>9?8:0,i[++c]=I,d=49;d--;)
*(Q+I+e[d])=n;
printf("%c[3;28f Nivel=1",27);
Inicio:
printf("%c[5;28fLineas=%u",27,L);
for(n=0;n<12;n++)
if(y=C[n]=A[a][n])
if(!*(Q+i[N[n]+4]))
for(I=i[N[n]+4],d=49;d--;)
*(Q+I+e[d])=y;
else while(1)
if(getch()==27) return 0;
a=rand()%7;
while(n--)
for(I=i[N[n]]+17402,y=A[a][n],d=49;d--;)
*(Q+I+e[d])=y;
x=c=4;
while(x+1){
while(E=kbhit()) getch();
do if(kbhit()) E=getch();
while(!E&&clock()-T<M);
if(E==27&&getch()==27) 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(n=12;n--;)
if(D[n]=C[n]) for(I=i[N[n]+c],d=49;d--;)
*(Q+I+e[d])=0;
if(E==77||E==75) x+=E-76;
else if(E!=72) x+=E=11;
else for(n=12;n--;) D[n]=C[B[n]];
while(++n<12)
if(D[n]&&*(Q+i[N[n]+x])) break;
if(n<12) x=-1;
else if(c!=x) c=x;
else while(n--) C[n]=D[n];
for(n=12;n--;)
if(y=C[n]) for(I=i[N[n]+c],d=49;d--;)
*(Q+I+e[d])=y;
if(E==11) T=clock();
else x=c;
}
while(++n<12)
if(C[n]) Y[y=(N[n]+c)/11]++;
do while(Y[x=y]>8)
for(L++;x--;Y[x]=0)
if(Y[x]+Y[x+1])
for(Y[x+1]=Y[x],c=11*x+1,n=9;n--;c++)
if(*(Q+i[c])+*(Q+i[c+11]))
for(I=x?*(Q+i[c]):0,d=49;d--;)
*(Q+i[c]+e[d])-=*(Q+i[c+11]+e[d])=I;
while(--y);
goto Inicio;
}
Comentarios sobre la versión: 1.7 (0)
No hay comentarios