Game Development Reference
'Compute and collect those blanks
Dim Sq As Square
'Go through my blanks looking in theirs
For Each Sq In BlankSquares
'Need the key to search
Dim sqKey As String = theField.KeyFromRC(Sq.R, Sq.C)
If TheirBlankSquares.Contains(sqKey) Then
'It's mine and it's theirs
commonBlankCount += 1
'It's mine alone and a possible move
'Do we have anything to say?
If commonBlankCount = 0 Then Continue For
'Do I have possible moves?
If PrivateBlanks.Count = 0 Then Continue For
'So what do those common blanks tell us?
'We can compute how many private blanks they have
Dim theirPrivateBlankCount As Integer = theirBlanks - _
'From that we can take a crack at their view of the smallest possible
'number of mines in the common blanks
Dim minCommonMines As Integer = theySee - theirPrivateBlankCount - _
'But it can't be negative
If minCommonMines < 0 Then minCommonMines = 0
'We can run similar numbers for clear squares
Dim minCommonClear As Integer = theirBlanks - _
(theySee - theirFlags) - theirPrivateBlankCount
'That can't be negative either
If minCommonClear < 0 Then minCommonClear = 0
'If those are both zero, they are no help to us
If minCommonClear = 0 And minCommonMines = 0 Then Continue For
'This is a good point for error checks
'We have useful information - is it useful enough?
'Do the mines help us?