求一个free pascal智障级游戏

作者&投稿:除尚 (若有异议请与网页底部的电邮联系)
求一个free pascal的小游戏~

USES Crt;
CONST
Change:Array [0..6,0..3,0..7] Of Byte =(((0,1,1,1,2,1,3,1),(1,0,1,1,1,2,1,3),(0,1,1,1,2,1,3,1),(1,0,1,1,1,2,1,3)),
((1,0,0,1,1,1,2,1),(1,0,1,1,1,2,2,1),(0,1,1,1,2,1,1,2),(1,0,0,1,1,1,1,2)),
((1,0,2,0,1,1,2,1),(1,0,2,0,1,1,2,1),(1,0,2,0,1,1,2,1),(1,0,2,0,1,1,2,1)),
((1,0,2,0,0,1,1,1),(0,0,0,1,1,1,1,2),(1,0,2,0,0,1,1,1),(0,0,0,1,1,1,1,2)),
((0,0,1,0,1,1,2,1),(1,0,0,1,1,1,0,2),(0,0,1,0,1,1,2,1),(1,0,0,1,1,1,0,2)),
((1,0,2,0,1,1,1,2),(0,0,0,1,1,1,2,1),(1,0,0,2,1,1,1,2),(2,2,0,1,1,1,2,1)),
((0,0,1,0,1,1,1,2),(2,0,0,1,1,1,2,1),(2,2,1,0,1,1,1,2),(0,2,0,1,1,1,2,1)));
VAR
Board:Array [0..3,0..11,1..25] Of Byte;
Players,N,Nowx,Nowy,Kind,Trans,Speed:Byte;
Time,Score:Word;
Now:Array [0..7] Of Byte;
PROCEDURE Furbish;
VAR B,C:Byte;
Begin
For C:=24 Downto 2 Do Begin
Gotoxy(1,C);
For B:=1 To 10 Do
If Board[0,B,C]=0 Then Write(' ')
Else Write('圹');
End;
End;
PROCEDURE Clear;
Var A,B,C:Byte;D:Boolean;
Begin
For A:=24 Downto 1 Do
Begin
D:=True;
For B:=1 To 10 Do
If Board[0,B,A]=0 Then D:=False;
If D=True Then
Begin
Score:=Score+10;Gotoxy(1,1);Write(Score:5,'0');
For C:=A Downto 2 Do
For B:=1 To 10 Do
Board[0,B,C]:=Board[0,B,C-1];
A:=A+1;
End;
End;
Furbish;
End;
FUNCTION Canmove(X,Y:Byte):Boolean;
BEGIN
Canmove:=True;
If Board[0,X+Now[0],Y+Now[1]]>0 Then Canmove:=False;
If Board[0,X+Now[2],Y+Now[3]]>0 Then Canmove:=False;
If Board[0,X+Now[4],Y+Now[5]]>0 Then Canmove:=False;
If Board[0,X+Now[6],Y+Now[7]]>0 Then Canmove:=False;
End;
PROCEDURE Clean;
Begin
Gotoxy((Nowx+Now[0])*2-1,Nowy+Now[1]);Write(' ');
Gotoxy((Nowx+Now[2])*2-1,Nowy+Now[3]);Write(' ');
Gotoxy((Nowx+Now[4])*2-1,Nowy+Now[5]);Write(' ');
Gotoxy((Nowx+Now[6])*2-1,Nowy+Now[7]);Write(' ');
End;
PROCEDURE Show;
Begin
Gotoxy((Nowx+Now[0])*2-1,Nowy+Now[1]);Write('圹');
Gotoxy((Nowx+Now[2])*2-1,Nowy+Now[3]);Write('圹');
Gotoxy((Nowx+Now[4])*2-1,Nowy+Now[5]);Write('圹');
Gotoxy((Nowx+Now[6])*2-1,Nowy+Now[7]);Write('圹');
End;
BEGIN
Fillchar(Board,Sizeof(Board),0);
Randomize;Score:=0;
For N:=1 To 24 Do
Board[0,0,N]:=1;
For N:=1 To 24 Do
Board[0,11,N]:=1;
For N:=1 To 10 Do
Board[0,N,25]:=1;
Window(31,2,50,25);Textcolor(White);Textbackground(Blue);
Clrscr;Window(31,2,51,25);
Speed:=1;
Kind:=Random(7);Trans:=Random(4);Nowx:=4;Nowy:=1;
For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];
While Canmove(Nowx,Nowy) Do
Begin
Repeat
Clean;Nowy:=Nowy+1;Show;
Repeat
If Keypressed Then
Case Upcase(Readkey) Of
#0:Case Readkey Of
#75:If Canmove(Nowx-1,Nowy) Then Begin Clean;Nowx:=Nowx-1;Show;End;
#77:If Canmove(Nowx+1,Nowy) Then Begin Clean;Nowx:=Nowx+1;Show;End;
#80:Begin Clean;Repeat
If Canmove(Nowx,Nowy+1) Then Nowy:=Nowy+1;
Until Not(Canmove(Nowx,Nowy+1));Show;End;
#61:Begin Gotoxy(9,12);Write('Pause');Repeat Delay(1000);Until Keypressed;Furbish;End;
End;
#27:Exit;
' ',#13:Begin
Clean;Trans:=Trans+1;
If Trans=4 Then Trans:=0;
For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];
If Not(Canmove(Nowx,Nowy)) Then Begin Trans:=Trans-1;For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];Show;End
Else Show;
End;
End;
Until Not(Keypressed);
Delay((10-Speed)*50);
Until Not(Canmove(Nowx,Nowy+1));
Score:=Score+1;Gotoxy(1,1);Write(Score:5,'0');Speed:=(Score Div 300)+1;
Board[0,Nowx+Now[0],Nowy+Now[1]]:=1;
Board[0,Nowx+Now[2],Nowy+Now[3]]:=1;
Board[0,Nowx+Now[4],Nowy+Now[5]]:=1;
Board[0,Nowx+Now[6],Nowy+Now[7]]:=1;
Clear;
Kind:=Random(7);Trans:=Random(4);Nowx:=4;Nowy:=1;
For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];
End;
Gotoxy(7,12);Write('GAME OVER');Readln;
END.

