program tris; uses crt; var a1,a2,a3,b1,b2,b3,c1,c2,c3,mossa,segno,winner:string; fine:integer; procedure schermo; begin; clrscr; writeln(' c ',c1,'| ',c2,'|',c3); writeln(' _______'); writeln(' b ',b1,'| ',b2,'|',b3); writeln(' _______'); writeln(' a ',a1,'| ',a2,'|',a3); writeln; writeln(' 1 2 3'); writeln; end; procedure vittoria; begin; writeln('il risultato del incontro Š...',winner); readln; halt; end; procedure pari; begin; writeln('complimenti a tutti e due: la partita Š finita pari!'); readln; halt; end; procedure condizioni_vittoria; begin; if fine=0 then begin winner:='parit…'; vittoria; end; if (a1='x') and (a2='x') and (a3='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (b1='x') and (b2='x') and (b3='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (c1='x') and (c2='x') and (c3='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (a1='x') and (b1='x') and (c1='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (a2='x') and (b2='x') and (c2='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (a3='x') and (b3='x') and (c3='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (a1='x') and (b2='x') and (c3='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (a3='x') and (b2='x') and (c1='x') then begin winner:='giocatore 1 vince'; vittoria; end; if (a1='o') and (a2='o') and (a3='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (b1='o') and (b2='o') and (b3='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (c1='o') and (c2='o') and (c3='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (a1='o') and (b1='o') and (c1='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (a2='o') and (b2='o') and (c2='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (a3='o') and (b3='o') and (c3='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (a1='o') and (b2='o') and (c3='o') then begin winner:='giocatore 2 vince'; vittoria; end; if (a3='o') and (b2='o') and (c1='o') then begin winner:='giocatore 2 vince'; vittoria; end; end; procedure conversione; begin; if (mossa='a1') then a1:=segno; if (mossa='a2') then a2:=segno; if (mossa='a3') then a3:=segno; if (mossa='b1') then b1:=segno; if (mossa='b2') then b2:=segno; if (mossa='b3') then b3:=segno; if (mossa='c1') then c1:=segno; if (mossa='c2') then c2:=segno; if (mossa='c3') then c3:=segno; fine:=fine-1; schermo; condizioni_vittoria end; procedure condizioni; begin repeat; readln(mossa) until ((mossa='a1') and (a1=' ')) or ((mossa='a2') and (a2=' ')) or ((mossa='a3') and (a3=' ')) or ((mossa='b1') and (b1=' ')) or ((mossa='b2') and (b2=' ')) or ((mossa='b3') and (b3=' ')) or ((mossa='c1') and (c1=' ')) or ((mossa='c2') and (c2=' ')) or ((mossa='c3') and (c3=' ')); conversione; end; procedure giocatore1; begin; segno:='x'; writeln('giocatore 1, dammi le cordinate dove vuoi mettere il pallino...'); condizioni; end; procedure giocatore2; begin; segno:='o'; writeln('giocatore 2, dammi le cordinate dove vuoi mettere il pallino...'); condizioni; end; begin; fine:=9; a1:=' ';a2:=' ';a3:=' ';b1:=' ';b2:=' ';b3:=' ';c1:=' ';c2:=' ';c3:=' '; schermo; repeat; giocatore1; giocatore2; until a1='erqkujhg'; end.