uses
crt;
var
level:(A,B,C);
sign:array[1..30,1..16] of (unuse,opened,flag);
ground:array[1..30,1..16] of -1..8;
booms:integer;
procedure super(x,y);
var
ns:integer;
begin
if sign[x-1,y-1]=flag then ns:=ns+1;
if sign[x,y-1]=flag then ns:=ns+1;
if sign[x+1,y-1]=flag then ns:=ns+1;
if sign[x-1,y]=flag then ns:=ns+1;
if sign[x+1,y]=flag then ns:=ns+1;
if sign[x-1,y+1]=flag then ns:=ns+1;
if sign[x,y+1]=flag then ns:=ns+1;
if sign[x+1,y+1]=flag then ns:=ns+1;
if ground[x,y]=ns then
begin
if sign[x-1,y-1]<>flag then leftclick(x-1,y-1);
if sign[x,y-1]<>flag then leftclick(x,y-1);
if sign[x+1,y-1]<>flag then leftclick(c+1,y-1);
if sign[x-1,y]<>flag then leftclick(x-1,y);
if sign[x+1,y]<>flag then leftclick(x+1,y);
if sign[x-1,y+1]<>flag then leftclick(c-1,y+1);
if sign[x,y+1]<>flag then leftclick(x,y+1);
if sign[x+1,y+1]<>flag then leftclick(x+1,y+1);
end;
emd;
function win;
var
i,j,x,y,all,other:integer;
begin
case level of
A:begin
all:=10;
x:=9;
y:=9;
end;
B:begin
all:=40;
x:=16;
y:=16;
end;
C:begin
all:=99;
x:=30;
y:=16;
end;
end;
other:=x*y-all;
for i:=1 to 16 do
for j:=1 to 30 do
begin
if (ground[i,j]=-1)and(sign[i,j]=flag) then
all:=all-1;
if (ground[i,j]<>-1)and(sign[i,j]=opened) then
other:=other-1;
end;
if (all=0)or(other=0)then
begin
clrscr;
textcolor('red');
repeat
writeln('You win!!!');
until keypress;
end;
end;
procedure lose;
begin
clrscr;
repeat
textcolor('red');
writeln(' Sorry!!! You Lost!!!');
until keypressed;
end;