Dim a() As Integer
Dim c As Integer
Dim inx, secc, k, levl, tm, totl, rund, rund1 As Byte
Dim op As Boolean
Dim movl(63) As Integer
Dim movt(63) As Integer
Private Sub c1_Click(Index As Integer)
clear
If Index = inx Then c1(Index).Caption = a(Index): GoTo lll:
c1(Index).Caption = a(Index)
If c = a(Index) Then
c1(inx).Visible = False: c1(Index).Visible = False
k = k + 1
Select Case levl
Case 0
h = 8
Case 1
h = 18
Case 2
h = 32
End Select
If k = h Then
Timer1.Enabled = False
rep = MsgBox("Поздравляем вы сложили все карточки за " & secc & " сек" & " . Если хотите продолжить нажмите Да для выхода нажмите Нет", vbYesNo)
If rep = vbYes Then
new_Click
Else
End
End If
End If
clear
End If
lll:
inx = Index
c = a(Index)
End Sub
Private Sub c1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
c1(Index).BackColor = &H80&
End Sub
Private Sub c1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
For m = 0 To totl - 1
c1(m).BackColor = vbWhite
Next m
c1(Index).BackColor = &HFFC0C0
End Sub
Private Sub c1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
For m = 0 To totl - 1
c1(m).BackColor = vbWhite
Next m
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub File_Click()
End Sub
Private Sub Form_Resize()
If Form1.WindowState <> 1 Then
Select Case levl
Case 0
w = c1(3).Width + c1(3).Left
h = c1(15).Top + c1(15).Height + 650
Case 1
w = c1(5).Width + c1(5).Left
h = c1(35).Top + c1(35).Height + 650
Case 2
w = c1(7).Width + c1(7).Left
h = c1(63).Top + c1(63).Height + 650
End Select
Form1.Width = w
Form1.Height = h
End If
End Sub
Private Sub lvl_Click(Index As Integer)
For m = 0 To 2
lvl(m).Checked = False
Next m
lvl(Index).Checked = True
levl = Index
jump
Select Case levl
Case 0
ReDim a(0 To 15)
tm = 60
rund = 2: rund1 = 4:: totl = 16
w = c1(3).Width + c1(3).Left
h = c1(15).Top + c1(15).Height + 650
Case 1
ReDim a(0 To 35)
tm = 80
rund = 3: rund1 = 6: totl = 36
w = c1(5).Width + c1(5).Left
h = c1(35).Top + c1(35).Height + 650
Case 2
tm = 100
ReDim a(0 To 63)
rund = 4: rund1 = 8: totl = 64
w = c1(7).Width + c1(7).Left
h = c1(63).Top + c1(63).Height + 650
End Select
Form1.Width = w
Form1.Height = h
lst
new_Click
End Sub
Private Sub new_Click()
For m = 0 To totl - 1
c1(m).Visible = True
c1(m).Enabled = False
c1(m).BackColor = vbWhite
Next m
Timer1.Enabled = False
op = False: start.Caption = "Старт"
o = Int(10 * Rnd)
For pp = 0 To o
clear
lst
Next pp
k = 0
clear
secc = 0
Form1.Caption = ""
End Sub
Public Sub lst()
clear
For u = 0 To (totl - 2) / 2
ll = Str(Int(1000 * Rnd) + 2)
a(u) = ll
a(u + (totl / 2)) = ll
Next u
For n = 0 To (totl - 2) / 2
f = Int(totl - 2 * Rnd)
s = a(f)
a(f) = a(n)
a(n) = s
Next n
For m = 0 To totl - 1
c1(m).Caption = a(m)
Next m
For p = 0 To rund1 - 1
d = c1(rund1 + p).Caption
c1(rund1 + p).Caption = c1(rund * rund1 + p).Caption
c1(rund * rund1 + p).Caption = d
Next p
For m = 0 To totl - 1
a(m) = c1(m).Caption
Next m
clear
End Sub
Private Sub Form_Load()
If App.PrevInstance Then End
arrange
Frame1.BackColor = vbLigtBlue
For m = 0 To 63
movt(m) = c1(m).Top
movl(m) = c1(m).Left
c1(m).Enabled = False
Next m
levl = 0: totl = 16
rund = 2: rund1 = 4
jump
ReDim a(0 To 15)
lst
new_Click
tm = 60
lvl(0).Checked = True
lvl_Click (0)
clear
End Sub
Private Function clear()
For m = 0 To totl - 1
c1(m).Caption = ""
Next m
End Function
Private Sub self_Click()
res = MsgBox("В игре следует за определенное время найти все парные карточки с цифрами", , "О игре")
End Sub
Private Sub start_Click()
For m = 0 To totl - 1
c1(m).Visible = True
c1(m).Enabled = True
Next m
If op = False Then
Timer1.Enabled = True
start.Caption = "Пауза"
op = True
Else
Timer1.Enabled = False
start.Caption = "Старт"
op = False
End If
End Sub
Private Sub Timer1_Timer()
Form1.Caption = tm - secc & " сек" & " " & Format((100 * k / 18), ".##") & " %"
secc = secc + 1
If secc = tm + 1 Then
For m = 0 To totl - 1
c1(m).Caption = a(m)
Next m
Timer1.Enabled = False
rep = MsgBox(" Хотите попробавать ещё раз ?", vbYesNo, "Время вышло!")
If rep = vbYes Then new_Click
If rep = vbNo Then End
End If
End Sub
Private Function jump()
For m = 0 To 63
c1(m).Visible = False
Next m
Select Case levl
Case 0
For i = 0 To 3
For j = 4 * i To (4 * i) + 3
c1(j).Left = movl(j + 4 * i)
c1(j).Top = movt(j + 4 * i)
c1(j).Visible = True
Next j
Next i
Case 1
For i = 0 To 5
For j = 6 * i To (6 * i) + 5
c1(j).Left = movl(j + (2 * i))
c1(j).Top = movt(j + (2 * i))
c1(j).Visible = True
c1(j).Visible = True
Next j
Next i
Case 2
For m = 0 To 63
c1(m).Top = movt(m)
c1(m).Left = movl(m)
c1(m).Visible = True
Next m
End Select
End Function
Public Sub arrange()
For i = 0 To 7
For j = 8 * i To ((i + 1) * 8) - 1
If j < 8 Then
c1(j).Left = j * 975
c1(j).Top = 0
Else
c1(j).Left = c1(j - 8).Left
c1(j).Top = c1(j - 8).Top + 735
End If
Next j
Next i
End Sub