Fonction pour creer un sudoku
Résolu
pyvator
-
pyvator -
pyvator -
Bonjour,
J'aimerais savoir si il existe un algorithim qui trouve si la même valeur existe dans un row et une collone . Car je
souhaiterai faire un sudoku checker c'est a dire qui dit si c 'est juste ou faux. Et aussi si possible dans un carré de 6
cellules.
je vous remercie d'avance,
J'aimerais savoir si il existe un algorithim qui trouve si la même valeur existe dans un row et une collone . Car je
souhaiterai faire un sudoku checker c'est a dire qui dit si c 'est juste ou faux. Et aussi si possible dans un carré de 6
cellules.
je vous remercie d'avance,
Configuration: Windows XP Internet Explorer 6.0 microsoft office excel 2003
4 réponses
-
Euh... tu veux dire un carré de 9 cellules non ?
Bon, voici l'algo :
Soit array un tableau de 9 lignes et 9 colonnes
Soit squareRowToSearch un entier de 1 à 3 (l'indice vertical du carré où il faut chercher)
Soit squareColumnToSearch un entier de 1 à 3 (l'indice horizontal du carré où il faut chercher)
Soit row un entier de 1 à 9
Soit column un entier de 1 à 9
Soit inputValue un entier de 1 à 9 (le nombre à chercher dans le carré)
Soit isPresent un booléen
Mettre la valeur Faux dans isPresent
Pour row allant de (squareRowToSearch * 3 - 2) à (squareRowToSearch * 3) de 1 en 1
> Pour column allant de (squareColumnToSearch * 3 - 2) à (squareColumnToSearch * 3) de 1 en 1
> > Si la valeur de array à row, column est égal à inputValue
> > > Mettre Vrai dans isPresent
> > Fin si
> Fin pour
Fin pour
Si isPresent est vrai, alors, le nombre est présent. -
slut ftiercel,
je te remercie de ta reponse, mais pourrais tu mettre la fonction en anglais parce que sinon je ne m'y retrouve pas vraiment.
merci de ta comprehension -
You have array an array of 9 rows by 9 columns
You have squareRowToSearch an integer from 1 to 3
You have squareColumnToSearch an integer from 1 to 3
You have row an integer from 1 to 9
You have column an integer from 1 to 9
You have inputValue an integer from 1 to 9
You have isPresent a boolean
Put the value False into isPresent
For row from (squareRowToSearch * 3 - 2) to (squareRowToSearch * 3) 1 by 1
> For column from (squareColumnToSearch * 3 - 2) to (squareColumnToSearch * 3) 1 by 1
> > If the value of array at row, column is equal to inputValue
> > > Put the value True into isPresent
> > End if
> End for
End for -