begin
{我不会被执行}
//我也不会被执行
end.
最常见的了

var a:char;
i,j,m,n:integer;
ma:array[1..10,1..10]of integer;
hp,mp,money,ql,dengji,fy,atc,mc,hpmax,mpmax,zhiye,jy,mcp:integer;
procedure map;
begin
randomize;
m:=random(10);
n:=random(10);
writeln('*******地图********');
for i:=1 to 10 do
begin
for j:=1 to 10 do
begin
if (i=m)and(j=n)then
begin
ma[i,j]:=9;
write('9 ');
end
else
begin
ma[i,j]:=random(3);
if ma[i,j]=0 then write('0 ');
if ma[i,j]=1 then write('1 ');
if ma[i,j]=2 then write('2 ');
end;
end;
writeln;
end;
writeln('*******************');
readln;
end;
procedure save;
var t:text;
begin
rewrite(t);
writeln(t,dengji);
writeln(t,hpmax,' ',hp);
writeln(t,mpmax,' ',mp);
writeln(t,ql);
writeln(t,fy);
writeln(t,mc);
writeln(t,atc);
writeln(t,money);
end;
procedure load;
var t:text;
begin
reset(t);
readln(t,dengji);
readln(t,hpmax,hp);
readln(t,mpmax,mp);
readln(t,ql);
readln(t,fy);
readln(t,mc);
readln(t,atc);
readln(t,money);
end;
procedure ziliao;
begin
writeln('********************人物资料**********************');
writeln('* 等级:',dengji,' *');
writeln('* 生命:',hpmax,'/',hp,' *');
writeln('* 魔力:',mpmax,'/',mp,' *');
writeln('* 金钱:',money,' *');////////////
writeln('* 升级经验/现在经验:',dengji*100+30,'/',JY,' *');
writeln('**************************************************');
end;
procedure shengji;
begin
if jy>=dengji*100+30 then
begin
writeln('升级了!大家鼓掌!!呕~~~~~~~~~');
dengji:=dengji+1;
jy:=jy-dengji*100-30;
atc:=atc+dengji*2+10;
fy:=fy+dengji*2+10;
mcp:=mcp+dengji*2+4;
hpmax:=hpmax+dengji*10;
mpmax:=mpmax+dengji*8;
writeln('#############资料###########');
writeln('等级:',dengji);
hp:=hpmax;
writeln('生命:',hpmax,'/',hp);
mp:=mpmax;
writeln('魔力:',mpmax,'/',mp);
writeln('攻击力:',atc);
writeln('防御力:',fy);
writeln('魔击力:',mc);
end;
end;

