Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. bool GameBoard::CompareHTable(int first, int second)
  2. {
  3.     bool compare;   // state of the predicate
  4.    
  5.     // if the heuristic values are equivalent
  6.     if( hTable_[first] == hTable_[second] )
  7.     {
  8.         // if the distance is greater than or the same
  9.         if( dTable_[first] >= dTable_[second] )
  10.             compare = true;     // then this one comes first
  11.         else    // otherwise
  12.             compare = false;    // first doesnt belong here
  13.     }
  14.  
  15.     // otherwise if the heuristic value is lower
  16.     else if( hTable_[first] < hTable_[second] )
  17.         compare = true;     // then choose this one
  18.  
  19.     else    // otherwise
  20.         compare = false;    // choose second to come first
  21.    
  22.    
  23.     return compare;     // return the decision of the predicate
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement