Game Development Reference
In-Depth Information
'MIGHT WANT TO DO SOME TIE BREAKING BY LOOKING AHEAD HERE?
'Not really, the final result doesn't fail.
Return Candidate
End If
'Line is already broken, we have to look ahead.
'Initialize the variables.
Dim BestCurrentMove As GameState = Nothing
Dim BestFutureResult As GameState = Nothing
'What does the future hold for each of my moves?
For Each Candidate In SortedMoves
'Ask the future.
Dim FutureGame As GameState = HoundsLookAhead(Candidate, depth)
'Is that the best?
If BetterHoundsMove(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 & _
'
" Hounds2: Hounds's best move is a " & _
'
BestCurrentMove.GameRank.ToString)
'Did the caller want the move or the result?
If WantMove Then
Return BestCurrentMove
Else
Return BestFutureResult
End If
End If
'This is not a good sign to be here; make the message stand out.
Debug.WriteLine("#########################Hounds2: " & _
"hit default return.")
'Best we have in a broken situation.
Return CType(SortedMoves(SortedMoves.Count), GameState)
End Function
Search Nedrilad ::




Custom Search