IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OpenOffice & LibreOffice Discussion :

Macro : itération avec plus d'une condition [LibreOffice][Tableur]


Sujet :

OpenOffice & LibreOffice

  1. #1
    Membre actif

    Homme Profil pro
    Apprenti Langage C, pratiquant OpenOffice et Poo
    Inscrit en
    Février 2015
    Messages
    229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre (Centre)

    Informations professionnelles :
    Activité : Apprenti Langage C, pratiquant OpenOffice et Poo
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2015
    Messages : 229
    Points : 218
    Points
    218
    Par défaut Macro : itération avec plus d'une condition
    Bonjour,

    Je souhaite obtenir une liste de valeurs comprises entre 1 et 9, tirées au sort et différente les unes des autres.

    J'ai essayé avec les codes ci-dessous (pour 3 et 2 valeurs pour débuter), sans résultat :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    REM  *****  BASIC  *****
    Option explicit
     
    Sub Iteration_1
     
     
    Set Document = ThisComponent
     
    rem Déclarations ------------------------------------------------------------------------------------
    Dim A1(1 to 9),B1(1 to 9),C1(1 to 9)
    Dim A2(1 to 9),B2(1 to 9),C2(1 to 9)
     
    Dim Num As Integer
    Dim Affiche as string
     
    rem Calcul valeurs -----------------------------------------------------------------------------
     
    Do
    Num = Int((10 * Rnd))
    If Num = 0 = True Then loop
    Exit do
    A1 = Num
     
    Do
    Num = Int((10 * Rnd))
    If Num = 0 = True Then loop
    If Num = A1  = True Then loop
    Exit do
    B1 = Num
     
    Do
    Num = Int((10 * Rnd))
    If Num = 0 = True Then loop
    If Num = A1  = True Then loop
    If Num = B1  = True Then loop
    Exit do
    C1 = Num
     
    Do
    Num = Int((10 * Rnd))
    If Num = 0 = True Then loop
    If Num = A1  = True Then loop
    If Num = B1  = True Then loop
    If Num = C1  = True Then loop
    Exit Do
    A2 = Num
     
    Do
    Num = Int((10 * Rnd))
    If Num = 0 = True Then loop
    If Num = A1  = True Then loop
    If Num = B1  = True Then loop
    If Num = C1  = True Then loop
    If Num = A2  = True Then loop
    Exit do
    B2 = Num
     
    Do
    Num = Int((10 * Rnd))
    If Num = 0 = True Then loop
    If Num = A1  = True Then loop
    If Num = B1  = True Then loop
    If Num = C1  = True Then loop
    If Num = A2  = True Then loop
    If Num = B2  = True Then loop
    Exit do
    C2 = Num
     
    Affiche = A1 &" "& B1 &" " & C1 &" "& A2 &" "& B2 &" "& C2 &" "
     
    Print Affiche
     
    End sub

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    REM  *****  BASIC  *****
    Option explicit
     
    Sub Iteration_2
     
    Dim Document as object
     
    Set Document = ThisComponent
     
    rem Déclarations ------------------------------------------------------------------------------------
    Dim A1(1 to 9) 
    Dim B1(1 to 9)
    Dim Num As Integer
    Dim Affiche as string
     
    rem Calcul valeurs -----------------------------------------------------------------------------
     
    Do
    Num = Int((10 * Rnd))
    loop until Num > 0
    A1 = Num
     
    Do
    Num = Int((10 * Rnd))
    loop until Num > 0
    If Num = A1 then loop
    B1 = Num
     
    Affiche = A1 & " " & B1
     
    Print Affiche
     
    End sub
    J'ai été surpris que lors de la déclaration des variables A1 à C2, l'éditeur refuse que je fixe le type de variable ( integer ou variant). Cela est-il redondant avec la définition de la plage (1 to 9) qui détermine le type integer ?

    J'utilise la fonction "rnd" qui génère des valeurs au hazard de 0 à 9, alors je dois tester :

    1/ que la valeur sortie n'est pas nulle
    2/ que les valeurs sorties après la première sont différentes des précédentes.

    Pouvez-vous me confirmer que les fonction "if" et "do...loop" n'acceptent qu'une seule condition.

    Je m'oriente aujourd'hui sur une écriture avec des sous-programmes ou avec d'autres fonctions que "do...loop" et "if".

    Merci d'avance pour votre aide.

    Cordialement,

    Pascal

    PS : je n'arrive pas à modifier mon profil : je ne m'intéresse plus au VBA mais au StarBasic.
    Pascaltech

    Traduction : guides, manuels, normes : http://tradinfo.e-monsite.com/

  2. #2
    Rédacteur

    Avatar de zoom61
    Homme Profil pro
    ...
    Inscrit en
    Janvier 2005
    Messages
    9 429
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : ...
    Secteur : Industrie

    Informations forums :
    Inscription : Janvier 2005
    Messages : 9 429
    Points : 58 612
    Points
    58 612
    Billets dans le blog
    11
    Par défaut
    Bonjour,

    Dans cette discussion tu devrais trouver la solution à ton problème.

    Cdlt
    N'oubliez pas le Tag afin de faciliter la recherche, et en votant cela permet de mieux la cibler.

    Je ne réponds pas aux messages privés s'ils sont liés à une question technique

  3. #3
    Membre actif

    Homme Profil pro
    Consultant informatique
    Inscrit en
    Septembre 2011
    Messages
    370
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2011
    Messages : 370
    Points : 251
    Points
    251
    Par défaut
    Bonjour,

    Si j'ai bien compris ta demande, il s'agit d'un tirage de numéro entre 1 et 9 sans remise.

    J'ai fait très différemment de toi, mais ça fonctionne.
    Tu obtiens un tableau qui stocke les valeurs tirées, les unes après les autres:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    Sub aleatoir ()
    Dim TableauValeurs (8) as integer
    Dim i as integer
    Dim j as integer
    Dim k as integer 'k est la valeur qui permet de savoir si les conditions sont remplies k = 0 => non,k = 1 => oui 
     
    'La première valeur a être générée est forcément bonne, donc nous mettons k à 1.
    k = 1
     
    'Nous remplissons le tableau qui contient 9 valeurs de 0 à 8.
    For i = 0 to 8
    	'nous vérifions les conditions suivantes: pas de valeur déjà tiré et pas de valeur égale à 0.
    	If k = 0 then 
    		k = 1
    		i = i - 1
    	end if
    	'nous stockons la valeur aléatoire dans le tableau.
    	TableauValeurs (i) = Int((10 * Rnd))
    	'si c'est le premier tirage, nous allons au tirage suivant.
    	If i = 0 then
    		goto NextI
    	end if 
    	'nous vérifions que la dernière valeur stocké n'est pas égale à une valeur précédemment tirée et stockée
    	For j = 0 to (i - 1)
    		if TableauValeurs (i) = TableauValeurs (j) OR TableauValeurs (i) = 0 then
    			'si c'est le cas, nous mettons k à 0.
    			goto FauxNext
    		end if
    	next
    	'si il n'y a pas d'égalité ou si la dernière valeur est différente de 0 alors nous allons au prochain tirage.
    	goto NextI
    FauxNext:
    	k=0
    NextI:
    next
    End sub
    Cordialement,
    vandman

  4. #4
    Membre actif

    Homme Profil pro
    Apprenti Langage C, pratiquant OpenOffice et Poo
    Inscrit en
    Février 2015
    Messages
    229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre (Centre)

    Informations professionnelles :
    Activité : Apprenti Langage C, pratiquant OpenOffice et Poo
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2015
    Messages : 229
    Points : 218
    Points
    218
    Par défaut
    Bonjour,

    Merci pour vos réponse.

    Zoom61,

    Voici le code de la discussion :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    Sub Tirage
    Rem Déclaration des variables
    Dim Lig as Integer, Col as Integer
    Dim NumBoule as Integer
    Dim TableauBoules (4) as Integer
    Dim oDocument As Object, oSheet As Object, oCell As Object
    TableauBoules = Array(0,0,0,0,0)
    Randomize()
    oDocument = ThisComponent
    oSheet = oDocument.Sheets.getByName("Loto")
    Rem La Premiere ligne
    Lig = 2
    Rem Tirage en boucle de 5 nombres au hasard
    For Col = 0 to 4
        oCell = oSheet.getCellByPosition(Col,Lig)
        Do
            sortie = False
            NumBoule = int(rnd()*49) + 1
    Rem On regarde si la boule est déja sortie
            For j = 0 To Col
                If NumBoule = TableauBoules(j) Then
                   sortie = True
                End If
            Next j
         Loop Until (sortie = False)           
         oCell.setValue(NumBoule)
         TableauBoules(Col) = NumBoule
    Next Col
     
    Rem on tire le numéro Chance de 1 à 10
              oCell = oSheet.getCellByPosition(6,Lig)
              oCell.setValue( Int(9*Rnd)+1)
    End Sub
    Le traitement de la fonction rnd() est intéressant : l'ajout de 1 supprime la valeur zéro et toutes les autres valeurs sont inférieures à la valeur maxi.

    Ecriture théorique : Variable = int(rnd()*(Valeurmaxi-1)) + 1 (l'arrondi des entiers s'effectue à la valeur supérieure)

    Ce qui me gène, c'est l'utilisation du numéro de colonne pour l'itération. Je ne peux pas décider du positionnement de la valeur sortie dans la feuille. J'ai eu beau triturer ce code, je n'ai pas de solution.

    Vandman,

    Merci pour ton code.

    Je ne connaissais pas l'utilisation de la commande OR après IF. Je vais essayer d'en positionner plusieurs, pour rire.

    J'essaie ton code, à ma sauce et te tiens au courant.

    J'ai cherché avec des sous-programmes mais je rencontre des difficultés lors de la première exécution qui est incompatible avec les boucles.

    J'ai testé la fonction Select Case ci-dessous, mais je rencontre une erreur.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    REM  *****  BASIC  *****
    Option explicit
     
    Sub Aleatoire
     
    Dim Document as object
    Dim Grille As Object
    Set Document = ThisComponent
     
    rem Déclarations ------------------------------------------------------------------------------------
    Dim A1 as integer
    Dim B1 as integer
    Dim C1 as integer
    Dim D1 as integer
    Dim Num as integer
     
    Grille = Document.Sheets.getByName("Grille")
     
    rem Calcul valeurs -----------------------------------------------------------------------------
     
    alea
    A1 = Num
     
    alea
    Select case Num
    Case Num = A1
    alea
    Case else
    B1 = Num
    end select
     
    alea
    Select case Num
    Case Num = A1
    alea
    Case Num = B1
    alea
    Case else
    C1 = Num
    end select
     
    alea
    Select case Num
    Case Num = A1
    alea
    Case Num = B1
    alea
    Case Num = B1
    alea
    Case else
    D1 = Num
    end select
     
     
    Rem Affectation des valeurs aux cellules -------------------------------------------------
    Grille.getCellByPosition(0, 0).value =	A1
    Grille.getCellByPosition(1, 0).value =	B1
    Grille.getCellByPosition(2, 0).value =	C1
    Grille.getCellByPosition(3, 0).value =	D1
    End sub
     
    sub Alea
    Num = Int(Rnd()* 9)+1  '<----- variable non définie
    End sub
    Je ne sais pas pourquoi. J'ai noté que les erreurs affichées ne correspondent pas toujours à l'erreur réelle.

    Merci pour votre aide.

    A+
    Pascaltech

    Traduction : guides, manuels, normes : http://tradinfo.e-monsite.com/

  5. #5
    Membre actif

    Homme Profil pro
    Consultant informatique
    Inscrit en
    Septembre 2011
    Messages
    370
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2011
    Messages : 370
    Points : 251
    Points
    251
    Par défaut
    Bonjour,

    Le message "variable non définit" est normal car tu ne définit pas dans ta sous-routine (sub) alea la variable num.

    De plus, la déclaration n'est pas correcte. Je ne suis pas sure mais il me semble que seul des fonctions peuvent retourner une valeur.

    Int(Rnd()* 9)+1 => te renvoies des valeurs de 1 à 10. Or il me semble que tu veux des valeurs de 1 à 9.
    Il faudrait que tu fasses comme ca:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
     
    Sub Aleatoire
    ....
    'tu stockes le résultat de ta fonction "alea" dans "Num"
    Num = alea
    ....
    End sub
     
    'Declaration de ta fonction en tant qu' "integer". Donc retourne un Integer.
    function Alea () as integer
    alea = Int(Rnd()* 8)+1 'renvoie des valeurs de 1 à 9.
    End function
    Cordialement,
    Vandman

  6. #6
    Membre actif

    Homme Profil pro
    Apprenti Langage C, pratiquant OpenOffice et Poo
    Inscrit en
    Février 2015
    Messages
    229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre (Centre)

    Informations professionnelles :
    Activité : Apprenti Langage C, pratiquant OpenOffice et Poo
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2015
    Messages : 229
    Points : 218
    Points
    218
    Par défaut
    Bonjour,

    Citation Envoyé par vandman Voir le message
    Bonjour,

    Le message "variable non définie" est normal car tu ne définit pas dans ta sous-routine (sub) alea la variable num.
    Oui, je l'ai modifié en ce sens et cela fonctionne. Je suis surpris que la variable doive être déclarée à nouveau dans la sous-routine.

    De plus, la déclaration n'est pas correcte. Je ne suis pas sûre mais il me semble que seul des fonctions peuvent retourner une valeur.
    Je ne comprends pas ce que tu veux dire.

    Int(Rnd()* 9)+1 => te renvoies des valeurs de 1 à 10. Or il me semble que tu veux des valeurs de 1 à 9.
    Oui, c'est juste. Rnd()*9 envoie des valeurs comprises entre 0 + 1 = 1 et (0,9999*9) + 1 = 8,9999 + 1 = 9,9999 (je ne sais pas jusqu'à quelle décimale), et comme c'est un entier, la valeur est arrondie à l'entier supérieur. J'étais persuadé que l'arrondi se faisait sur l'entier inférieur. Cela explique les valeurs 10 obtenues lors des essais.


    1/ Analyse de ton code : mes interventions en Rem dans ton code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    Sub aleatoir ()
    Dim TableauValeurs (8) as integer
    Dim i as integer
    Dim j as integer
    Dim k as integer 'k est la valeur qui permet de savoir si les conditions sont remplies k = 0 => non,k = 1 => oui 
     
    Rem Rajout des déclarations correspondant à mon fichier Tableur
    Dim Document as object
    Dim Grille As Object
    Set Document = ThisComponent
     
    Grille = Document.Sheets.getByName("Grille")
    Rem -----------------------------------------------------------------------
     
    'La première valeur a être générée est forcément bonne, donc nous mettons k à 1.
    k = 1
     
    'Nous remplissons le tableau qui contient 9 valeurs de 0 à 8.
    For i = 0 to 8
            'nous vérifions les conditions suivantes: pas de valeur déjà tiré et pas de valeur égale à 0.
            If k = 0 then 
                    k = 1
                    i = i - 1
            end if
            'nous stockons la valeur aléatoire dans le tableau.
     
    Rem j'ai modifié la génération de la valeur aléatoire pour annuler le « 0 ».
     
            TableauValeurs (i) = Int((9 * Rnd))+1
            'si c'est le premier tirage, nous allons au tirage suivant.
            If i = 0 then
                    goto NextI
            end if 
            'nous vérifions que la dernière valeur stocké n'est pas égale à une valeur précédemment tirée et stockée
            For j = 0 to (i – 1)
     
    Rem positionnement de « print » des valeurs i et j qui permet de faire évoluer le programme pas à Rem pas et visualiser les valeurs de i et j
     
    	Print " i = " & i
            	Print " j = " & j
                    if TableauValeurs (i) = TableauValeurs (j) OR TableauValeurs (i) = 0 then
                            'si c'est le cas, nous mettons k à 0.
                            goto FauxNext                       
                    end if
     
    Rem Ecriture dans la grille de la valeur de TableauValeurs (i) à chaque boucle
    	Grille.getCellByPosition(i, j).value =	TableauValeurs (i)
     
    Rem j'utilise i et j pour changer de de colonne et de ligne ( i de 0 à 8, et j de 0 à  i – 1)
    Rem Cela met en évidence les différentes valeurs de i et j
    Rem Valeurs obtenues sur un essai :
      A B C D E F G H I  
    1   2 1 3 6 8 5 4 6
    2      1 3 6 8 5 4 6
    3        3 6 8 5 4 6
    4           6 8 5 4 6
    5              8 5 4
    6                5 4
    7                   4
     
    Rem les répétitions en vertical(j) montrent, par exemple, qu'il a fallut 7 itérations pour obtenir le 4.
    Rem Je n'obtiens que 8 valeurs et non 9 : j = i - 1
            next
            'si il n'y a pas d'égalité ou si la dernière valeur est différente de 0 alors nous allons au prochain tirage.
            goto NextI
    FauxNext:
            k=0
    NextI:
    next
    End sub

    2/ Correction du programme précédent utilisant Select Case :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    Option explicit
     
    Sub Aleatoire_2
     
    Dim Document as object
    Dim Grille As Object
    Set Document = ThisComponent
     
    rem Déclarations ------------------------------------------------------------------------------------
    Dim A1 as integer
    Dim B1 as integer
    Dim C1 as integer
    Dim D1 as integer
    Dim Num as integer
     
    Grille = Document.Sheets.getByName("Grille")
     
    rem Calcul valeurs -----------------------------------------------------------------------------
     
     
    A1 = Int(Rnd * 9)+1
    Print "A1 = " & A1
     
    Tirage_B1:
    Num = Int(Rnd * 9)+1
    Print "NUM = " & Num
    Select case Num
    Case A1
    	Print "GoTo tirage_B1"
    Case else
    	Print "B1 = Num"
    	B1 = Num
    end select
     
    Tirage_C1:
    Num = Int(Rnd * 9)+1
    Print "Num = " & Num
    Select case Num
    Case A1
    	Print "GoTo tirage_C1"
    	GoTo tirage_C1
    Case B1
    	Print "GoTo tirage_C1"
    	GoTo tirage_C1
    Case else
    	Print "C1 = Num"
    	C1 = Num
    end select
     
    Tirage_D1:
    Num = Int(Rnd * 9)+1
    Print Num
    Select case Num
    Case A1
    	Print "GoTo tirage_D1"
    	GoTo tirage_D1
    Case B1
    	Print "GoTo tirage_D1"
    	GoTo tirage_D1
    Case C1
    	Print "GoTo tirage_D1"
    	GoTo tirage_D1
    Case else
    	Print "D1 = Num"
    D1 = Num
    end select
     
     
    Rem Affectation des valeurs aux cellules -------------------------------------------------
    Grille.getCellByPosition(0, 0).value =	A1
    Grille.getCellByPosition(1, 0).value =	B1
    Grille.getCellByPosition(2, 0).value =	C1
    Grille.getCellByPosition(3, 0).value =	D1
    End sub
    J'ai positionné des "Print" intermédiaires ce qui permet de voir les tirages et les boucles.

    Je m'étais trompé dans la déclaration des "Case", il suffit d'écrire la valeur et non l'égalité après "Case"


    3/Extension du programme ci-dessus

    J'ai simplifié la déclaration des variables en laissant le langage choisir, c'est à dire en variant.
    Inutile de déclarer de 1 à 9, qui peut le plus, peut le moins.

    J'utilise l'instruction « GoTo », malgré tout, le code est clair, mais long, long !!!!

    Je pense que l'on peut mieux faire, raccourcir le code, utiliser des variables pour l'attribution des valeurs des cellules par exemple, mais cela se complique lorsque l'on s'approche de la fin.

    Mais mon objectif, que je dévoile ici, c'est de créer une grille de Sudoku !

    Sur mon ordinateur, le code beugue à partir de la cellule C3, donne une valeur de 10(je sais maintenant pourquoi, grâce à toi) et se bloque à la cellule D3 systématiquement.




    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    REM  *****  BASIC  *****
    Option explicit
     
    Sub Aleatoire_3
     
    Dim Document as object
    Dim Grille As Object
    Set Document = ThisComponent
     
    rem Déclarations ------------------------------------------------------------------------------------
    Dim A1 , B1, C1, D1, E1, F1, G1, H1, I1, J1
    Dim A2 , B2, C2, D2, E2, F2, G2, H2, I2, J2
    Dim A3 , B3, C3, D3, E3, F3, G3, H3, I3, J3
    Dim A4 , B4, C4, D4, E4, F4, G4, H4, I4, J4
    Dim A5 , B5, C5, D5, E5, F5, G5, H5, I5, J5
    Dim A6 , B6, C6, D6, E6, F6, G6, H6, I6, J6
    Dim A7 , B7, C7, D7, E7, F7, G7, H7, I7, J7
    Dim A8 , B8, C8, D8, E8, F8, G8, H8, I8, J8
    Dim A9 , B9, C9, D9, E9, F9, G9, H9, I9, J9
    Dim Num as integer
     
    Grille = Document.Sheets.getByName("Grille")
     
    rem Calcul valeurs -----------------------------------------------------------------------------
     
     
    A1 = Int(Rnd * 9)+1
     
     
    Tirage_B1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_B1
    Case else
    	B1 = Num
    End select
     
    Tirage_C1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_C1
    Case B1
    	GoTo tirage_C1
    Case else
    	C1 = Num
    End select
     
    Tirage_D1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_D1
    Case B1
    	GoTo tirage_D1
    Case C1
    	GoTo tirage_D1
    Case else
    	D1 = Num
    End select
     
    Tirage_E1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_E1
    Case B1
    	GoTo tirage_E1
    Case C1
    	GoTo tirage_E1
    Case D1
    	GoTo tirage_E1
    Case else
    	E1 = Num
    End select
     
    Tirage_F1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_F1
    Case B1
    	GoTo tirage_F1
    Case C1
    	GoTo tirage_F1
    Case D1
    	GoTo tirage_F1
    Case E1
    	GoTo tirage_F1
    Case else
    	F1 = Num
    End select
     
    Tirage_G1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_G1
    Case B1
    	GoTo tirage_G1
    Case C1
    	GoTo tirage_G1
    Case D1
    	GoTo tirage_G1
    Case E1
    	GoTo tirage_G1
    Case F1
    	GoTo tirage_G1
    Case else
    	G1 = Num
    End select
     
    Tirage_H1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_H1
    Case B1
    	GoTo tirage_H1
    Case C1
    	GoTo tirage_H1
    Case D1
    	GoTo tirage_H1
    Case E1
    	GoTo tirage_H1
    Case F1
    	GoTo tirage_H1
    Case G1
    	GoTo tirage_H1
    Case else
    	H1 = Num
    End select
     
    Tirage_I1:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_I1
    Case B1
    	GoTo tirage_I1
    Case C1
    	GoTo tirage_I1
    Case D1
    	GoTo tirage_I1
    Case E1
    	GoTo tirage_I1
    Case F1
    	GoTo tirage_I1
    Case G1
    	GoTo tirage_I1
    Case H1
    	GoTo tirage_I1
    Case else
    	I1 = Num
    End select
     
    Tirage_A2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_A2
    Case B1
    	GoTo tirage_A2
    Case C1
    	GoTo tirage_A2
    Case else
    	A2 = Num
    End select
     
    Tirage_B2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_B2
    Case B1
    	GoTo tirage_B2
    Case C1
    	GoTo tirage_B2
    Case A2
    	GoTo tirage_B2
    Case else
    	B2 = Num
    End select
     
    Tirage_C2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case A1
    	GoTo tirage_C2
    Case B1
    	GoTo tirage_C2
    Case C1
    	GoTo tirage_C2
    Case A2
    	GoTo tirage_C2
    Case B2
    	GoTo tirage_C2
    Case else
    	C2 = Num
    End select
     
    Tirage_D2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case D1
    	GoTo tirage_D2
    Case E1
    	GoTo tirage_D2
    Case F1
    	GoTo tirage_D2
    Case A2
    	GoTo tirage_D2
    Case B2
    	GoTo tirage_D2
    Case C2
    	GoTo tirage_D2
     
    Case else
    	D2 = Num
    End select
     
    Tirage_E2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case D1
    	GoTo tirage_E2
    Case E1
    	GoTo tirage_E2
    Case F1
    	GoTo tirage_E2
    Case A2
    	GoTo tirage_E2
    Case B2
    	GoTo tirage_E2
    Case C2
    	GoTo tirage_E2
    Case D2
    	GoTo tirage_E2
     
    Case else
    	E2 = Num
    End select
     
    Tirage_F2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case D1
    	GoTo tirage_F2
    Case E1
    	GoTo tirage_F2
    Case F1
    	GoTo tirage_F2
    Case A2
    	GoTo tirage_F2
    Case B2
    	GoTo tirage_F2
    Case C2
    	GoTo tirage_F2
    Case D2
    	GoTo tirage_F2
    Case E2
    	GoTo tirage_F2
    Case else
    	F2 = Num
    End select
     
    Tirage_G2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case G1
    	GoTo tirage_G2
    Case H1
    	GoTo tirage_G2
    Case I1
    	GoTo tirage_G2
    Case A2
    	GoTo tirage_G2
    Case B2
    	GoTo tirage_G2
    Case C2
    	GoTo tirage_G2
    Case D2
    	GoTo tirage_G2
    Case E2
    	GoTo tirage_G2
    Case F2
    	GoTo tirage_G2
    Case else
    	G2 = Num
    End select
     
    Tirage_H2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case G1
    	GoTo tirage_H2
    Case H1
    	GoTo tirage_H2
    Case I1
    	GoTo tirage_H2
    Case A2
    	GoTo tirage_H2
    Case B2
    	GoTo tirage_H2
    Case C2
    	GoTo tirage_H2
    Case D2
    	GoTo tirage_H2
    Case E2
    	GoTo tirage_H2
    Case F2
    	GoTo tirage_H2
    Case G2
    	GoTo tirage_H2
    Case else
    	H2 = Num
    End select
     
    Tirage_I2:
    Num = Int(Rnd * 9)+1
    Select case Num
    Case G1
    	GoTo tirage_I2
    Case H1
    	GoTo tirage_I2
    Case I1
    	GoTo tirage_I2
    Case A2
    	GoTo tirage_I2
    Case B2
    	GoTo tirage_I2
    Case C2
    	GoTo tirage_I2
    Case D2
    	GoTo tirage_I2
    Case E2
    	GoTo tirage_I2
    Case F2
    	GoTo tirage_I2
    Case G2
    	GoTo tirage_I2
    Case H2
    	GoTo tirage_I2
    Case else
    	I2 = Num
    End select
     
     
     
    Rem Affectation des valeurs aux cellules -------------------------------------------------
     
    rem ligne 1 ------------------------------
    Grille.getCellByPosition(0, 0).value =	A1
    Grille.getCellByPosition(1, 0).value =	B1
    Grille.getCellByPosition(2, 0).value =	C1
    Grille.getCellByPosition(3, 0).value =	D1
    Grille.getCellByPosition(4, 0).value =	E1
    Grille.getCellByPosition(5, 0).value =	F1
    Grille.getCellByPosition(6, 0).value =	G1
    Grille.getCellByPosition(7, 0).value =	H1
    Grille.getCellByPosition(8, 0).value =	I1
     
    rem ligne 2 ------------------------------
    Grille.getCellByPosition(0, 1).value =	A2
    Grille.getCellByPosition(1, 1).value =	B2
    Grille.getCellByPosition(2, 1).value =	C2
    Grille.getCellByPosition(3, 1).value =	D2
    Grille.getCellByPosition(4, 1).value =	E2
    Grille.getCellByPosition(5, 1).value =	F2
    Grille.getCellByPosition(6, 1).value =	G2
    Grille.getCellByPosition(7, 1).value =	H2
    Grille.getCellByPosition(8, 1).value =	I2
     
    End sub
    Et ainsi de suite ....
    Pascaltech

    Traduction : guides, manuels, normes : http://tradinfo.e-monsite.com/

  7. #7
    Membre actif

    Homme Profil pro
    Apprenti Langage C, pratiquant OpenOffice et Poo
    Inscrit en
    Février 2015
    Messages
    229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre (Centre)

    Informations professionnelles :
    Activité : Apprenti Langage C, pratiquant OpenOffice et Poo
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2015
    Messages : 229
    Points : 218
    Points
    218
    Par défaut
    Bonjour,

    J'ai traité différemment le sujet ci-dessous :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    REM  *****  BASIC  *****
    Option explicit
     
    Sub Sudoku
     
    Dim Document as object
    Dim Grille As Object
    Set Document = ThisComponent
     
    rem Déclarations ------------------------------------------------------------------------------------
    Dim A1 , B1, C1, D1, E1, F1, G1, H1, I1, J1
    Dim A2 , B2, C2, D2, E2, F2, G2, H2, I2, J2
    Dim A3 , B3, C3, D3, E3, F3, G3, H3, I3, J3
    Dim A4 , B4, C4, D4, E4, F4, G4, H4, I4, J4
    Dim A5 , B5, C5, D5, E5, F5, G5, H5, I5, J5
    Dim A6 , B6, C6, D6, E6, F6, G6, H6, I6, J6
    Dim A7 , B7, C7, D7, E7, F7, G7, H7, I7, J7
    Dim A8 , B8, C8, D8, E8, F8, G8, H8, I8, J8
    Dim A9 , B9, C9, D9, E9, F9, G9, H9, I9, J9
    Dim i as integer
    Dim j as integer
    Dim Num as integer
     
    Grille = Document.Sheets.getByName("Grille")
     
    rem Calcul valeurs -----------------------------------------------------------------------------
     
    For i = 0 to 8
    	For j = 0 to 8
    Tirage:
    	Num = Int(Rnd * 8)+1
     
    Select case i
    case 0
     Select case j
     case 0
     A1 = Num
     case 1
     A2 = Num
     if A2 = A1 then goto Tirage
     case 2
     A3 = Num
     if A3 = A1 or A3 = A2 then goto Tirage
     case 3
     A4 = Num
     if A4 = A1 or A4 = A2 then goto Tirage
     if A4 = A3 		   then goto Tirage
     case 4
     A5 = Num
     if A5 = A1 or A5 = A2 then goto Tirage
     if A5 = A3 or A5 = A4 then goto Tirage
     case 5
     A6 = Num
     if A6 = A1 or A6 = A2 then goto Tirage
     if A6 = A3 or A6 = A4 then goto Tirage
     if A6 = A5            then goto Tirage
     Case 6
     A7 = Num
     if A7 = A1 or A7 = A2 then goto Tirage
     if A7 = A3 or A7 = A4 then goto Tirage
     if A7 = A5 or A7 = A6 then goto Tirage
     case 7
     A8 = Num
     if A8 = A1 or A8 = A2 then goto Tirage
     if A8 = A3 or A8 = A4 then goto Tirage
     if A8 = A5 or A8 = A6 then goto Tirage
     if A8 =A7 			   then goto Tirage
     case 8
     A9 = 45 - (A1+A2+A3+A4+A5+A6+A7+A8)
     End select
     
    case 1
     Select case j ' Valeur ou type de donnée interdit. Index hors de la plage définie
     case 0
     B1 = Num
     if B1 = A1 or B1 = A2 then goto Tirage
     if B1 = A3            then goto Tirage
     case 1
     B2 = Num
     if B2 = A1 or B2 = A2 then goto Tirage
     if B2 = A3            then goto Tirage
     if B2 = B1            then goto Tirage
     case 2
     B3 = Num
     if B3 = A1 or B3 = A2 then goto Tirage
     if B3 = A3            then goto Tirage
     if B3 = B1 or B3 = B2 then goto Tirage
     case 3
     B4 = Num
     if B4 = A4 or B4 = A5 then goto Tirage
     if B4 = A6            then goto Tirage
     if B4 = B1 or B4 = B2 then goto Tirage
     if B4 = B3 	       then goto Tirage
     case 4
     B5 = Num
     if B5 = A4 or B5 = A5 then goto Tirage
     if B5 = A6            then goto Tirage
     if B5 = B1 or B5 = B2 then goto Tirage
     if B5 = B3 or B5 = B4 then goto Tirage
     case 5
     B6 = Num
     if B6 = A4 or B6 = A5 then goto Tirage
     if B6 = A6            then goto Tirage
     if B6 = B1 or B6 = B2 then goto Tirage
     if B6 = B3 or B6 = B4 then goto Tirage
     if B6 = B5            then goto Tirage
     case 6
     B7 = Num
     if B7 = A4 or B7 = A5 then goto Tirage
     if B7 = A6            then goto Tirage
     if B7 = B1 or B7 = B2 then goto Tirage
     if B7 = B3 or B7 = B4 then goto Tirage
     if B7 = B5 or B7 = B6 then goto Tirage
     case 7
     B8 = Num
     print " B8 = " & B8
     if B8 = A4 or B8 = A5 then goto Tirage
     if B8 = A6            then goto Tirage
     if B8 = B1 or B8 = B2 then goto Tirage
     if B8 = B3 or B8 = B4 then goto Tirage
     if B8 = B5 or B8 = B6 then goto Tirage
     if B8 =B7 	           then goto Tirage
     case 8
     B9 = 45 - (B1+B2+B3+B4+B5+B6+B7+B8)
     End select
     
    case 2
     Select case j ' Valeur ou type de donnée interdit. Index hors de la plage définie
     case 0
     C1 = Num
     if C1 = A1 or C1 = A2 then goto Tirage
     if C1 = A3            then goto Tirage
     if C1 = B1 or C1 = B2 then goto Tirage
     if C1 = B3 	       then goto Tirage
     case 1
     C2 = Num
     if C2 = A1 or C2 = A2 then goto Tirage
     if C2 = A3            then goto Tirage
     if C2 = B1 or C2 = B2 then goto Tirage
     if C2 = B3 	       then goto Tirage
     if C2 = C1            then goto Tirage
     case 2
     C3 = Num
     C3 = 45 - (A1+A2+A3+B1+B2+B3+C1+C2)
     case 3
     C4 = Num
     if C4 = A4 or C4 = A5 then goto Tirage
     if C4 = A6            then goto Tirage
     if C4 = B4 or C4 = B5 then goto Tirage
     if C4 = B6 	       then goto Tirage
     if C4 = C1 or C4 = C2 then goto Tirage
     if C4 = C3            then goto Tirage
     case 4
     C5 = Num
     if C5 = A4 or C5 = A5 then goto Tirage
     if C5 = A6            then goto Tirage
     if C5 = B4 or C5 = B5 then goto Tirage
     if C5 = B6 	       then goto Tirage
     if C5 = C1 or C5 = C2 then goto Tirage
     if C5 = C3 or C5 = C4 then goto Tirage
     case 5
     C6 = Num
     C6 = 45 - (A4+A5+A6+B4+B5+B6+C4+C5)
     case 6
     C7 = Num
     if C7 = A7 or C7 = A8 then goto Tirage
     if C7 = A9            then goto Tirage
     if C7 = B7 or C7 = B8 then goto Tirage
     if C7 = B9 	       then goto Tirage
     if C7 = C1 or C7 = C2 then goto Tirage
     if C7 = C3 or C7 = C4 then goto Tirage
     if C7 = C5 or C7 = C6 then goto Tirage
     case 7
     C8 = Num
     if C8 = A7 or C8 = A8 then goto Tirage
     if C8 = A9            then goto Tirage
     if C8 = B7 or C8 = B8 then goto Tirage
     if C8 = B9 	       then goto Tirage
     if C8 = C1 or C8 = C2 then goto Tirage
     if C8 = C3 or C8 = C4 then goto Tirage
     if C8 = C5 or C8 = C6 then goto Tirage
     if C8 = C7            then goto Tirage
     case 8
     C9 = Num
     C9 = 45 - (A7+A8+A9+B7+B8+B9+C7+C8)
     End select
    End select
     
        Next j
    Next i
     
     
    Rem Affectation des valeurs aux cellules -------------------------------------------------
     
    rem ligne 1 ------------------------------
    Grille.getCellByPosition(0, 0).value =	A1
    Grille.getCellByPosition(1, 0).value =	B1
    Grille.getCellByPosition(2, 0).value =	C1
    Grille.getCellByPosition(3, 0).value =	D1
    Grille.getCellByPosition(4, 0).value =	E1
    Grille.getCellByPosition(5, 0).value =	F1
    Grille.getCellByPosition(6, 0).value =	G1
    Grille.getCellByPosition(7, 0).value =	H1
    Grille.getCellByPosition(8, 0).value =	I1
     
    rem ligne 2 ------------------------------
    Grille.getCellByPosition(0, 1).value =	A2
    Grille.getCellByPosition(1, 1).value =	B2
    Grille.getCellByPosition(2, 1).value =	C2
    Grille.getCellByPosition(3, 1).value =	D2
    Grille.getCellByPosition(4, 1).value =	E2
    Grille.getCellByPosition(5, 1).value =	F2
    Grille.getCellByPosition(6, 1).value =	G2
    Grille.getCellByPosition(7, 1).value =	H2
    Grille.getCellByPosition(8, 1).value =	I2
     
    rem ligne 3 ------------------------------
    Grille.getCellByPosition(0, 2).value =	A3
    Grille.getCellByPosition(1, 2).value =	B3
    Grille.getCellByPosition(2, 2).value =	C3
    Grille.getCellByPosition(3, 2).value =	D3
    Grille.getCellByPosition(4, 2).value =	E3
    Grille.getCellByPosition(5, 2).value =	F3
    Grille.getCellByPosition(6, 2).value =	G3
    Grille.getCellByPosition(7, 2).value =	H3
    Grille.getCellByPosition(8, 2).value =	I3
     
    rem ligne 4 ------------------------------
    Grille.getCellByPosition(0, 3).value =	A4
    Grille.getCellByPosition(1, 3).value =	B4
    Grille.getCellByPosition(2, 3).value =	C4
    Grille.getCellByPosition(3, 3).value =	D4
    Grille.getCellByPosition(4, 3).value =	E4
    Grille.getCellByPosition(5, 3).value =	F4
    Grille.getCellByPosition(6, 3).value =	G4
    Grille.getCellByPosition(7, 3).value =	H4
    Grille.getCellByPosition(8, 3).value =	I4
     
    rem ligne 5 ------------------------------
    Grille.getCellByPosition(0, 4).value =	A5
    Grille.getCellByPosition(1, 4).value =	B5
    Grille.getCellByPosition(2, 4).value =	C5
    Grille.getCellByPosition(3, 4).value =	D5
    Grille.getCellByPosition(4, 4).value =	E5
    Grille.getCellByPosition(5, 4).value =	F5
    Grille.getCellByPosition(6, 4).value =	G5
    Grille.getCellByPosition(7, 4).value =	H5
    Grille.getCellByPosition(8, 4).value =	I5
     
    rem ligne 6 ------------------------------
    Grille.getCellByPosition(0, 5).value =	A6
    Grille.getCellByPosition(1, 5).value =	B6
    Grille.getCellByPosition(2, 5).value =	C6
    Grille.getCellByPosition(3, 5).value =	D6
    Grille.getCellByPosition(4, 5).value =	E6
    Grille.getCellByPosition(5, 5).value =	F6
    Grille.getCellByPosition(6, 5).value =	G6
    Grille.getCellByPosition(7, 5).value =	H6
    Grille.getCellByPosition(8, 5).value =	I6
     
    rem ligne 7 ------------------------------
    Grille.getCellByPosition(0, 6).value =	A7
    Grille.getCellByPosition(1, 6).value =	B7
    Grille.getCellByPosition(2, 6).value =	C7
    Grille.getCellByPosition(3, 6).value =	D7
    Grille.getCellByPosition(4, 6).value =	E7
    Grille.getCellByPosition(5, 6).value =	F7
    Grille.getCellByPosition(6, 6).value =	G7
    Grille.getCellByPosition(7, 6).value =	H7
    Grille.getCellByPosition(8, 6).value =	I7
     
    rem ligne 8 ------------------------------
    Grille.getCellByPosition(0, 7).value =	A8
    Grille.getCellByPosition(1, 7).value =	B8
    Grille.getCellByPosition(2, 7).value =	C8
    Grille.getCellByPosition(3, 7).value =	D8
    Grille.getCellByPosition(4, 7).value =	E8
    Grille.getCellByPosition(5, 7).value =	F8
    Grille.getCellByPosition(6, 7).value =	G8
    Grille.getCellByPosition(7, 7).value =	H8
    Grille.getCellByPosition(8, 7).value =	I8
     
    rem ligne 8 ------------------------------
    Grille.getCellByPosition(0, 8).value =	A9
    Grille.getCellByPosition(1, 8).value =	B9
    Grille.getCellByPosition(2, 8).value =	C9
    Grille.getCellByPosition(3, 8).value =	D9
    Grille.getCellByPosition(4, 8).value =	E9
    Grille.getCellByPosition(5, 8).value =	F9
    Grille.getCellByPosition(6, 8).value =	G9
    Grille.getCellByPosition(7, 8).value =	H9
    Grille.getCellByPosition(8, 8).value =	I9
     
     
    End sub
    J'ai compris pour quelle raison le programme génère l'erreur : "Valeur ou type de donnée interdit. Index hors de la plage définie"
    A partir de la case A9, je met la contrainte d'une sortie aléatoire alors qu'il ne reste qu'une seule possibilité pour A9. Cela génère une recherche en boucle infinie.
    J'ai remplacé la sélection de A9, ainsi que des 9èmes valeurs des autres lignes, par la somme de la ligne - les valeurs précédentes. (somme de ligne ou de colonne ou de bloc de 9 cases = 45)

    Le problème se pose ensuite pour le tirage de la cellule B8. 1 tirage sur 3 n'est pas résolu. Il faudrait pouvoir effectuer un tirage au sort sur les valeurs restantes.

    Je recherche maintenant avec la fonction "Choose".
    Pascaltech

    Traduction : guides, manuels, normes : http://tradinfo.e-monsite.com/

  8. #8
    Expert éminent
    Avatar de jurassic pork
    Homme Profil pro
    Bidouilleur
    Inscrit en
    Décembre 2008
    Messages
    3 953
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Bidouilleur
    Secteur : Industrie

    Informations forums :
    Inscription : Décembre 2008
    Messages : 3 953
    Points : 9 283
    Points
    9 283
    Par défaut
    hello,
    je ne voudrais pas jouer les rabat-joie mais il existe une extension openoffice ( ici ) qui génére des grilles de sudoku et leurs solutions. Il y avait un petit problème pour la faire fonctionner sous libreOffice 4.4 mais cela n'a pas été compliqué à résoudre :
    dans le début de la procédure main mettre les lignes suivantes en commentaire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Dok.Sheets.removeByName(Dok.Sheets(0).Name)
    Dok.Sheets.removeByName(Dok.Sheets(0).Name)
    pour mettre en français rajouter la procédure French :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    Sub French
    Na(0)="Puzzle"
    Na(1)="Solution"
    Na(2)="Exemple"
    Na(3)="Carrés vides : "
    Na(4)="""Différences entre solutions: """
    End Sub
    et modifier le code de la procédure Yazyk :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    	Case Else:
    	French
    	End Select
    End Sub
    Nom : sudoku.png
