文件夹“E:\game”文件:
1.E:\game\discribe.pas
内容:
游戏说明
计算并输入结果,规则:
1.A+B=?则输入A+B的和;
2.A-B=?则输入A-B的差
(如果A-B<0,必须有负号);
3.A*B=?则输入A*B的积;
4.AdivB=?输入A/B的商
(不包括余数);
5.AsqrB=?输入A*(B的平方);
6.A!表示求A的阶乘
(A!=1*2*3*...*A)
祝你有好成绩!
积分:关数*10/道
2.E:\game\music0.pas
内容:
4 6 160 0 欢
4 6 160 0 乐
4 8 160 0 女
4 10 160 0 神
4 10 160 0 圣
4 8 160 0 洁
4 6 160 0 美
4 4 160 0 丽
4 2 160 0 灿
4 2 160 0 烂
4 4 160 0 光
4 6 160 0 芒
4 6 320 0 照
4 4 80 0 大
4 4 160 0 地
4 0 320 0
0 0 0 0
3.E:\game\music2.pas
内容:
4 6 160 0 我
4 6 160 0 们
4 8 160 0 怀
4 10 160 0 着
4 10 160 0 火
4 8 160 0 样
4 6 160 0 热
4 4 160 0 情
4 2 160 0 来
4 2 160 0 到
4 4 160 0 你
4 6 160 0 的
4 4 320 0 圣
4 2 80 0 殿
4 2 160 0 里
4 0 320 0 .
4.E:\game\music3.pas
内容:
4 4 160 0 你
4 4 160 0 的
4 6 160 0 威
4 2 160 0 力
4 4 160 0 能
4 6 80 1 把
4 8 80 0
4 6 160 0 人
4 2 160 0 类
4 4 160 0 重
4 6 80 1 新
4 8 80 0
4 6 160 0 团
4 4 160 0 结
4 2 160 0 在
4 4 160 0 一
2 10 160 0 起
4 6 160 1 在
4 6 160 0
4 6 160 6 你
4 8 160 0 光
4 10 160 0 辉
4 10 160 0 照
4 8 160 0 耀
4 6 160 0 之
4 8 80 1 下
4 4 80 0
4 2 160 0 人
4 2 160 0 类
4 4 160 0 团
4 6 160 0 结
4 4 320 0 成
4 2 80 0 兄
4 2 160 0 弟
4 0 320 0
5.E:\game\highrecords.pas
内容:
1810 sunlight
6.(主程序)E:\game\game.pas
内容:
program game(input,output,f);
uses crt;
label 1;
type
sun=record
name:string;
score:longint
end;
var mn,mm,mmm,a,b,c,e,an,level,i,j,k,k0,n,o:longint;score:integer;
flag,flag2:boolean;
f:text; d,z:longint;
ch:array[0..6]of char;
s:string;
high:sun;
procedure play(k:integer);
const base=32.625;
var x:real;i,a,b,c,d:integer;s:string;ch:char;s2:string[5];
begin
ch:=chr(48+k);
s:='E:\game\music'+ch;
s:=s+'.pas';
assign(f,s);reset(f);
while not eof(f) do
begin
readln(f,a,b,c,d,s2);
if b=0 then delay(c)
else begin
x:=base;
for i:=1 to a do x:=x*2;
for i:= 1 to b-1 do
x:=x*1.059463994;
if d=0 then begin
sound(round(x));
delay(c*2);
nosound
end
else begin
sound(round(x));
delay(c*2)
end;
end
end; writeln;
close(f);
end;
function fi(i:longint):longint;
begin if i=0 then fi:=1 else fi:=fi(i-1)*i end;
procedure discribe;
var s:string;f:text;
begin
assign(f,'E:\game\discribe.pas');
reset(f);
while not eof(f) do
begin
readln(f,s);
gotoxy(wherex+3,wherey);
writeln(s)
end;
close(f);gotoxy(wherex+3,wherey);
end;
FUNCTION make(x:longint;y:char;z:longint):longint;
begin
case y of
'+' :exit(x+z);
'-' :exit(x-z);
'*' :exit(x*z);
'/' :exit(x div z);
'm' :exit(x mod z);
's' :make:=x*sqr(z);
end end;
begin
textmode(3);
window(10,1,50,15);
textbackground(1);
textcolor(14);
clrscr;
gotoxy(5,5);
writeln('欢迎来到这个游戏!');
gotoxy(wherex+5,wherey);
readkey;
clrscr;
textcolor(14);
gotoxy(4,5);
writeln('Is this your first time enter this game?');
gotoxy(wherex+7,wherey);
writeln('1-Yes');
gotoxy(wherex+7,wherey);
writeln('2-No');
gotoxy(wherex+3,wherey);
readln(o);
if o=1 then begin clrscr;textcolor(3); discribe end;
if o=1then readkey;
clrscr;o:=1;
repeat
inc(o);
if o=16 then o:=1;
textcolor(o);clrscr;
gotoxy(wherex+7,wherey);
writeln('1-Start');
gotoxy(wherex+7,wherey);
writeln('2-Exit');
gotoxy(wherex+7,wherey);
delay(500)
until keypressed;
readln(k0);
clrscr;
textcolor(2);
if k0=1 then
begin
gotoxy(8,8);
writeln('Welcome!');
gotoxy(wherex+8,wherey);
mm:=1;
1: randomize;
ch[0]:='+';
ch[1]:='-';ch[2]:='*';
ch[3]:='/';ch[4]:='m';ch[5]:='s';
ch[6]:='!';
flag2:=false;
level:=1;mn:=1;mmm:=1;readkey;
REPEAT
if mm=1 then begin
clrscr;
textcolor(4);
gotoxy(wherex+4,wherey);
writeln('Music or not?');
gotoxy(wherex+5,wherey);
writeln('1—Music');
gotoxy(wherex+5,wherey);
writeln('2—Not');
gotoxy(wherex+5,wherey);
writeln('3—Never ask again');
gotoxy(wherex+5,wherey);
readln(mn);
if mn=3 then mm:=0;
end
else mn:=0;
if not flag2 then score:=0;
flag:=true;
n:=1;
WHILE flag and(n<=10)DO
BEGIN
textcolor(3);
gotoxy(wherex+7,wherey);
a:=random(100)+1;
b:=random(100)+1;
if level=1 then c:=random(2)
else if level=2 then c:=random(4)
else if level<=4 then c:=random(6)
else c:=random(7);
if c=6 then
a:=a div 10;
write(a);
case c of
0 :write('+');
1 :write('-');
2 :write('*');
3 :write('div');
4 :write('mod');
5 :write('sqr');
6 :write('!');
end;
if c=6 then begin
e:=random(4)+1;
case e of
0 :write('+');
1 :write('-');
2 :write('*');
3 :write('div');
end;
end;
writeln(b,'=?');
if c<>6 then d:=make(a,ch[c],b)
else begin d:=fi(a);d:=make(d,ch[e],b) end;
gotoxy(wherex+7,wherey);
readln(an);
clrscr;
if (an=d)or(abs(an-d)<=0.01) then begin
inc(score,10*level);
gotoxy(wherex+2,wherey);
inc(n);textcolor(4);
write('Right!','Score:+');
textcolor(13);
writeln(score);
textcolor(4);
gotoxy(wherex+2,wherey);
write('Your level: ');
textcolor(random(13)+2);
writeln(level);
if mn=1 then play(0) end
else begin
flag:=false;textcolor(11);
gotoxy(wherex+4,wherey);
writeln('I''m sorry.You''re wrong!');
gotoxy(wherex+4,wherey);
write('Answer:');textcolor(14);writeln(d);
gotoxy(wherex+4,wherey);
if mn=1 then play(2);Readkey end
end;
clrscr;
if n>=10 then begin
inc(level);textcolor(12);
flag2:=true;
gotoxy(wherex+4,wherey+5);
writeln('Congratulations!');
gotoxy(wherex+4,wherey);
writeln('You''ve passed level ',level-1,'!');
if mn=1 then play(3);readkey
end
else flag2:=false;
UNTIL not flag2;
if score>=100 then begin
clrscr;
textcolor(4);
gotoxy(wherex+4,wherey);
writeln('You got a good result.Put down you name!!');
gotoxy(wherex+4,wherey);
readln(s);
assign(f,'E:\game\highrecords.pas');
append(f);
clrscr;
textcolor(10);
writeln(f,score,' ',s);
close(f);
gotoxy(wherex+3,wherey);
writeln('Score ','Name':12);
reset(f);textcolor(12);
while not eof(f)do
begin
readln(f,high.score,high.name);
gotoxy(wherex+3,wherey);
writeln(high.score,high.name)
end;
close(f);
gotoxy(wherex+7,wherey);
readkey;
end;
clrscr;
textcolor(15);
gotoxy(wherex+4,wherey);
writeln('Thank you for coming!Welcome Next Time!');
if mn=1 then play(0);
gotoxy(wherex+4,wherey);
readkey;
clrscr;textcolor(10);
gotoxy(wherex+3,wherey);
writeln('Try again?');
gotoxy(wherex+4,wherey);
writeln('Yes—1');
gotoxy(wherex+4,wherey);
writeln('No—2');
gotoxy(wherex+5,wherey);
readln(mmm);
if mmm=1 then goto 1;
end;
clrscr;
textcolor(14);
gotoxy(wherex+4,1);
writeln('Thank you for using Sunlight Ware!');
gotoxy(wherex+4,wherey+1);
writeln('QQ:282974362');
gotoxy(wherex+2,wherey+1);
writeln('E-mail:sunlight12345@eyou.com');
readkey
END.
[ 此贴被sunlight在2006-05-02 00:31重新编辑 ]