Оценить:
 Рейтинг: 0

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

Год написания книги
2023
Теги
<< 1 ... 7 8 9 10 11 12 13 14 15 ... 57 >>
На страницу:
11 из 57
Настройки чтения
Размер шрифта
Высота строк
Поля

End Function

Private Sub ClearMarkedForDeletion()

Dim row As Integer

Dim column As Integer

For column = matrix.GetLength(1) – 1 To 0 Step -1

' If column is completely empty, then move everthing

' down one.

For row = 0 To matrix.GetLength(0) – 1

If Not matrix(row, column) Is Nothing Then

matrix(row, column).MarkedForDeletion = False

End If

Next

Next

End Sub

''' <summary>

''' Find out how many blocks will be eliminated.

''' </summary>

''' <returns></returns>

''' <remarks></remarks>

Private Function CalculateScore() As Integer

Dim row As Integer

Dim column As Integer

Dim total As Integer = 0

For column = matrix.GetLength(1) – 1 To 0 Step -1

' If column is completely empty, then move everthing

' down one.

For row = 0 To matrix.GetLength(0) – 1

If Not matrix(row, column) Is Nothing Then

If matrix(row, column).MarkedForDeletion Then

total += 1

End If

End If

Next

Next

Return total

End Function

''' <summary>

''' After the blocks are removed from the columns, there may be

''' columns that are empty. Move columns from right to left to

''' fill in the empty columns.

''' </summary>

''' <remarks></remarks>

Public Sub CollapseColumns()

Dim row As Integer

Dim column As Integer

For column = matrix.GetLength(1) – 1 To 0 Step -1

' If column is completely empty, then all the columns

' over one.

Dim noBlocks As Boolean = True

For row = 0 To matrix.GetLength(0) – 1
<< 1 ... 7 8 9 10 11 12 13 14 15 ... 57 >>
На страницу:
11 из 57

Другие электронные книги автора Валерий Алексеевич Жарков