Game Development Reference

In-Depth Information

If minCommonMines > 0 Then

If minCommonMines = sees - flags Then

'The common mines are all of my mines!

'Since both variables were ByRef, we can change them

SimonSays = BasicRule.PossibleActions.ClickBlanks

SquaresList = PrivateBlanks

'Finding one set of moves is good enough

Return

End If

End If

'Do the clear squares help us?

If minCommonClear > 0 Then

If blanks - minCommonClear = sees - flags Then

'The common squares include all of my clear

'Therefore, my private blanks must all be mines

'Since both variables were ByRef, we can change them

SimonSays = BasicRule.PossibleActions.BlanksToFlags

SquaresList = PrivateBlanks

'Finding one set of moves is good enough

Return

End If

End If

Next Helper

End Sub

The first part of the routine reads just like single-square matching. We get the

basic statistics for the original square and check for blanks. There is nothing to do

if there are no blank squares to act on. At that point, the original square looks for

help from the helpers that were passed in.

If the helper is not revealed, the helper square lacks the required numerical

information. The
Continue For
directive tells VB that we are done with this

iteration of the loop and to go on with the next iteration. We will make

numerous qualifying tests on the helpers as we go. This could be coded with

nested
If
statements, but the nesting level would be extreme.

At this point, we know that the helper has basic data, so we get it the same way we

get it for any other square. If the helper has no blanks, it cannot help. If it has

blanks, we need to know if any of them are common blanks. We need the count

of the common squares but not the squares themselves. We do need the original