Taquin

Soyez le premier à donner votre avis sur cette source.

Vue 6 650 fois - Téléchargée 451 fois

Description


Source / Exemple :


Private Sub Bt_melanger_Click()
Dim bt(9), num(9)
For i = 1 To 9
bt(9) = 0
num(9) = 0
Next

For i = 1 To 9
a = Int(Rnd() * 10)
If a = 0 Then a = 1
While bt(a) <> 0
a = (a + 1) Mod 10
If a = 0 Then a = 1
Wend
bt(a) = a
num(i) = a
Next

Bt1.Caption = num(1)
If Bt1.Caption = (9) Then Bt1.Visible = False Else Bt1.Visible = True

Bt2.Caption = num(2)
If Bt2.Caption = (9) Then Bt2.Visible = False Else Bt2.Visible = True

Bt3.Caption = num(3)
If Bt3.Caption = (9) Then Bt3.Visible = False Else Bt3.Visible = True

Bt4.Caption = num(4)
If Bt4.Caption = (9) Then Bt4.Visible = False Else Bt4.Visible = True

Bt5.Caption = num(5)
If Bt5.Caption = (9) Then Bt5.Visible = False Else Bt5.Visible = True

Bt6.Caption = num(6)
If Bt6.Caption = (9) Then Bt6.Visible = False Else Bt6.Visible = True

Bt7.Caption = num(7)
If Bt7.Caption = (9) Then Bt7.Visible = False Else Bt7.Visible = True

Bt8.Caption = num(8)
If Bt8.Caption = (9) Then Bt8.Visible = False Else Bt8.Visible = True

Bt9.Caption = num(9)
If Bt9.Caption = (9) Then Bt9.Visible = False Else Bt9.Visible = True

End Sub

Private Sub Bt_trier_Click()
Bt1.Visible = True
Bt2.Visible = True
Bt3.Visible = True
Bt4.Visible = True
Bt5.Visible = True
Bt6.Visible = True
Bt7.Visible = True
Bt8.Visible = True
Bt9.Visible = False

Bt1.Caption = "1"
Bt2.Caption = "2"
Bt3.Caption = "3"
Bt4.Caption = "4"
Bt5.Caption = "5"
Bt6.Caption = "6"
Bt7.Caption = "7"
Bt8.Caption = "8"
Bt9.Caption = "9"

End Sub

Private Sub Bt1_Click()
If Bt2.Visible = False Then
Bt2.Visible = True
Bt2.Caption = Bt1.Caption
Bt1.Caption = "9"
Bt1.Visible = False
Call verif
End If

If Bt4.Visible = False Then
Bt4.Visible = True
Bt4.Caption = Bt1.Caption
Bt1.Caption = "9"
Bt1.Visible = False
Call verif
End If
End Sub

Private Sub Bt2_Click()
If Bt1.Visible = False Then
Bt1.Visible = True
Bt1.Caption = Bt2.Caption
Bt2.Caption = "9"
Bt2.Visible = False
Call verif
End If

If Bt3.Visible = False Then
Bt3.Visible = True
Bt3.Caption = Bt2.Caption
Bt2.Caption = "9"
Bt2.Visible = False
Call verif
End If

If Bt5.Visible = False Then
Bt5.Visible = True
Bt5.Caption = Bt2.Caption
Bt2.Caption = "9"
Bt2.Visible = False
Call verif
End If
End Sub

Private Sub Bt3_Click()
If Bt2.Visible = False Then
Bt2.Visible = True
Bt2.Caption = Bt3.Caption
Bt3.Caption = "9"
Bt3.Visible = False
Call verif
End If

If Bt6.Visible = False Then
Bt6.Visible = True
Bt6.Caption = Bt3.Caption
Bt3.Caption = "9"
Bt3.Visible = False
Call verif
End If
End Sub

Private Sub Bt4_Click()
If Bt1.Visible = False Then
Bt1.Visible = True
Bt1.Caption = Bt4.Caption
Bt4.Caption = "9"
Bt4.Visible = False
Call verif
End If

