with Ada.Text_Io, Ada.Integer_Text_Io, Ada.Numerics.Discrete_Random; use Ada.Text_Io, Ada.Integer_Text_Io; procedure Poker_win is type Vettore is array (Integer range <>) of Integer; type Matrice is array (Integer range <>, Integer range <>) of Integer; type Seme is (Quadri, Cuori, Fiori, Picche); type Ct is (Sei, Sette, Otto, Nove, Dieci, Jack, Donne, Re, Asso); subtype Rdm is Integer range 6..14; package My_Rdm is new Ada.Numerics.Discrete_Random (Rdm); use My_Rdm; package Ct_Io is new Ada.Text_Io.Enumeration_Io(Ct); use Ct_Io; package Seme_Io is new Ada.Text_Io.Enumeration_Io(Seme); use Seme_Io; type Carte is (Sei, Sette, Otto, Nove, Dieci, Jack, Donne, Re, Asso); package Carte_Io is new Ada.Text_Io.Enumeration_Io(Carte); use Carte_Io; -- Inizio dichiarazioni variabili Mat : Matrice (1..4, 1..9); -- Matrice controllo Xx : Integer; -- Variabile posizioni vettore X : Integer := 6; -- Variabile inizializazzione matrice controllo Nc : Integer := 5; -- Variabile carte da cambiare Pc : Vettore (1..Nc); -- Vettore corte da cambiare G : Generator; -- Variabile generatore random S,C : Integer; -- Variabile per generare i vettori carte e seme Vs,Vss : Vettore (1..5); -- Vettori seme Vc,Vcc : Vettore (1..5); -- Vettori carte Cl : Integer := 0; -- Variabile per creare i vettori da stampare I, Yy, Tt : Integer := 1; -- Variabile posizioni vettore Pg1, Pg2 : Integer; -- Variabile punteggio Vg1, Vg2 : Integer := 0; -- Variabile vittorie dec : Integer; -- Variabile per uscita Cg1, Cg2 : Vettore (1..9); -- Vettori di controllo delle carte Sg1, Sg2 : Vettore (1..4); -- Vettori di controllo dei semi -- Fine dichiarazione variabili -- Inizio azeramento variabili procedure Azeramento is begin X := 6; Nc := 5; I := 1; Yy := 1; Tt := 1; Cl := 0; end Azeramento; -- Fine azeramento variabili -- Inizio creazione matrice di controllo procedure Matrix is begin for I in 1..4 loop X := 6; New_Line; for J in 1..9 loop Mat(I,J) := X; X := X+1; end loop; end loop; end Matrix; -- Fine creazione matrice di controllo -- Inizia schermata iniziale procedure Gioco is begin new_line(23); Put("*******************************************"); New_Line; Put("*******************************************"); New_Line; Put("** **"); New_Line; Put("** ooooo ooooo oo ooooo ooooo **"); New_Line; Put("** oo oo oo oo oo oo oo oo oo **"); New_Line; Put("** ooooo oo oo oooo oooo ooooo **"); New_Line; Put("** oo oo oo ooo oo ooo **"); New_Line; Put("** oo oo oo oooo oo oooo **"); New_Line; Put("** oo ooooo oo oo ooooo oo oo **"); New_Line; Put("** **"); New_Line; Put("*******************************************"); New_Line; Put("*******************************************"); New_Line(6); Put("Mischio le carte"); new_line(2); for I in 1..16 loop Put("*"); delay(0.05); end loop; New_Line; end Gioco; -- Fine schermata iniziale -- Inizio procedura di pausa procedure Pausa is N1 : Character; begin New_line(2); Put("***Premi un tasto per continuare***"); New_Line(1); Get_immediate(N1); -- Premendo qualsiasi tasto il programma continua end Pausa; -- Fine procedura di pausa -- Inizio procedura Random procedure Casuale is begin Reset (G); I := 1; loop S := Random(G); S := (C mod 4)+1; C := Random(G); C := (C mod 9)+6; for J in 1..9 loop if Mat(S,J) = C then Mat(S,J) := 0; Vs(I) := S; Vc(I) := C; I := I+1; end if; end loop; if I = 6 then exit; end if; end loop; end Casuale; -- Fine procedura Random -- Inizio procedura di stampa principale procedure Stampa is begin -- Inizio stampa vettore seme Cl := 1; for I in 1..5 loop Set_Col(Count(Cl)); if Vs(I) = 1 then Put(Seme'Val(0));Put(" "); end if; if Vs(I) = 2 then Put(Seme'Val(1));Put(" "); end if ; if Vs(I) = 3 then Put(Seme'Val(2));Put(" "); end if; if Vs(I) = 4 then Put(Seme'Val(3));Put(" "); end if; Cl := Cl+8; end loop; -- Fine stampa vettore seme New_Line; Cl := 1; -- Inizio stampa vettore carta for I in 1..5 loop Set_Col(Count(Cl)); if Vc(I) = 6 then Put(Ct'Val(0));Put(" "); end if; if Vc(I) = 7 then Put(Ct'Val(1));Put(" "); end if; if Vc(I) = 8 then Put(Ct'Val(2));Put(" "); end if; if Vc(I) = 9 then Put(Ct'Val(3));Put(" "); end if; if Vc(I) = 10 then Put(Ct'Val(4));Put(" "); end if; if Vc(I) = 11 then Put(Ct'Val(5));Put(" "); end if; if Vc(I) = 12 then Put(Ct'Val(6));Put(" "); end if; if Vc(I) = 13 then Put(Ct'Val(7));Put(" "); end if; if Vc(I) = 14 then Put(Ct'Val(8));Put(" "); end if; Cl := Cl+8; end loop; -- Fine stampa vettore carta end Stampa; -- Fine procedura di stampa principale -- Inizio procedura di stampa nuove carte giocatore uno procedure Stampa_2 is begin Cl := 1; -- Inizio stampa vettore seme for I in 1..5 loop Set_Col(Count(Cl)); if Vss(I) = 1 then Put(Seme'Val(0));Put(" "); end if; if Vss(I) = 2 then Put(Seme'Val(1));Put(" "); end if ; if Vss(I) = 3 then Put(Seme'Val(2));Put(" "); end if; if Vss(I) = 4 then Put(Seme'Val(3));Put(" "); end if; Cl := Cl+8; end loop; -- Fine stampa vettore seme New_Line; Cl := 1; -- Inizio stampa vettore carta for I in 1..5 loop Set_Col(Count(Cl)); if Vcc(I) = 6 then Put(Ct'Val(0));Put(" "); end if; if Vcc(I) = 7 then Put(Ct'Val(1));Put(" "); end if; if Vcc(I) = 8 then Put(Ct'Val(2));Put(" "); end if; if Vcc(I) = 9 then Put(Ct'Val(3));Put(" "); end if; if Vcc(I) = 10 then Put(Ct'Val(4));Put(" "); end if; if Vcc(I) = 11 then Put(Ct'Val(5));Put(" "); end if; if Vcc(I) = 12 then Put(Ct'Val(6));Put(" "); end if; if Vcc(I) = 13 then Put(Ct'Val(7));Put(" "); end if; if Vcc(I) = 14 then Put(Ct'Val(8));Put(" "); end if; Cl := Cl+8; end loop; -- Fine stampa vettore carta end Stampa_2; -- Fine procedura di stampa delle nuove carte giocatore uno -- Inizio crazione vettore di controllo giocatore 1 procedure Vettori_G1 is begin -- Inizio vettore seme for I in 1..4 loop Sg1(I) := 0; end loop; for I in 1..5 loop if Vss(I) = 1 then Sg1(1) := Sg1(1)+1; elsif Vss(I) = 2 then Sg1(2) := Sg1(2)+1; elsif Vss(I) = 3 then Sg1(3) := Sg1(3)+1; elsif Vss(I) = 4 then Sg1(4) := Sg1(4)+1; end if; end loop; -- Fine vettore seme -- Inizio vettore carta for I in 1..9 loop Cg1(I) := 0; end loop; for I in 1..5 loop if Vcc(I) = 6 then Cg1(1) := Cg1(1)+1; elsif Vcc(I) = 7 then Cg1(2) := Cg1(2)+1; elsif Vcc(I) = 8 then Cg1(3) := Cg1(3)+1; elsif Vcc(I) = 9 then Cg1(4) := Cg1(4)+1; elsif Vcc(I) = 10 then Cg1(5) := Cg1(5)+1; elsif Vcc(I) = 11 then Cg1(6) := Cg1(6)+1; elsif Vcc(I) = 12 then Cg1(7) := Cg1(7)+1; elsif Vcc(I) = 13 then Cg1(8) := Cg1(8)+1; elsif Vcc(I) = 14 then Cg1(9) := Cg1(9)+1; end if; end loop; -- Fine vettore carte end Vettori_G1; -- Fine crazione vettori di controllo giocatore 1 -- Inizio crazione vettori di controllo giocatore 2 procedure Vettori_G2 is begin -- Inizio vettore seme for I in 1..4 loop Sg2(I) := 0; end loop; for I in 1..5 loop if Vs(I) = 1 then Sg2(1) := Sg2(1)+1; elsif Vs(I) = 2 then Sg2(2) := Sg2(2)+1; elsif Vs(I) = 3 then Sg2(3) := Sg2(3)+1; elsif Vs(I) = 4 then Sg2(4) := Sg2(4)+1; end if; end loop; -- Fine vettore seme -- Inizio vettore carta for I in 1..9 loop Cg2(I) := 0; end loop; for I in 1..5 loop if Vc(I) = 6 then Cg2(1) := Cg2(1)+1; elsif Vc(I) = 7 then Cg2(2) := Cg2(2)+1; elsif Vc(I) = 8 then Cg2(3) := Cg2(3)+1; elsif Vc(I) = 9 then Cg2(4) := Cg2(4)+1; elsif Vc(I) = 10 then Cg2(5) := Cg2(5)+1; elsif Vc(I) = 11 then Cg2(6) := Cg2(6)+1; elsif Vc(I) = 12 then Cg2(7) := Cg2(7)+1; elsif Vc(I) = 13 then Cg2(8) := Cg2(8)+1; elsif Vc(I) = 14 then Cg2(9) := Cg2(9)+1; end if; end loop; -- Fine vettore carte end Vettori_G2; -- Inizio crazione vettori di controllo giocatore 2 -- Inizio controllo carte giocatore 1 procedure Controllo_G1 is begin Vettori_G1; I := 1; Pg1 := -1; -- Inizio coppia, doppia coppia for I in 1..9 loop if Cg1(I) = 2 then Pg1 := Pg1+2; end if; end loop; -- Fine coppia, doppia coppia I := 1; -- Inizio tris for I in 1..9 loop if Cg1(I) = 3 then Pg1 := 2; end if; end loop; -- Fine tris I := 1; -- Inizio full for I in 1..9 loop if Cg1(I) = 3 then for O in 1..9 loop if Cg1(O) = 2 then Pg1 := 4; end if; end loop; end if; end loop; -- Fine full -- Inizio scala if Cg1(1)*Cg1(2)*Cg1(3)*Cg1(4)*Cg1(5) = 1 then Pg1 := 5; elsif Cg1(2)*Cg1(3)*Cg1(4)*Cg1(5)*Cg1(6) = 1 then Pg1 := 5; elsif Cg1(3)*Cg1(4)*Cg1(5)*Cg1(6)*Cg1(7) = 1 then Pg1 := 5; elsif Cg1(4)*Cg1(5)*Cg1(6)*Cg1(7)*Cg1(8) = 1 then Pg1 := 5; elsif Cg1(5)*Cg1(6)*Cg1(7)*Cg1(8)*Cg1(9) = 1 then Pg1 := 5; end if; -- Fine scala -- Inizio colore if Sg1(1)+Sg1(2) = 5 then Pg1 := 6; elsif Sg1(3)+Sg1(4) = 5 then Pg1 := 6; end if; -- Fine colore I := 1; -- Inizio Pocker for I in 1..9 loop if Cg1(I) = 4 then Pg1 := 7; end if; end loop; -- Fine Pocker -- Inizio scala reale if Sg1(1) = 5 or Sg1(2) = 5 or Sg1(3) = 5 or Sg1(4) = 5 then if Cg1(1)*Cg1(2)*Cg1(3)*Cg1(4)*Cg1(5) = 1 then Pg1 := 8; elsif Cg1(2)*Cg1(3)*Cg1(4)*Cg1(5)*Cg1(6) = 1 then Pg1 := 8; elsif Cg1(3)*Cg1(4)*Cg1(5)*Cg1(6)*Cg1(7) = 1 then Pg1 := 8; elsif Cg1(4)*Cg1(5)*Cg1(6)*Cg1(7)*Cg1(8) = 1 then Pg1 := 8; elsif Cg1(5)*Cg1(6)*Cg1(7)*Cg1(8)*Cg1(9) = 1 then Pg1 := 8; end if; end if; -- Fine scala reale end Controllo_G1; -- Fine controllo carte giocatore 1 -- Inizio controllo carte giocatore 2 procedure Controllo_G2 is begin Vettori_G2; I := 1; Pg2 := -1; -- Inizio coppia, doppia coppia for I in 1..9 loop if Cg2(I) = 2 then Pg2 := Pg2+2; end if; end loop; -- Fine coppia, doppia coppia I := 1; -- Inizio tris for I in 1..9 loop if Cg2(I) = 3 then Pg2 := 2; end if; end loop; -- Fine tris I := 1; -- Inizio full for I in 1..9 loop if Cg2(I) = 3 then for O in 1..9 loop if Cg2(O) = 2 then Pg2 := 4; end if; end loop; end if; end loop; -- Fine full -- Inizio scala if Cg2(1)*Cg2(2)*Cg2(3)*Cg2(4)*Cg2(5) = 1 then Pg2 := 5; elsif Cg2(2)*Cg2(3)*Cg2(4)*Cg2(5)*Cg2(6) = 1 then Pg2 := 5; elsif Cg2(3)*Cg2(4)*Cg2(5)*Cg2(6)*Cg2(7) = 1 then Pg2 := 5; elsif Cg2(4)*Cg2(5)*Cg2(6)*Cg2(7)*Cg2(8) = 1 then Pg2 := 5; elsif Cg2(5)*Cg2(6)*Cg2(7)*Cg2(8)*Cg2(9) = 1 then Pg2 := 5; end if; -- Fine scala -- Inizio colore if Sg2(1)+Sg2(2) = 5 then Pg2 := 6; elsif Sg2(3)+Sg2(4) = 5 then Pg2 := 6; end if; -- Fine colore I := 1; -- Inizio Pocker for I in 1..9 loop if Cg2(I) = 4 then Pg2 := 7; end if; end loop; -- Fine Pocker -- Inizio scala reale if Sg2(1) = 5 or Sg2(2) = 5 or Sg2(3) = 5 or Sg2(4) = 5 then if Cg2(1)*Cg2(2)*Cg2(3)*Cg2(4)*Cg2(5) = 1 then Pg2 := 8; elsif Cg2(2)*Cg2(3)*Cg2(4)*Cg2(5)*Cg2(6) = 1 then Pg2 := 8; elsif Cg2(3)*Cg2(4)*Cg2(5)*Cg2(6)*Cg2(7) = 1 then Pg2 := 8; elsif Cg2(4)*Cg2(5)*Cg2(6)*Cg2(7)*Cg2(8) = 1 then Pg2 := 8; elsif Cg2(5)*Cg2(6)*Cg2(7)*Cg2(8)*Cg2(9) = 1 then Pg2 := 8; end if; end if; -- Fine scala reale end Controllo_G2; -- Fine controllo carte giocatore 2 -- Inizio controllo vittoria procedure Vittoria is a, b, c, d : integer; begin Vettori_G1; Vettori_G2; new_line(23); Put("Queste sono le carte del giocatore UNO:"); New_Line(2); Stampa_2; New_Line(6); Put("Queste sono le carte del giocatore DUE:"); New_Line(2); Stampa; New_Line(6); -- Inizio controllo coppia,...,scala reale migliore if Pg1 = Pg2 then -- Inizio nulla if Pg1 = -1 then Put(" !!!Peccato questa volta e' pari!!!"); -- Fine nulla -- Inizio coppia elsif Pg1 = 1 then for i in 1..9 loop if Cg1(I) = 2 or Cg2(I) = 2 then if Cg1(I) = Cg2(I) then Put(" !!!Peccato questa volta e' pari!!!"); exit; elsif Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con una coppia piu' alta!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con una coppia piu' alta!!!"); exit; end if; end if; end loop; -- Fine coppia -- Inizio tris elsif Pg1 = 2 then for i in 1..9 loop if Cg1(I) = 3 or Cg2(I) = 3 then if Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con un tris piu' alto!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con un tris piu' alto!!!"); exit; elsif Cg1(I) = Cg2(I) then Put(" !!!Peccato questa volta e' pari!!!"); exit; end if; end if; end loop; -- Fine tris -- Inizio doppia coppia elsif Pg1 = 3 then for x in 1..9 loop if Cg1(x) = 2 then a := x; b := a; loop if Cg1(b+1) = 2 then get(b); exit; end if; end loop; end if; end loop; for x in 1..9 loop if Cg2(x) = 2 then c := x; d := c; loop if Cg2(d+1) = 2 then get(d); exit; end if; end loop; end if; end loop; if a+b > c+d then Vg1 := Vg1+1; put(" !!!Il giocatore uno vince con una doppia coppia piu' alta!!!"); elsif a+b < c+d then Vg2 := Vg2+1; put(" !!!Il giocatore due vince con una doppia coppia piu' alta!!!"); elsif a+b = c+d then put(" !!!Peccato questa volta e' pari!!!"); end if; -- Fine doppia coppia -- Inizio full elsif Pg1 = 4 then for i in 1..9 loop if Cg1(I) = 3 or Cg2(I) = 3 then if Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con un full piu' alto!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con un full piu' alto!!!"); exit; elsif Cg1(I) = Cg2(I) then for i in 1..9 loop if Cg1(I) = 2 or Cg2(I) = 2 then if Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con un full piu' alto!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con un full piu' alto!!!"); exit; elsif Cg1(I) = Cg2(I) then Put(" !!!Peccato questa volta e' pari!!!"); exit; end if; end if; end loop; exit; end if; end if; end loop; -- Fine full -- Inizio scala elsif Pg1 = 5 then for i in 1..5 loop if Cg1(I) = 1 or Cg2(I) = 1 then if Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con una scala piu' alta!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con una scala piu' alta!!!"); exit; elsif Cg1(I) = Cg2(I) then Put(" !!!Peccato questa volta e' pari!!!"); exit; end if; end if; end loop; -- Fine scala -- Inizio colore elsif Pg1 = 6 then Put(" !!!Peccato questa volta e' pari!!!"); -- Fine colore -- Inizio poker elsif Pg1 = 7 then for i in 1..9 loop if Cg1(I) = 4 or Cg2(I) = 4 then if Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con un pocker piu' alto!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con un pocker piu' alto!!!"); exit; elsif Cg1(I) = Cg2(I) then Put(" !!!Peccato questa volta e' pari!!!"); exit; end if; end if; end loop; -- Fine poker -- Inizio scala reale elsif Pg1 = 8 then for i in 1..5 loop if Cg1(I) = 1 or Cg2(I) = 1 then if Cg1(I) > Cg2(I) then Vg1 := Vg1+1; Put(" !!!Il giocatore due vince con una scala reale piu' alta!!!"); exit; elsif Cg2(I) > Cg1(I) then Vg2 := Vg2+1; Put(" !!!Il giocatore uno vince con una scala reale piu' alta!!!"); exit; elsif Cg1(I) = Cg2(I) then Put(" !!!Peccato questa volta e' pari!!!"); exit; end if; end if; end loop; end if; -- Fine scala reale -- Fine controllo coppia,...,scala reale migliore -- Inizio controllo punteggio migliore else if Pg1 > Pg2 then -- Inizio vittoria giocatore 1 Vg1 := Vg1+1; Put(" !!!Il giocatore uno vince"); if Pg1 = 1 then Put(" con una coppia!!!"); elsif Pg1 = 2 then Put(" con un tris!!!"); elsif Pg1 = 3 then Put(" con una doppia coppia!!!"); elsif Pg1 = 4 then Put(" con un full!!!"); elsif Pg1 = 5 then Put(" con una scala!!!"); elsif Pg1 = 6 then Put(" con colore!!!"); elsif Pg1 = 7 then Put(" con un pocker!!!"); elsif Pg1 = 8 then Put(" con una scala reale!!!"); end if; -- Fine vittoria giocatore 1 else -- Inizio vittoria giocatore 2 Vg2 := Vg2+1; Put(" !!!Il giocatore due vince"); if Pg2 = 1 then Put(" con una coppia!!!"); elsif Pg2 = 2 then Put(" con un tris!!!"); elsif Pg2 = 3 then Put(" con una doppia coppia!!!"); elsif Pg2 = 4 then Put(" con un full!!!"); elsif Pg2 = 5 then Put(" con una scala!!!"); elsif Pg2 = 6 then Put(" con colore!!!"); elsif Pg2 = 7 then Put(" con un pocker!!!"); elsif Pg2 = 8 then Put(" con una scala reale!!!"); end if; -- Fine vittoria giocatore 2 end if; end if; end Vittoria; -- Fine controllo vittoria -- Inizio procedura di gioco giocatore 1 procedure Giocatore_Uno is begin new_line(23); Reset (G); Put(" GIOCATORE UNO"); new_line(2); Put("Queste sono tue le carte:");New_Line(2); Casuale; Stampa; New_Line(2); Put("Quante carte vuoi cambiare? ");Get(Nc); loop if Nc > 4 then Put("Cambio non possibile!");New_Line; Put("Quante carte vuoi cambiare? ");Get(Nc); else if Nc < 5 then exit; end if; end if; end loop; if Nc > 0 and Nc < 5 then loop New_Line; Put("Posizione della ");Put(Yy);Put(" carta da cambiare? ");Get(Pc(Yy)); if Pc(Yy) > 5 then Put("Posizione non possibile!");New_Line; else Yy := Yy+1; end if; if Yy = Nc+1 then exit; end if; end loop; Xx := 1; loop S := Random(G); S := (C mod 4)+1; C := Random(G); C := (C mod 9)+6; for J in 1..9 loop if Mat(S,J) = C then Vs(Pc(Xx)) := S; Vc(Pc(Xx)) := C; Mat(S,J) := 0; Xx := Xx+1; end if; end loop; if Xx = Nc+1 then exit; end if; end loop; for I in 1..5 loop Vcc(I) := Vc(I); Vss(I) := Vs(I); end loop; New_Line(2); Put("Queste sono le tue nuove carte ");New_Line(2); Stampa_2; Pausa; else for I in 1..5 loop Vss(I) := Vs(I); Vcc(I) := Vc(I); end loop; end if; end Giocatore_Uno; -- Fine procedura di gioco giocatore 1 -- Inizio procedura di gioco giocatore 2 procedure Giocatore_Due is begin New_line(23); Reset (G); Put(" GIOCATORE DUE"); new_line(2); Put("Queste sono le tue carte:");New_Line(2); Casuale; Stampa; New_Line(2); Put("Quante carte vuoi cambiare? ");Get(Nc); loop if Nc > 4 then Put("Cambio non possibile!");New_Line; Put("Quante carte vuoi cambiare? ");Get(Nc); else if Nc < 5 then exit; end if; end if; end loop; if Nc > 0 and Nc < 5 then loop New_Line; Put("Posizione della ");Put(Tt);Put(" carta da cambiare? ");Get(Pc(Tt)); if Pc(Tt) > 5 then Put("Posizione non possibile!");New_Line; else Tt := Tt+1; end if; if Tt = Nc+1 then exit; end if; end loop; Xx := 1; loop S := Random(G); S := (C mod 4)+1; C := Random(G); C := (C mod 9)+6; for J in 1..9 loop if Mat(S,J) = C then Vs(Pc(Xx)) := S; Vc(Pc(Xx)) := C; Mat(S,J) := 0; Xx := Xx+1; end if; end loop; if Xx = Nc+1 then exit; end if; end loop; New_Line(2); Put("Queste sono le tue nuove carte ");New_Line(2); Stampa; Pausa; end if; end Giocatore_Due; -- Fine procedure di gioco giocatore 2 -- Inizio procedura principale begin loop -- Inizio richiamo delle procedure Azeramento; Matrix; Gioco; Giocatore_Uno; Giocatore_Due; Controllo_G1; Controllo_G2; Vittoria; new_line(2); Pausa; -- Fine richiamo delle procedure -- Inizio conteggio vittorie New_line(23); Put("CONTEGGIO VITTORIE:"); new_line(2); Put("Il giocatore uno ha vinto fin ora:"); Put(Vg1,2); new_line(2); Put("Il giocatore due ha vinto fin ora:"); Put(Vg2,2); -- Fine conteggio vittorie -- Inizio uscita New_line(16); Put("Vuoi ancora giocare?"); New_line(2); Put("1. SI'"); new_line; Put("2. NO"); new_line; get(dec); new_line(2); if dec = 2 then exit; end if; -- Fine uscita end loop; end Poker_win; -- Fine procedura principale