Hra kameň, papier, nožnice s počítačom
Delphi & Pascal (česká wiki)
Kategorija: KMP (Programy mladňakoch
Zrobil: Juraj Pupák
Program: Gamekmn.pas
Subor exe: Gamekmn.exe
Zrobil: Juraj Pupák
Program: Gamekmn.pas
Subor exe: Gamekmn.exe
Hra kameň, papier, nožnice s počítačom.
{ GAMEKMN.PAS } { Hra kamen, papier, noznice s pocitacom. } { } { Author: Juraj Pupak } { Date : 27.10.2006 http://www.trsek.com } program Game; uses crt; Procedure Play; var x : array [1..3] of string; a : integer; menu : integer; begin writeln('1.kamen'); writeln('2.papier'); writeln('3.noznice'); readln(menu); randomize; a := Random(3) + 1; x[1] := 'kamen'; x[2] := 'papier'; x[3] := 'noznice'; writeln('Pocitac vybral : ' ,x[a]); IF menu = a THEN begin writeln('Remiza'); end else begin IF ((menu = 1) and (a = 2)) or ((menu = 2) and (a = 3)) or ((menu = 3) and (a = 1)) THEN begin writeln('Vyhral pocitac'); end else writeln('Vyhral si ty'); end; end; var i,number : integer; begin clrscr; writeln('Hra kamen, papier, noznice s pocitacom.'); writeln('---------------------------------------'); write('Zadaj pocet hier'); readln(number); For i := 1 To number Do begin Play; end; readln; end.