Реализация программного модуля, на встроенном языке программирования Visual Basic for Application (VBA), страница 14

End If

End Function

Public Function контур2() As Boolean

Dim w(1 To 7, 1 To 7) As String

Dim s As String

s = "-->"

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

w(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

If w(2, 6) = s And w(2, 7) = s And w(6, 7) = s Then

контур2 = True

Else

контур2 = False

End If

End Function

Public Function контур3() As Boolean

Dim w(1 To 7, 1 To 7) As String

Dim s As String

s = "-->"

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

w(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

If w(2, 5) = s And w(3, 5) = s And w(2, 7) = s And w(3, 6) = s And w(6, 7) = s Then

контур3 = True

Else

контур3 = False

End If

End Function

Public Function контур4() As Boolean

Dim w(1 To 7, 1 To 7) As String

Dim s As String

s = "-->"

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

w(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

If w(1, 4) = s And w(4, 5) = s And w(3, 5) = s And w(3, 6) = s And w(6, 7) = s And w(1, 7) = s Then

контур4 = True

Else

контур4 = False

End If

End Function

Public Function контур5() As Boolean

Dim w(1 To 7, 1 To 7) As String

Dim s As String

s = "-->"

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

w(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

If w(1, 4) = s And w(4, 5) = s And w(2, 5) = s And w(2, 7) = s And w(1, 7) = s Then

контур5 = True

Else

контур5 = False

End If

End Function

Public Function контур6() As Boolean

Dim w(1 To 7, 1 To 7) As String

Dim s As String

s = "-->"

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

w(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

If w(1, 4) = s And w(1, 7) = s And w(4, 5) = s And w(2, 5) = s And w(2, 6) = s And w(6, 7) = s Then

контур6 = True

Else

контур6 = False

End If

End Function

Public Function контур7() As Boolean

Dim w(1 To 7, 1 To 7) As String

Dim s As String

s = "-->"

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

w(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

If w(1, 7) = s And w(1, 4) = s And w(2, 7) = s And w(2, 6) = s And w(3, 6) = s And w(3, 5) = s And w(4, 5) = s Then

контур7 = True

Else

контур7 = False

End If

End Function

Public Function сравниваем(a As Double, b As Double) As Boolean

If a < 0 Then a = (-1) * a

If b < 0 Then b = (-1) * b

If a >= b Then сравниваем = True

If a < b Then сравниваем = False

End Function

Public Function min(a As Double, b As Double)

If a >= b Then min = b

If a < b Then min = a

End Function

Public Function min1(a As Integer, b As Integer)

If a >= b Then min1 = b

If a < b Then min1 = a

End Function

Public Function max(a As Double, b As Double)

If a >= b Then max = a

If a < b Then max = b

End Function

Public Function max1(a As Integer, b As Integer)

If a >= b Then max1 = a

If a < b Then max1 = b

End Function

'анализконтура1

Public Sub kontur1(a As Integer, b As Integer)

Dim p(1 To 7) As Double

Dim n(1 To 7, 1 To 7) As Double

Dim postavka(1 To 7, 1 To 7) As Double

Dim metka(1 To 7, 1 To 7) As String

Dim w(1 To 7, 1 To 7) As String

Dim z(1 To 4) As Double

Dim l As Double

Dim l1 As Double

Dim l2 As Double

For i = 1 To 7 Step 1

p(i) = Worksheets("Лист1").Cells(15, i)

Next i

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

n(i, j) = Worksheets("Лист1").Cells(i + 6, j + 15)

metka(i, j) = Worksheets("Лист1").Cells(i + 6, j + 8)

Next j

Next i

For i = 1 To 7 Step 1

For j = 1 To 7 Step 1

postavka(i, j) = Worksheets("Лист1").Cells(i + 15, j + 8)

Next j

Next i

If ((a = 3 And b = 6) Or (a = 6 And b = 3)) And p(3) <= p(6) Then z(1) = 6: z(2) = 2: z(3) = 5: z(4) = 3

If ((a = 3 And b = 6) Or (a = 6 And b = 3)) And p(3) > p(6) Then z(1) = 3: z(2) = 5: z(3) = 2: z(4) = 6

If ((a = 2 And b = 6) Or (a = 6 And b = 2)) And p(2) <= p(6) Then z(1) = 6: z(2) = 3: z(3) = 5: z(4) = 2