florenth
Messages postés1023Date d'inscriptiondimanche 1 août 2004StatutMembreDernière intervention17 août 20083 21 févr. 2008 à 10:30
Bonjour, je cherche une petite aide mais je ne précise aucun travail déjà fait si ce n'est les modalités d'affichage (normalement le dernier truc dont on se préoccupe, surtout dans ce cas).
J'espère pour toi que tu as pas mal de connaissances parce que c'est pas évident à la base ce que tu veux faire.
spawn2004
Messages postés3Date d'inscriptionjeudi 19 août 2004StatutMembreDernière intervention25 février 2008 25 févr. 2008 à 22:08
Merci pour les petites infos .. j'ai pas pu repondre plus vite car beaucoup de choses en meme temp . voici ou j'en suis
Note : je tente d'afficher le tableau pour chaqu'une des solutions possibles avec un compteur final ( 92 possibiliter normalement )
var
tabl : array [0..7 ,0..7] of byte ;
i,j,k,l,m,n,o,p,q,r,t: byte;
pion : byte;
check : boolean;
count : byte;
procedure checkqueen (xx,yy: byte);
var
i,j : integer;
gauche, droite : integer;
begin
check:= true;
gauche:= xx-1 ;
droite:= xx+1 ;
for I := YY-1 downto 0 do
begin
if tabl[xx,i] = 1 then check:= false; if (gauche >0) and (tabl[gauche,i] 1) then check:= false; if (droite <7) and (tabl[droite,i] 1) then check:= false;
if not check then break;
dec(gauche);
inc(droite);
tabl [xx,yy]:= 5;
end;
if check = true then
begin
tabl[xx,yy]:= 1;
inc (count);
end;
if count = 8 then
for Q := 0 to 7 do
begin
for r := 0 to 7 do
write (tabl[r,q]);
writeln;
writeln ;
end;
// dEBUT ROGRAMME
begin
count := 0;
for I := 0 to 7 do //boucle 1
begin
if tabl [i,0]=0 then
checkqueen (i,0);
for j := 0 to 7 do //boucle 2
begin
if tabl [j,1]=0 then
checkqueen (j,1);
for k := 0 to 7 do //boucle 3
begin
if tabl [k,2]=0 then
checkqueen (k,2);
for l := 0 to 7 do //boucle 4
begin
if tabl [l,3]=0 then
checkqueen (l,3);
for m := 0 to 7 do //boucle 5
begin
if tabl [m,4]=0 then
checkqueen (m,4);
for n := 0 to 7 do //boucle 6
begin
if tabl [n,5]=0 then
checkqueen (n,5);
for o := 0 to 7 do //boucle 7
begin
if tabl [o,6]=0 then
checkqueen (o,6);
for p := 0 to 7 do //boucle 8
begin
if tabl [p,7]=0 then
checkqueen (p,7);
end;
end;
end;
end;
end;
end;
end;
end;
end.