Public init As Boolean
Dim tabl2() As Integer
Public nbmin As Integer
Public cmp As Integer
Public m As Integer
Public a As Integer
Public vict As Integer
Private Sub Form_Load()
' reglage effet sonore
MMControl1.Notify = False
MMControl1.Wait = False
MMControl1.Shareable = False
MMControl1.DeviceType = "WaveAudio"
expert.Checked = False
normale.Checked = False
nbmin = 100
Timer1.Interval = 1
Text1.Text = "Bien venu sur la terre 'MODITE'!!"
Timer2.Interval = 1
Timer3.Enabled = False
MMControl1.FileName = "C:\Documents and Settings\halim\Bureau\vbprojet\wav\horreur.wav"
son
End Sub
Private Sub Command1_Click(Index As Integer)
Text1.Text = "C pas mal continue!!"
Command1(Index).Visible = False
b = Command2(Index).Caption
If b = "Q" Then
Text1.Text = "Vous êtes mort mon pote!!"
MMControl1.FileName = "C:\Documents and Settings\halim\Bureau\vbprojet\wav\EXPLODE.wav"
son
Timer3.Enabled = True
For i = 0 To 399
If Command2(i).Caption = "Q" Then
Command2(i).BackColor = QBColor(12)
Command1(i).Visible = False
End If
Next
For i = 0 To 399
Command1(i).Enabled = False
Next
End If
If b = " " Then
Text1.Text = "Quelle chance!!"
MMControl1.FileName = "C:\Documents and Settings\halim\Bureau\vbprojet\wav\CHIMES.wav"
son
'faclité du jeux
For i = Index To Index + 200 Step 20
For j = 1 To 14
Select Case j
Case 1
p = i + 1
Case 2
p = i - 1
Case 3
p = i - 21
Case 4
p = i - 20
Case 5
p = i - 19
Case 6
p = i + 19
Case 7
p = i + 20
Case 8
p = i + 21
Case 9
p = i + 2
Case 10
p = i - 2
Case 11
p = i - 22
Case 12
p = i - 18
Case 13
p = i + 22
Case 14
p = i + 18
End Select
If i <= 399 Then
d = Command2(i).Caption
End If
If p <= 399 And p >= 0 Then
f = Command2(p).Caption
End If
If p <= 399 And p >= 0 And d = " " And f <> "Q" Then
Command1(p).Visible = False
End If
Next
Next
End If
If b <> "Q" Then
vict = 0
For i = 0 To 399
If Command1(i).Visible = True Then
vict = vict + 1
End If
Next
If vict = nbmin Then
Text1.Text = "Fellicitation!!"
MMControl1.FileName = "C:\Documents and Settings\halim\Bureau\vbprojet\wav\APPLAUSE.wav"
son
For j = 0 To 399
Command1(j).Enabled = False
Next
End If
End If
End Sub
Private Sub Command1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Static i As Integer
Static reg As Integer
If Button = 2 Then
Text1.Text = Str(Index)
If reg <> Index Then
i = 0
End If
If i = 0 Then
Command1(Index).Caption = "$"
reg = Index
i = i + 1
GoTo suite:
End If
If i = 1 Then
Command1(Index).Caption = " "
i = 0
End If
suite:
End If
End Sub
Private Sub Command1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Deminer.SetFocus
End Sub
Private Sub Deminer_Click()
Static j As Integer
Static l As Integer
Static c As Integer
Static g As Integer
Dim tabl1(0 To 400) As Integer
MMControl1.FileName = "C:\Documents and Settings\halim\Bureau\vbprojet\wav\UTOPIA.wav"
son
If m = 1 Then
j = 0
l = 0
c = 0
n = 0
g = 0
i = 0
For t = 0 To 399
Command1(t).Visible = True
Command1(t).Enabled = False
Command1(t).Caption = " "
Command2(t).Caption = " "
Command2(t).ForeColor = QBColor(0)
Command2(t).BackColor = QBColor(7)
Next
m = 1
End If
'remplissage d'un tableau contenant les nombre aleatoires de 0 a 399
For i = 1 To 200
Timer1_Timer
Timer1.Enabled = False
tabl1(i) = a
For k = 1 To 200
If tabl1(i) = tabl1(k) And i <> k Then
i = i - 1
End If
Next
Next
' creation du champ de mines
For t = 0 To 399
Command1(t).Enabled = True
Next
m = 1
' distribution aleatoire des mines
l = 0
For i = 0 To 399
Command1(i).Top = 2200 + 250 * l
Command1(i).Visible = True
Command1(i).Left = 650 + 80 * c
Command2(i).Top = 2200 + 250 * l
Command2(i).Visible = True
Command2(i).Left = 650 + 80 * c
If i <= nbmin - 1 Then
Command2(tabl1(i + 1)).Caption = "Q"
End If
j = j + 1
l = l + 1
If j = 20 Then
j = 0
l = 0
c = c + 3
End If
Next
'calcule du nomre de bombe entourant chaque carré vide
For i = 20 To 379
b = Command2(i).Caption
' Elimination des valeur de periode i+20 et i+19
per = True
For r = 19 To 399 Step 20
If i = r Then
per = False
End If
Next
For r = 0 To 380 Step 20
If i = r Then
per = False
End If
Next
If b = " " And per Then
cmp = i
comptage
End If
per = True
Next
For i = 0 To 399
s = 0
b = Command2(i).Caption
' calcule de nomre de bombes dans les bord du champs de mines
For r = 1 To 18
If i = r Then
s = 1
End If
Next
For r = 381 To 398
If i = r Then
s = -1
End If
Next
If b = " " Then
cmp = i
comptage
End If
Next
For i = 0 To 399
s = 0
b = Command2(i).Caption
' calcule de nomre de bombes dans les bord du champs de mines
For r = 39 To 379 Step 20
If i = r Then
s = -1
End If
Next
For r = 20 To 360 Step 20
If i = r Then
s = 1
End If
Next
If b = " " Then
cmp = i
comptage
End If
Next
For i = 0 To 399 Step 399
b = Command2(i).Caption
' calcule de nomre de bombes dans les coins du champs de mines
If i = 0 Then
s = 1
End If
If i = 399 Then
s = -1
End If
If b = " " Then
cmp = i
comptage
End If
Next
For i = 19 To 380
s = 0
b = Command2(i).Caption
' calcule de nomre de bombes dans les coins du champs de mines
If i = 19 Then
s = 1
End If
If i = 380 Then
s = -1
End If
If b = " " Then
cmp = i
comptage
End If
Next
End Sub
Private Sub expert_Click()
expert.Checked = True
normale.Checked = False
debut.Checked = False
nbmin = 150
End Sub
Private Sub debut_Click()
debut.Checked = True
expert.Checked = False
normale.Checked = False
nbmin = 50
End Sub
Private Sub normale_Click()
normale.Checked = True
expert.Checked = False
debut.Checked = False
nbmin = 100
End Sub
Private Sub NOUVJ_Click()
Deminer_Click
End Sub
Private Sub quiter_Click()
End
End Sub
Public Sub son()
MMControl1.Command = "close"
MMControl1.Command = "open"
MMControl1.DeviceType = "WaveAudio"
MMControl1.Notify = False
MMControl1.Wait = False
MMControl1.Command = "play"
End Sub
Private Sub Timer1_Timer()
a = Int(399 * Rnd + 1)
End Sub
Private Sub Timer2_Timer()
Text1.Text = "Clicker sur DEMINER Pour Commencer.."
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
Text1.Text = "Clicker sur DEMINER Pour Recommencer.."
Timer3.Enabled = False
End Sub
Private Sub comptage()
Static n As Integer
For j = 1 To 8
Select Case j
Case 1
p = cmp + 1
Case 2
p = cmp - 1
Case 3
p = cmp - 21
Case 4
p = cmp - 20
Case 5
p = cmp - 19
Case 6
p = cmp + 19
Case 7
p = cmp + 20
Case 8
p = cmp + 21
End Select
If p <= 399 And p >= 0 Then
d = Command2(p).Caption
If d = "Q" Then
n = n + 1
End If
End If
Next
If n <> 0 Then
Select Case n
Case 2
Command2(cmp).ForeColor = QBColor(2)
Case 3
Command2(cmp).ForeColor = QBColor(9)
Case 4
Command2(cmp).ForeColor = QBColor(5)
Case 5
Command2(cmp).ForeColor = QBColor(12)
Case 6
Command2(cmp).ForeColor = QBColor(5)
Case 7
Command2(cmp).ForeColor = QBColor(4)
End Select
Command2(cmp).Caption = Str(n)
n = 0
End If
End Sub