procedure moguaishou;
var p:char;
z,ghp,fyl,gatc,hp0,jy,mcp:integer;
begin
gatc:=random(100)+dengji*10;
writeln('你遇到了怪兽,现在:Y:战斗;N:逃跑。Y/N');
readln(p);
ghp:=random(100)*20;
hp0:=ghp;
fyl:=fy;
if p='Y' then
begin
writeln('战斗开始');
while (hp>0)and(ghp>0) do
begin
writeln('你的HP:',hpmax,'/',hp,' ','MP:',mpmax,'/',mp,' ','气力',ql);
writeln('怪兽的HP:',hp0,'/',ghp);
writeln('攻击:1:普通攻击 2:魔法攻击 3:必杀 4:防御 5:逃跑 ');
readln(p);
z:=random(11);
if z=5 then
begin
if p='1' then
begin
write('攻击无效!');
readln;
end;
if p='2' then
begin
write('没打中');
readln;
end;
end
else
begin
if p='1'
then
begin
ghp:=ghp-atc;
if ghp<=0
then
begin
write('打败怪兽! 经验+',hp0);
readln;
z:=random(5);
jy:=jy+hp0;
if z=2 then writeln('得到金钱',(hp0 div 10)*10);
money:=money+((hp0 div 10)*10);
readln;
ql:=ql+10;
break;
end
else
begin
write('怪兽受到伤害,HP-',atc,'怪HP:',hp0,'/',ghp);
readln;
ql:=ql+10;
end;
end;
if p='2'
then
begin
begin
writeln('选择魔法:');
if dengji>=0 then writeln('1.火球:初始攻击力110 mp-2');
if dengji>=2 then writeln('2.火焰:初始攻击力150 mp-5');
if dengji>=4 then writeln('3.冰球:初始攻击力200,冰冻效果,怪兽一回合不能攻击 mp-10');
if dengji>=6 then writeln('4.冰柱:初始攻击力250,冰冻效果,怪兽三回合不能攻击 mp-20');
if dengji>=8 then writeln('5.猛虎炎神:初始攻击力400,灼伤效果,怪兽每回合hp减少10% mp-40');
if dengji>=10 then writeln('6.冰环暴:初始攻击力450,冰冻效果,怪兽三回合不能攻击 mp-40');
readln(p);
if p='1' then
if mp>=2
then
begin
mp:=mp-2;
mcp:=110+mc;
end
else writeln('魔力不够!');
if p='2' then
if mp>=5
then
begin
mp:=mp-5;
mcp:=150+mc;
end
else writeln('魔力不够!');
if p='3' then
if mp>=10
then
begin
mp:=mp-10;
mcp:=200+mc;
end
else writeln('魔力不够!');
if p='4' then
if mp>=20
then
begin
mp:=mp-20;
mcp:=250+mc;
end
else writeln('魔力不够!');
if p='5' then
if mp>=40
then
begin
mp:=mp-40;
mcp:=400+mc;
end
else writeln('魔力不够!');
if p='6' then
if mp>=40
then
begin
mp:=mp-40;
mcp:=400+mc;
end
else writeln('魔力不够!');
end;
ghp:=ghp-mcp;
if ghp<0
then
begin
write('打败怪兽! 经验+',(hp0 mod 10+10));
readln;
jy:=jy+hp0;
z:=random(5);
if z=3 then writeln('得到金钱',(hp0 div 10*10));
money:=money+((hp0 div 10)*10);
ql:=ql+10;
break;
end
else
begin
write('怪兽受到伤害,HP-',mcp,'怪HP:',hp0,'/',ghp);
readln;
ql:=ql+10;
end;
end;
if p='4' then fyl:=fy*2;
if p='5' then begin
z:=random(4);
if z=3 then writeln('逃跑失败!')
else exit;
end;
end;
writeln('回合结束');
writeln('怪兽攻击!');
z:=random(9);
if z=1 then
begin
write('miss! ye!');
readln;
end
else
begin
if fy>=gatc then
begin
write('成功防御!');
readln;
end
else
begin
hp:=hp+fyl-gatc;
if hp>0 then
begin
write('你的HP-',gatc-fyl,' ',hpmax,'/',hp);
readln;
end
else
begin
write('你挂了!重新开始吧!');
readln;
halt;
end;
end;
write('回合结束');
readln;
end;
end;
shengji;
end;
end;

