各位老铁们,大家好,今天由我来为大家分享pascal游戏,以及用pascal可编什么游戏的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!

用pascal可编什么游戏

通过运用crt单元,可以编出一些简单的游戏。例如贪吃蛇、推箱子、扫雷等。这些都是我编过的游戏下面附上代码。

pascal游戏 用pascal可编什么游戏

贪吃蛇:

program she;

uses crt;

label 1,2,3;

type point=record

pascal游戏 用pascal可编什么游戏

x,y:1..20;

end;

type shuzu=array[1..20,1..20] of char;

var a:shuzu;s:string;b:array[1..1000]of point;i,j,f,fen:integer;

head,tail:0..1001;c:boolean;

procedure ran2;

var p,q:integer;

begin

randomize;

p:=random(17)+2;

q:=random(17)+2;

if a[p,q]='' then a[p,q]:='#' else ran2;

end;

procedure ran;

var p,q:integer;

begin

randomize;

p:=random(17)+2;

q:=random(17)+2;

if a[p,q]='' then a[p,q]:=chr(2) else ran;

end;

procedure print(x:shuzu);

var i,j:1..20;

begin

for i:=1 to 20 do

for j:=1 to 20 do

begin

textcolor(15);

if a[i,j]=chr(2) then textcolor(12);

write(a[i,j]);

if j=20 then writeln

end;

writeln('Score:',fen);

end;

begin

textmode(1);cursoroff;

3:fillchar(a,sizeof(a),'');

head:=0;tail:=3;fen:=0;f:=4;

b[1].x:=2;b[1].y:=2;

b[2].x:=2;b[2].y:=3;

b[3].x:=2;b[3].y:=4;

for i:=1 to 20 do

begin

a[1,i]:='#';a[i,1]:='#';

a[20,i]:='#';a[i,20]:='#';

end;

a[2,2]:='o';a[2,3]:='o';a[2,4]:='?;

ran;

1:

c:=false;

clrscr;

print(a);

for i:=1 to 300 do

begin

delay(1);

if(keypressed)and(not(c)) then

case readkey of

#72:

if(f=3)or(f=4) then begin f:=1;c:=true; end;

#80:

if(f=3)or(f=4) then begin f:=2;c:=true end;

#75:

if(f=1)or(f=2) then begin f:=3;c:=true end;

#77:

if(f=1)or(f=2) then begin f:=4;c:=true end;

#27:

begin

writeln('Do you want to exit(Y/N)?');

repeat

readln(s);

if(s='Y')or(s='y') then halt;

until(s='N')or(s='n');

goto 1;

end;

end;

end;

a[b[tail].x,b[tail].y]:='o';

case f of

1:

begin

if(a[b[tail].x-1,b[tail].y]='#')or

((a[b[tail].x-1,b[tail].y]='o')and(not((b[tail].x-1=b[head mod 1000+1].x)and(b[tail].y=b[head mod 1000+1].y)))) then goto 2;

if a[b[tail].x-1,b[tail].y]=chr(2) then

begin

fen:=fen+10;

ran;ran2

end

else

begin

head:=head mod 1000+1;

a[b[head].x,b[head].y]:='';

end;

tail:=tail+1;

if tail=1001 then

begin

tail:=1;

b[1].x:=b[1000].x-1;b[1].y:=b[1000].y;

end

else

begin

b[tail].x:=b[tail-1].x-1;b[tail].y:=b[tail-1].y;

end;

end;

2:

begin

if(a[b[tail].x+1,b[tail].y]='#')or

((a[b[tail].x+1,b[tail].y]='o')and(not((b[tail].x+1=b[head mod 1000+1].x)and(b[tail].y=b[head mod 1000+1].y)))) then goto 2;

if a[b[tail].x+1,b[tail].y]=chr(2) then

begin

fen:=fen+10;

ran;ran2

end

else

begin

head:=head mod 1000+1;

a[b[head].x,b[head].y]:='';

end;

tail:=tail+1;

if tail=1001 then

begin

tail:=1;

b[1].x:=b[1000].x+1;b[1].y:=b[1000].y;

end

else

begin

b[tail].x:=b[tail-1].x+1;b[tail].y:=b[tail-1].y;

end;

end;

3:

begin

if(a[b[tail].x,b[tail].y-1]='#')or

((a[b[tail].x,b[tail].y-1]='o')and(not((b[tail].x=b[head mod 1000+1].x)and(b[tail].y-1=b[head mod 1000+1].y)))) then goto 2;

if a[b[tail].x,b[tail].y-1]=chr(2) then

begin

fen:=fen+10;

ran;ran2

end

else

begin

head:=head mod 1000+1;

a[b[head].x,b[head].y]:='';

end;

tail:=tail+1;

if tail=1001 then

begin

tail:=1;

b[1].x:=b[1000].x;b[1].y:=b[1000].y-1;

end

else

begin

b[tail].x:=b[tail-1].x;b[tail].y:=b[tail-1].y-1;

end;

end;

4:

begin

if(a[b[tail].x,b[tail].y+1]='#')or

((a[b[tail].x,b[tail].y+1]='o')and(not((b[tail].x=b[head mod 1000+1].x)and(b[tail].y+1=b[head mod 1000+1].y)))) then goto 2;

if a[b[tail].x,b[tail].y+1]=chr(2) then

begin

fen:=fen+10;

ran;ran2

end

else

begin

head:=head mod 1000+1;

a[b[head].x,b[head].y]:='';

end;

tail:=tail+1;

if tail=1001 then

begin

tail:=1;

b[1].x:=b[1000].x;b[1].y:=b[1000].y+1;

end

else

begin

b[tail].x:=b[tail-1].x;b[tail].y:=b[tail-1].y+1;

end;

end;

end;

a[b[tail].x,b[tail].y]:='?;

goto 1;

2:writeln('Game Over!Score:',fen);

writeln('Play again(Y/N)?');

repeat

readln(s);

if(s='Y')or(s='y') then goto 3;

if(s='N')or(s='n') then halt;

until(s='Y')or(s='y')or(s='N')or(s='n');

end.

推箱子(主文件):

program tuixiang;

uses crt,tx,dos;

label 1,2,3,4,5;

var f:text;n,p,q,i,j:integer;s1,s:string;

a:sz1;b:sz2;top:integer;ren:poi;

procedure wrong;

begin

sound(300);

delay(100);

nosound;

end;

function over:boolean;

var i:integer;

begin

for i:=1 to top do

if a[b[i].x,b[i].y]<>'? then exit(false);

exit(true);

end;

begin

textmode(1);cursoroff;

highvideo;

window(15,7,30,25);

write('Please choose a unit(1~11):');

read(n);

2:str(n,s1);s:='c:\map'+s1+'.in';

print(n,ren,a,b,top);

assign(f,s);

reset(f);

readln(f,i);

for j:=1 to i do

readln(f,p,q);

readln(f,p,q);

close(f);

1:case readkey of

#72:

if(a[ren.x-1,ren.y]='')or(a[ren.x-1,ren.y]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x-1,ren.y]:=chr(2);

ren.x:=ren.x-1;

end

else

if a[ren.x-1,ren.y]=chr(233) then

if(a[ren.x-2,ren.y]='')or(a[ren.x-2,ren.y]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x-1,ren.y]:=chr(2);a[ren.x-2,ren.y]:=chr(233);

ren.x:=ren.x-1;

end

else wrong

else

wrong;

#80:

if(a[ren.x+1,ren.y]='')or(a[ren.x+1,ren.y]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x+1,ren.y]:=chr(2);

ren.x:=ren.x+1;

end

else

if a[ren.x+1,ren.y]=chr(233) then

if(a[ren.x+2,ren.y]='')or(a[ren.x+2,ren.y]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x+1,ren.y]:=chr(2);a[ren.x+2,ren.y]:=chr(233);

ren.x:=ren.x+1;

end

else wrong

else

wrong;

#75:

if(a[ren.x,ren.y-1]='')or(a[ren.x,ren.y-1]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x,ren.y-1]:=chr(2);

ren.y:=ren.y-1;

end

else

if a[ren.x,ren.y-1]=chr(233) then

if(a[ren.x,ren.y-2]='')or(a[ren.x,ren.y-2]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x,ren.y-1]:=chr(2);a[ren.x,ren.y-2]:=chr(233);

ren.y:=ren.y-1;

end

else wrong

else

wrong;

#77:

if(a[ren.x,ren.y+1]='')or(a[ren.x,ren.y+1]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x,ren.y+1]:=chr(2);

ren.y:=ren.y+1;

end

else

if a[ren.x,ren.y+1]=chr(233) then

if(a[ren.x,ren.y+2]='')or(a[ren.x,ren.y+2]='o') then

begin

if dong(ren.x,ren.y,top,b) then a[ren.x,ren.y]:='o' else a[ren.x,ren.y]:='';

a[ren.x,ren.y+1]:=chr(2);a[ren.x,ren.y+2]:=chr(233);

ren.y:=ren.y+1;

end

else wrong

else

wrong;

#27:

begin

write('Are you sure to exit(Y/N)?');

4:readln(s1);

if(s1='y')or(s1='Y') then

begin

textmode(lo(lastmode));

halt

end

else

if(s1<>'n')and(s1<>'N') then goto 4;

end;

else

goto 1;

end;

pr(p,q,top,a,b);

if over then

begin

erase(f);

if n=11 then

begin

write('Congratulations!Play again(Y/N)?');

5:readln(s1);

if(s1='y')or(s1='Y') then

begin

n:=1;goto 2;

end

else

if(s1='n')or(s1='N') then halt

else goto 5;

end;

write('Congratulations!Go to next unit(Y/N)?');

3:readln(s1);

if(s1='y')or(s1='Y') then

begin

n:=n+1;goto 2;

end

else

if(s1='n')or(s1='N') then halt

else goto 3;

end;

goto 1;

end.

推箱子(附带单元):

unit tx;

interface

uses crt;

type poi=record

x,y:integer;

end;

type sz1=array[1..50,1..50]of char;

type sz2=array[1..10]of poi;

function dong(x,y,top:integer;var b:sz2):boolean;

procedure print(x:integer;var ren:poi;var a:sz1;var b:sz2;var top:integer);

procedure pr(x,y,top:integer;a:sz1;b:sz2);

implementation

function dong(x,y,top:integer;var b:sz2):boolean;

var i:integer;

begin

for i:=1 to top do

if(b[i].x=x)and(b[i].y=y) then exit(true);

exit(false);

end;

procedure print(x:integer;var ren:poi;var a:sz1;var b:sz2;var top:integer);

var f:text;s1,s:string;

procedure prsc;

var i,j,m,n:integer;

begin

clrscr;

assign(f,s);

reset(f);

readln(f,top);

for i:=1 to top do

readln(f,b[i].x,b[i].y);

readln(f,m,n);

for i:=1 to m do

for j:=1 to n do

begin

textcolor(15);

if dong(i,j,top,b) then textcolor(12);

read(f,a[i,j]);write(a[i,j]);

if a[i,j]=chr(2) then

begin

ren.x:=i;

ren.y:=j;

end;

if j=n then

begin

readln(f);

writeln

end;

end;

close(f);

end;

begin

str(x,s1);s:='c:\map'+s1+'.in';

assign(f,s);rewrite(f);

case x of

1:

begin

writeln(f,3);

writeln(f,5,'',2);

writeln(f,6,'',2);

writeln(f,7,'',2);

writeln(f,9,'',8);

writeln(f,'#####');

writeln(f,'#####');

writeln(f,'##?#');

writeln(f,'#?#');

writeln(f,'#o####');

writeln(f,'#o#?#');

writeln(f,'#o###');

writeln(f,'####');

writeln(f,'#####');

end;

2:

begin

writeln(f,5);

writeln(f,6,'',2);

writeln(f,7,'',2);

writeln(f,7,'',3);

writeln(f,7,'',4);

writeln(f,7,'',5);

writeln(f,8,'',6);

writeln(f,'####');

writeln(f,'###');

writeln(f,'#?#');

writeln(f,'##?##');

writeln(f,'##?#');

writeln(f,'#o?#');

writeln(f,'#oo閛#');

writeln(f,'######');

end;

3:

begin

writeln(f,3);

writeln(f,4,'',8);

writeln(f,5,'',8);

writeln(f,6,'',8);

writeln(f,9,'',9);

writeln(f,'#####');

writeln(f,'##');

writeln(f,'#殚####');

writeln(f,'#?##o#');

writeln(f,'######o#');

writeln(f,'## o#');

writeln(f,'###');

writeln(f,'#####');

writeln(f,'#####');

end;

4:

begin

writeln(f,4);

writeln(f,3,'',5);

writeln(f,3,'',6);

writeln(f,4,'',5);

writeln(f,4,'',6);

writeln(f,10,'',7);

writeln(f,'####');

writeln(f,'#####');

writeln(f,'#?oo#');

writeln(f,'## oo#');

writeln(f,'##?##');

writeln(f,'###');

writeln(f,'#?#');

writeln(f,'##?#');

