推扬网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
推扬网 门户 你问我答 查看内容

给几个Pascal的小游戏

2020-7-17 19:02| 发布者: admin| 查看: 6| 评论: 0

摘要: 匿名用户的回答: program xiangqi;varx:arrayof integer;zf,yf:string;z,y,xf:boolean;c,d,x1,y1,x2,y2:integer;procedure beginner;beginwriteln('左方:');readln(zf);writeln('右方:') ...

匿名用户的回答:

program xiangqi;
var
x:array[1..10,1..9]of integer;
zf,yf:string;
z,y,xf:boolean;
c,d,x1,y1,x2,y2:integer;
procedure beginner;
begin
writeln('左方:');
readln(zf);
writeln('右方:');
readln(yf);
writeln('开始!');
end;
procedure first;
var a,b:integer;
begin
for a:=1 to 10 do
for b:=1 to 9 do
x[a,b]:=0;
x[1,1]:=5;x[1,2]:=4;x[1,3]:=3;x[1,4]:=2;x[1,5]:=1;x[1,6]:=2;x[1,7]:=3;x[1,8]:=4;x[1,9]:=5;x[3,2]:=6;x[3,8]:=6;x[4,1]:=7;x[4,3]:=7;x[4,5]:=7;x[4,7]:=7;x[4,9]:=7;x[10,1]:=5+7;x[10,2]:=4+7;x[10,3]:=3+7;x[10,4]:=2+7;x[10,5]:=1+7;x[10,6]:=2+7;x[10,7]:=3+7;x[10,8]:=4+7;x[10,9]:=5+7;x[8,2]:=6+7;x[8,8]:=6+7;x[7,1]:=7+7;x[7,3]:=7+7;x[7,5]:=7+7;x[7,7]:=7+7;x[7,9]:=7+7;
end;
procedure writer;
var a,b:integer;
begin
writeln;
writeln(' 1 2 3 4 5 6 7 8 9');
for a:=1 to 10 do
begin
write(a:2,' ');
for b:=1 to 9 do
case x[a,b] of
0:write(' ');
1:write('将');
2:write('士');
3:write('象');
4:write('马');
5:write('车');
6:write('炮');
7:write('兵');
8:write('帅');
9:write('仕');
10:write('相');
11:write('马');
12:write('车');
13:write('泡');
14:write('卒');
end;
writeln;
end;
writeln;
end;
{function k:boolean;<br>begin<br>k:=true;<br>if xf<br>then<br>if x[x1,y1]<8<br>then<br>begin<br>k:=false;<br>exit;<br>end<br>else<br>if x[x1,y1]>7<br>then<br>begin<br>k:=false;<br>exit;<br>end;<br>end;}
begin
while true do
begin
beginner;
first;
xf:=true;
repeat
writer;
if xf
then write('左方:')
else write('右方:');
readln(x1,y1,x2,y2);
{while not(k) do<br>begin<br>writeln('对不起,不可以这样下,请重新下:');<br>readln(x1,y1,x2,y2);<br>end;}
x[x2,y2]:=x[x1,y1];
x[x1,y1]:=0;
z:=false;
y:=false;
for c:=1 to 10 do
for d:=1 to 9 do
begin
if x[c,d]=1 then z:=true;
if x[c,d]=8 then y:=true;
end;
xf:=not(xf);
until (not(z))or(not(y));
if z
then write(zf,'赢了')
else write(yf,'赢了');
writeln;
end;
end.

匿名用户的回答:

1 pascal小游戏(原创)
uses crt;

type list=record
ty,ax:integer;
end;
xy=record
bx,by:integer;
end;
l1=array[1..4,1..5]of char;
l2=array[1..5,1..6]of char;
l3=array[1..8,1..5]of char;

const
my:l1=(('0','0','A','0','0'),
('A','0','H','0','A'),
('b','H','H','H','d'),
('0','T','U','T','0'));

pl:l3=(('0','H','0','H','0'),
('p','H','I','H','q'),
('0','H','X','H','0'),
('0','V','0','V','0'),
('0','H','H','H','0'),
('0','H','O','H','0'),
('0','H','H','H','0'),
('0','0','V','0','0'));

boss:l2=(('0','T','H','H','T','0'),
('X','H','I','I','H','X'),
('X','H','X','X','H','X'),
('H','0','H','H','0','H'),
('V','0','V','V','0','V'));