procedure shangdian;
var p:char;
begin
writeln('*********************商店****************************');
if money<=0 then
begin
writeln('老板:这里不欢迎穷光蛋!滚!!!!');
exit;
end
else
writeln('1.红药:HP+50 100元 2.蓝药 MP+50 100元');
write('(本商店现仅开放这两类药品,你要什么?1/2 Q:Quit)');
while (money>0)and(p<>'Q') do
begin
readln(p);
if p='1' then
begin
if hp+100>hpmax
then
begin
hp:=hpmax;
writeln('生命:',hpmax,'/',hp);
money:=money-100;
end
else
begin
hp:=hp+100;
writeln('生命:',hpmax,'/',hp);
money:=money-100;
end;
end
else
if p='2' then
begin
if mp+50>mpmax
then
begin
mp:=mpmax;
writeln('魔力:',mpmax,'/',mp);
money:=money-100;
end
else
begin
mp:=mp+50;
money:=money-100;
writeln('魔力:',mpmax,'/',mp);
end;
end;
end;
if money<=0 then writeln('店老板:没钱?滚!!!!!');
end;
procedure kaishi;
var s,m,n,k,l:integer;
p:char;
begin
write('请选择角色:1.剑士 2.魔法师 :');
readln(l);
if l=1 then
begin
hp:=500;
hpmax:=hp;
mp:=30;
mpmax:=mp;
money:=1000;
fy:=100;
dengji:=1;
atc:=150;
mc:=50;
zhiye:=1;
end;
if l=2 then
begin
hp:=300;
hpmax:=hp;
mp:=50;
mpmax:=mp;
money:=1000;
fy:=50;
dengji:=1;
atc:=80;
mc:=150;
zhiye:=2;
end;

randomize;
repeat
writeln('hp:',hpmax,'/',hp,' ','mp:',mpmax,'/',mp,' ','money:',money);
m:=1;
n:=1;
writeln('请输入:F:移动 B:购买物品 Z:人物状态 M:地图 Q?离开');
readln(p);
if p='F' then
begin
writeln('W:向前 S:向下 A:向左 D:向右 ');////{}////gvhfdghdvdhs!!!!!!! {}
readln(p);
if p='W'
then
begin
m:=m+1;
if m>10 then
begin
writeln('无法前进!');
m:=m-1;
end
else
if ma[m,n]=0 then writeln('什么都没有......');
if ma[m,n]=1 then moguaishou;
end;
end;
if p='B' then shangdian;
if p='Z' then ziliao;
if p='M' then map;
until p='Q';
end;

procedure shuoming;
var p:char;
begin
writeln('************************游戏说明******************************');
writeln('* 你是一个英雄,在峡谷里前进,前方可能有妖怪,也可能有宝物。 *');
writeln('* 你遇到野兽时,你可以用身上的东西向他攻击。按G键是攻击,按 *');
writeln('* T键是逃跑,但可能逃不掉哦!你开始只有一把小刀,以后可能拣 *');
writeln('* 到其它宝物,要加油哦!你的任务是找到传说中的宝物-CSW之剑 *');
writeln('* 然后打败大魔王(剧情比较老土,请见谅......) *');
writeln('*************************************************************');
writeln('好了,开始游戏吧!Y/N');
readln(p);
if p='N' then halt
else if p='Y' then kaishi
else
begin
writeln('耍我,死把!');
readln;
halt;
end;
end;

begin
writeln('************************游戏开始****************************');
writeln('* F:如何游戏:说明游戏方式 *');
writeln('* B:开始游戏:进入游戏 *');
writeln('* Q:退出游戏:离开游戏 *');
writeln('**************************************************************');
writeln('请输入:');
readln(a);
if a='F' then shuoming
else if a='B' then kaishi
else if a='Q' then halt;
end.

