program dominate; Unit elem:class; var couleur:integer,x:integer,y:integer; end elem; Unit init_tab:procedure; var i,j,valx,valy:integer; begin (* INITIALISATION DES COULEURS *) for i:=-1 to 10 do for j:=-1 to 10 do tab(i,j):=new elem; verif(i,j):=new elem; tab(i,j).couleur:=0; verif(i,j).couleur:=0; od; od; for i:=-2 to 11 do for j:=-2 to 11 do simul(i,j):=new elem; simul(i,j).couleur:=0; od; od; tab(1,1).couleur:=1; tab(8,8).couleur:=1; tab(8,1).couleur:=2; tab(1,8).couleur:=2; verif(1,1).couleur:=1; verif(8,8).couleur:=1; verif(8,1).couleur:=2; verif(1,8).couleur:=2; (* INITIALISATION DES POSITIONS *) valx:= 120; valy:= 50; for i:=-1 to 10 do tab(-1,i).x:=0; tab(i,-1).x:=0; tab(-1,i).x:=0; tab(i,-1).x:=0; od; for i:=-1 to 10 do tab(10,i).x:=0; tab(i,10).x:=0; tab(10,i).x:=0; tab(i,10).x:=0; od; for i:=1 to 8 do for j:=1 to 8 do tab(i,j).x := valx; tab(i,j).y := valy; valx:=valx+50; od; valx:=120; valy:=valy+50; od; end init_tab; Unit aff_tab:procedure; var i,j:integer; begin for i:=1 to 8 do for j:=1 to 8 do write(tab(i,j).couleur); od; writeln; od; end aff_tab; Unit aff_simul:procedure; var i,j:integer; begin for i:=1 to 8 do for j:=1 to 8 do write(simul(i,j).couleur); od; writeln; od; end aff_simul; Unit aff_verif:procedure; var i,j:integer; begin for i:=1 to 8 do for j:=1 to 8 do write(verif(i,j).couleur); od; writeln; od; end aff_verif; Unit creatab:procedure; var i:integer; begin array tab dim(-1:10); for i:=-1 to 10 do array tab(i) dim(-1:10); od; array verif dim(-1:10); for i:=-1 to 10 do array verif(i) dim(-1:10); od; array simul dim(-2:11); for i:=-2 to 11 do array simul(i) dim(-2:11); od; end creatab; unit recopie : procedure; var i,j:integer; begin for i:=-1 to 10 do for j:=-1 to 10 do simul(i,j).couleur:=tab(i,j).couleur; od; od; end recopie; unit ecran : procedure; begin pref IIUWGRAPH block unit sortie:procedure; begin call groff; end sortie; var i:integer,rep:char ; begin pref MOUSE block unit presentation:procedure; begin call bouton(110,150,530,330); call outstring(230,220," PROJET nø2 DE LI1 ",15,7); call outstring(230,240,"DOMINATE : jeu de strategie",15,7); call outstring(0,0,"ANTON JEAN-FRANCOIS",15,0); call outstring(0,20,"LAVIGNOTTE SEBASTIEN",15,0); call outstring(0,40,"Licence Informatique - Groupe II",15,0); call outstring(0,60,"Annee universitaire 1994/1995",15,0); call outstring(200,450,"Appuyer sur le bouton GAUCHE de votre souris...",15,0); (* Attente de l'appui de la souris *) while (Num_Mouse <> 1) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; od; call cls; call cadre; call menu0; end presentation; unit finir : procedure; var i,j:integer,modifie :boolean; begin modifie:=false; if num_joueur=1 then num_joueur:=2; else num_joueur:=1; fi; for i:=1 to 8 do for j:=1 to 8 do if tab(i,j).couleur=0 then tab(i,j).couleur:=num_joueur; modifie:=true; fi; if modifie then call affic; call compte; modifie:=false; fi; od; od; call compte; call affic; call finjeu; end finir; unit finjeu : procedure; begin call bouton(214,200,428,320); if ( nombre1 > nombre2 ) then call outstring(250,230,"VAINQUEUR : JOUEUR 1",15,7); else call outstring(250,230,"VAINQUEUR : JOUEUR 2",15,7); fi; call bouton(270,270,380,300); call outstring(280,280,"cliquez ici",15,7); while (Num_Mouse<>3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=270 and x_s<=380) and (y_s>=270 and y_s<=300) then call cls; call cadre; call menu0; fi; fi; od; end finjeu; unit tirage : procedure; var x:real,i,premier:integer; begin premier:=0; call bouton(214,200,428,320); call outstring(265,230,"Tirage au sort",15,7); x:=random; if (x>=0 and x<0.5) then premier:=1;fi; if (x>=0.5 and x<1) then premier:=2;fi; for i:=1 to 1000 do call outstring(321,285,"³",15,7); call outstring(321,285,"\",15,7); call outstring(321,285," ",15,7); call outstring(321,285,"Ä",15,7); call outstring(321,285,"/",15,7); call outstring(321,285," ",15,7); od; if (premier=1) then call outstring(220,285,"Le JOUEUR 1 va commencer",15,7); num_joueur:=1; else call outstring(220,285,"Le JOUEUR 2 va commencer",15,7); num_joueur:=2; fi; call bouton(250,250,360,280); call outstring(260,260,"cliquez ici",15,7); while (Num_Mouse<>3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=250 and x_s<=360) and (y_s>=240 and y_s<=270) then call cls; call cadre; if num_joueur=1 then case type1 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; else case type2 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; fi; fi; fi; od; end tirage; unit info1 : procedure; begin call patern(10,100,20,110,4,1); call outstring(30,100,"JOUEUR 1",4,0); call patern(100,100,110,110,4,1); call outstring(10,150,"POINTS : ",4,0); call track(80,150,nombre1,0,4); end info1; unit info2 : procedure; begin call patern(530,100,540,110,9,1); call outstring(550,100,"JOUEUR 2",9,0); call patern(620,100,630,110,9,1); call outstring(530,150,"POINTS : ",9,0); call track(600,150,nombre2,0,9); end info2; unit erreur : procedure; begin call patern(0,460,640,479,10,1); call outstring(260,465,"COUP IMPOSSIBLE A REALISER",15,10); call cls; call cadre; call tourjeu; end erreur; unit choix : procedure; begin call bouton(189,175,453,345); call point(321,177); call draw(321,343); call outstring(223,185,"JOUEUR 1",0,7); call outstring(200,210,"humain",0,7); call patern(305,210,315,225,15,1); call outstring(200,240,"expansion",0,7); call patern(305,240,315,255,15,1); call outstring(200,270,"destruction",0,7); call patern(305,270,315,285,15,1); call outstring(355,185,"JOUEUR 2",0,7); call outstring(332,210,"humain",0,7); call patern(437,210,447,225,15,1); call outstring(332,240,"expansion",0,7); call patern(437,240,447,255,15,1); call outstring(332,270,"destruction",0,7); call patern(437,270,447,285,15,1); call bouton(306,300,336,320); call outstring(315,305,"OK",15,7); case type1 when 1 : call outstring(306,211,"X",0,15); when 2 : call outstring(306,241,"X",0,15); when 3 : call outstring(306,271,"X",0,15); esac; case type2 when 1 : call outstring(438,211,"X",0,15); when 2 : call outstring(438,241,"X",0,15); when 3 : call outstring(438,271,"X",0,15); esac; while (Num_mouse <> 3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=306 and x_s<=336) and (y_s>=300 and y_s<=320) then call cls; call cadre; call tirage; fi; if (x_s>=305 and x_s<=315) and (y_s>=210 and y_s<=220) then call patern(305,210,315,225,15,1); call patern(305,240,315,255,15,1); call patern(305,270,315,285,15,1); call outstring(306,211,"X",0,15); type1:=1; fi; if (x_s>=305 and x_s<=315) and (y_s>=240 and y_s<=250) then call patern(305,210,315,225,15,1); call patern(305,240,315,255,15,1); call patern(305,270,315,285,15,1); call outstring(306,241,"X",0,15); type1:=2; fi; if (x_s>=305 and x_s<=315) and (y_s>=270 and y_s<=280) then call patern(305,210,315,225,15,1); call patern(305,240,315,255,15,1); call patern(305,270,315,285,15,1); call outstring(306,271,"X",0,15); type1:=3; fi; if (x_s>=437 and x_s<=447) and (y_s>=210 and y_s<=220) then call patern(437,210,447,225,15,1); call patern(437,240,447,255,15,1); call patern(437,270,447,285,15,1); call outstring(438,211,"X",0,15); type2:=1; fi; if (x_s>=437 and x_s<=447) and (y_s>=240 and y_s<=250) then call patern(437,210,447,225,15,1); call patern(437,240,447,255,15,1); call patern(437,270,447,285,15,1); call outstring(438,241,"X",0,15); type2:=2; fi; if (x_s>=437 and x_s<=447) and (y_s>=270 and y_s<=280) then call patern(437,210,447,225,15,1); call patern(437,240,447,255,15,1); call patern(437,270,447,285,15,1); call outstring(438,271,"X",0,15); type2:=3; fi; fi; od; end choix; unit aide : procedure; begin call bouton(10,50,632,460); call outstring(304,80,"AIDE",15,7); call point(300,95); call draw(336,95); call outstring(20,110,"CONTROLE ET REGLE DU JEU",15,7); call outstring(20,125,"Bienvenue sur DOMINATE. Ce jeu est bas‚ sur les rŠgles du",0,7); call outstring(20,140,"trŠs vieux et trŠs c‚lŠbre 'GO'. C'est donc un jeu de",0,7); call outstring(20,155,"strat‚gie de plateau o— le but est de recouvrir un",0,7); call outstring(20,170,"maximum d'espaces avec la couleur de votre joueur.",0,7); call outstring(20,185,"MOUVEMENT DURANT LE JEU",15,7); call outstring(20,200,"Quand c'est votre tour de jouer, choisissez simplement la",0,7); call outstring(20,215,"piŠce … bouger en cliquant dessus … l'aide du bouton",0,7); call outstring(20,230,"gauche de la souris. Durant le jeu, il est possible de",0,7); call outstring(20,245,"bouger sur une case voisine dans n'importe quelle",0,7); call outstring(20,260,"direction ou sauter horizontalement et verticalement par",0,7); call outstring(20,275,"dessus un obstacle. Si vous sautez, l'espace par dessus",0,7); call outstring(20,290,"lequel vous bougez garde son ‚tat initial, malgr‚ que la",0,7); call outstring(20,305,"case de destination change de couleur.",0,7); call outstring(20,320,"Apr‚s votre mouvement toutes les piŠces adversaires ",0,7); call outstring(20,335,"voisines … la case de destination deviennent de votre",0,7); call outstring(20,350,"couleur.",0,7); call outstring(20,365,"GAGNER UNE PARTIE",15,7); call outstring(20,380,"Lorsque toutes les cases du plateau sont utilis‚es, ou si",0,7); call outstring(20,395,"un des deux joueurs ne peut plus bouger, l'ordinateur",0,7); call outstring(20,410,"remplit les cases libres, en correspondance avec les",0,7); call outstring(20,425,"mouvements de chaque joueur, le joueur qui possŠde alors",0,7); call outstring(20,440," le plus de cases du plateau est le vainqueur.",0,7); call bouton(490,390,600,420); call outstring(500,400,"cliquez ici",15,7); while (Num_Mouse<>3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=490 and x_s<=600) and (y_s>=390 and y_s<=420) then call cls; call cadre; call menu0; fi; fi; od; end aide; unit cadre : procedure; var i,j:integer; begin if num_joueur=1 then call patern(25,95,95,115,15,0); else call patern(545,95,615,115,15,0); fi; call bouton(5,5,640,30); call outstring(20,13,"QUITTER",15,7); call outstring(125,13,"JEU",15,7); call outstring(200,13,"AIDE",15,7); call info1; call info2; for i:=1 to 8 do for j:=1 to 8 do call patern(tab(i,j).x,tab(i,j).y,tab(i,j).x+50,tab(i,j).y+50,15,0); od; od; for i:=1 to 8 do for j:=1 to 8 do case tab(i,j).couleur when 0 : ; when 1 : call patern(tab(i,j).x+1,tab(i,j).y+1,tab(i,j).x+49,tab(i,j).y+49,4,1); when 2 : call patern(tab(i,j).x+1,tab(i,j).y+1,tab(i,j).x+49,tab(i,j).y+49,9,1); when 3 : call patern(tab(i,j).x,tab(i,j).y,tab(i,j).x+50,tab(i,j).y+50,2,0); when 4 : call patern(tab(i,j).x,tab(i,j).y,tab(i,j).x+50,tab(i,j).y+50,14,0); esac; od; od; end cadre; unit affic : procedure; var i,j:integer; begin if num_joueur=1 then call patern(25,95,95,115,15,0); call patern(545,95,615,115,0,0); else call patern(545,95,615,115,15,0); call patern(25,95,95,115,0,0); fi; call patern(79,149,95,172,0,1); call track(80,150,nombre1,0,4); call patern(599,149,615,172,0,1); call track(600,150,nombre2,0,9); for i:=1 to 8 do for j:=1 to 8 do case tab(i,j).couleur when 0 : call patern(tab(i,j).x+1,tab(i,j).y+1,tab(i,j).x+49,tab(i,j).y+49,0,1); when 1 : call patern(tab(i,j).x+1,tab(i,j).y+1,tab(i,j).x+49,tab(i,j).y+49,4,1); when 2 : call patern(tab(i,j).x+1,tab(i,j).y+1,tab(i,j).x+49,tab(i,j).y+49,9,1); when 3 : call patern(tab(i,j).x,tab(i,j).y,tab(i,j).x+50,tab(i,j).y+50,2,0); when 4 : call patern(tab(i,j).x,tab(i,j).y,tab(i,j).x+50,tab(i,j).y+50,14,0); esac; od; od; end affic; unit vraiquit : procedure; begin call bouton(214,200,428,320); call outstring(290,230,"QUITTER ?",15,7); call bouton(250,300,300,280); call outstring(260,285,"OUI",15,7); call bouton(342,300,392,280); call outstring(352,285,"NON",15,7); while (Num_Mouse<>3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=250 and x_s<=300) and (y_s>=280 and y_s<=300) then call groff; call endrun; fi; if (x_s>=342 and x_s<=392) and (y_s>=280 and y_s<=300) then call cls; call cadre; call menu0; fi; fi; od; end vraiquit; unit noujeu : procedure; begin call bouton(214,200,428,320); call outstring(270,230,"NOUVEAU JEU ?",15,7); call bouton(250,300,300,280); call outstring(260,285,"OUI",15,7); call bouton(342,300,392,280); call outstring(352,285,"NON",15,7); while (Num_Mouse<>3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=250 and x_s<=300) and (y_s>=280 and y_s<=300) then call init_tab; call compte; call cls; call cadre; call choix; fi; if (x_s>=342 and x_s<=392) and (y_s>=280 and y_s<=300) then call cls; call cadre; call menu0; fi; fi; od; end noujeu; unit menu0 : procedure; var i:integer; (* * Affichage et gestion du premier * menu utilisateur du programme. *) begin while (Num_Mouse<>3) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse) ; if num_mouse = 1 then if (x_s>=20 and x_s<=80) and (y_s>=5 and y_s<=30) then call vraiquit; fi; if (x_s>=125 and x_s<=155) and (y_s>=5 and y_s<=30) then call noujeu; fi; if (x_s>=200 and x_s<=240) and (y_s>=5 and y_s<=30) then call aide; fi; if (x_s>=120 and x_s<=520) and (y_s>=50 and y_s<=450) then if num_joueur=1 then case type1 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; else case type2 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; fi; fi; fi; od; end menu0; unit tourjeu : procedure; var inter:integer; begin inter:=0; fini:=false; trouve:=false; termine:=false; call remis0(tab); call remis0(verif); call cadre; possible:=false; call verifjeu; if (possible) then while (not fini) do while (not trouve) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse); if (num_mouse = 1) then if y_s <30 then call menu0;fi; call reccase1(x_s,y_s); fi; od; if (tab(coury,courx).couleur = num_joueur) then call remis0(tab); call remis0(verif); call affpos; call affic; else call tourjeu; fi; while (not termine) do Mouse:=getpress(x_s,y_s,Keyb1,Keyb2,Flag,Num_Mouse); if (num_mouse = 1) then if y_s <30 then call menu0;fi; call reccase2(x_s,y_s); fi; od; if ( (indx=courx) and (indy=coury)) then call tourjeu; else if ((tab(indy,indx).couleur <>3) and (tab(indy,indx).couleur <>4)) then call tourjeu; else case tab(indy,indx).couleur when 3 :tab(indy,indx).couleur:=num_joueur; verif(indy,indx).couleur:=num_joueur; fini:=true; termine:=true; call remis0(tab); call remis0(verif); call consequence; call affic; when 4 : tab(coury,courx).couleur:=0; tab(indy,indx).couleur:=num_joueur; verif(coury,courx).couleur:=0; verif(indy,indx).couleur:=num_joueur; fini:=true; termine:=true; call remis0(tab); call remis0(verif); call consequence; call affic; esac; fi;fi; od; call compte; if (fini) then if num_joueur=1 then num_joueur:=2; else num_joueur:=1; fi; trouve:=false; termine:=false; call affic; if num_joueur=1 then courx:=1;coury:=1; case type1 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; else case type2 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; fi; fi; else call finir; fi; end tourjeu; unit expansion : procedure; var i,j,a,b:integer,ok:boolean; begin call verifjeu; ok:=false; if (possible) then for i:=1 to 8 do for j:=1 to 8 do if tab(i,j).couleur=num_joueur then indy:=i;indx:=j; courx:=j;coury:=i; call affpos; fi; od; od; for a:=1 to 8 do for b:=1 to 8 do if (tab(a,b).couleur = 3) then if (not ok) then tab(a,b).couleur:=num_joueur; verif(a,b).couleur:=num_joueur; ok:=true; call remis0(tab); call remis0(verif); indx:=b;indy:=a; call consequence; call affic; fi; fi; od; od; for a:=1 to 8 do for b:=1 to 8 do case tab(a,b).couleur when 4 : if (not ok) then tab(coury,courx).couleur:=0; tab(a,b).couleur:=num_joueur; verif(coury,courx).couleur:=0; verif(a,b).couleur:=num_joueur; ok:=true; call remis0(tab); call remis0(verif); indx:=b;indy:=a; call consequence; call affic; fi; esac; od; od; if (ok) then if num_joueur=1 then num_joueur:=2; else num_joueur:=1; fi; call compte; call affic; if num_joueur=1 then case type1 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; else case type2 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; fi; fi; else call finir; fi; end expansion; unit destruction : procedure; var i,j,a,b,premx,premy,derx,dery,actuel : integer,teremi:boolean; begin call verifjeu; if possible then call recopie; teremi := false; if num_joueur=1 then actuel:=nombre1; else actuel:=nombre2; fi; for i:=1 to 8 do for j:=1 to 8 do call remis0(tab); call recopie; if tab(i,j).couleur=num_joueur then indx:=j;indy:=i; call affpos; if (pos <> 0 ) then for a:=i-2 to i+2 do for b:=j-2 to j+2 do if (a>=1 and a<=8) and (b>=1 and b<=8) then case tab(a,b).couleur when 3 : simul(a,b).couleur:=num_joueur; ix:=b;iy:=a; call cons; call simcom; if ( nomb > actuel ) then premx:=j;premy:=i; derx:=b;dery:=a; actuel:=nomb; fi; when 4 : simul(a,b).couleur:=num_joueur; simul(i,j).couleur:=0; ix:=b;iy:=a; call cons; call simcom; if ( nomb > actuel ) then premx:=j;premy:=i; derx:=b;dery:=a; actuel:=nomb; fi; esac; call recopie; fi; od; od; fi; fi; od; call remis0(tab); od; if (tab(premy,premx).couleur = num_joueur) then indx:=premx;indy:=premy; call affpos; case tab(dery,derx).couleur when 3 : tab(dery,derx).couleur:=num_joueur; verif(dery,derx).couleur:=num_joueur; teremi:=true; call remis0(tab); call remis0(verif); indx:=derx;indy:=dery; call consequence; call affic; when 4 : tab(premy,premx).couleur:=0; tab(dery,derx).couleur:=num_joueur; verif(premy,premx).couleur:=0; verif(dery,derx).couleur:=num_joueur; teremi:=true; call remis0(tab); call remis0(verif); indx:=derx;indy:=dery; call consequence; call affic; esac; fi; if (teremi) then if num_joueur=1 then num_joueur:=2; else num_joueur:=1; fi; call compte; call affic; if num_joueur=1 then case type1 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; else case type2 when 1 : call tourjeu; when 2 : call expansion; when 3 : call destruction; esac; fi; fi; else call finir; fi; call recopie; call remis0(tab); call remis0(verif); end destruction; unit compte : procedure; var i,j,jou1,jou2:integer; begin jou1:=0; jou2:=0; for i:=1 to 8 do for j:=1 to 8 do if tab(i,j).couleur=1 then jou1:=jou1+1;fi; if tab(i,j).couleur=2 then jou2:=jou2+1;fi; od; od; nombre1:=jou1; nombre2:=jou2; end compte; unit simcom : procedure; var i,j,jou1,jou2:integer; begin jou1:=0; jou2:=0; for i:=1 to 8 do for j:=1 to 8 do if simul(i,j).couleur=1 then jou1:=jou1+1;fi; if simul(i,j).couleur=2 then jou2:=jou2+1;fi; od; od; if num_joueur=1 then nomb:=jou1; else nomb:=jou2; fi; end simcom; unit consequence : procedure; begin if tab(indy-1,indx-1).couleur<>0 then tab(indy-1,indx-1).couleur:=num_joueur; verif(indy-1,indx-1).couleur:=num_joueur;fi; if tab(indy-1,indx).couleur<>0 then tab(indy-1,indx).couleur:=num_joueur; verif(indy-1,indx).couleur:=num_joueur;fi; if tab(indy-1,indx+1).couleur<>0 then tab(indy-1,indx+1).couleur:=num_joueur; verif(indy-1,indx+1).couleur:=num_joueur;fi; if tab(indy,indx-1).couleur<>0 then tab(indy,indx-1).couleur:=num_joueur; verif(indy,indx-1).couleur:=num_joueur;fi; if tab(indy,indx+1).couleur<>0 then tab(indy,indx+1).couleur:=num_joueur; verif(indy,indx+1).couleur:=num_joueur;fi; if tab(indy+1,indx-1).couleur<>0 then tab(indy+1,indx-1).couleur:=num_joueur; verif(indy+1,indx-1).couleur:=num_joueur;fi; if tab(indy+1,indx).couleur<>0 then tab(indy+1,indx).couleur:=num_joueur; verif(indy+1,indx).couleur:=num_joueur;fi; if tab(indy+1,indx+1).couleur<>0 then tab(indy+1,indx+1).couleur:=num_joueur; verif(indy+1,indx+1).couleur:=num_joueur;fi; end consequence; unit cons : procedure; begin call remis0(simul); if simul(iy-1,ix-1).couleur<>0 then simul(iy-1,ix-1).couleur:=num_joueur; fi; if simul(iy-1,ix).couleur<>0 then simul(iy-1,ix).couleur:=num_joueur; fi; if simul(iy-1,ix+1).couleur<>0 then simul(iy-1,ix+1).couleur:=num_joueur; fi; if simul(iy,ix-1).couleur<>0 then simul(iy,ix-1).couleur:=num_joueur; fi; if simul(iy,ix+1).couleur<>0 then simul(iy,ix+1).couleur:=num_joueur; fi; if simul(iy+1,ix-1).couleur<>0 then simul(iy+1,ix-1).couleur:=num_joueur; fi; if simul(iy+1,ix).couleur<>0 then simul(iy+1,ix).couleur:=num_joueur; fi; if simul(iy+1,ix+1).couleur<>0 then simul(iy+1,ix+1).couleur:=num_joueur; fi; end cons; unit affpos : procedure; var i,j : integer; begin j:=indx;i:=indy; pos:=0; if (tab(i,j).couleur=num_joueur) then if tab(i-1,j-1).couleur=0 then tab(i-1,j-1).couleur:=3;pos:=pos+1;fi; if tab(i-1,j).couleur=0 then tab(i-1,j).couleur:=3;pos:=pos+1;fi; if tab(i-1,j+1).couleur=0 then tab(i-1,j+1).couleur:=3;pos:=pos+1;fi; if tab(i,j-1).couleur=0 then tab(i,j-1).couleur:=3;pos:=pos+1;fi; if tab(i,j+1).couleur=0 then tab(i,j+1).couleur:=3;pos:=pos+1;fi; if tab(i+1,j-1).couleur=0 then tab(i+1,j-1).couleur:=3;pos:=pos+1;fi; if tab(i+1,j).couleur=0 then tab(i+1,j).couleur:=3;pos:=pos+1;fi; if tab(i+1,j+1).couleur=0 then tab(i+1,j+1).couleur:=3;pos:=pos+1;fi; if tab(i+2,j).couleur=0 then tab(i+2,j).couleur:=4;pos:=pos+1;fi; if tab(i-2,j).couleur=0 then tab(i-2,j).couleur:=4;pos:=pos+1;fi; if tab(i,j+2).couleur=0 then tab(i,j+2).couleur:=4;pos:=pos+1;fi; if tab(i,j-2).couleur=0 then tab(i,j-2).couleur:=4;pos:=pos+1;fi; fi; end affpos; unit reccase1 : procedure(x_s,y_s:integer); var px,py :integer; begin px:=120;py:=50;courx:=1;coury:=1; trouve:=false; (* recherche de x *) if ((x_s<120) or (y_s>520)) then call erreur; else while (not trouve) do if ((x_s>=px) and (x_s450)) then call erreur; else while (not trouve) do if ((y_s>=py) and (y_s520)) then call erreur; else while (not termine) do if ((x_s>=px) and (x_s450)) then call erreur; else while (not termine) do if ((y_s>=py) and (y_s