发布游戏,Pascal扫雷,鼠标控制!
pascal吧
全部回复
仅看楼主
level 2
7yb6f 楼主
program mine_clearance_mouse ;
uses crt,mouse;
var i,j,a,b,x,y,long,num,l:longint;
mine,display:array [0..16,0..16] of shortint;
u,v:char;
temp:boolean;
m:tmouseevent;
procedure lost;
var i,j:longint;
begin
for i:=1 to long do
for j:=1 to long do
if mine[i,j]=10 then
begin
gotoxy(j,i
+3
);
textbackground(white);
textcolor(28);
write('X');
textbackground(black);
textcolor(white);
end;
gotoxy(1,long+4);
writeln('You Lost!');
writeln('********** **********');
writeln(' continue ** exit **');
writeln('********** **********');
repeat
getmouseevent(m);
if (m.x>=0) and (m.y>=long+3) and (m.x<=9) and (m.y<=long+6) then
begin
gotoxy(m.x+1,m.y+1);
if m.buttons=1 then
begin
v:='*';
break;
end;
end;
if (m.x>=19) and (m.y>=long+3) and (m.x<=29) and (m.y<=long+6) then
begin
gotoxy(m.x+1,m.y+1);
if m.buttons=1 then
begin
v:=chr(27);
break;
end;
end;
until false;
end;
procedure zero(ki,kj:longint);
begin
display[ki,kj]:=2;
gotoxy(kj,ki+3);
textcolor((mine[ki,kj] mod 5)+10);
if mine[ki,kj]=0 then write(' ') else write(mine[ki,kj]);
textcolor(white);
if mine[ki,kj]<>0 then exit;
if display[ki-1,kj-1]<>2 then zero(ki-1,kj-1);
if display[ki-1,kj]<>2 then zero(ki-1,kj);
if display[ki-1,kj+1]<>2 then zero(ki-1,kj+1);
if display[ki,kj-1]<>2 then zero(ki,kj-1);
if display[ki,kj+1]<>2 then zero(ki,kj+1);
if display[ki+1,kj-1]<>2 then zero(ki+1,kj-1);
if display[ki+1,kj]<>2 then zero(ki+1,kj);
if display[ki+1,kj+1]<>2 then zero(ki+1,kj+1);
end;
begin
randomize;
initmouse;
u:='1';
long:=7;num:=10;
repeat
clrscr;
textbackground(red);
textcolor(lightgreen);
writeln('Mine Clearance Writer:Ebola');
textbackground(black);
textcolor(white);
for i:=0 to long+1 do
for j:=0 to long+1 do
mine[i,j]:=0;
for i:=0 to long+1 do
begin
display[i,0]:=2;
display[i,long+1]:=2;
end;
for i:=1 to long do
begin
display[0,i]:=2;
display[long+1,i]:=2;
end;
for i:=1 to num do
begin
a:=random(long)+1;
b:=random(long)+1;
mine[a,b]:=10;
end;
for i:=1 to long do
for j:=1 to long do
if mine[i,j]=10 then
begin
if mine[i-1,j-1]<>10 then inc(mine[i-1,j-1]);
if mine[i-1,j]<>10 then inc(mine[i-1,j]);
if mine[i-1,j+1]<>10 then inc(mine[i-1,j+1]);
if mine[i,j-1]<>10 then inc(mine[i,j-1]);
if mine[i,j+1]<>10 then inc(mine[i,j+1]);
if mine[i+1,j-1]<>10 then inc(mine[i+1,j-1]);
if mine[i+1,j]<>10 then inc(mine[i+1,j]);
if mine[i+1,j+1]<>10 then inc(mine[i+1,j+1]);
end;
for i:=1 to long do
for j:=1 to long do
display[i,j]:=1;
x:=1;y:=1;
gotoxy(20,4);
write('**********');
gotoxy(20,5);
write('** exit **');
gotoxy(20,6);
write('**********');
gotoxy(20,8);
write('**********');
gotoxy(20,9);
write('difficulty');
gotoxy(20,10);
write('**********');
gotoxy(1,4);
textbackground(black);
textcolor(white);
for i:=1 to long do
begin
for j:=1 to long do
case display[i,j] of
1:begin textbackground(white);write(' ');textbackground(black);end;
2:case mine[i,j] of
0:write(' ');
1..8:begin textcolor((mine[i,j] mod 5)+10);textbackground(8);write(mine[i,j]);textcolor(white);textbackground(black);end;
end;
3:begin textcolor(20);write('*');textcolor(white);end;
end;
gotoxy(1,i+4);
end;
gotoxy(1,4);
repeat
l:=0;
gotoxy(y,x+3);
repeat
getmouseevent(m);
if (m.x>=0) and (m.x<=long-1) and (m.y>=3) and (m.y<=long+2) then
begin
gotoxy(m.x+1,m.y+1);
x:=m.y-2;
y:=m.x+1;
l:=m.buttons;
end;
if (m.x>=19) and (m.y>=3) and (m.x<=29) and (m.y<=5) then
begin
gotoxy(m.x+1,m.y+1);
if m.buttons=1 then exit;
end;
if (m.x>=19) and (m.y>=7) and (m.x<=29) and (m.y<=9) then
begin
gotoxy(m.x+1,m.y+1);
if m.buttons=1 then
begin
l:=4;
break;
end;
end;
until l in [1..2];
if (l=4) then
begin
case u of
'1':u:='2';
'2':u:='3';
'3':u:='1';
end;
break;
end;
if (l=1) and (display[x,y] mod 2=1) then
case mine[x,y] of
0:zero(x,y);
1..8:begin display[x,y]:=2;textcolor((mine[x,y] mod 5)+10);write(mine[x,y]);textcolor(white);end;
10:begin lost;break;end;
end;
if (l=2) and (display[x,y]<>2) then
case display[x,y] of
1:begin display[x,y]:=3;textcolor(20);textbackground(white);write('*');textcolor(white);textbackground(black);end;
3:begin display[x,y]:=1;textbackground(white);write(' ');textbackground(black);end;
end;
temp:=true;
for i:=1 to long do
for j:=1 to long do
if (mine[i,j] in [1..8]) and (display[i,j] mod 2=1) then temp:=false;
until temp;
if not temp then
case u of
'1':begin long:=7;num:=10;end;
'2':begin long:=10;num:=20;end;
'3':begin long:=15;num:=45;end;
end
else
begin
gotoxy(1,long+4);
writeln('You Won!');
writeln('********** **********');
writeln(' continue ** exit **');
writeln('********** **********');
repeat
getmouseevent(m);
if (m.x>=0) and (m.y>=long+3) and (m.x<=9) and (m.y<=long+6) then
begin
gotoxy(m.x+1,m.y+1);
if m.buttons=1 then
begin
v:='*';
break;
end;
end;
if (m.x>=19) and (m.y>=long+3) and (m.x<=29) and (m.y<=long+6) then
begin
gotoxy(m.x+1,m.y+1);
if m.buttons=1 then
begin
v:=chr(27);
break;
end;
end;
until false;
end;
until v=chr(27);
end.
源码在此,盗版者亡!
2016年08月01日 02点08分 1
level 2
7yb6f 楼主
不要复制楼上源码,度娘排版出错了
下载地址: [无效] http://pan.baidu.com/s/1i4CcV6P
2016年08月01日 02点08分 4
level 9
[真棒],厉害
2016年08月01日 09点08分 6
level 2
怎样玩的?
2017年12月25日 11点12分 7
1