var pm,pw,cm,cw,jishuqif:longint;
px,pz,cx,cz:longint;
pb,ph,pt,pf,py,cb,ch,cf,ct,cy:longint;
a,b,c,d,e:longint;
begin
writeln(' 欢迎来到BOB游戏世界 ');
begin
write(' 你想要多少金钱:');
readln(pm);
write(' 你想要多少木材:');
readln(pw);
writeln(' 你的金钱:',pm,' ','你的木材:',pw );
writeln(' 游戏正式开始 ');
writeln(' 1=剪刀 2=石头 3=布 ');
cm:=pm; cw:=pw;
px:=10000; cx:=10000;
pz:=500; cz:=500;
pb:=0; ph:=0; pt:=0; pf:=0; py:=0; cb:=0; ch:=0; ct:=0; cf:=0; cy:=0;
repeat
randomize;
a:=random(3)+1;
randomize;
b:=random(5)+1;
jishuqif:=jishuqif+1;
writeln(' 第',jishuqif,'回合 ');
writeln('你的血量:',px,'你的攻击力:',pz,'你的金钱:',pm,'你的木材:',pw,' ,','电脑的血量:',cx,'电脑的攻击力:',cz,'电脑的金钱:',cm,'电脑的木材:',cw);
writeln('步兵:',pb,'火枪兵:',ph,'坦克:',pt,'飞机:',pf,'原子弹:',py,' ','步兵:',cb,'火枪兵:',ch,'坦克:',ct,'飞机:',cf,'原子弹:',cy);
write(' 面对凶悍的电脑,你出(剪刀,石头或布):');
readln(c);
begin
if (c=1) and (a=1) then begin writeln(' 你出剪刀,电脑出剪刀,没有赢家 ');
d:=3; end;
if (c=1) and (a=2) then begin writeln(' 你出剪刀,电脑出石头,电脑赢了 ');
d:=2; end;
if (c=1) and (a=3) then begin writeln(' 你出剪刀,电脑出布 ,你 赢 了 ');
d:=1; end;
if (c=2) and (a=1) then begin writeln(' 你出石头,电脑出剪刀,你 赢 了 ');
d:=1; end;
if (c=2) and (a=2) then begin writeln(' 你出石头,电脑出石头,没有赢家 ');
d:=3; end;
if (c=2) and (a=3) then begin writeln(' 你出石头,电脑出布 ,电脑赢了 ');
d:=2; end;
if (c=3) and (a=1) then begin writeln(' 你 出 布,电脑出剪刀,电脑赢了 ');
d:=2; end;
if (c=3) and (a=2) then begin writeln(' 你 出 布,电脑出石头,你 赢 了 ');
d:=1; end;
if (c=3) and (a=3) then begin writeln(' 你 出 布,电脑出布, 没有赢家 ');
d:=3; end;
if (c>3) then begin writeln('输入错误!'); d:=3; end;
if (c<1) then begin writeln('输入错误!'); d:=3; end;
end;
if d=3 then begin
writeln(' 本局没有赢家 ');
end;
if d=1 then begin write(' 恭喜你,你获得了主动权,你的战略是:');
readln(e);
if (e=1) and (pm>100) then begin
pb:=pb+1; pm:=(pm-100); px:=px+100; pz:=pz+100;
writeln(' 你选择了买一个步兵 ');
end else if (pm<100) then begin e:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (e=2) and (pm>200) and (pw>50) then begin
ph:=ph+1; pm:=(pm-200); pw:=(pw-50); px:=px+250; pz:=pz+200;
writeln(' 你选择了买一个火枪兵 ');
end else if (pm<200) or (pw<50) then begin e:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (e=3) and (pm>500) and (pw>250) then begin
pt:=pt+1; pm:=(pm-500); pw:=(pw-250); px:=px+500; pz:=pz+500;
writeln(' 你选择了买一辆坦克 ');
end else if (pm<500) or (pw<250) then begin e:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (e=4) and (pm>1000) and (pw>500) then begin
pf:=pf+1; pm:=(pm-1000); pw:=(pw-500); px:=px+750; pz:=pz+1000;
writeln(' 你选择了买一架飞机 ');
end else if (pm<1000) or (pw<500) then begin e:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (e=123456789) and (pm>10000) and (pw>10000) then begin
py:=py+1; pm:=(pm-10000); pw:=(pw-10000); pz:=pz+5000;
writeln(' 你选择了买一个原子弹 ');
end else if (pm<10000) or (pw<10000) then begin b:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (e=5) then begin
cx:=cx-pz;
writeln(' 你选择了攻击电脑,电脑的血量减去了:',pz,'点 ');
if py>0 then begin pz:=pz-(5000*py); py:=py-py; end else py:=py-0;
end;
end;
if d=2 then begin
writeln(' 很遗憾,你让电脑获得了主动权,电脑的操作是:',b);

