src/agent.cpp
// In order to do translation, find the two succs that most closely match
// the current action.
In order to do translation, find the two succs that most closely match
the current action.
In order to do translation find the two succs that most closely match the current action .
void Agent::GetTwoClosestSuccs(Node *node, int actual_bet_to, int *below_succ, int *below_bet_to,
			       int *above_succ, int *above_bet_to) {
  int num_succs = node->NumSuccs();
  int fsi = node->FoldSuccIndex();
  *below_succ = -1;
  *below_bet_to = -1;
  *above_succ = -1;
  *above_bet_to = -1;
  int best_below_diff = kMaxInt;
  int best_above_diff = kMaxInt;
  for (int s = 0; s < num_succs; ++s) {
    if (s == fsi) continue;
    int this_bet_to = node->IthSucc(s)->LastBetTo() * small_blind_;
    int diff = this_bet_to - actual_bet_to;
    if (diff <= 0) {
      if (-diff < best_below_diff) {
	best_below_diff = -diff;
	*below_succ = s;
	*below_bet_to = this_bet_to;
      }
    } else {
      if (diff < best_above_diff) {
	best_above_diff = diff;
	*above_succ = s;
	*above_bet_to = this_bet_to;
      }
    }
  }
}
void Agent :: GetTwoClosestSuccs ( Node * node , int actual_bet_to , int * below_succ , int * below_bet_to , int * above_succ , int * above_bet_to ) { int num_succs = node -> NumSuccs ( ) ; int fsi = node -> FoldSuccIndex ( ) ; * below_succ = -1 ; * below_bet_to = -1 ; * above_succ = -1 ; * above_bet_to = -1 ; int best_below_diff = kMaxInt ; int best_above_diff = kMaxInt ; for ( int s = 0 ; s < num_succs ; ++ s ) { if ( s == fsi ) continue ; int this_bet_to = node -> IthSucc ( s ) -> LastBetTo ( ) * small_blind_ ; int diff = this_bet_to - actual_bet_to ; if ( diff <= 0 ) { if ( - diff < best_below_diff ) { best_below_diff = - diff ; * below_succ = s ; * below_bet_to = this_bet_to ; } } else { if ( diff < best_above_diff ) { best_above_diff = diff ; * above_succ = s ; * above_bet_to = this_bet_to ; } } } }
In order to do translation, find the two succs that most closely match
the current action.
In order to do translation find the two succs that most closely match the current action .
// Want to find closest bet below and closest bet above