Game Development Reference
Dim blanks As Integer = 0
Dim BlankSquares As Collection
'Now fill in all of those - note that the
'three numbers are call by reference
BlankSquares = BasicStatsAndBlanks(RevealedSquare, Neighbors, sees, _
'If no blanks, we have nothing to do.
If blanks = 0 Then Return
'Can one of the helpers aid us?
Dim Helper As Square
For Each Helper In Helpers
'If at any point in the loop we know no help is
'possible, we continue For to get the next helper
'To help me, they must be revealed
If Not Helper.IsRevealed Then Continue For
'We need the helper's basic data
Dim TheirNeighbors As Collection = _
'How many mines do they see?
Dim theySee As Integer = 0
'And how many flags are around them?
Dim theirFlags As Integer = 0
'And how many blanks are around them?
Dim theirBlanks As Integer = 0
Dim TheirBlankSquares As Collection
'Now fill in all of those - note that the variables
'for the three numbers are passed by reference
TheirBlankSquares = BasicStatsAndBlanks(Helper, TheirNeighbors, _
theySee, theirFlags, theirBlanks)
'If they lack blanks, they can't help us
If theirBlanks = 0 Then Continue For
'My blanks that they can't see are where my moves will go
Dim PrivateBlanks As New Collection
'Shared blanks are how they will help us
Dim commonBlankCount As Integer = 0