raff le petit jeu de mot!! ^_^:
soi-disant Posté le 17 mai 2004 à 15:30:22
Que pensez vous de cela :
-- procedure recup_autre_case : récupère une autre case jouable, pour jouer un coup " intelligent".
procedure recup_autre_case(g : in plateau ; coup1 : in couple ; coup2 : in out couple ) is
int1, int2 : integer ;
fin : integer ;
trouve : boolean ;
begin
trouve := false ;
int1 := coup1.x ;
int2 := coup1.y ;
test_intervalle(int1, int2) ;
fin := nbr_tour_voisinage(g, coup.x, coup.y) ;
while fin / = 0 and then trouve = false loop
for i in int1 - 1 . . int1 + 1 loop
for j in int2 - 1 . . int2 +1 loop
coup2.x := i ;
coup2.y := j ;
if coup_valide(g,coup1,coup2) then
if tour_5(g, coup1, coup2) then trouve := true ;
end if ;
end if ;
fin := fin - 1 ;
end loop ;
end loop ;
end loop ;
if trouve = false then
for i in int1 - 1 . . int1 + 1 loop
for j in int2 - 1 . . int2 +1 loop
coup2.x := i ;
coup2.y := j ;
if coup_valide(g,coup1,coup2) then
if vision_coup ( g, coup1, coup2) then trouve := true ;
end if ;
end if ;
end loop ;
end loop ;
end if ;
if trouve = false then
recup_case_adj(g, coup1, coup2) ;
end if ;
end recup_autre_case ;
voila c ca!!