freepascal吧 关注:250贴子:915
  • 3回复贴,共1

一个弱智游戏,不妨玩玩

只看楼主收藏回复

Label 1,8,9,10,11,12,13,14;
           var a,b,c,d,e,f,score1,score2,g:integer;
begin
9:
write('请输入石子的总数:   ');
read(a);        writeln;
write('请输入你想要的范围(下限在前,上限在后):   ');
read(b,c);   writeln;
if (a<0) or (b<0) or (b>=c) then begin
writeln('你输入错误了,请再输一次');
goto 9;    end;
writeln('你想要怎样的难易程度?','   1----简单','    其他任意数字键-------困难   ');
read(g); writeln;
8:
   write('你要拿几个?');
     read(d); writeln;
if (d<b) or (d>c) or (d>a) then begin
writeln('你拿的不在范围内或大于总数');
goto 8;
end;
a:=a-d;
write('总数还剩下:',a);     writeln;
if (a>0) and (a<b) then goto 12;
if a=0 then goto 10;
if g=1 then begin
             randomize;
            e:=random(c-b)+b;
          goto 13;    end
else begin
   if (a mod (b+c)>=b) and (a mod (b+c)<=c) then begin
   e:=a mod (b+c); goto 13; end;
   if a mod (b+c)=0 then begin
   randomize;
   e:=random(c-b)+b;
   goto 13
    end;
   e:=b;
   1:
if (a-e<b) or (a-e>c) then goto 13 else
if e=c then goto 13 else begin e:=e+1; goto 1;
end;     end;            13:       a:=a-e;
write('我拿了:',e);    writeln;
write('我拿了之后总数还有:',a);    writeln;
if a>0 then if a<b then goto 12;
if a=0 then goto 11; goto 8;
10:     writeln('你赢了');   score1:=score1+10;      goto 14;
11:     writeln('输给我了哦'); score2:=score2+10;       goto 14;
12:     writeln('我们谁都拿不到,所以是平局');        goto 14;
14:writeln('你现在的分数是:',score1); writeln;
     writeln('我的分数是:',score2); writeln;
   writeln('再来一局吗?','   1键退出','   其他任意数字键继续');
readln(f);
if f<>1 then goto 9;
if score1>score2 then writeln('最后还是你赢啊,下次一定赢你');
if score1<score2 then writeln('你最后还是输了,回去修炼一千年再来挑战我吧');
if score1=score2 then writeln('不错不错,竟然跟我打平');
readln
end.



IP属地:湖北1楼2011-06-18 15:52回复
    给你看看再弱智点的。
    猜数字………………
    var
    a,b,c:integr;
    begin
    readln(b);
    a:=random(b);
    repeat
    readln(c);
    if a>c then writeln('small');
    if a=c then writeln('you is god');
    if a<c then writeln('big');
    until a=c;
    readln(c);
    end;


    2楼2012-02-19 21:24
    回复
      广告
      立即查看
      晕死你呀!!!! 长死了 我是初手 55555555


      3楼2012-02-23 16:16
      回复
        都是神马东东啊


        5楼2016-07-22 20:32
        回复