Affichages : 325
Taille : 38,5 Ko

    Ami calmant, J.P
    Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

  9. #9
    Membre actif

    Homme Profil pro
    Consultant informatique
    Inscrit en
    Septembre 2011
    Messages
    370
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2011
    Messages : 370
    Points : 251
    Points
    251
    Par défaut
    Bonjour Pascaltech,

    Je suis surpris que la variable doive être déclarée à nouveau dans la sous-routine.
    Chaque sous-routine est indépendante. il faut donc redéfinir les variable à chaque fois.
    Le seul moyen de ne pas avoir à déclarer les variables à chaque fois est de déclarer des variables "globales" ou "publiques".

    Je ne comprends pas ce que tu veux dire.
    Regarde ce lien, il est tres explicite "utilisation de procédure et de fonction"

    Oui, c'est juste. Rnd()*9 envoie des valeurs comprises entre 0 + 1 = 1 et (0,9999*9) + 1 = 8,9999 + 1 = 9,9999 (je ne sais pas jusqu'à quelle décimale), et comme c'est un entier, la valeur est arrondie à l'entier supérieur. J'étais persuadé que l'arrondi se faisait sur l'entier inférieur. Cela explique les valeurs 10 obtenues lors des essais.
    Rnd renvoie un nombre aléatoire entre 0 et 1. Si tu multiplies ce nombre par 9, tu obtiendras un nombre entre 0 et 9. D'ou le "(Rnd() * 8 ) + 1" pour avoir un nombre entre 1 et 9 (cf. fonction Rnd)

    Cordialement
    vandman

  10. #10
    Membre actif

    Homme Profil pro
    Apprenti Langage C, pratiquant OpenOffice et Poo
    Inscrit en
    Février 2015
    Messages
    229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre (Centre)

    Informations professionnelles :
    Activité : Apprenti Langage C, pratiquant OpenOffice et Poo
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2015
    Messages : 229
    Points : 218
    Points
    218
    Par défaut
    Bonjour,

    Merci Jurassic Pork pour la proposition (j'aime trop ton avatar!). J'essaierai cette extension. Je me suis fixé cet objectif à titre d'exercice alors tu comprendra que je vais continuer à chercher.

    Merci Vandman pour les précisions.

    Cordialement,

    Bon week end.
    Pascaltech

    Traduction : guides, manuels, normes : http://tradinfo.e-monsite.com/

  11. #11
    Membre actif

    Homme Profil pro
    Apprenti Langage C, pratiquant OpenOffice et Poo
    Inscrit en
    Février 2015
    Messages
    229
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Indre (Centre)

    Informations professionnelles :
    Activité : Apprenti Langage C, pratiquant OpenOffice et Poo
    Secteur : Industrie

    Informations forums :
    Inscription : Février 2015
    Messages : 229
    Points : 218
    Points
    218
    Par défaut
    Bonjour,

    Pour terminer le sujet, j'ai essayé de démonter le code de l'add-in fourni par Jurassic Pork.

    Je ne saurai pas expliquer quelle méthode a été utilisée pour obtenir une sortie aléatoire des chiffres formant la grille. C'est plutôt complexe.

    Voici le code d'origine :
    Le sub Dia correspond à la boîte de dialogue demandant de choisir la dimension de la grille et la difficulté. A l'issu du choix deux valeurs sont envoyées au Sub Main :
    NN correspond au nombre de cases x cases par bloc.
    SB correspond à la difficulté qui détermine le nombre de cases effacées.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
     
     
    Dim oDia As Object
    ------------------------------------------------------------------------------------------------
    Sub Dia
    Dim oL As Object
    oL = CreateUnoListener("oL_", "com.sun.star.awt.XTextListener")
    DialogLibraries.LoadLibrary("sudoku1")
    oDia = CreateUnoDialog(DialogLibraries.sudoku1.Dialog1)
    oDia.getControl("NumericField1").addTextListener(oL)
     
    If oDia.execute=1 then Main(oDia.getControl("NumericField1").Value, oDia.getControl("ScrollBar1").Value)
    oDia.getControl("NumericField1").removeTextListener(oL)
    End Sub
    ------------------------------------------------------------------------------------------------
    Sub oL_textChanged
    Strg = cStr(oDia.getControl("NumericField1").Value)
    oDia.getControl("Label1").setText(Strg+"×"+Strg)
    End Sub
    ------------------------------------------------------------------------------------------------
     
     
    Dim SP As Boolean
    Dim XN As Integer
    Dim Na(4) As String
    '------------------------------------------------------------------------------------------------
    Sub Main (NN As Integer, SB As Integer)
    XN = NN*NN
    Dim Dok As Object
    Dim A(XN-1,XN-1) As Integer
    Dim List(2) As Object
    Dim Tsvet(NN-1,NN-1) As Long
    Dim PN1(XN-1) As Integer
    Dim StRange As String
     
    Dok = StarDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, Array())
    Randomize
     
    j=3
    Dim ZN AS Integer
    While ZN<XN
    	ZN=j*(j-1)*(j-2)
    	j=j+1
    Wend
    ZN = j
    If ZN<NN then ZN=NN
     
    Dim RN(ZN-1) As Integer
    RN(0)=130+Int(125*rnd)
    For i=1 to ZN-1
    	RN(i)=130+(Int(RN(i-1)+10+20*rnd) mod 125)
    Next
     
    ji = 2+Int((ZN-1)*rnd)
    For i=0 to NN-1
    	For j=0 to NN-1
    		Tsvet(i,j) = RGB(RN(i),RN((i+j+1) mod ZN),RN((i+j+ji) mod ZN))
    	Next
    Next
    Dok.Sheets.removeByName(Dok.Sheets(0).Name)
    Dok.Sheets.removeByName(Dok.Sheets(0).Name)
    List(0)=Dok.Sheets(0)
     
    For i=0 to XN-1
    	List(0).Columns(i).Width = 1500
    	With List(0).Rows(i)
    		.Height = 1500
    		.HoriJustify = com.sun.star.table.CellHoriJustify.CENTER
    		.VertJustify = com.sun.star.table.CellVertJustify.CENTER
    		.CharHeight = 20
    		.CharColor = 0
    	End With
    	For j=0 to XN-1
    		List(0).getCellByPosition(i,j).CellBackColor = Tsvet(Int(i/NN),Int(j/NN))
    	Next
    Next
     
    CC = Dok.CurrentController
    StRange = "A1:"+List(0).Columns(XN-1).Name+cStr(XN)
    CC.Select(List(0).getCellRangeByName(StRange)
    document   = CC.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    dispatcher.executeDispatch(document, ".uno:AddPrintArea", "", 0, Array())
     
    dim args1(12) as new com.sun.star.beans.PropertyValue
    args1(0).Name = "OuterBorder.LeftBorder"
    args1(0).Value = Array(16777215,0,35,0)
    args1(1).Name = "OuterBorder.LeftDistance"
    args1(1).Value = 0
    args1(2).Name = "OuterBorder.RightBorder"
    args1(2).Value = Array(16777215,0,35,0)
    args1(3).Name = "OuterBorder.RightDistance"
    args1(3).Value = 0
    args1(4).Name = "OuterBorder.TopBorder"
    args1(4).Value = Array(16777215,0,35,0)
    args1(5).Name = "OuterBorder.TopDistance"
    args1(5).Value = 0
    args1(6).Name = "OuterBorder.BottomBorder"
    args1(6).Value = Array(16777215,0,35,0)
    args1(7).Name = "OuterBorder.BottomDistance"
    args1(7).Value = 0
    args1(8).Name = "InnerBorder.Horizontal"
    args1(8).Value = Array(16777215,0,35,0)
    args1(9).Name = "InnerBorder.Vertical"
    args1(9).Value = Array(16777215,0,35,0)
    args1(10).Name = "InnerBorder.Flags"
    args1(10).Value = 0
    args1(11).Name = "InnerBorder.ValidFlags"
    args1(11).Value = 127
    args1(12).Name = "InnerBorder.DefaultDistance"
    args1(12).Value = 0
     
    dispatcher.executeDispatch(document, ".uno:SetBorderStyle", "", 0, args1())
    CC.Select(List(0).getCellRangeByName(List(0).Columns(XN).Name+"1"))
     
    Dok.Sheets.copyByName(Dok.Sheets(0).Name, "1", createUnoValue("short", 1))
    Dok.Sheets.copyByName(Dok.Sheets(0).Name, "2", createUnoValue("short", 1))
     
    Yazyk
     
     
    For i=0 to 2
    	List(i) = Dok.Sheets(i)
    	Dok.Sheets(i).Name = Na(i)
    Next
     
    For i=0 to XN-1
    	PN1(i) = i+1
    	A(i,0)=i+1
    Next
    For j=1 to XN-1
    	YN = j*NN + Int(j/NN)
    	For i=0 to XN-1
    		A((i+YN) mod XN,j) = A(i,0)
    	Next
    Next
     
     
    Dim fx(XN-1) As Integer
    Dim fx3(XN-1,NN-1,1) As Integer
    Dim nx As Integer
    Dim PN2(XN-1) As Integer
    Dim PN3(NN-1,NN-1) As Integer
    Dim PN4(NN-1) As Integer
     
    i=0
    nx = Int(XN*rnd)
    PN2(0) = PN1(nx)
    fx(nx)=1
    While i<XN-1
    	nx = Int(XN*rnd)
    	If fx(nx)=0 then
    		i=i+1
    		PN2(i) = PN1(nx)
    		fx(nx)=1
    	Endif
    Wend
    For i=0 to NN-1
    	PN4(i) = i
    Next
    Dim PN5(XN-1,1) As Integer
     
    For k=0 to 1
    	For j=0 to NN-1
    		i=0
    		nx = Int(NN*rnd)
    		PN3(0,j) = PN4(nx)
    		fx3(nx,j,k)=1
    		While i<NN-1
    			nx = Int(NN*rnd)
    			If fx3(nx,j,k)=0 then
    				i=i+1
    				PN3(i,j) = PN4(nx)
    				fx3(nx,j,k)=1
    			Endif
    		Wend
    	Next
    	For i=0 to XN-1
    		zz = Int(i/NN)
    		PN5(i,k)=zz*NN+PN3(i mod NN, zz)
    	Next
    Next
     
    For i=0 to XN-1
    	For j=0 to XN-1
    		List(2).getCellByPosition(i,j).Value = A(i,j)
    	Next
    Next
     
    For i=0 to XN-1
    	For j=0 to XN-1
    		List(1).getCellByPosition(i,j).Value = PN2(A(PN5(i,0),PN5(j,1))-1)
    	Next
    Next
     
    For i=0 to XN-1
    	For j=0 to XN-1
    		List(0).getCellByPosition(i,j).Formula = "="+Na(1)+"."+List(0).Columns(i).Name+cStr(j+1)
    		List(0).getCellByPosition(i,j).CharColor = 0
    	Next
    Next
     
    rem Fin de XN-1 -------------------------------------------
     
     
    Dim M(SB-1) As Integer
    PN() = Array(2,3,5,7,11,13,17,19,23,29,31)
    Mx = 0
    For k=0 to SB-1
    	Do
    	Mx = (Mx+1+Int(4*rnd)) mod 11
    	Loop Until (NN mod PN(Mx))<>0
    	M(k) = PN(Mx)
    Next
    For j=0 to SB-1
    	For i=0 to (XN*XN)-1 step M(j)
    		List(0).getCellByPosition(Int(i/XN),i mod XN).Formula = ""
    		List(0).getCellByPosition(Int(i/XN),i mod XN).CharColor = 2302940
    	Next
    Next
    With List(0).Columns(XN+1)
    	.Width = 6000
    	.CharHeight = 12
    	.IsTextWrapped = TRUE
    	.HoriJustify = com.sun.star.table.CellHoriJustify.RIGHT
    	.VertJustify = com.sun.star.table.CellVertJustify.BOTTOM
    End With
    With List(0).Columns(XN+2)
    	.CharHeight = 12
    	.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT
    	.VertJustify = com.sun.star.table.CellVertJustify.BOTTOM
    End With
     
     
    List(0).getCellByPosition(XN+1,0).String = Na(3)
    List(0).getCellByPosition(XN+2,0).Formula = "="+cStr(XN*XN)+"-COUNTA("+StRange+")"
    List(0).getCellByPosition(XN+1,1).Formula = "=IF("+List(0).Columns(XN+2).Name+"1=0;"+Na(4)+";"""")"
    List(0).getCellByPosition(XN+2,1).ArrayFormula = "=IF("+List(0).Columns(XN+2).Name+"1=0;SUM(IF("+Na(0)+"."+StRange+"-"+Na(1)+"."+StRange+"=0;"""";1));"""")"
    List(0).getCellRangeByName(List(0).Columns(XN+1).Name+"1"+":"+List(0).Columns(XN+2).Name+"3").CellBackColor = RGB(200+50*rnd,200+50*rnd,200+50*rnd)
     
    Dok.setModified(FALSE)
    End Sub
    '------------------------------------------------------------------------------------------------
    Sub Yazyk
    	Dim OOYazyk As String	
    	Dim aSettings, aConfigProvider
    	Dim args2(0) As new com.sun.star.beans.PropertyValue
    	aConfigProvider = createUnoService( "com.sun.star.configuration.ConfigurationProvider" )
    	args2(0).Name = "nodepath"
    	args2(0).Value = "/org.openoffice.Setup/L10N"
    	aSettings = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args2() )
     
    	OOYazyk = aSettings.getByName("ooLocale")
    	OOYazyk =lCase(Left(Trim(OOYazyk),2))
     
    	Select Case OOYazyk	
    	Case "ru":
    	Russian
    	Case "uk":
    	English
    	Case "be":
    	French
    	Case Else:
        French
    	End Select
    End Sub
    '------------------------------------------------------------------------------------------------
    Sub Russian
    Na(0)="??????"
    Na(1)="???????"
    Na(2)="???????"
    Na(3)="?????? ??????: "
    Na(4)="""??????? ? ????????: """
    End Sub
    '------------------------------------------------------------------------------------------------
    Sub English
    Na(0)="Puzzle"
    Na(1)="Solution"
    Na(2)="Sample"
    Na(3)="Empty squares: "
    Na(4)="""Differences between solutions: """
    End Sub
    '------------------------------------------------------------------------------------------------
    Sub French
    Na(0)="Puzzle"
    Na(1)="Solution"
    Na(2)="Exemple"
    Na(3)="Carrés vides : "
    Na(4)="""Différences entre solutions: """
    End Sub
    '------------------------------------------------------------------------------------------------
    Voici le même code documenté qui permet de générer une page d'information sur les variables utilisées. A lancer avec un nouveau classeur, un 3 feuilles )


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    REM  *****  BASIC  *****
    Dim XN As Integer
    Dim Na(4) As String
    Sub Main '(NN As Integer, SB As Integer)
    rem NN  Nombre de cases*cases par bloc : reçu par Sub Dia
    rem SB correspond à la difficulté : reçu par Sub Dia
    Dim NN as integer
    Dim SB as integer
    NN = 3
    SB = 2
     
    Dim Dok as object
    Set Dok = ThisComponent
     
    XN = NN*NN
     
    Dim List(2) As Object
    Dim A(XN-1,XN-1) As Integer
    Dim Tsvet(NN-1,NN-1) As Long
    Dim PN1(XN-1) As Integer
    Dim fx(XN-1) As Integer
    Dim fx3(XN-1,NN-1,1) As Integer
    Dim nx As Integer
    Dim PN2(XN-1) As Integer
    Dim PN3(NN-1,NN-1) As Integer
    Dim PN4(NN-1) As Integer
    Dim PN5(XN-1,1) As Integer
    Dim StRange As String
    Randomize
     
    lig = 1 		' Définition du numéro de ligne pour affichage
    col = 1 		' Définition du numéro de colonnes pour affichage
     
    	j=3
    Dim ZN AS Integer	
    		While ZN<XN
    		ZN=j*(j-1)*(j-2)
    		j=j+1
    		Wend
    	ZN = j
    If ZN<NN then ZN=NN
    Dim RN(ZN-1) As Integer
    Dok.Sheets.removeByName(Dok.Sheets(2).Name)
    Dok.sheets.insertNewByName(1,2)
    Dok.Sheets.insertNewByName(2,3)
    Dok.Sheets.insertNewByName(3,4)
    Dok.Sheets.insertNewByName("Liste données",5)
    feuille = Dok.Sheets.getByIndex(5)
     
    rem Fin Affichage --------------------------------------------
    	lig = 1
    	Col = 1
    	feuille.getCellByPosition(0, lig).String = "NN : Nombre de cases*cases par bloc"
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "NN ="
    	col = col + 1
    	feuille.getCellByPosition(col, lig).value = NN
    	lig = lig + 1
    	col = 1
    	feuille.getCellByPosition(col, lig).String = "XN ="
    	col = col + 1	
    	feuille.getCellByPosition(col, lig).value =  XN
    	lig = lig + 1
    	col = 1
    	feuille.getCellByPosition(col, lig).String = "ZN ="
    	col = col + 1	
    	feuille.getCellByPosition(col, lig).value =  ZN
    	lig = lig + 1
    	col = 1
    	lig = lig + 1
    rem Fin Affichage --------------------------------------------
     
    RN(0)=130+Int(125*rnd)
     
    rem Affichage ------------------------------------------------
    	col = 2
    	feuille.getCellByPosition(col, lig).String = "(i)"
    	lig = lig + 1
    	col = 1
    	feuille.getCellByPosition(0, lig).String = "RN(i)=130+(Int(RN(i-1)+10+20*rnd) mod 125)"
    	ligne = ligne + 1
    rem Fin Affichage --------------------------------------------
     
    For i =1 to ZN-1
    	RN(i)=130+(Int(RN(i-1)+10+20*rnd) mod 125)
     
    rem Affichage ------------------------------------------------
    	feuille.getCellByPosition(col, lig).String = "RN(" & i &") ="
    	col = col + 1
    	feuille.getCellByPosition(col, lig).value =  i
    	col = col + 1
     	feuille.getCellByPosition(col, lig).value = RN(i)
    	lig = lig + 1
    	col = 1
    rem Fin Affichage --------------------------------------------
     
    Next
     
    rem Affichage ------------------------------------------------
    	lig = lig + 1
    	col = 1 	
     	feuille.getCellByPosition(0, lig).String = "ji = 2+Int((ZN-1)*rnd)"
    	lig = lig + 1
     	feuille.getCellByPosition(col, lig).String = "(ZN-1) ="
     	col = col + 1
     	feuille.getCellByPosition(col, lig).value = ZN-1
    	lig = lig + 1
    	col = 1
     	feuille.getCellByPosition(col, lig).String = "Int((ZN-1)*rnd) ="
     	col = col + 1
     	feuille.getCellByPosition(col, lig).value = Int((ZN-1)*rnd)
    	lig = lig + 1
    	col = 1
    rem Fin Affichage --------------------------------------------
     
    ji = 2+Int((ZN-1)*rnd)
     
    rem Affichage ------------------------------------------------
    	feuille.getCellByPosition(col, lig).String = "ji ="
    	col = col + 1
     	feuille.getCellByPosition(col, lig).value = ji
    	lig = lig + 1
    	lig = lig + 1
    	feuille.getCellByPosition(0, lig).String = "Tsvet(i,j) donne la couleur des cases"
    	lig = lig + 1
    	feuille.getCellByPosition(0, lig).String = "Tsvet(i,j) = RGB(RN(i),RN((i+j+1) mod ZN),RN((i+j+ji) mod ZN))"
    	lig = lig + 1
    	col = 1
    	feuille.getCellByPosition(col, lig).String = "NN-1 ="
    	col = col + 1
    	feuille.getCellByPosition(col, lig).value = NN-1
    	lig = lig + 1
    	col = 1
    	feuille.getCellByPosition(col, lig).String = "i ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "j ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "RN(i) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "RN((i+j+1) mod ZN) = "
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "RN((i+j+ji) mod ZN) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "Red ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "Green ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "Blue ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "Tsvet(i,j) ="
    	col = 2
    rem Fin Affichage --------------------------------------------
     
    For i =1 to NN-1
    	For j=0 to NN-1
    		Tsvet(i,j) = RGB(RN(i),RN((i+j+1) mod ZN),RN((i+j+ji) mod ZN))
    		RN(i) = 130+(Int(RN(i-1)+10+20*rnd) mod 125)
    		RN((i+j+1) mod ZN) = 130+(Int(RN(i-1)+10+20*rnd) mod 125)
    		RN((i+j+ji) mod ZN) = 130+(Int(RN(i-1)+10+20*rnd) mod 125)
    		RGB1 = RN(i)
    		RGB2 = RN((i+j+1) mod ZN)
    		RGB3 = RN((i+j+ji) mod ZN)
     
    rem Affichage ------------------------------------------------
    	lig = lig - 8
     	feuille.getCellByPosition(col, lig).value = i
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = j
    	lig = lig + 1
     	feuille.getCellByPosition(col, lig).value = RN(i)
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = RN((i+j+1) mod ZN)
    	lig = lig + 1
     	feuille.getCellByPosition(col, lig).value = RN((i+j+ji) mod ZN)
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = RGB1
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = RGB2
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = RGB3	
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = Tsvet(i,j)
    	col = col + 1	
    rem Fin Affichage --------------------------------------------
     
    	Next
    Next
    Dok.Sheets.removeByName(Dok.Sheets(0).Name)
    Dok.Sheets.removeByName(Dok.Sheets(0).Name)
    List(0)=Dok.Sheets(0)
    rem Affichage ------------------------------------------------
    	Col = 1
    	lig = lig + 2
    	feuille.getCellByPosition(col, lig).String = "(i) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "PN1(i) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "A(i,0) ="
    	col = 2	
    rem Fin Affichage --------------------------------------------
    For i=0 to 2
    	List(i) = Dok.Sheets(i)
    	Dok.Sheets(i).Name = Na(i)
    next
    For i =0 to XN-1
    	PN1(i) = i+1
    	A(i,0)= i+1
     
    rem Affichage ------------------------------------------------
    	lig = lig - 2
    	feuille.getCellByPosition(col, lig).value = i
    	lig = lig + 1	
    	feuille.getCellByPosition(col, lig).value = PN1(i)
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = A(i,0)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    Next
     
    rem Affichage ------------------------------------------------
    	col = 1
    	lig = lig + 2
    	feuille.getCellByPosition(col, lig).String = "(i) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "YN ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "(i+YN) mod XN ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "A((i+YN) mod XN,j) ="
    	col = 2
    rem Fin Affichage --------------------------------------------
     
    For j=1 to XN-1
    	YN = j*NN + Int(j/NN)
    	For i =0 to XN-1
    		A((i+YN) mod XN,j) = A(i,0)
     
    rem Affichage ------------------------------------------------
    	lig = lig - 3
    	feuille.getCellByPosition(col, lig).value = i
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = YN
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = (i+YN) mod XN
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = A((i+YN) mod XN,j)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    	Next i
    Next j
     
     
     
     
     
    rem Affichage ------------------------------------------------
    	col = 1
    	lig = lig + 2
    	feuille.getCellByPosition(col, lig).String = "(i) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "nx ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "PN2(XN-1) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "fx(XN-1) ="
    	col = 2
    rem Fin Affichage --------------------------------------------
     
    i=0
    nx = Int(XN*rnd)
    PN2(0) = PN1(nx)
    fx(nx)=1
    While i<XN-1
    	nx = Int(XN*rnd)
    	If fx(nx)=0 then
    		i=i+1
    		PN2(i) = PN1(nx)
    		fx(nx)=1
     
    rem Affichage ------------------------------------------------
    	lig = lig - 3
    	feuille.getCellByPosition(col, lig).value = i
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = nx
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = PN2(i)
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = fx(nx)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    	Endif
    Wend
     
    rem Affichage ------------------------------------------------
    	lig = lig + 2
    	col = 1
    	feuille.getCellByPosition(col, lig).String = "XN-1 ="
    	col = col + 1
    	feuille.getCellByPosition(col, lig).value = XN-1
    	lig = lig + 2
    	col = 1
    	feuille.getCellByPosition(col, lig).String = "PN4(NN-1) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "(NN-1) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "i ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "j ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "k ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "PN3(NN-1,NN-1) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "nx ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "fx(XN-1) ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "fx3(XN-1,NN-1,1) ="
    	lig = lig + 2
    	feuille.getCellByPosition(col, lig).String = "i ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "k ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "zz ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "NN ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "i mod NN ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).String = "NN-1 ="
    	lig = lig + 1
    	feuille.getCellByPosition(0, lig).String = "PN5(XN-1,1), PN5(i,k)=zz*NN+PN3(i mod NN,zz)"
    	feuille.getCellByPosition(col, lig).String = "PN5(XN-1,1) ="
    	col = 2
    	lig = lig - 16
    rem Fin Affichage --------------------------------------------
     
    For i=0 to NN-1
    	PN4(i) = i
     
    rem Affichage boucle -----------------------------------------
    	feuille.getCellByPosition(col, lig).value = PN4(i)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    Next
     
    rem Affichage ------------------------------------------------
    	col = 2
    	lig = lig + 1
    rem Fin Affichage --------------------------------------------
     
    For k=0 to 1
    	For j=0 to NN-1
    		i=0
    		nx = Int(NN*rnd)
    		PN3(0,j) = PN4(nx)
    		fx3(nx,j,k)=1
    		While i<NN-1
    			nx = Int(NN*rnd)
    			If fx3(nx,j,k)=0 then
    				i=i+1
    				PN3(i,j) = PN4(nx)
    				fx3(nx,j,k)=1
    			Endif
    		Wend
    rem Affichage boucle -----------------------------------------
    	feuille.getCellByPosition(col, lig).value = NN-1
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = i
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = j
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = k
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = PN3(0,j)
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = nx
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = fx(nx)
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = fx3(nx,j,k)
    	col = col + 1
    	lig = lig - 7
    rem Fin Affichage --------------------------------------------
     
    	Next
     
    rem Affichage ------------------------------------------------
    	lig = lig + 9
    rem Fin Affichage --------------------------------------------
     
    For i=0 to XN-1
    	zz = Int(i/NN)
     
    rem Affichage boucle -----------------------------------------
    	feuille.getCellByPosition(col, lig).value = i
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = k
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = zz
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = NN
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = i mod NN
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = NN-1
    	lig = lig + 2
    rem Fin Affichage --------------------------------------------
     
    	PN5(i,k)=zz*NN+PN3(i mod NN,zz)
     
    rem Affichage ------------------------------------------------
     
    	feuille.getCellByPosition(col, lig).value = PN5(i,k)
    	col = col + 1
    	lig = lig - 7
    rem Fin Affichage --------------------------------------------
     
    	Next
    	lig = lig - 9
    	col = col + 1
    Next k
     
    rem Affichage ------------------------------------------------
     
    	col = 1
    	lig = lig + 16
    	feuille.getCellByPosition(0, lig).string = "List(2).getCellByPosition(i,j).Value = A(i,j)"
    	feuille.getCellByPosition(col, lig).string = "List(2)"
    	col = col + 1
    		print "Définition grille sur feuille3"
    rem Fin Affichage --------------------------------------------
     
    For i =0 to XN-1
    	For j=0 to XN-1
    		List(2).getCellByPosition(i,j).Value = A(i,j)
     
    rem Affichage ------------------------------------------------
     
    	feuille.getCellByPosition(col, lig).value = A(i,j)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    	Next
    Next
     
    rem Affichage ------------------------------------------------
    col = 1
    lig = lig + 1
    	feuille.getCellByPosition(0, lig).string = "List(1).getCellByPosition(i,j).Value = PN2(A(PN5(i,0),PN5(j,1))-1)"
    	feuille.getCellByPosition(col, lig).string = "List(1)"
    	col = col + 1
    		print "Définition grille sur feuille2"
    rem Fin Affichage --------------------------------------------
     
    For i =0 to XN-1
    	For j=0 to XN-1
    		List(1).getCellByPosition(i,j).Value = PN2(A(PN5(i,0),PN5(j,1))-1)
     
    rem Affichage ------------------------------------------------
     
    	feuille.getCellByPosition(col, lig).value = PN2(A(PN5(i,0),PN5(j,1))-1)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    	Next
    Next
     
    rem Affichage ------------------------------------------------
    col = 1
    lig = lig + 1
    	feuille.getCellByPosition(0, lig).string = "List(0).getCellByPosition(i,j).Formula = ''=''+Na(1)+''.''+List(0).Columns(i).Name+cStr(j+1)"
    	feuille.getCellByPosition(col, lig).string = "List(0)"
    	col = col + 1
    		print "Définition grille sur feuille1"
    rem Fin Affichage --------------------------------------------
     
    For i =0 to XN-1
    	For j=0 to XN-1
    rem 						   code remplacé : = "="+Na(1)+"."+List(0).Columns(i).Name+cStr(j+1)
    		List(0).getCellByPosition(i,j).Formula = "="+2+"."+List(0).Columns(i).Name+cStr(j+1)
    		List(0).getCellByPosition(i,j).CharColor = 0
     
    rem Affichage ------------------------------------------------
     
    	feuille.getCellByPosition(col, lig).value = "="+2+"."+List(0).Columns(i).Name+cStr(j+1)
    	col = col + 1
    rem Fin Affichage --------------------------------------------
     
    	Next
    Next
     
    rem Affichage ------------------------------------------------
    	Col = 1
    	lig = lig + 2
    	feuille.getCellByPosition(col, lig).string = "Mx ="
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).string = "NN mod PN(Mx) ="
    	col = col + 1
    	lig = lig - 1
    rem Fin Affichage --------------------------------------------
     
    Dim M(SB-1) As Integer
    PN() = Array(2,3,5,7,11,13,17,19,23,29,31)
    Mx = 0
    For k=0 to SB-1
    	Do
    	Mx = (Mx+1+Int(4*rnd)) mod 11
     
    rem Affichage ------------------------------------------------
    	feuille.getCellByPosition(col, lig).value = Mx
    	lig = lig + 1
    	feuille.getCellByPosition(col, lig).value = NN mod PN(Mx)
    	col = col + 1
    	lig = lig - 1
    rem Fin Affichage --------------------------------------------
     
    	Loop Until (NN mod PN(Mx))<>0
    	M(k) = PN(Mx) ' M = pas d'effacement
    Next
     
    rem Effacement des cases selon le pas M(j):
    For j=0 to SB-1
    	For i=0 to (XN*XN)-1 step M(j)
    		List(0).getCellByPosition(Int(i/XN),i mod XN).Formula = ""
    		List(0).getCellByPosition(Int(i/XN),i mod XN).CharColor = 2302940
    	Next
    Next
    With List(0).Columns(XN+1)
    	.Width = 6000
    	.CharHeight = 12
    	.IsTextWrapped = TRUE
    	.HoriJustify = com.sun.star.table.CellHoriJustify.RIGHT
    	.VertJustify = com.sun.star.table.CellVertJustify.BOTTOM
    End With
    With List(0).Columns(XN+2)
    	.CharHeight = 12
    	.HoriJustify = com.sun.star.table.CellHoriJustify.LEFT
    	.VertJustify = com.sun.star.table.CellVertJustify.BOTTOM
    End With
     
     
    List(0).getCellByPosition(XN+1,0).String = Na(3)
    List(0).getCellByPosition(XN+2,0).Formula = "="+cStr(XN*XN)+"-COUNTA("+StRange+")"
    List(0).getCellByPosition(XN+1,1).Formula = "=IF("+List(0).Columns(XN+2).Name+"1=0;"+Na(4)+";"""")"
    List(0).getCellByPosition(XN+2,1).ArrayFormula = "=IF("+List(0).Columns(XN+2).Name+"1=0;SUM(IF("+Na(0)+"."+StRange+"-"+Na(1)+"."+StRange+"=0;"""";1));"""")"
    List(0).getCellRangeByName(List(0).Columns(XN+1).Name+"1"+":"+List(0).Columns(XN+2).Name+"3").CellBackColor = RGB(200+50*rnd,200+50*rnd,200+50*rnd)
     
    Dok.setModified(FALSE)
     
    End Sub
    J'ai fait l'impasse sur la mise en forme. Bon courage. Merci de me dire si vous comprenez l'algorithme.

    Pascaltech
    Pascaltech

    Traduction : guides, manuels, normes : http://tradinfo.e-monsite.com/

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [LDAP] Impossible de faire une requête avec plus de 1 condition
    Par mower666 dans le forum Bibliothèques et frameworks
    Réponses: 0
    Dernier message: 15/02/2013, 11h24
  2. Réponses: 0
    Dernier message: 17/09/2009, 23h37
  3. Réponses: 10
    Dernier message: 17/04/2008, 14h29
  4. Probleme avec COUNT() contenant une condition
    Par smarties dans le forum Requêtes
    Réponses: 1
    Dernier message: 26/07/2007, 10h19
  5. Réponses: 3
    Dernier message: 31/08/2006, 16h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo