Game Development Reference
In-Depth Information
Debug.WriteLine("Fox following shortest path to " & _
Return Candidate
'Look-ahead code - only when hemmed in:
'If they asked for a move and we only have 1,
'no need to look ahead. If they didn't ask
'for a move, we look ahead to evaluate the quality
'of our one move.
If WantMove And SortedMoves.Count = 1 Then
Debug.WriteLine("Fox OPTIMIZING: Only one move at depth " & _
Return Candidate
End If
'I need to break that line (or die trying).
'At the moment, nothing looks good. (Pun alert).
Dim BestCurrentMove As GameState = Nothing
Dim BestFutureResult As GameState = Nothing
'What does the future hold for each move I can make?
For Each Candidate In SortedMoves
'Ask the future.
Dim FutureGame As GameState = FoxLookAhead(Candidate, depth)
'Is it the best future?
If BetterFoxMove(FutureGame, BestFutureResult) Then
BestCurrentMove = Candidate
BestFutureResult = FutureGame
End If
Next Candidate
'I should always have a best move.
If BestCurrentMove IsNot Nothing Then
'Debug.WriteLine(depth.ToString & _
" Fox2: Fox's best move is to " & _
'Did the caller want the move or the result?
If WantMove Then
Return BestCurrentMove
Search Nedrilad ::

Custom Search