Game Development Reference
In-Depth Information
rest of the code from any changes we make to the AI. Add the following code to
the module:
#Region "Public Interface"
Public Function MoveFox(ByVal GS As GameState) As GameState
Debug.WriteLine("")
Debug.WriteLine("Move #" & (GS.MoveCount + 1).ToString)
Debug.WriteLine("Move Fox.")
'The code for this is on the CD.
'Return Fox1(GS)
Return Fox2(GS, 1, True)
End Function
Public Function MoveHounds(ByVal GS As GameState) As GameState
Debug.WriteLine("")
Debug.WriteLine("Move #" & (GS.MoveCount + 1).ToString)
Debug.WriteLine("Move Hounds.")
'The code for this is on the CD.
'Return Hounds1(GS)
Return Hounds2(GS, 1, True)
End Function
#End Region
Internal Helper Routines for the AI
The actual AI will benefit from some helper routines. The discussion of the
evaluation function indicated that the code will not always do a strict comparison
between board rankings. So we will need a way to say that one board is better than
another, and the fox and the hounds will have different opinions on the matter.
That said, often the code will use simple rank, so we should provide a way to keep
a sorted list of candidate boards.
We will create a new region called Internal Stuff in the module. Remember that
regions cannot overlap. The first thing we will add is code to keep a sorted list.
Add the following code:
#Region "Internal Stuff"
Private Sub AddGameStateKeepSorted(ByVal NewGS As GameState, _
ByVal SortedMoves As Collection)
 
Search Nedrilad ::




Custom Search