24.06.2013 Views

Télécharger (5Mb) - Université du Québec à Trois-Rivières

Télécharger (5Mb) - Université du Québec à Trois-Rivières

Télécharger (5Mb) - Université du Québec à Trois-Rivières

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

IICompter le nombre de composantes connexes les<br />

valeurs non nulles différentes dans le tableau<br />

IIi1 est inscrit<br />

int comp = Oi<br />

int val = Oi<br />

for (int i = Oi i < nbLignes i i++)<br />

(<br />

for (int j Oi j < nbColonnes i j++)<br />

if (grille[i , j] !=O && grille[i , j] != val)<br />

{<br />

val = grille[i , j] i<br />

comp++ i<br />

IIRemettre les cellules non nulles <strong>à</strong> 1<br />

for (int i = Oi i < nbLignes i i++)<br />

for (int j = Oi j < nbColonnes i j++)<br />

if (grille[i , j] > 0)<br />

grille[i, j] = l i<br />

IIVérifier si le polyomino est inscrit<br />

bool inscrit1 , inscrit2 , inscrit3 , inscrit4 i<br />

if (comp == 1)<br />

(<br />

inscrit1 = false i<br />

for (int i = Oi i < nbLignes i++)<br />

if (grille[i , O] > 0)<br />

inscrit1 true i<br />

inscrit2 = false i<br />

for (int i = O i i < nbLignes i i++)<br />

if (grille[i , nbColonnes- 1] > 0)<br />

inscrit2 = true i<br />

inscrit3 = false i<br />

for (int j = Oi j < nbColonnes j++)<br />

if (grille[O , j] > 0)<br />

inscrit3 = true i<br />

inscrit4 = false i<br />

for (int j = Oi j < nbColonnes j++)<br />

if (grille[nbLignes- 1 , j] > 0)<br />

inscrit4 = true i<br />

if (inscrit1 && inscrit2 && inscrit3 && inscrit4)<br />

IICalculer l ' aire<br />

laire = Oi<br />

nombre de 1 dans le tableau<br />

for (int i = O i i < nbLignes i i++)<br />

for (int j = Oi j < nbColonnes i j++)<br />

if (grille[i , j] > 0)<br />

laire++ i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!