if (b=1) and (cm>100) then begin
cb:=cb+1; cm:=(cm-100); cx:=cx+100; cz:=cz+100;
writeln(' 电脑选择了买一个步兵 ');
end else if (cm<100) then begin b:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (b=2) and (cm>200) and (cw>50) then begin
ch:=ch+1; cm:=(cm-200); cw:=(cw-50); cx:=cx+250; cz:=cz+200;
writeln(' 电脑选择了买一个火枪兵 ');
end else if (cm<200) or (cw<50) then begin b:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (b=3) and (cm>500) and (cw>250) then begin
ct:=ct+1; cm:=(cm-500); cw:=(cw-250); cx:=cx+500; cz:=cz+500;
writeln(' 电脑选择了买一辆坦克 ');
end else if (cm<500) or (cw<250) then begin b:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (b=4) and (cm>1000) and (cw>500) then begin
cf:=cf+1; cm:=(cm-1000); cw:=(cw-500); cx:=cx+750; cz:=cz+1000;
writeln(' 电脑选择了买一架飞机 ');
end else if (cm<1000) or (cw<500) then begin b:=0;writeln('金钱或木材不足!你的操作失败!'); end;
if (b=5) then begin
px:=px-cz;
writeln(' 电脑选择了攻击你,你的血量减去了:',cz,'点 ');
end;
end;

if px<0 then writeln(' 哦,电脑打死了你,你输了!');
if cx<0 then writeln(' 恭喜你,你已经打死了电脑,你赢了!');

until (px<0) or (cx<0);
end;
writeln(' 谢谢你的参与! ');
readln;
end.

