Private Function Trouvé(ByVal Niv As Long) As Boolean
Dim M As Long, LAtJ As ListeAléat, PJ As Long, J As Long, _
L As Long, LAtG As ListeAléat, PG As Long, G As Long
UFmVisu.Montre Niv / NivMax
M = Niv \ NbEQu + 1: L = Niv Mod NbEQu + 1: Set LAtJ = TLAtJ(M): Set LAtG = TLAtG(M)
If L = 1 And M > 1 And NbGages >= 2 * NbEQu Then
LAtG.Init NbGages: For L = 1 To NbEQu: LAtG.Supprimer TTir(M - 1, L, 2): Next L
L = Niv Mod NbEQu + 1: End If
Do: If UFmVisu.Abandon Then Exit Function
PJ = PJ + 1: J = LAtJ.Aléat(PJ): If J = 0 Then Exit Function
If TNbRenc(L, J) Then
PG = 0: Do: PG = PG + 1: G = LAtG.Aléat(PG): If G = 0 Then Exit Function
Loop While TGAttr(1, L, G) Or TGAttr(2, J, G)
LAtJ.Supprimer J: TNbRenc(L, J) = TNbRenc(L, J) - 1: LAtG.Supprimer G: TGAttr(1, L, G) = True: TGAttr(2, J, G) = True
TTir(M, L, 1) = J: TTir(M, L, 2) = G
If Niv >= NivMax Then Trouvé = True: Exit Function
Trouvé = Trouvé(Niv + 1): If Trouvé Then Exit Function
LAtJ.Remettre J, PJ: TNbRenc(L, J) = TNbRenc(L, J) + 1: LAtG.Remettre G, PG: TGAttr(1, L, G) = False: TGAttr(2, J, G) = False
End If
Loop
End Function