writeln(f,'####');

writeln(f,'####');

end;

5:

begin

writeln(f,3);

writeln(f,5,'',2);

writeln(f,6,'',2);

writeln(f,7,'',2);

writeln(f,8,'',8);

writeln(f,'####');

writeln(f,'####');

writeln(f,'#?#');

writeln(f,'######');

writeln(f,'#o###');

writeln(f,'#o?##');

writeln(f,'#o?#');

writeln(f,'########');

end;

6:

begin

writeln(f,5);

writeln(f,2,'',7);

writeln(f,3,'',7);

writeln(f,4,'',7);

writeln(f,5,'',7);

writeln(f,6,'',7);

writeln(f,10,'',8);

writeln(f,'###');

writeln(f,'#o#');

writeln(f,'#####o#');

writeln(f,'##? o#');

writeln(f,'#殚o#');

writeln(f,'#? o#');

writeln(f,'######');

writeln(f,'#?#');

writeln(f,'####');

writeln(f,'######');

end;

7:

begin

writeln(f,5);

writeln(f,2,'',4);

writeln(f,2,'',5);

writeln(f,3,'',3);

writeln(f,3,'',4);

writeln(f,3,'',5);

writeln(f,10,'',7);

writeln(f,'####');

writeln(f,'##oo#');

writeln(f,'#ooo#');

writeln(f,'##?#');

writeln(f,'#??');

writeln(f,'##?##');

writeln(f,'##?#');

writeln(f,'##');

writeln(f,'######');

writeln(f,'###');

end;

8:

begin

writeln(f,6);

writeln(f,5,'',5);

writeln(f,5,'',6);

writeln(f,6,'',5);

writeln(f,6,'',6);

writeln(f,7,'',5);

writeln(f,7,'',6);

writeln(f,11,'',9);

writeln(f,'####');

writeln(f,'#######');

writeln(f,'#??#');

writeln(f,'####');

writeln(f,'###oo#');

writeln(f,'##?oo?#');

writeln(f,'##oo##');

writeln(f,'####');

writeln(f,'#??#');

writeln(f,'#######');

writeln(f,'####');

end;

9:

begin

writeln(f,5);

writeln(f,4,'',5);

writeln(f,5,'',4);

writeln(f,5,'',5);

writeln(f,6,'',4);

writeln(f,6,'',5);

writeln(f,8,'',7);

writeln(f,'####');

writeln(f,'##');

writeln(f,'###?');

writeln(f,'#殚o##');

writeln(f,'#閛o#');

writeln(f,'#閛o#');

writeln(f,'####');

writeln(f,'#####');

end;

10:

begin

writeln(f,4);

writeln(f,5,'',4);

writeln(f,6,'',4);

writeln(f,7,'',4);

writeln(f,8,'',4);

writeln(f,12,'',6);

writeln(f,'####');

writeln(f,'####');

writeln(f,'#?#');

writeln(f,'#?#');

writeln(f,'###o#');

writeln(f,'#o#');

writeln(f,'#o##');

writeln(f,'###o#');

writeln(f,'#?#');

writeln(f,'#?#');

writeln(f,'###');

writeln(f,'#####');

end;

11:

begin

writeln(f,4);

writeln(f,5,'',4);

writeln(f,5,'',5);

writeln(f,6,'',4);

writeln(f,6,'',5);

writeln(f,9,'',7);

writeln(f,'#####');

writeln(f,'####');

writeln(f,'#?#');

writeln(f,'#?#');

writeln(f,'#閛o#');

writeln(f,'###oo#');

writeln(f,'##?#');

writeln(f,'##');

writeln(f,'####');

end;

end;

close(f);

prsc;

end;

procedure pr(x,y,top:integer;a:sz1;b:sz2);

var i,j:integer;

begin

clrscr;

for i:=1 to x do

for j:=1 to y do

begin

textcolor(15);

if dong(i,j,top,b) then textcolor(12);

write(a[i,j]);

if j=y then writeln

end;

end;

end.

扫雷:

program saolei;

uses crt;

label 1,2,3,4;

var a,b:array[1..14,1..14]of char;i,j,t,t2,l:integer;s:string;

procedure ran;

var p:integer;nu:integer;

begin

randomize;

for i:=1 to t do

for j:=1 to t do

begin

b[i,j]:='?;a[i,j]:='?;

end;

for p:=1 to t2 do

begin

repeat

i:=random(t)+1;j:=random(t)+1;

