Game Development Reference
In-Depth Information
'Faster is better; slam the door first, win later.
If Result.MoveCount < BetterThan.MoveCount Then
Debug.WriteLine("Hounds a " & Result.GameRank.ToString & _
" at move " & Result.MoveCount.ToString & _
" is better than a " & BetterThan.GameRank.ToString & _
" at move " & BetterThan.MoveCount.ToString)
Return True
Else
Debug.WriteLine("Hounds a " & Result.GameRank.ToString & _
" at move " & Result.MoveCount.ToString & _
" is worse than a " & BetterThan.GameRank.ToString & _
" at move " & BetterThan.MoveCount.ToString)
Return False
End If
End If
'Are the moves tied?
If Result.GameRank = BetterThan.GameRank Then
'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
Else
'Make bad things happen later.
If Result.MoveCount > BetterThan.MoveCount Then
Return True
End If
End If
End If
'Larger rank is better for hounds.
Return Result.GameRank > BetterThan.GameRank
End Function
The Fox's Move
The AI module now has the support services the two AIs will call upon. It is time
to add the two-part AI for the fox. The AI will go in a separate region. Add the
following code to the module:
 
Search Nedrilad ::




Custom Search