俄罗斯方块
USES Crt;
CONST
Change:Array [0..6,0..3,0..7] Of Byte =(((0,1,1,1,2,1,3,1),(1,0,1,1,1,2,1,3),(0,1,1,1,2,1,3,1),(1,0,1,1,1,2,1,3)),
((1,0,0,1,1,1,2,1),(1,0,1,1,1,2,2,1),(0,1,1,1,2,1,1,2),(1,0,0,1,1,1,1,2)),
((1,0,2,0,1,1,2,1),(1,0,2,0,1,1,2,1),(1,0,2,0,1,1,2,1),(1,0,2,0,1,1,2,1)),
((1,0,2,0,0,1,1,1),(0,0,0,1,1,1,1,2),(1,0,2,0,0,1,1,1),(0,0,0,1,1,1,1,2)),
((0,0,1,0,1,1,2,1),(1,0,0,1,1,1,0,2),(0,0,1,0,1,1,2,1),(1,0,0,1,1,1,0,2)),
((1,0,2,0,1,1,1,2),(0,0,0,1,1,1,2,1),(1,0,0,2,1,1,1,2),(2,2,0,1,1,1,2,1)),
((0,0,1,0,1,1,1,2),(2,0,0,1,1,1,2,1),(2,2,1,0,1,1,1,2),(0,2,0,1,1,1,2,1)));
VAR
Board:Array [0..3,0..11,1..25] Of Byte;
Players,N,Nowx,Nowy,Kind,Trans,Speed:Byte;
Time,Score:Word;
Now:Array [0..7] Of Byte;
PROCEDURE Furbish;
VAR B,C:Byte;
Begin
For C:=24 Downto 2 Do Begin
Gotoxy(1,C);
For B:=1 To 10 Do
If Board[0,B,C]=0 Then Write(' ')
Else Write('圹');
End;
End;
PROCEDURE Clear;
Var A,B,C:Byte;D:Boolean;
Begin
For A:=24 Downto 1 Do
Begin
D:=True;
For B:=1 To 10 Do
If Board[0,B,A]=0 Then D:=False;
If D=True Then
Begin
Score:=Score+10;Gotoxy(1,1);Write(Score:5,'0');
For C:=A Downto 2 Do
For B:=1 To 10 Do
Board[0,B,C]:=Board[0,B,C-1];
A:=A+1;
End;
End;
Furbish;
End;
FUNCTION Canmove(X,Y:Byte):Boolean;
BEGIN
Canmove:=True;
If Board[0,X+Now[0],Y+Now[1]]>0 Then Canmove:=False;
If Board[0,X+Now[2],Y+Now[3]]>0 Then Canmove:=False;
If Board[0,X+Now[4],Y+Now[5]]>0 Then Canmove:=False;
If Board[0,X+Now[6],Y+Now[7]]>0 Then Canmove:=False;
End;
PROCEDURE Clean;
Begin
Gotoxy((Nowx+Now[0])*2-1,Nowy+Now[1]);Write(' ');
Gotoxy((Nowx+Now[2])*2-1,Nowy+Now[3]);Write(' ');
Gotoxy((Nowx+Now[4])*2-1,Nowy+Now[5]);Write(' ');
Gotoxy((Nowx+Now[6])*2-1,Nowy+Now[7]);Write(' ');
End;
PROCEDURE Show;
Begin
Gotoxy((Nowx+Now[0])*2-1,Nowy+Now[1]);Write('圹');
Gotoxy((Nowx+Now[2])*2-1,Nowy+Now[3]);Write('圹');
Gotoxy((Nowx+Now[4])*2-1,Nowy+Now[5]);Write('圹');
Gotoxy((Nowx+Now[6])*2-1,Nowy+Now[7]);Write('圹');
End;
BEGIN
Fillchar(Board,Sizeof(Board),0);
Randomize;Score:=0;
For N:=1 To 24 Do
Board[0,0,N]:=1;
For N:=1 To 24 Do
Board[0,11,N]:=1;
For N:=1 To 10 Do
Board[0,N,25]:=1;
Window(31,2,50,25);Textcolor(White);Textbackground(Blue);
Clrscr;Window(31,2,51,25);
Speed:=1;
Kind:=Random(7);Trans:=Random(4);Nowx:=4;Nowy:=1;
For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];
While Canmove(Nowx,Nowy) Do
Begin
Repeat
Clean;Nowy:=Nowy+1;Show;
Repeat
If Keypressed Then
Case Upcase(Readkey) Of
#0:Case Readkey Of
#75:If Canmove(Nowx-1,Nowy) Then Begin Clean;Nowx:=Nowx-1;Show;End;
#77:If Canmove(Nowx+1,Nowy) Then Begin Clean;Nowx:=Nowx+1;Show;End;
#80:Begin Clean;Repeat
If Canmove(Nowx,Nowy+1) Then Nowy:=Nowy+1;
Until Not(Canmove(Nowx,Nowy+1));Show;End;
#61:Begin Gotoxy(9,12);Write('Pause');Repeat Delay(1000);Until Keypressed;Furbish;End;
End;
#27:Exit;
' ',#13:Begin
Clean;Trans:=Trans+1;
If Trans=4 Then Trans:=0;
For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];
If Not(Canmove(Nowx,Nowy)) Then Begin Trans:=Trans-1;For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];Show;End
Else Show;
End;
End;
Until Not(Keypressed);
Delay((10-Speed)*50);
Until Not(Canmove(Nowx,Nowy+1));
Score:=Score+1;Gotoxy(1,1);Write(Score:5,'0');Speed:=(Score Div 300)+1;
Board[0,Nowx+Now[0],Nowy+Now[1]]:=1;
Board[0,Nowx+Now[2],Nowy+Now[3]]:=1;
Board[0,Nowx+Now[4],Nowy+Now[5]]:=1;
Board[0,Nowx+Now[6],Nowy+Now[7]]:=1;
Clear;
Kind:=Random(7);Trans:=Random(4);Nowx:=4;Nowy:=1;
For N:=0 To 7 Do
Now[N]:=Change[Kind,Trans,N];
End;
Gotoxy(7,12);Write('GAME OVER');Readln;
END.