If Bt5.Visible = False Then
Bt5.Visible = True
Bt5.Caption = Bt4.Caption
Bt4.Caption = "9"
Bt4.Visible = False
Call verif
End If

If Bt7.Visible = False Then
Bt7.Visible = True
Bt7.Caption = Bt4.Caption
Bt4.Caption = "9"
Bt4.Visible = False
Call verif
End If
End Sub

Private Sub Bt5_Click()
If Bt2.Visible = False Then
Bt2.Visible = True
Bt2.Caption = Bt5.Caption
Bt5.Caption = "9"
Bt5.Visible = False
Call verif
End If

If Bt4.Visible = False Then
Bt4.Visible = True
Bt4.Caption = Bt5.Caption
Bt5.Caption = "9"
Bt5.Visible = False
Call verif
End If

If Bt6.Visible = False Then
Bt6.Visible = True
Bt6.Caption = Bt5.Caption
Bt5.Caption = "9"
Bt5.Visible = False
Call verif
End If

If Bt8.Visible = False Then
Bt8.Visible = True
Bt8.Caption = Bt5.Caption
Bt5.Caption = "9"
Bt5.Visible = False
End If
End Sub

Private Sub Bt6_Click()
If Bt3.Visible = False Then
Bt3.Visible = True
Bt3.Caption = Bt6.Caption
Bt6.Caption = "9"
Bt6.Visible = False
Call verif
End If

If Bt5.Visible = False Then
Bt5.Visible = True
Bt5.Caption = Bt6.Caption
Bt6.Caption = "9"
Bt6.Visible = False
Call verif
End If

If Bt9.Visible = False Then
Bt9.Visible = True
Bt9.Caption = Bt6.Caption
Bt6.Caption = "9"
Bt6.Visible = False
Call verif
End If
End Sub

Private Sub Bt7_Click()
If Bt4.Visible = False Then
Bt4.Visible = True
Bt4.Caption = Bt7.Caption
Bt7.Caption = "9"
Bt7.Visible = False
Call verif
End If

If Bt8.Visible = False Then
Bt8.Visible = True
Bt8.Caption = Bt7.Caption
Bt7.Caption = "9"
Bt7.Visible = False
Call verif
End If
End Sub

Private Sub Bt8_Click()
If Bt5.Visible = False Then
Bt5.Visible = True
Bt5.Caption = Bt8.Caption
Bt8.Caption = "9"
Bt8.Visible = False
Call verif
End If

If Bt7.Visible = False Then
Bt7.Visible = True
Bt7.Caption = Bt8.Caption
Bt8.Caption = "9"
Bt8.Visible = False
Call verif
End If

If Bt9.Visible = False Then
Bt9.Visible = True
Bt9.Caption = Bt8.Caption
Bt8.Caption = "9"
Bt8.Visible = False
Call verif
End If
End Sub

Private Sub Bt9_Click()
If Bt6.Visible = False Then
Bt6.Visible = True
Bt6.Caption = Bt9.Caption
Bt9.Caption = "9"
Bt9.Visible = False
Call verif
End If

If Bt8.Visible = False Then
Bt8.Visible = True
Bt8.Caption = Bt9.Caption
Bt9.Caption = "9"
Bt9.Visible = False
Call verif
End If
End Sub
Private Sub verif()
Dim m
If Bt1.Caption = "1" And Bt2.Caption = "2" And Bt3.Caption = "3" And Bt4.Caption = "4" And Bt5.Caption = "5" And Bt6.Caption = "6" And Bt7.Caption = "7" And Bt8.Caption = "8" Then
For i = 1 To 2
OpenForms = DoEvents
Next
m = MsgBox("Terminé", vbOKOnly, "Gagné", a, a)
End If
End Sub

Private Sub Command1_Click()
End
End Sub

Conclusion :


Un jeu de taquin bien sympa

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.