Simply emulator of game Sportka

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: KMP (Club of young programmers)

Author: Kii-Shi
Program: 20sportk.pas
File exe: 20sportk.exe

Simply emulator of game Sportka.
{ 20SPORTK.PAS                                                      }
{                                                                   }
{ Author: Kii-Shi                                                   }
{ Date  : 25.03.2006                           http://www.trsek.com }
 
program sportka;
uses crt;
label znova;
var a,b:array [1..6] of integer;
    i,k,p,n:integer;
    ch:char;
begin znova:
clrscr;
       writeln('Zadaj 6 cisel od 1 do 50 ktore tipujes');
       for i:=1 to 6 do readln(a[i]);
clrscr;
       randomize;
       for i:=1 to 6 do b[i]:=1+random(50);
       repeat
             p:=5;
             for i:=1 to 5 do for k:=i+1 to 5 do
                           if b[i]=b[k] then begin
                                             b[k]:=1+random(50);
                                             p:=0;
                                             end;
       until p=5;p:=1;n:=0;
       for i:=1 to 6 do
       if a[p]=b[i] then begin
                              p:=p+1;
                              n:=n+1;
                              end
                         else p:=p+1;
writeln('hadal si tieto cisla: ');
for i:=1 to 6 do write(a[i],';');writeln;
writeln('pocitac vybral tieto: ');
for i:=1 to 6 do write(b[i],';');writeln;
writeln('uhadol si ',n,' cisel'); writeln;
writeln('opakovat? ANO <enter>; NIE <ina klavesa>');
ch:=readkey; if ch=chr(13) then goto znova;
end.