|
Program tetris;
uses crt,dos;
var spazio:array[2..15,1..23] of byte;
x,y,cx,cy,c,pos,r,nr,nnr,vel,lev:byte;
score,bscore,pezzi:integer;
com,answer:char;
stop,gameover,drop:boolean;
percorso:string[30];
tscore:text;
procedure I;
begin
textcolor(12);
if (spazio[7,3]<>0) or (spazio[8,3]<>0) or (spazio[9,3]<>0) or (spazio[10,3]<>0) then
gameover:=true
else
begin
gotoxy(11,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
case pos of
1:if (spazio[x-4,y+1]=0) and (spazio[x-3,y+1]=0) and (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-4,y);
write(' ');
gotoxy(x-4,y+1);
write('ÛÛÛÛ')
end
else
stop:=true;
2:if (spazio[x-1,y+1]=0) then
begin
gotoxy(x-1,y-3);
write(' ');
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-2);
write('Û');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-1,y);
write('Û');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
end;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
case pos of
1:begin
if com='a' then
if (spazio[x-5,y]=0) then
begin
stop:=false;
gotoxy(x-4,y);
write(' ');
gotoxy(x-5,y);
write('ÛÛÛÛ')
end;
if com='d' then
if (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-4,y);
write(' ');
gotoxy(x-3,y);
write('ÛÛÛÛ')
end;
if com='w' then
if (spazio[x-3,y-2]=0) and (spazio[x-3,y-1]=0) and (spazio[x-3,y+1]=0) then
begin
stop:=false;
pos:=2;
gotoxy(x-4,y);
write(' ');
gotoxy(x-3,y-2);
write('Û');
gotoxy(x-3,y-1);
write('Û');
gotoxy(x-3,y);
write('Û');
gotoxy(x-3,y+1);
write('Û');
gotoxy(x-2,y+1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(12);
gotoxy(x,y)
end
end;
2:begin
if com='a' then
if (spazio[x-2,y-3]=0) and (spazio[x-2,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-3);
write(' ');
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-3);
write('Û');
gotoxy(x-2,y-2);
write('Û');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x,y-3]=0) and (spazio[x,y-2]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-3);
write(' ');
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-3);
write('Û');
gotoxy(x,y-2);
write('Û');
gotoxy(x,y-1);
write('Û');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x-2,y-1]=0) and (spazio[x,y-1]=0) and (spazio[x+1,y-1]=0) then
begin
stop:=false;
pos:=1;
gotoxy(x-1,y-3);
write(' ');
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛÛÛ');
gotoxy(x+2,y-1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(12);
gotoxy(x,y)
end
end
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
case pos of
1:begin
spazio[x-4,y]:=12;
spazio[x-3,y]:=12;
spazio[x-2,y]:=12;
spazio[x-1,y]:=12
end;
2:begin
spazio[x-1,y-3]:=12;
spazio[x-1,y-2]:=12;
spazio[x-1,y-1]:=12;
spazio[x-1,y]:=12
end
end
end
end;
procedure J;
begin
textcolor(15);
if (spazio[7,3]<>0) or (spazio[8,3]<>0) or (spazio[9,3]<>0) then
gameover:=true
else
begin
gotoxy(10,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
case pos of
1:if (spazio[x-3,y+1]=0) and (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-3,y);
write('Û');
gotoxy(x-3,y+1);
write('ÛÛÛ')
end
else
stop:=true;
2:if (spazio[x,y-1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-1);
write('ÛÛ');
gotoxy(x-1,y);
write('Û');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
3:if (spazio[x-1,y+1]=0) and (spazio[x-3,y]=0) and (spazio[x-2,y]=0) then
begin
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-3,y);
write('ÛÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
4:if (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-1,y);
write('Û');
gotoxy(x-2,y+1);
write('ÛÛ')
end
else
stop:=true;
end;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
case pos of
1:begin
if com='a' then
if (spazio[x-4,y-1]=0) and (spazio[x-4,y]=0) then
begin
stop:=false;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-4,y-1);
write('Û');
gotoxy(x-4,y);
write('ÛÛÛ')
end;
if com='d' then
if (spazio[x-2,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('ÛÛÛ')
end;
if com='w' then
if (spazio[x-2,y-1]=0) and (spazio[x-1,y-1]=0) and (spazio[x-2,y+1]=0) then
begin
stop:=false;
pos:=2;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛ');
gotoxy(x-2,y);
write('Û');
gotoxy(x-2,y+1);
write('Û');
gotoxy(x-1,y+1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(15);
gotoxy(x,y)
end
end;
2:begin
if com='a' then
if (spazio[x-2,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-2);
write('ÛÛ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x+1,y-2]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-2);
write('ÛÛ');
gotoxy(x,y-1);
write('Û');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x-2,y-1]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
pos:=3;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛÛ');
gotoxy(x,y);
write('Û');
gotoxy(x+1,y)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(15);
gotoxy(x,y)
end
end;
3:begin
if com='a' then
if (spazio[x-4,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-4,y-1);
write('ÛÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x-2,y-2]=0) and (spazio[x-3,y]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
pos:=4;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-2);
write('Û');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-3,y);
write('ÛÛ');
gotoxy(x-1,y)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(15);
gotoxy(x,y)
end
end;
4:begin
if com='a' then
if (spazio[x-2,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x-3,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y-2);
write('Û');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-3,y);
write('ÛÛ')
end;
if com='d' then
if (spazio[x,y-2]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x,y-2);
write('Û');
gotoxy(x,y-1);
write('Û');
gotoxy(x-1,y);
write('ÛÛ')
end;
if com='w' then
if (spazio[x-2,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x,y-1]=0) then
begin
stop:=false;
pos:=1;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y-2);
write('Û');
gotoxy(x-2,y-1);
write('ÛÛÛ');
gotoxy(x+1,y-1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(15);
gotoxy(x,y)
end
end
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
case pos of
1:begin
spazio[x-3,y-1]:=15;
spazio[x-3,y]:=15;
spazio[x-2,y]:=15;
spazio[x-1,y]:=15
end;
2:begin
spazio[x-1,y-2]:=15;
spazio[x,y-2]:=15;
spazio[x-1,y-1]:=15;
spazio[x-1,y]:=15
end;
3:begin
spazio[x-3,y-1]:=15;
spazio[x-2,y-1]:=15;
spazio[x-1,y-1]:=15;
spazio[x-1,y]:=15
end;
4:begin
spazio[x-1,y-2]:=15;
spazio[x-1,y-1]:=15;
spazio[x-2,y]:=15;
spazio[x-1,y]:=15
end
end
end
end;
procedure L;
begin
textcolor(13);
if (spazio[7,3]<>0) or (spazio[8,3]<>0) or (spazio[9,3]<>0) then
gameover:=true
else
begin
gotoxy(10,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
case pos of
1:if (spazio[x-3,y+1]=0) and (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-1,y);
write('Û');
gotoxy(x-3,y+1);
write('ÛÛÛ')
end
else
stop:=true;
2:if (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('Û');
gotoxy(x-2,y+1);
write('ÛÛ')
end
else
stop:=true;
3:if (spazio[x-1,y+1]=0) and (spazio[x,y]=0) and (spazio[x+1,y]=0) then
begin
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y);
write('ÛÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
4:if (spazio[x-2,y-1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛ');
gotoxy(x-1,y);
write('Û');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
end;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
case pos of
1:begin
if com='a' then
if (spazio[x-2,y-1]=0) and (spazio[x-4,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-4,y);
write('ÛÛÛ')
end;
if com='d' then
if (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x,y-1);
write('Û');
gotoxy(x-2,y);
write('ÛÛÛ')
end;
if com='w' then
if (spazio[x-2,y-1]=0) and (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
stop:=false;
pos:=2;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('Û');
gotoxy(x-2,y+1);
write('ÛÛ');
gotoxy(x,y+1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(13);
gotoxy(x,y)
end
end;
2:begin
if com='a' then
if (spazio[x-3,y-2]=0) and (spazio[x-3,y-1]=0) and (spazio[x-3,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-3,y-2);
write('Û');
gotoxy(x-3,y-1);
write('Û');
gotoxy(x-3,y);
write('ÛÛ')
end;
if com='d' then
if (spazio[x-1,y-2]=0) and (spazio[x-1,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-1,y-2);
write('Û');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-1,y);
write('ÛÛ')
end;
if com='w' then
if (spazio[x-3,y-1]=0) and (spazio[x-1,y-1]=0) and (spazio[x-3,y]=0) then
begin
stop:=false;
pos:=3;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-3,y-1);
write('ÛÛÛ');
gotoxy(x-3,y);
write('Û');
gotoxy(x-2,y)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(13);
gotoxy(x,y)
end
end;
3:begin
if com='a' then
if (spazio[x-2,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x+2,y-1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-1);
write('ÛÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x-1,y-2]=0) and (spazio[x,y-2]=0) and (spazio[x,y]=0) then
begin
stop:=false;
pos:=4;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-2);
write('ÛÛ');
gotoxy(x,y-1);
write('Û');
gotoxy(x,y);
write('Û');
gotoxy(x+1,y)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(13);
gotoxy(x,y)
end
end;
4:begin
if com='a' then
if (spazio[x-3,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-3,y-2);
write('ÛÛ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x,y-2]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-2);
write('ÛÛ');
gotoxy(x,y-1);
write('Û');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x,y-1]=0) then
begin
stop:=false;
pos:=1;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-2);
write('Û');
gotoxy(x-2,y-1);
write('ÛÛÛ');
gotoxy(x+1,y-1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(13);
gotoxy(x,y)
end
end
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
case pos of
1:begin
spazio[x-1,y-1]:=13;
spazio[x-3,y]:=13;
spazio[x-2,y]:=13;
spazio[x-1,y]:=13
end;
2:begin
spazio[x-2,y-2]:=13;
spazio[x-2,y-1]:=13;
spazio[x-2,y]:=13;
spazio[x-1,y]:=13
end;
3:begin
spazio[x-1,y-1]:=13;
spazio[x,y-1]:=13;
spazio[x+1,y-1]:=13;
spazio[x-1,y]:=13
end;
4:begin
spazio[x-2,y-2]:=13;
spazio[x-1,y-2]:=13;
spazio[x-1,y-1]:=13;
spazio[x-1,y]:=13
end
end
end
end;
procedure O;
begin
textcolor(9);
if (spazio[8,3]<>0) or (spazio[9,3]<>0) then
gameover:=true
else
begin
gotoxy(10,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
if (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y);
write('ÛÛ');
gotoxy(x-2,y+1);
write('ÛÛ')
end
else
stop:=true;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
if com='a' then
if (spazio[x-3,y-1]=0) and (spazio[x-3,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-3,y-1);
write('ÛÛ');
gotoxy(x-3,y);
write('ÛÛ')
end;
if com='d' then
if (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-1,y-1);
write('ÛÛ');
gotoxy(x-1,y);
write('ÛÛ')
end;
if com='w' then
stop:=false;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(9);
gotoxy(x,y)
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
spazio[x-2,y-1]:=9;
spazio[x-2,y]:=9;
spazio[x-1,y-1]:=9;
spazio[x-1,y]:=9
end
end;
procedure S;
begin
textcolor(10);
if(spazio[8,3]<>0) or (spazio[9,3]<>0) then
gameover:=true
else
begin
gotoxy(10,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
case pos of
1:if (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-1,y);
write('ÛÛ');
gotoxy(x-2,y+1);
write('ÛÛ')
end
else
stop:=true;
2:if (spazio[x-1,y+1]=0) and (spazio[x-2,y]=0) then
begin
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-2,y);
write('ÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
end;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
case pos of
1:begin
if com='a' then
if (spazio[x-2,y-1]=0) and (spazio[x-3,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛ');
gotoxy(x-3,y);
write('ÛÛ')
end;
if com='d' then
if (spazio[x+1,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x,y-1);
write('ÛÛ');
gotoxy(x-1,y);
write('ÛÛ')
end;
if com='w' then
if (spazio[x,y]=0) and (spazio[x,y+1]=0) then
begin
stop:=false;
pos:=2;
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-1,y);
write('ÛÛ');
gotoxy(x,y+1);
write('Û');
gotoxy(x+1,y+1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(10);
gotoxy(x,y)
end
end;
2:begin
if com='a' then
if (spazio[x-3,y-2]=0) and (spazio[x-3,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-3,y-2);
write('Û');
gotoxy(x-3,y-1);
write('ÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x-1,y-2]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-2);
write('Û');
gotoxy(x-1,y-1);
write('ÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x-1,y-2]=0) and (spazio[x-3,y-1]=0) then
begin
stop:=false;
pos:=1;
gotoxy(x-2,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-2);
write('ÛÛ');
gotoxy(x-3,y-1);
write('ÛÛ');
gotoxy(x-1,y-1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(10);
gotoxy(x,y)
end
end
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
case pos of
1:begin
spazio[x-1,y-1]:=10;
spazio[x,y-1]:=10;
spazio[x-2,y]:=10;
spazio[x-1,y]:=10
end;
2:begin
spazio[x-2,y-2]:=10;
spazio[x-2,y-1]:=10;
spazio[x-1,y-1]:=10;
spazio[x-1,y]:=10
end
end
end
end;
procedure T;
begin
textcolor(14);
if (spazio[7,3]<>0) or (spazio[8,3]<>0) or (spazio[9,3]<>0) then
gameover:=true
else
begin
gotoxy(10,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
case pos of
1:if (spazio[x-3,y+1]=0) and (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-2,y);
write('Û');
gotoxy(x-3,y+1);
write('ÛÛÛ')
end
else
stop:=true;
2:if (spazio[x-1,y+1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-1,y);
write('ÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
3:if (spazio[x-2,y]=0) and (spazio[x-1,y+1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y);
write('ÛÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
4:if (spazio[x-2,y]=0) and (spazio[x-1,y+1]=0) then
begin
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-2,y);
write('ÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
end;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
case pos of
1:begin
if com='a' then
if (spazio[x-3,y-1]=0) and (spazio[x-4,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-3,y-1);
write('Û');
gotoxy(x-4,y);
write('ÛÛÛ')
end;
if com='d' then
if (spazio[x-1,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-3,y);
write(' ');
gotoxy(x-1,y-1);
write('Û');
gotoxy(x-2,y);
write('ÛÛÛ')
end;
if com='w' then
if spazio[x-2,y+1]=0 then
begin
stop:=false;
pos:=2;
gotoxy(x-3,y);
write(' ');
gotoxy(x-2,y+1);
write('Û');
gotoxy(x-1,y+1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(14);
gotoxy(x,y)
end
end;
2:begin
if com='a' then
if (spazio[x-2,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-2);
write('Û');
gotoxy(x-2,y-1);
write('ÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x,y-2]=0) and (spazio[x+1,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-2);
write('Û');
gotoxy(x,y-1);
write('ÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if spazio[x-2,y-1]=0 then
begin
stop:=false;
pos:=3;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x,y)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(14);
gotoxy(x,y)
end
end;
3:begin
if com='a' then
if (spazio[x-3,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-3,y-1);
write('ÛÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x+1,y-1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-1);
write('ÛÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if spazio[x-1,y-2]=0 then
begin
stop:=false;
pos:=4;
gotoxy(x,y-1);
write(' ');
gotoxy(x-1,y-2);
write('Û');
gotoxy(x,y);
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(14);
gotoxy(x,y)
end
end;
4:begin
if com='a' then
if (spazio[x-2,y-2]=0) and (spazio[x-3,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-2,y-2);
write('Û');
gotoxy(x-3,y-1);
write('ÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x,y-2]=0) and (spazio[x,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-1,y-2);
write(' ');
gotoxy(x-2,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-2);
write('Û');
gotoxy(x-1,y-1);
write('ÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if spazio[x,y-1]=0 then
begin
stop:=false;
pos:=1;
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-1);
write('Û');
gotoxy(x+1,y-1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(14);
gotoxy(x,y)
end
end
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
case pos of
1:begin
spazio[x-2,y-1]:=14;
spazio[x-3,y]:=14;
spazio[x-2,y]:=14;
spazio[x-1,y]:=14
end;
2:begin
spazio[x-1,y-2]:=14;
spazio[x-1,y-1]:=14;
spazio[x,y-1]:=14;
spazio[x-1,y]:=14
end;
3:begin
spazio[x-2,y-1]:=14;
spazio[x-1,y-1]:=14;
spazio[x,y-1]:=14;
spazio[x-1,y]:=14
end;
4:begin
spazio[x-1,y-2]:=14;
spazio[x-2,y-1]:=14;
spazio[x-1,y-1]:=14;
spazio[x-1,y]:=14
end
end
end
end;
procedure Z;
begin
textcolor(11);
if(spazio[8,3]<>0) or (spazio[9,3]<>0) then
gameover:=true
else
begin
gotoxy(10,2);
repeat
stop:=false;
x:=wherex;
y:=wherey;
case pos of
1:if (spazio[x-2,y+1]=0) and (spazio[x-1,y+1]=0) and (spazio[x-3,y]=0) then
begin
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-3,y);
write('ÛÛ');
gotoxy(x-2,y+1);
write('ÛÛ')
end
else
stop:=true;
2:if (spazio[x-1,y+1]=0) and (spazio[x,y]=0) then
begin
gotoxy(x,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x,y-1);
write('Û');
gotoxy(x-1,y);
write('ÛÛ');
gotoxy(x-1,y+1);
write('Û')
end
else
stop:=true;
end;
for c:=1 to 10 do
begin
if drop=false then
if stop=false then
delay(vel)
else
delay(30);
if keypressed then
begin
com:=readkey;
x:=wherex;
y:=wherey;
case com of
#0:begin
com:=readkey;
if 'K'=com then com:='a';
if 'M'=com then com:='d';
if 'H'=com then com:='w';
if 'P'=com then com:='s'
end
end;
case pos of
1:begin
if com='a' then
if (spazio[x-4,y-1]=0) and (spazio[x-3,y]=0) then
begin
stop:=false;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-4,y-1);
write('ÛÛ');
gotoxy(x-3,y);
write('ÛÛ')
end;
if com='d' then
if (spazio[x-1,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y-1);
write('ÛÛ');
gotoxy(x-1,y);
write('ÛÛ')
end;
if com='w' then
if (spazio[x-3,y]=0) and (spazio[x-3,y+1]=0) then
begin
stop:=false;
pos:=2;
gotoxy(x-3,y-1);
write(' ');
gotoxy(x-2,y);
write(' ');
gotoxy(x-2,y-1);
write('Û');
gotoxy(x-3,y);
write('ÛÛ');
gotoxy(x-3,y+1);
write('Û');
gotoxy(x-2,y+1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(11);
gotoxy(x,y)
end
end;
2:begin
if com='a' then
if (spazio[x-1,y-2]=0) and (spazio[x-2,y-1]=0) and (spazio[x-2,y]=0) then
begin
stop:=false;
gotoxy(x,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-2);
write('Û');
gotoxy(x-2,y-1);
write('ÛÛ');
gotoxy(x-2,y);
write('Û')
end;
if com='d' then
if (spazio[x+1,y-2]=0) and (spazio[x+1,y-1]=0) and (spazio[x,y]=0) then
begin
stop:=false;
gotoxy(x,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x+1,y-2);
write('Û');
gotoxy(x,y-1);
write('ÛÛ');
gotoxy(x,y);
write('Û')
end;
if com='w' then
if (spazio[x-1,y-2]=0) and (spazio[x+1,y-1]=0) then
begin
stop:=false;
pos:=1;
gotoxy(x,y-2);
write(' ');
gotoxy(x-1,y-1);
write(' ');
gotoxy(x-1,y);
write(' ');
gotoxy(x-1,y-2);
write('ÛÛ');
gotoxy(x,y-1);
write('ÛÛ');
gotoxy(x+2,y-1)
end;
if com='s' then
break;
if com=' ' then
drop:=true;
if com=chr(27) then
begin
x:=wherex;
y:=wherey;
textcolor(7);
gotoxy(50,9);
write('PAUSA');
gotoxy(41,11);
write('premi invio per continuare');
readln;
gotoxy(50,9);
clreol;
gotoxy(41,11);
clreol;
textcolor(11);
gotoxy(x,y)
end
end
end
end
end
until stop;
if drop then
delay(vel);
x:=wherex;
y:=wherey;
case pos of
1:begin
spazio[x-3,y-1]:=11;
spazio[x-2,y-1]:=11;
spazio[x-2,y]:=11;
spazio[x-1,y]:=11
end;
2:begin
spazio[x,y-2]:=11;
spazio[x-1,y-1]:=11;
spazio[x,y-1]:=11;
spazio[x-1,y]:=11
end
end
end
end;
begin
repeat
clrscr;
randomize;
for cx:=4 to 13 do
for cy:=2 to 22 do
spazio[cx,cy]:=0;
for cx:=4 to 13 do
begin
spazio[cx,23]:=1;
spazio[cx,1]:=1
end;
for cy:=2 to 22 do
begin
spazio[2,cy]:=1;
spazio[3,cy]:=1;
spazio[14,cy]:=1;
spazio[15,cy]:=1
end;
pezzi:=0;
score:=0;
assign(tscore,'tscore.txt');
percorso:=fsearch('tscore.txt',getenv(percorso));
if percorso='' then
begin
rewrite(tscore);
write(tscore,score);
close(tscore)
end;
reset(tscore);
read(tscore,bscore);
close(tscore);
gameover:=false;
cursoroff;
writeln;
writeln;
writeln(' ± ± prossimo: ÛÛÛÛÛ ÛÛÛÛ ÛÛÛÛÛ ÛÛÛÛ Û ÛÛÛÛ ');
writeln(' ± ± Û Û Û Û Û Û Û ');
writeln(' ± ± Û ÛÛÛ Û ÛÛÛÛ Û ÛÛÛÛ ');
writeln(' ± ± Û Û Û Û Û Û Û ');
writeln(' ± ± Û ÛÛÛÛ Û Û Û Û ÛÛÛÛ ');
writeln(' ± ± ');
writeln(' ± ± comandi: ');
writeln(' ± ± ');
writeln(' ± ± =sinistra ');
writeln(' ± ± =destra ');
writeln(' ± ± =ruota ');
writeln(' ± ± =aumenta velocita'' ');
writeln(' ± ± SPACE=lascia cadere ');
writeln(' ± ± ESC=pausa ');
writeln(' ± ± ');
writeln(' ± ± ');
writeln(' ± ± livello: ');
writeln(' ± ± pezzi: ');
writeln(' ± ± punteggio: ');
writeln(' ± ± miglior punteggio: ');
writeln(' ±±±±±±±±±±±± ');
gotoxy(42,9);
write('premi invio per giocare ');
readln;
gotoxy(42,9);
clreol;
nnr:=random(7);
nr:=random(7);
repeat
for cx:=4 to 13 do
for cy:=3 to 22 do
begin
gotoxy(cx,cy);
if spazio[cx,cy]=0 then
begin
textcolor(16);
write('Û')
end
else
begin
textcolor(spazio[cx,cy]);
write('Û')
end
end;
textcolor(7);
gotoxy(1,2);
clreol;
pos:=1;
drop:=false;
case score of
0..9:lev:=1;
10..19:lev:=2;
20..29:lev:=3;
30..39:lev:=4;
40..49:lev:=5;
50..59:lev:=6;
60..69:lev:=7;
70..79:lev:=8;
80..89:lev:=9;
90..99:lev:=10;
100..109:lev:=11;
110..119:lev:=12;
120..129:lev:=13;
130..139:lev:=14;
else lev:=15
end;
case lev of
1:vel:=50;
2:vel:=45;
3:vel:=40;
4:vel:=35;
5:vel:=30;
6:vel:=25;
7:vel:=20;
8:vel:=15;
9:vel:=10;
10:vel:=5;
11:vel:=4;
12:vel:=3;
13:vel:=2;
14:vel:=1;
15:vel:=0
end;
gotoxy(25,19);
write(lev);
gotoxy(23,20);
write(pezzi);
gotoxy(27,21);
write(score);
if score=bscore then
write(' NUOVO RECORD!');
gotoxy(35,22);
write(bscore);
r:=nr;
nr:=nnr;
repeat
nnr:=random(7);
until (nnr<>r) and (nnr<>nr);
gotoxy(19,5);
write(' ');
gotoxy(19,6);
write(' ');
case nr of
0:begin
textcolor(12);
gotoxy(19,6);
write('ÛÛÛÛ')
end;
1:begin
textcolor(15);
gotoxy(19,5);
write('Û');
gotoxy(19,6);
write('ÛÛÛ')
end;
2:begin
textcolor(13);
gotoxy(21,5);
write('Û');
gotoxy(19,6);
write('ÛÛÛ')
end;
3:begin
textcolor(9);
gotoxy(20,5);
write('ÛÛ');
gotoxy(20,6);
write('ÛÛ')
end;
4:begin
textcolor(10);
gotoxy(21,5);
write('ÛÛ');
gotoxy(20,6);
write('ÛÛ')
end;
5:begin
textcolor(14);
gotoxy(20,5);
write('Û');
gotoxy(19,6);
write('ÛÛÛ')
end;
6:begin
textcolor(11);
gotoxy(19,5);
write('ÛÛ');
gotoxy(20,6);
write('ÛÛ')
end
end;
case r of
0:I;
1:J;
2:L;
3:O;
4:S;
5:T;
6:Z
end;
pezzi:=pezzi+1;
if lev>9 then
delay(300);
c:=23;
repeat
c:=c-1;
if (spazio[4,c]<>0) and
(spazio[5,c]<>0) and
(spazio[6,c]<>0) and
(spazio[7,c]<>0) and
(spazio[8,c]<>0) and
(spazio[9,c]<>0) and
(spazio[10,c]<>0) and
(spazio[11,c]<>0) and
(spazio[12,c]<>0) and
(spazio[13,c]<>0) then
begin
for cy:=c downto 3 do
for cx:=4 to 13 do
begin
spazio[cx,cy]:=spazio[cx,cy-1];
gotoxy(cx,cy);
if spazio[cx,cy]=0 then
write(' ')
else
begin
textcolor(spazio[cx,cy]);
write('Û')
end
end;
score:=score+1;
c:=c+1
end
until c=3;
if score>bscore then
bscore:=score;
textcolor(7);
until gameover;
rewrite(tscore);
write(tscore,bscore);
close(tscore);
gotoxy(49,9);
write('GAME OVER');
gotoxy(41,11);
write('vuoi giocare ancora(s/n)? ');
read(answer);
until (answer='n') or (answer='N')
end.
|
|