Tin học Game Hủy ô vuông bằng Pascal

HưngMC2007

Học sinh mới
Thành viên
5 Tháng ba 2021
4
1
6
16
Bình Định
THCS Bình Thuận
[TẶNG BẠN] TRỌN BỘ Bí kíp học tốt 08 môn
Chắc suất Đại học top - Giữ chỗ ngay!!

ĐĂNG BÀI NGAY để cùng trao đổi với các thành viên siêu nhiệt tình & dễ thương trên diễn đàn.

uses crt, tcvn, dos;
var ch, p2, m, n, pa : char;
k, sou : boolean;
ten, yea, mon, day, time, st, p1 : string;
d, v, i, j, p, a, b : integer;
ye, mo, da, tim : word;
tsp : text;
procedure sod1;
begin
if sou=true then
sound(700);
delay(200);
nosound;
end;
procedure sod2;
begin
if sou=true then
sound(300);
delay(1000);
nosound;
end;
begin
clrscr;
loadfont;
sou:=true;
assign(tsp,'BOV.inp');
append(tsp);
write(tsp,'');
close(tsp);
repeat begin
textbackground(2);
clrscr;
textcolor(0);
gotoxy(37,11);
write(telex('Chowi (C)'));
gotoxy(34,12);
write(telex('Thafnh tisch (A)'));
gotoxy(34,13);
write(telex('Casch chowi (H)'));
gotoxy(35,14);
write(telex('Tufy chojn (S)'));
gotoxy(37,15);
write(telex('Thoast (E)'));
gotoxy(30,25);
write(telex('Barn quyeefn: HuwngMC2007'));
keypressed;
ch:=readkey;
while (ch<>'c') and (ch<>'a') and (ch<>'h') and (ch<>'s') and
(ch<>'e') and (ch<>chr(27)) and (ch<>chr(13)) do
begin keypressed;ch:=readkey end;
if (ch='c') or (ch=chr(13)) then
repeat begin
k:=true;
repeat begin
clrscr;
textbackground(2);
textcolor(0);
gotoxy(24,13);
write(telex('Nhaajp teen( 1 --> 12 kis tuwj ): '));readln(ten);
end until (length(ten)>0) and (length(ten)<=12);
randomize;
d:=0;
v:=200;
textbackground(6);
clrscr;
textbackground(7);
for i:=1 to 9 do begin
gotoxy((i-1)*8+1,1);
write(' ',i,' ');
end;
gotoxy(73,1);
write(' 0 ');
gotoxy(1,1);
textcolor(4);
textbackground(6);
for i:=0 to 9 do
for j:=1 to 21 do begin
gotoxy(i*8+1,j);
write(#186);
end;
textcolor(0);
textbackground(7);
gotoxy(1,24);
for i:=1 to 10 do write(' ');
textbackground(4);
gotoxy(1,22);
for i:=1 to 10 do write(' ');
gotoxy(5,25);
textbackground(3);
write('Score: ',d);
gotoxy(15,25);
textbackground(13);
write(ten);
gotoxy(29,25);
textbackground(7);
write('Speed = ',1000/v/2.5:5:2,' cm/s');
textbackground(0);
p:=random(10);
str(p,p1);
p2:=p1[1];
if p>0 then a:=(p-1)*8+random(6)+2 else a:=72 +random(6)+2;
b:=2;
gotoxy(a,b);
textbackground(8);
textcolor(14+blink);
write(#40,#41);
textcolor(0);
textbackground(0);
pa:='p';
repeat begin
if n=chr(27) then k:=false;
while (n='p') or (pa<>'p') do begin
gotoxy(75,25);
textcolor(0);
textbackground(1);
write('Pause');
repeat until keypressed;
pa:=readkey;
n:=' ';
gotoxy(75,25);
textbackground(6);
write(' ');
end;
m:=n;
if m<>p2 then repeat begin
gotoxy(a,b);
textbackground(6);
write(' ');
inc(b);
gotoxy(a,b);
textbackground(8);
textcolor(14+blink);
write(#40,#41);
textbackground(0);
delay(v);
if b=22 then begin
k:=false;
sod2;
break;
end;
end until keypressed else begin
if v>50 then dec(v,3);
inc(d); sod1;
gotoxy(a,b);
textbackground(6);
write(' ');
p:=random(10);
str(p,p1);
p2:=p1[1];
if p>0 then a:=(p-1)*8+random(6)+2 else a:=72 +random(6)+2;
b:=2;
gotoxy(a,b);
textbackground(8);
textcolor(14+blink);
write(#40,#41);
textcolor(0);
textbackground(0);
gotoxy(5,25);
textbackground(3);
write('Score: ',d);
gotoxy(15,25);
gotoxy(29,25);
textbackground(7);
write('Speed = ',1000/v/2.5:5:2,' cm/s');
textbackground(0);
n:=' '; j:=1;
end;
if (j<>1) and (k=true) and (n<>chr(27)) then n:=readkey;
j:=0;
end until k=false;
getdate(ye,mo,da,tim);
append(tsp);
str(d:4,st);
str(ye:4,yea);
str(mo:2,mon);
str(da:2,day);
str(tim:2,time);
st:=st+' '+day+'/'+mon+'/'+yea+' '+ten;
writeln(tsp,'/',st);
close(tsp);
textbackground(10);
clrscr;
textbackground(15);
textcolor(0);
gotoxy(34,10);
write(telex('Suaast sawsc!'));
gotoxy(32,11);
write(telex('Bajn cos '),d,telex(' ddieerm!'));
delay(1000);
repeat until keypressed;
textbackground(10);
repeat begin
clrscr;
gotoxy(33,12);
writeln(telex('Thuwr laji? (Y/N)'));
keypressed;
n:=readkey;
end until (n='y') or (n='n');
end until n='n' else
if ch='a' then repeat begin
clrscr;
gotoxy(36,2);
writeln(telex('Thafnh tisch'));
gotoxy(26,wherey);
writeln(telex('Ddieerm Thowfi gian Teen'));
assign(tsp,'BOV.inp');
reset(tsp);
textcolor(0);
j:=0;
while not eof(tsp) do begin
inc(j);
readln(tsp,st);
gotoxy(23,wherey);
writeln(j,'/',st);
end;
gotoxy(25,24);
writeln('Home (N)');
gotoxy(43,24);
writeln(telex('Xosa taast car (D)'));
repeat until keypressed;
ch:=readkey;
while (ch<>'n') and (ch<>'d') and (ch<>chr(13)) and (ch<>chr(27)) do begin
keypressed;
ch:=readkey;
end;
if ch='d' then begin
rewrite(tsp);
write('');
close(tsp);
end;
delay(50);
end until (ch='n') or (ch='d') or (ch=chr(13)) or (ch=chr(27)) else
if ch='s' then repeat begin
clrscr;
gotoxy(30,13);
if sou=true then write('Sound( S ) - ',telex('Baajt -'))
else if sou=false then write('Sound( S ) - ',telex('Tawst -'));
gotoxy(37,24);
write('Home (N)');
repeat until keypressed;
ch:=readkey;
while (ch<>'n') and (ch<>'s') and (ch<>chr(13)) and (ch<>chr(27))
do begin
keypressed;
ch:=readkey;
end;
if ch='s' then
if sou=true then sou:=false else sou:=true;
delay(50);
end until (ch='n') or (ch=chr(13)) or (ch=chr(27)) else
if ch='h' then repeat begin
textbackground(10);
textcolor(0);
clrscr;
gotoxy(34,10);
writeln(telex('Casch chowi'));
gotoxy(16,wherey);
writeln(telex('Nhaasn casc phism tuwf 0 ddeesn 9 ddeer haj casc oo tuwowng uwsng.'));
gotoxy(26,wherey);
writeln(telex('Nhaasn phism P ddeer duwfng trof chowi.'));
gotoxy(23,wherey);
writeln(telex('Nhaasn phism '),'ESC',telex(' ddeer keest thusc trof chowi'));
gotoxy(31,wherey);
writeln(telex('Chusc may mawsn :3'));
gotoxy(35,wherey);
write('Home (N)');
repeat until keypressed;
ch:=readkey;
while (ch<>'n') and (ch<>chr(13)) and (ch<>chr(27)) do begin
keypressed;
ch:=readkey;
end;
delay(50);
end until (ch='n') or (ch=chr(13)) or (ch=chr(27))
end until (ch='e') or (ch=chr(27));
textbackground(0);
end.
 
  • Like
Reactions: Shinonome Kitaoji
Top Bottom