你可以访问我的QQ空间,上面有个pas游戏的板块,里面可能有你需要的。。
我的QQ是:276908737

http://www.ssfz.cn/xinxijs/ShowArticle.asp?ArticleID=929

导弹拦截


闵行区15693967493: 求一个free pascal的小游戏 -
惠帜易贴: 抢三十 :start rule exit 代码如下:program Crash_the_30; var c,p1,p2,i,j,n,a,b,d:integer; u:array[1..10] of string; begin while d=d do begin writeln('CRASH THE 30'); writeln('Start'); writeln('Rules'); writeln('Exit'); readln(u[1]); if u[1]='Rules' then writeln...

闵行区15693967493: 求一个free pascal智障级游戏 -
惠帜易贴: var a:char; i,j,m,n:integer; ma:array[1..10,1..10]of integer; hp,mp,money,ql,dengji,fy,atc,mc,hpmax,mpmax,zhiye,jy,mcp:integer;procedure map;beginrandomize;m:=random(10);n:=random(10);writeln('*******地图********');for i:=1 to 10 dobegin for j...

闵行区15693967493: 一个很弱智的free Pascal问题:如何注释啊? -
惠帜易贴: begin {我不会被执行} //我也不会被执行 end.最常见的了

闵行区15693967493: 一个超级难的free pascal循环问题 -
惠帜易贴: 用F[I]表示上到第I级台阶时的方法数 因为F[I]只能由F[I-1],F[I-2],F[I-3]三种状态到达,所以递推式 F[I]=F[I-1]+F[I-2]+F[I-3] Var F:Array[0..10]of Longint; I:Longint; Begin F[0]:=1; F[1]:=1; F[2]:=2; For I:=3 to 10 do F[I]:=F[I-1]+F[I-2]+F[I-3]; Writeln(F[10]); End;

闵行区15693967493: Free Pascal 问题求解!!
惠帜易贴: 首先,我们看看要执行完成这项计划,最多需要多少天,最直接的就是第一天0圈,第二天1圈,第三天2圈,第四天3圈,第m-1天m圈,合计 0+1+2+……+m-1==n. 相当于:m2-m-2n=0 所以方程的解就是所需要的天数,由于必须为整数天,而...

闵行区15693967493: free pascal 高难度题目 -
惠帜易贴: 第一题: 其实是一道简单的模拟题 代码 var i,j,k,m,n,t,h,tt:longint; a:array[1..1000]of longint; cc:array[1..10000]of boolean; begin read(n); for i:=1 to 1000 do cc[i]:=true; for j:=1 to maxint do begin t:=0; for i:=1 to n do begin if cc[i]=true then begin inc(t);...

闵行区15693967493: 用free pascal做一个简单的猜数字游戏 -
惠帜易贴: 一楼的太麻烦了吧!!!!! var i,j,a,b,d,z,n,m:integer; m:char; begin randmize; <随机初始化> repeat i:=0; z:=randmize(11); <随机得到1~10的答案(你可以自由调节大小)> repeat readln(a); if a=z then begin writeln('OK!'); break; end else ...

闵行区15693967493: 智障怎样分级 -
惠帜易贴: 儿童按照智商分数和社会适应障碍程度两个基本指标将儿童智力障碍分为四个等级. ①轻度智力障碍 智商70~55分(以韦氏智力测验为例,下同),同时具有轻度的社会适应障碍.轻度智力障碍儿童具有基本的生活自理能力,能承担简单的家...

闵行区15693967493: Free Pascal问题..会滴速度来..
惠帜易贴: 设到第n级阶梯的走法数为jt(n),因为到第n级阶梯可由 第n-2级 或者 第n-1级跨上来,所以jt(n):=jt(n-2)+jt(n-1); 这里的边界为jt(1)=1————到第一级阶梯共一种走法;jt(2):=2————到第二级阶梯共2种走法; 有何疑问可以追问..

闵行区15693967493: free pascal 超级小菜求救~~ -
惠帜易贴: var a,t,n:integer;begin;for n:=2 to 100 dobegin a:=0; for t:=1 to n do if n mod t =0 then a:=a+1;if a<=2 then writeln(n) else writeln;end; readln;end.

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网