Game Development Reference
In-Depth Information
'Only the ones that the fox can reach.
Dim BN As New Collection
Dim stopAt As Integer = 1
Dim startAt As Integer = 1
Dim ss As Integer
Dim pbs As Integer
Dim i As Integer
'Add the fox's square to the collection.
BN.Add(Fox, Fox.ToString)
While startAt <= stopAt
'Check the members of the collection we've not checked before.
For i = startAt To stopAt
ss = CInt(BN(i))
'My neighbors are potentially black squares.
For Each pbs In Moves.Neighbors(ss)
If Squares(pbs).Holds = Checker.None Then
'Don't add if already there.
If Not BN.Contains(pbs.ToString) Then
'Add them to be counted, we'll check
'their neighbors next loop.
BN.Add(pbs, pbs.ToString)
End If
End If
Next pbs
Next i
'Start at the one after the end of the group we just did,
'which is the first new one if we added any.
startAt = stopAt + 1
stopAt = BN.Count
'If we didn't add any, stopAt didn't change, so
'startAt is now greater, terminating the loop.
End While
'Add in the hounds.
Return BN.Count + 4
End Function
We need to add the ability to mark the buttons with the values of the game state.
There will be a number of methods that the outside world can use to access the
game state, so we will create a separate region for them. Add the following code to
the class, outside any of the other regions:
#Region "Public Methods"
Search Nedrilad ::

Custom Search