Game Development Reference
In-Depth Information
End If
'One or both of the moves is bad.
'Is this result worse than what we have?
If Result.GameRank > BetterThan.GameRank Then Return False
'Is it better?
If Result.GameRank < BetterThan.GameRank Then
Debug.WriteLine("Fox: Result of " & Result.GameRank.ToString & _
" is better than " & BetterThan.GameRank.ToString)
Return True
'Break ties based on move count.
If Result.GameRank < UNREACHABLE Then
'Make good things happen sooner.
If Result.MoveCount < BetterThan.MoveCount Then
Return True
End If
'Make bad things happen later.
If Result.MoveCount > BetterThan.MoveCount Then
Return True
End If
End If
End If
'Default to false.
Return False
End Function
The fox uses this code when looking ahead, which is to say when it is trying to
break the line. This code would not work when the line is broken. The same
routine for the hounds is critical for them, as the discussion of the evaluation
function showed. Add the following code to the Internal Stuff region:
Private Function BetterHoundsMove(ByVal Result As GameState, _
ByVal BetterThan As GameState) As Boolean
'Anything is better than nothing.
If BetterThan Is Nothing Then Return True
'Are they both good moves?
If BetterThan.GameRank >= UNREACHABLE And _
Result.GameRank >= UNREACHABLE Then
Search Nedrilad ::

Custom Search