Game Development Reference
In-Depth Information
If RevealedSquare.IsRevealed Then
'We should be part of a playing field
Dim theField As PlayingField = RevealedSquare.Parent
'Who is around me?
Dim Neighbors As Collection = theField.NearNeighbors
(RevealedSquare.R, RevealedSquare.C)
'We keep a bunch of numbers:
'How many mines do we see?
Dim sees As Integer = 0
'And how many flags are around us?
Dim flags As Integer = 0
'And how many blanks are around us?
Dim blanks As Integer = 0
Dim BlankSquares As Collection
'Now fill in all of those. Note that the variables
'for the three numbers are passed by reference.
BlankSquares = BasicStatsAndBlanks(RevealedSquare, Neighbors, sees, _
flags, blanks)
'No blanks, no work possible
If blanks > 0 Then
'Decision time! No worries, it can't be both
If sees = flags Then
theField.MoreThoughts(Me.GetType.Name & " sees " & _
blanks.ToString & " safe squares to click.")
'Store the result for later execution
SimonSays = PossibleActions.ClickBlanks
SquaresList = BlankSquares
End If
If blanks + flags = sees Then
theField.MoreThoughts(Me.GetType.Name & " sees " & _
blanks.ToString & " mine squares to flag.")
'Store the results for later execution
SimonSays = PossibleActions.BlanksToFlags
SquaresList = BlankSquares
End If
End If
End If
Search Nedrilad ::

Custom Search