Hra je určená pro 2-5 hráču

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: KMP (Club of young programmers)
zavody.pngAuthor: Miroslav Lízal
web: pascalweb.wz.cz/index86.html

Program: Zavody.pas
File exe: Zavody.exe

Hra je určená pro 2-5 hráču. Účelem je dostat se co nejdříve do cile. Toho dosáhnete tak že budete co nejrychleji mačkat klávesu. V nastavení napíšete vaše jména. Zbylé položky proenterujete. Za jmény se ukáže ovládaní. Program lze použít i jako software pro zjištení kvality klávesnice.
{ ZAVODY.PAS                           Copyright (c) Miroslav Lízal }
{ Hra je urcena pro 2-5 hracu.                                      }
{ Ucelem je dostat se co nejdrive do cile.                          }
{ Toho dosahnete tak ze budete co nejrychleji mackat klavesu.       }
{ V nastaveni napisete vase jmena. Zbyle polozky proenterujete.     }
{ Za jmeny se ukaze ovladani.                                       }
{ Program lze pouzit i jako software pro zjisteni kvality klavesnice.}
{                                                                   }
{ Datum:02.04.2003                             http://www.trsek.com }
 
program zavody;
uses crt;
var volba,nacktery,takjak:char;
var cimpl1,cimpl2,cimpl3,cimpl4,cimpl5,ktery:integer;
var pl1,pl2,pl3,pl4,pl5:string;
var ipl1,ipl2,ipl3,ipl4,ipl5:integer;
var kompl1,kompl2,kompl3,kompl4,kompl5:integer;
var ispus,i,i1:integer;
var vys1,vys2,vys3,vys4,vys5,vys6,vys7,vys8,vys9,vys10,vys11,vys12,vys13,vys14,vys15:string;
var b1,b2,b3,b4,b5:integer;
 
procedure ja;
begin
clrscr;
textcolor(red);
write(chr(201));
for i:=1 to 78 do write(chr(205));
write(chr(187));
for i1:=1 to 47 do begin
write(chr(186));
for i:=1 to 78 do write(' ');
write(chr(186));
                  end;
write(chr(200));
for i:=1 to 78 do write(chr(205));
write(chr(188));
gotoxy(64,49); write(' Miroslav Lízal ');
textcolor(green);
gotoxy(20,5); write('O AUTOROVI');
gotoxy(5,8);write('AUTOR:               Miroslav Lízal');
gotoxy(5,10);write('ROK NAROZENI:        1986');
gotoxy(5,12);write('Kontakty:');
gotoxy(5,14);write('          E_MAIL:    mirek.lizal@centrum.cz');
gotoxy(5,15);write('');
 
repeat
until keypressed;
end;
 
procedure help;
begin
clrscr;
textcolor(red);
write(chr(201));
for i:=1 to 78 do write(chr(205));
write(chr(187));
for i1:=1 to 47 do begin
write(chr(186));
for i:=1 to 78 do write(' ');
write(chr(186));
                  end;
write(chr(200));
for i:=1 to 78 do write(chr(205));
write(chr(188));
gotoxy(64,49); write(' Miroslav Lízal ');
textcolor(green);
gotoxy(20,5); write('NAPOVEDA');
gotoxy(5,7);write('Tato napoveda muze poslouzit tem, kdo tuto hru nepochopili.');
gotoxy(5,9);write('Hra je urcena pro 2-5 hracu. Ucelem je dostat se co nejdrive do cile.');
gotoxy(5,10);write('Toho dosahnete tak ze budete co nejrychleji mackat klavesu.');
gotoxy(5,12);write('V nastaveni napisete vase jmena. Zbyle polozky proenterujete.');
gotoxy(5,13);write('Za jmeny se ukaze ovladani.');
gotoxy(5,15);write('Program lze pouzit i jako software pro zjisteni kvality klavesnice.');
repeat
until keypressed;
end;
 
 
procedure chy;
begin
b1:=0;
b2:=0;
b3:=0;
b4:=0;
b5:=0;
end;
procedure vysledky;
 
begin
clrscr;
textcolor(red);
write(chr(201));
for i:=1 to 78 do write(chr(205));
write(chr(187));
for i1:=1 to 47 do begin
write(chr(186));
for i:=1 to 78 do write(' ');
write(chr(186));
                  end;
write(chr(200));
for i:=1 to 78 do write(chr(205));
write(chr(188));
textcolor(red);
gotoxy(64,49); write(' Miroslav Lízal ');
textcolor(green);
gotoxy(5,3);
writeln('                      VYSLEDKY');
writeln;
gotoxy(5,5);write(chr(218));
for i:=1 to 15 do write(chr(196));
write(chr(194));
for i:=1 to 15 do write(chr(196));
writeln(chr(191));
gotoxy(5,6);writeln(chr(179),'     JMENO     ',chr(179),'POCET VYTEZSTVI',chr(179));
gotoxy(5,7);write(chr(195));
for i:=1 to 15 do write(chr(196));
write(chr(197));
for i:=1 to 15 do write(chr(196));
writeln(chr(180));
gotoxy(5,8);writeln(chr(179),'               ',chr(179),'               ',chr(179));
gotoxy(5,9);write(chr(195));
for i:=1 to 15 do write(chr(196));
write(chr(197));
for i:=1 to 15 do write(chr(196));
writeln(chr(180));
gotoxy(5,10);writeln(chr(179),'               ',chr(179),'               ',chr(179));
gotoxy(5,11);write(chr(195));
for i:=1 to 15 do write(chr(196));
write(chr(197));
for i:=1 to 15 do write(chr(196));
writeln(chr(180));
gotoxy(5,12);writeln(chr(179),'               ',chr(179),'               ',chr(179));
gotoxy(5,13);write(chr(195));
for i:=1 to 15 do write(chr(196));
write(chr(197));
for i:=1 to 15 do write(chr(196));
writeln(chr(180));
gotoxy(5,14);writeln(chr(179),'               ',chr(179),'               ',chr(179));
gotoxy(5,15);write(chr(195));
for i:=1 to 15 do write(chr(196));
write(chr(197));
for i:=1 to 15 do write(chr(196));
writeln(chr(180));
gotoxy(5,16);writeln(chr(179),'               ',chr(179),'               ',chr(179));
gotoxy(5,17);write(chr(192));
for i:=1 to 15 do write(chr(196));
write(chr(193));
for i:=1 to 15 do write(chr(196));
writeln(chr(217));
textcolor(yellow);
gotoxy(9,8); write(pl1);
textcolor(red);
gotoxy(9,10); write(pl2);
textcolor(007);
gotoxy(9,12); write(pl3);
textcolor(005);
gotoxy(9,14); write(pl4);
textcolor(006);
gotoxy(9,16); write(pl5);
textcolor(green);
gotoxy(15,20);
writeln;
gotoxy(25,8);
write(b1);
gotoxy(25,10);
write(b2);
gotoxy(25,12);
write(b3);
gotoxy(25,14);
write(b4);
gotoxy(25,16);
write(b5);
gotoxy(5,45);write(' Zmacknete nejakou klavesu!');
repeat;
until keypressed
end;
 
 
procedure nastaveni;
begin
clrscr;
textcolor(red);
write(chr(201));
for i:=1 to 78 do write(chr(205));
write(chr(187));
for i1:=1 to 47 do begin
write(chr(186));
for i:=1 to 78 do write(' ');
write(chr(186));
                  end;
write(chr(200));
for i:=1 to 78 do write(chr(205));
write(chr(188));
textcolor(red);
gotoxy(64,49); write(' Miroslav Lízal ');
 
 
textcolor(green);gotoxy(2,3);write('             NASTAVENI');
textcolor(yellow);
gotoxy(5,5);WRITELN('Hrac 1:');
textcolor(red);
gotoxy(5,7);WRITELN('Hrac 2:');
textcolor(007);
gotoxy(5,9);WRITELN('Hrac 3:');
textcolor(005);
gotoxy(5,11);WRITELN('Hrac 4:');
textcolor(006);
gotoxy(5,13);WRITELN('Hrac 5:');
 
textcolor(green);
gotoxy(15,5);readln(pl1);if not(pl1='') then begin gotoxy(25,5);write('klavesa: Y');end else pl1:='Hrac 1';
gotoxy(15,7);readln(pl2);if not(pl2='') then begin gotoxy(25,7);write('klavesa: C');end else pl2:='Hrac 2';
gotoxy(15,9);readln(pl3);if not(pl3='') then begin gotoxy(25,9);write('klavesa: B');end else pl3:='Hrac 3';
gotoxy(15,11);readln(pl4);if not(pl4='') then begin gotoxy(25,11);write('klavesa: M');end else pl4:='Hrac 4';
gotoxy(15,13);readln(pl5);if not(pl5='') then begin gotoxy(25,13);write('klavesa: 1');end else pl5:='Hrac 5';
writeln;
writeln;
gotoxy(5,15);
write(' Zmacknete nejakou klavesu!');
repeat;
until keypressed;
for i:=1 to 2 do chy;
end;
 
procedure ppl1;
begin
textcolor(yellow);
gotoxy(kompl1+13,7);
write(chr(219));
end;
procedure ppl2;
begin
textcolor(red);
gotoxy(kompl2+13,10);
write(chr(219));
end;
 
procedure ppl3;
begin
textcolor(007);
gotoxy(kompl3+13,13);
write(chr(219));
end;
 
procedure ppl4;
begin
textcolor(005);
gotoxy(kompl4+13,16);
write(chr(219));
end;
 
procedure ppl5;
begin
textcolor(006);
gotoxy(kompl5+13,19);
write(chr(219));
end;
 
 
procedure hra;
begin
repeat
kompl1:=0;
kompl2:=0;
kompl3:=0;
kompl4:=0;
kompl5:=0;
clrscr;
 
textcolor(red);
write(chr(201));
for i:=1 to 78 do write(chr(205));
write(chr(187));
for i1:=1 to 47 do begin
write(chr(186));
for i:=1 to 78 do write(' ');
write(chr(186));
                  end;
write(chr(200));
for i:=1 to 78 do write(chr(205));
write(chr(188));
gotoxy(64,49); write(' Miroslav Lízal ');
textcolor(yellow);
gotoxy(3,7);writeln(pl1);gotoxy(13,7);write(chr(219));
textcolor(red);
gotoxy(3,10);writeln(pl2);gotoxy(13,10);write(chr(219));
textcolor(007);
gotoxy(3,13);writeln(pl3);gotoxy(13,13);write(chr(219));
textcolor(005);
gotoxy(3,16);writeln(pl4);gotoxy(13,16);write(chr(219));
textcolor(006);
gotoxy(3,19);writeln(pl5);gotoxy(13,19);write(chr(219));
textcolor(green);
gotoxy(72,3);write('CIL');
gotoxy(73,4);write(chr(179));
gotoxy(73,5);write(chr(179));
gotoxy(73,6);write(chr(179));
gotoxy(73,7);write(chr(179));
gotoxy(73,8);write(chr(179));
gotoxy(73,9);write(chr(179));
gotoxy(73,10);write(chr(179));
gotoxy(73,11);write(chr(179));
gotoxy(73,12);write(chr(179));
gotoxy(73,13);write(chr(179));
gotoxy(73,14);write(chr(179));
gotoxy(73,15);write(chr(179));
gotoxy(73,16);write(chr(179));
gotoxy(73,17);write(chr(179));
gotoxy(73,18);write(chr(179));
gotoxy(73,19);write(chr(179));
gotoxy(73,20);write(chr(179));
gotoxy(73,21);write(chr(179));
gotoxy(73,22);write(chr(179));
gotoxy(73,23);write(chr(179));
 
gotoxy(12,3);write('START');
gotoxy(14,4);write(chr(179));
gotoxy(14,5);write(chr(179));
gotoxy(14,6);write(chr(179));
gotoxy(14,7);write(chr(179));
gotoxy(14,8);write(chr(179));
gotoxy(14,9);write(chr(179));
gotoxy(14,10);write(chr(179));
gotoxy(14,11);write(chr(179));
gotoxy(14,12);write(chr(179));
gotoxy(14,13);write(chr(179));
gotoxy(14,14);write(chr(179));
gotoxy(14,15);write(chr(179));
gotoxy(14,16);write(chr(179));
gotoxy(14,17);write(chr(179));
gotoxy(14,18);write(chr(179));
gotoxy(14,19);write(chr(179));
gotoxy(14,20);write(chr(179));
gotoxy(14,21);write(chr(179));
gotoxy(14,22);write(chr(179));
gotoxy(14,23);write(chr(179));
gotoxy(3,46); write(' Konec Q');
repeat
gotoxy(79,39);
nacktery:=upcase(readkey);
ktery:=ord(nacktery);
if ktery=cimpl1 then begin kompl1:=kompl1+1; ppl1; end;
if ktery=cimpl2 then begin kompl2:=kompl2+1; ppl2; end;
if ktery=cimpl3 then begin kompl3:=kompl3+1; ppl3; end;
if ktery=cimpl4 then begin kompl4:=kompl4+1; ppl4; end;
if ktery=cimpl5 then begin kompl5:=kompl5+1; ppl5; end;
 
until (kompl1=60) or (kompl2=60) or (kompl3=60) or (kompl4=60) or (kompl5=60) or (nacktery='q') or (nacktery='Q');
 
if (kompl1>kompl2) and (kompl1>kompl3) and (kompl1>kompl4) and (kompl1>kompl5) then begin b1:=b1+1 end;
if (kompl2>kompl1) and (kompl2>kompl3) and (kompl2>kompl4) and (kompl2>kompl5) then begin b2:=b2+1 end;
if (kompl3>kompl2) and (kompl3>kompl1) and (kompl3>kompl4) and (kompl3>kompl5) then begin b3:=b3+1 end;
if (kompl4>kompl2) and (kompl4>kompl3) and (kompl4>kompl1) and (kompl4>kompl5) then begin b4:=b4+1 end;
if (kompl5>kompl2) and (kompl5>kompl3) and (kompl5>kompl4) and (kompl5>kompl1) then begin b5:=b5+1 end;
 
 
 
 
 
 
 
 
kompl1:=0;
kompl2:=0;
kompl3:=0;
kompl4:=0;
kompl5:=0;
repeat
textcolor(red);
gotoxy(15,25);
writeln('Chcete zacit znovu? A/N ');
textcolor(black);
takjak:=upcase(readkey);
until (takjak='A') or (takjak='N');
until takjak='N';
end;
 
 
 
 
 
 
begin
textmode(CO80 + Font8x8);
textbackground(black);
clrscr;
 
pl1:='Hrac 1';
pl2:='Hrac 2';
pl3:='Hrac 3';
pl4:='Hrac 4';
pl5:='Hrac 5';
cimpl1:=ord('Y');
cimpl2:=ord('C');
cimpl3:=ord('B');
cimpl4:=ord('M');
cimpl5:=ord('1');
 
repeat
clrscr;
 
 
textcolor(red);
write(chr(201));
for i:=1 to 78 do write(chr(205));
write(chr(187));
for i1:=1 to 47 do begin
write(chr(186));
for i:=1 to 78 do write(' ');
write(chr(186));
                  end;
write(chr(200));
for i:=1 to 78 do write(chr(205));
write(chr(188));
gotoxy(64,49); write(' Miroslav Lízal ');
 
textcolor(yellow);
gotoxy(50,12);
write(chr(219),chr(219),chr(219),'   ',chr(219),chr(219));
gotoxy(51,13);
write(chr(219),'  ',chr(219),chr(219),chr(219),chr(219));textcolor(green);write(chr(219));textcolor(yellow);write(chr(219));
gotoxy(51,14);
write(chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219));
gotoxy(50,15);
write(chr(219),chr(219));
textcolor(blue);
write(chr(219));
textcolor(yellow);
write(chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219));
textcolor(blue);
write(chr(219));
textcolor(yellow);
write(chr(219),chr(219));
textcolor(red);
gotoxy(20,3);
write(chr(219),chr(219),chr(219),'   ',chr(219),chr(219));
gotoxy(21,4);
write(chr(219),'  ',chr(219),chr(219),chr(219),chr(219));textcolor(green);write(chr(219));textcolor(red);write(chr(219));
gotoxy(21,5);
write(chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219));
gotoxy(20,6);
write(chr(219),chr(219));
textcolor(blue);
write(chr(219));
textcolor(red);
write(chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219),chr(219));
textcolor(blue);
write(chr(219));
textcolor(red);
write(chr(219),chr(219));
 
 
gotoxy(64,49); write(' Miroslav Lízal ');
 
 
TEXTCOLOR(GREEN);
gotoxy(15,15);WRITELN('HRA          1');
gotoxy(15,17);WRITELN('NASTAVENI    2');
gotoxy(15,19);WRITELN('VYSLEDKY     3');
gotoxy(15,21);WRITELN('NAPOVEDA     4');
gotoxy(15,23);WRITELN('O AUTOROVI   5');
gotoxy(15,25);WRITELN('KONEC        6');
GOTOXY(15,27);
VOLBA:=READKEY;
if volba='1' then hra else if volba='2' then nastaveni else if volba='3' then vysledky else if volba='4' then help
else if volba='5' then ja;
 
 
until volba='6';
end.