until(a[i,j]='?)and(not((i=1)and(j=1)));

a[i,j]:='';

end;

for i:=1 to t do

for j:=1 to t do

if a[i,j]='? then

begin

nu:=0;

if(i>1)and(j>1) then if a[i-1,j-1]='' then inc(nu);

if(i>1) then if a[i-1,j]='' then inc(nu);

if(i>1)and(j<t) then if a[i-1,j+1]='' then inc(nu);

if(j>1) then if a[i,j-1]='' then inc(nu);

if(j<t) then if a[i,j+1]='' then inc(nu);

if(i<t)and(j>1) then if a[i+1,j-1]='' then inc(nu);

if(i<t) then if a[i+1,j]='' then inc(nu);

if(i<t)and(j<t) then if a[i+1,j+1]='' then inc(nu);

if nu>0 then a[i,j]:=chr(ord('0')+nu);

end;

i:=1;j:=1;

end;

procedure print;

var p,q:integer;

begin

clrscr;

for p:=1 to t do

for q:=1 to t do

begin

if b[p,q]='' then textcolor(12);

if(p=i)and(q=j) then textcolor(8);

write(b[p,q]);

if q=t then writeln;

textcolor(15);

end;

writeln('last:',l);

end;

procedure wrong;

begin

sound(300);

delay(100);

nosound

end;

procedure find(x,y:integer);

begin

b[x,y]:=a[x,y];

if b[x,y]<>'? then exit;

if(x>1)and(b[x-1,y]='?) then find(x-1,y);

if(y>1)and(b[x,y-1]='?) then find(x,y-1);

if(x<t)and(b[x+1,y]='?) then find(x+1,y);

if(y<t)and(b[x,y+1]='?) then find(x,y+1);

if(x>1)and(y>1)and(b[x-1,y-1]='?) then find(x-1,y-1);

if(x>1)and(y<t)and(b[x-1,y+1]='?) then find(x-1,y+1);

if(x<t)and(y>1)and(b[x+1,y-1]='?) then find(x+1,y-1);

if(x<t)and(y<t)and(b[x+1,y+1]='?) then find(x+1,y+1);

end;

procedure print2;

var p,q:integer;

begin

clrscr;

for p:=1 to t do

for q:=1 to t do

begin

if b[p,q]='' then

begin

textcolor(12);

write(b[p,q]);

end

else

if(a[p,q]='') then

begin

textcolor(9);

write(a[p,q]);

end

else write(b[p,q]);

if q=t then writeln;

textcolor(15);

end;

end;

function wan:boolean;

var p,q:integer;

begin

for p:=1 to t do

for q:=1 to t do

if b[p,q]='? then exit(false);

exit(true);

end;

begin

textmode(1);cursoroff;

window(12,8,30,25);

3:clrscr;

writeln('Please choose the level:');

writeln('1--easy 2--normal3--hard');

4:case readkey of

'1':begin t:=11;t2:=20; end;

'2':begin t:=12;t2:=30; end;

'3':begin t:=14;t2:=50; end;

else goto 4;

end;

l:=t2;

ran;

print;

1:case readkey of

#72:if i>1 then dec(i) else wrong;

#80:if i<t then inc(i) else wrong;

#75:if j>1 then dec(j) else wrong;

#77:if j<t then inc(j) else wrong;

#27:

begin

writeln('Do you want to exit(Y/N)?');

repeat

readln(s);

if(s='Y')or(s='y') then halt;

until(s='n')or(s='N');

end;

'j':

begin

b[i,j]:=a[i,j];

if b[i,j]='? then find(i,j);

if b[i,j]='' then begin print2;goto 2;end;

end;

'k':if(l>0)and(b[i,j]='?) then begin b[i,j]:='';dec(l); end;

'l':if b[i,j]='' then begin b[i,j]:='?;inc(l); end;

else goto 1;

end;

print;

if not(wan) then goto 1;

writeln('Congratulations!Play once again(Y/N)?');

repeat

readln(s);

if(s='N')or(s='n') then halt;

if(s='Y')or(s='y') then goto 3;

until s='y';

2:writeln('Game Over!Play once again(Y/N)?');

repeat

readln(s);

if(s='N')or(s='n') then halt;

if(s='Y')or(s='y') then goto 3;

until s='y';

end.

另外我又用c++编了一次贪吃蛇,也一起提供给你。

#include<iostream>

#include<windows.h>

using namespace std;

struct point

{short x,y;

};

char a[22][42];bool f;short i,j,fa;short x[5],y[5];

point s[1001];short h,t,p,q;char st;

short juage()

{if(GetKeyState(VK_UP)<0)

if(fa>=3){f=true;fa=1;return(0);}

if(GetKeyState(VK_DOWN)<0)

if(fa>=3){f=true;fa=2;return(0);}

if(GetKeyState(VK_LEFT)<0)

if(fa<=2){f=true;fa=3;return(0);}

if(GetKeyState(VK_RIGHT)<0)

if(fa<=2){f=true;fa=4;return(0);}

if(GetKeyState(27)<0)

{cout<<"您真的要退出吗(Y/N)?";

while(true)

{cin>>st;

if(st=='Y'|| st=='y') exit(0); else

if(st=='N'|| st=='n') break;

}

}

}

short ran()

{srand(time(0));

short x,y;

while(true)

{

x=rand()%20+1;y=rand()%40+1;

if(a[x][y]=='') a[x][y]='T';return(0);

}

}

int main()

{x[1]=-1;y[1]=0;

x[2]=1;y[2]=0;

x[3]=0;y[3]=-1;

x[4]=0;y[4]=1;

cout<<"贪吃蛇\n";

cout<<"本程序由聊城一中09级12班张凯开发\n";

cout<<"版权所有,翻版必究\n";cout<<endl<<endl;

cout<<"游戏说明:\n";

cout<<"方向键控制方向,Esc退出\n";

system("pause");

sta:

for(i=1;i<=20;i++)

for(j=1;j<=40;j++)

a[i][j]='';

for(i=0;i<=41;i++){a[0][i]='#';a[21][i]='#';}

for(i=1;i<=20;i++){a[i][0]='#';a[i][41]='#';}

a[1][1]='0';a[1][2]='0';a[1][3]='8';ran();

h=0;t=3;s[1].x=1;s[1].y=1;s[2].x=1;s[2].y=2;s[3].x=1;s[3].y=3;fa=4;

l1:

system("cls");

for(i=0;i<=21;i++)

{for(j=0;j<=41;j++) cout<<a[i][j];

cout<<endl;

}

f=false;

for(i=1;i<=15;i++)

{Sleep(1);if(!f) juage();}

p=s[t].x+x[fa];q=s[t].y+y[fa];

if(a[p][q]=='#'||(a[p][q]=='0'&&!(p==s[h+1].x&& q==s[h+1].y))) goto l2;

a[s[t].x][s[t].y]='0';

if(a[p][q]=='T')

{a[p][q]='8';t++;if(t==1001)t=1;s[t].x=p;s[t].y=q;ran();

}

else

{h++;if(h==1001) h=1;a[s[h].x][s[h].y]='';a[p][q]='8';

t++;if(t==1001) t=1;s[t].x=p;s[t].y=q;

}

goto l1;

l2:

cout<<"游戏结束!再玩一次吗(Y/N)?";

while(true)

{cin>>st;

if(st=='Y'|| st=='y') goto sta; else

if(st=='N'|| st=='n') return(0);

}

}

求一个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;

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.

Pascal显卡支持4K HDR游戏和串流,体验如何

Pascal显卡的HDR和4K表现引人注目。尽管性能跑分是玩家关注的焦点,但Pascal架构的新特性同样值得探讨。特别是对于4K和HDR的支持,它不仅提升了硬件的规格,还为用户带来全新的体验。

在硬件升级上,Pascal率先支持HDMI 2.0b的10/12b 4K HDR,这意味着它能够实现4K@60hz的10/12b HEVC解码,让HDR视频播放更加流畅。同时,它还支持10b HEVC编码,无论是HDR录制还是4K串流,都能提供出色的性能。DP 1.4的兼容性也让连接HDR显示设备变得更加便捷。

更令人兴奋的是,NVIDIA已经与多个工作室合作,确保了包括《古墓丽影》、《Paragon》在内的多款游戏支持HDR,尽管HDR显示器的普及可能还需时间,但Pascal显卡已经提前做好了准备。对于Shield用户,他们可以通过游戏串流享受HDR内容。

在4K串流方面,Pascal显卡更是走在了前列,它支持微软的PlayReady 3.0规范,允许用户在Windows电脑上流畅地体验4K高画质的流媒体内容。总的来说,Pascal显卡的这些前瞻性的支持,无疑为未来的游戏和多媒体体验奠定了坚实基础。