var ix,hp,bshp,box,i,j,k,t,sum,every:integer;
enlist:array[1..30]of list;
ch:char;
nowen:array[1..3]of list;
bom,boe:array[1..25]of xy;

procedure myij(x:integer);
begin
for k:=1 to 4 do begin
if x>=2 then gotoxy(x-1,21+k)
else gotoxy(x,21+k);
write(' ');
for t:=1 to 5 do
if my[k,t]<>'0' then write(my[k,t]) else write(' ');
if x+4<80 then write(' ');
end;
end;

procedure now(enemy:integer);
begin
gotoxy(1,1);
delline;
gotoxy(1,1);
insline;
gotoxy(1,1);
textcolor(black);
write(' Hp:',hp,' Remain enemy:',enemy,' Boss Hp:',bshp);
textcolor(red);
end;

function hiten(s:integer):integer;
begin
hiten:=0;
for t:=1 to 3 do
if (bom[s].by<=6)and(bom[s].bx-nowen[t].ax>=0)
and(bom[s].bx-nowen[t].ax<=4)then hiten:=t;
end;

function hitmy(s:integer):boolean;
begin
hitmy:=false;
if (boe[s].by>=21)and(boe[s].bx-ix>=0)
and(boe[s].bx-ix<=4)then hitmy:=true;
end;

function hitbo(s:integer):boolean;
begin
hitbo:=false;
if (bom[s].by<=7)and(bom[s].bx-box>=0)
and(bom[s].bx-box<=5)then hitbo:=true;
end;

procedure clear(s:integer);
begin
for t:=1 to 4 do begin
gotoxy(nowen[s].ax,t+1);
write(' ');
end;
end;

procedure win;
begin
clrscr;
gotoxy(28,12);
writeln('Congratulations,You win!');
write(' Press Enter to exit...');
readln;
halt;
end;

procedure plij(s,x:integer);
begin
for k:=1 to 4 do begin
if x>=2 then gotoxy(x-1,1+k)
else gotoxy(x,1+k);
write(' ');
for t:=1 to 5 do
if pl[s+k-1,t]<>'0' then write(pl[s+k-1,t]) else write(' ');
if x+4<80 then write(' ');
end;
end;

procedure lost;
begin
clrscr;
gotoxy(32,12);
writeln('Sorry,You lost!');
write(' Press Enter to exit...');
readln;
halt;
end;

function canmove(x:integer;y:integer):boolean;
begin
canmove:=false;
if ((x>=2)and(y=1))or((x<=71)and(y=2)) then canmove:=true;

鲜花

握手

雷人

路过

鸡蛋

最新评论

热门推荐
最新资讯
关闭

站长推荐上一条 /1 下一条

广告位招租

QQ|广告服务|网站出售|投稿要求|禁言标准|版权说明|免责声明|手机版|小黑屋|推扬网 ( 粤ICP备18134897号 )|网站地图

扫码关注
接收重要通知

收粉收量信息等
将会公布在公众号上

GMT+8, 2020-11-30 07:19 , Processed in 0.417346 second(s), 30 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

返回顶部

为了响应国家互联网安全,本站已和国家网信办举报中心对接。发布内容信息系统会自动记录IP地址、设备信息、行为记录等。如有发生犯罪违法违规行为,我们全部配合有关部门协助调查取证!

本站部分文字及图片均来自于网络,如侵犯到您的权益,请及时通知我们,我们将及时的处理。

本站所提供的信息,只供参考之用。本站不保证该等信息的准确性、有效性、及时性或完整性。本站一概毋须以任何方式就任何信息传递或传送的失误、不准确或错误对用户或任何其他人士负任何直接或间接的责任。
在法律允许的范围内,本站在此声明,不承担用户或任何人士就使用或未能使用本站所提供的信息或任何链接或项目所引致的任何直接、间接、附带、从属、特殊、惩罚性或惩戒性的损害赔偿(包括但不限于收益、预期利润的损失或失去的业务未实现预期的节省)。

本站中的文章(包括转贴文章)的版权仅归原作者所有,若作者有版权声明的或文章从其它网站(或各种互联网渠道)转载而附带有原所有站的版权声明者,其版权归属以附带声明为准;文章仅代表作者本人的观点,与本站立场无关。