Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 6: Программирование на Visual Basic искусственного интеллекта. Продолжение 2. Валерий Алексеевич Жарков
Чтение книги онлайн.

Читать онлайн книгу Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 6: Программирование на Visual Basic искусственного интеллекта. Продолжение 2 - Валерий Алексеевич Жарков страница 23

СКАЧАТЬ count

      End If

      End Function

      Private Function CheckRL(ByVal pos As Integer) As Integer

      If pos = 0 Or pos = 1 Or pos = 2 Or pos = 3 Or pos = 9 _

      Or pos = 10 Or pos = 11 _

      Or pos = 18 Or pos = 19 Or pos = 27 Or pos = 53 _

      Or pos = 61 Or pos = 62 _

      Or pos = 69 Or pos = 70 Or pos = 71 Or pos = 77 _

      Or pos = 78 Or pos = 79 Or pos = 80 Then

      Return 0

      End If

      Dim type As Integer = MPBoxes(pos).MPIndex

      Dim i As Integer = pos Mod 8

      If i = 0 Then

      i = 8

      ElseIf i < 4 Then

      i = (i + 1) * 8 + i

      ElseIf pos \ 8 >= 5 Then

      i = 45

      End If

      Dim count As Integer

      Dim startpos As Integer = i

      Dim endpos As Integer = i

      Dim tempi As Integer = i + 1

      Dim temp As Integer

      If i < 9 Then

      temp = i + 1

      Else

      temp = 9 – (i \ 8)

      End If

      While i < tempi + temp * 8

      If MPBoxes(i).MPIndex = type Then

      endpos += 8

      count = (endpos – startpos) \ 8

      Else

      If count > 4 Then

      While MPBoxes(pos).MPState = _

      BallState.ZOOMING_BALL

      Application.DoEvents()

      End While

      For j As Integer = 0 To count – 1

      MPBoxes(startpos + j * 8).Destroy()

      Next

      Return count

      End If

      If i >= pos + 32 Then

      Return count

      End If

      startpos = i + 8

      endpos = i + 8

      End If

      i += 8

      End While

      If count > 4 Then

      While MPBoxes(pos).MPState = BallState.ZOOMING_BALL

      Application.DoEvents()

      End While

      For j As Integer = 0 To count – 1

      MPBoxes(startpos + j * 8).Destroy()

      Next

      Return count

      End If

      End Function

      Private Function CalWin(ByVal pos As Integer) As Integer

      Dim point As Integer = CheckHor(pos)

      If point < 4 Then

      point = CheckVer(pos)

      End If

      If point < 4 Then

      point = CheckLR(pos)

      End If

      If point < 4 Then

      point = CheckRL(pos)

      End If

      If point > 4 Then

      Dim dpoint As Double = point * 100 + (dpoint \ 6) * 100

      Dim n As Double = DDScore.number + dpoint

      For i As Double = DDScore.number To n Step 10

      DDScore.number = i

      lblScore.Refresh()

      Next

      DDScore.number = n

      Return point

      Else

      Return 0

      End If

      End Function

      '#Region "Ball Event And Paint Board"

      Private Sub Ball_Click(ByVal sender As System.Object, _

      ByVal e As System.EventArgs)

      CType(sender, MotionPic).Jump()

      If CType(sender, MotionPic).MPState <> _

      BallState.NO_BALL Then

      If intFlag <> -1 Then

      MPBoxes(intFlag).Jump()

      End If

      'intFlag = MPBoxes.IndexOf(MPBoxes, sender)

      'Исправляем предупреждение:

      intFlag = Array.IndexOf(MPBoxes, sender)

      ElseIf intFlag <> -1 Then

      Dim tempS As String = MPBoxes(intFlag).Tag

      MPBoxes(intFlag).Tag = ""

      FindSol(intFlag)

      If sender.tag = "Here" Then

      'posMoveTo = MPBoxes.IndexOf(MPBoxes, sender)

      'Исправляем предупреждение:

      posMoveTo = Array.IndexOf(MPBoxes, sender)

      If posMoveTo = ThreeBP(0) Then

      prePic(0).SendToBack()

СКАЧАТЬ