pascal游戏吧 关注:1,978贴子:4,975
  • 4回复贴,共1

Pascal加子弹

只看楼主收藏回复

uses crt;
procedure s;
var a,b:longint; x,x1:char;
begin
a:=0;b:=0;
repeat
clrscr;
writeln('player:',a,' computer:',b);
x:=readkey;
if (a<1)and(x='d')then halt;
if (a<2)and(x='a')then halt;
if (a<3)and(x='r')then halt;
writeln('c');
if (x<>'a')and(x<>'r')and(x<>'d') then a:=a+1;
inc(b);
if x='a' then a:=a-2;
if x='d' then a:=a-1;
if x='r' then a:=a-3;
if x1='a' then b:=b-2;
if x1='d' then b:=b-1;
if x1='r' then b:=b-3;
delay(1000);
until x='a';
writeln('WIN!');
delay(1000);
end;
procedure g;
var a,b:longint;x,x1:char;
begin
a:=0;b:=0;
repeat
clrscr;
writeln('player:',a,' computer:',b);
x:=readkey;
if (a<1)and(x='d')then halt;
if (a<2)and(x='a')then halt;
if (a<3)and(x='r')then halt;
if x='c' then inc(a);
if (a>1)and(b>2)then begin randomize;
if random(2)=1 then x1:='r' else x1:='c';end
else if a>1 then begin randomize;
if random(2)=1 then x1:='d' else x1:='c';end;
if b<2 then x1:='c';
if (b>1)and(a=0)then x1:='a';
randomize;
if (random(2)=1)and(b>1) then x1:='a';
writeln(x1);
if x1='c' then inc(b);
if x='a' then a:=a-2;
if x='d' then a:=a-1;
if x='r' then a:=a-3;
if x1='a' then b:=b-2;
if x1='d' then b:=b-1;
if x1='r' then b:=b-3;
delay(1000);
until((x='c')and(x1='a'))or((x='a')and(x1='c'));
if x='c' then writeln('LOST!') else writeln('WIN!');
delay(1000);
end;
procedure d;
var a,b:longint;x,x1:char;
begin
a:=0;b:=0;
repeat
clrscr;
writeln('player:',a,' computer:',b);
x:=readkey;
if (a<1)and(x='d')then halt;
if (a<2)and(x='a')then halt;
if (a<3)and(x='r')then halt;
if b<2 then x1:='c'
else
begin
x1:='c';
if (x='a')and(b>2) then x1:='r';
if (x='a')and(b<3) then x1:='d';
if x='c' then x1:='a';
if x='a' then a:=a-2;
if x='d' then a:=a-1;
if x='r' then a:=a-3;
if x1='a' then b:=b-2;
if x1='d' then b:=b-1;
if x1='r' then b:=b-3;
end;
writeln(x1);
if x='c' then inc(a);
if x1='c' then inc(b);
delay(1000);
until (x1='a')or(x1='r');
writeln('LOST!');
delay(1000);
end;
procedure play;
begin
clrscr;
writeln;
writeln;
writeln;
writeln;
writeln;
writeln(' 1.simple');
writeln(' 2.generally');
writeln(' 3.difficulties');
case readkey of
'1':s;
'2':g;
'3':d;
end;
end;
procedure go;
begin
clrscr;
gotoxy(1,5);
writeln(' 1.play');
writeln(' 2.help');
writeln(' 3.exit');
case readkey of
'1':play;
'2':begin writeln('c:capacity a:attack(two capacity); d:defense(one capacity) r:rebound(three capacity)');readkey;go;end;
'3':halt;
end;
go;
end;
begin
go;
end.


IP属地:浙江1楼2012-05-22 19:39回复
    第一次编游戏,很激动!!!


    IP属地:浙江3楼2012-05-22 19:42
    回复
      2025-06-06 02:12:23
      广告
      http://115.com/file/an0ec259#加子弹.exe
      运行文件


      IP属地:浙江4楼2012-05-26 13:18
      回复
        还可以,只是界面友好点行不?


        IP属地:四川5楼2012-05-29 17:42
        回复
          ???界面友好???
          ??? 咋弄滴 ???


          IP属地:浙江6楼2012-05-31 19:15
          回复