src/dynamic_cbr.cpp
// target_p is the player who you want CBR values for.
// Things get confusing in subgame solving.  Suppose we are doing subgame
// solving for P0.  We might say cfr_target_p is 0.  Then I want T-values for
// P1.  So I pass in 1 to Compute(). We'll need the reach probs of P1's
// opponent, who is P0.
target_p is the player who you want CBR values for.
Things get confusing in subgame solving.  Suppose we are doing subgame
solving for P0.  We might say cfr_target_p is 0.  Then I want T-values for
P1.  So I pass in 1 to Compute(). We'll need the reach probs of P1's
opponent, who is P0.
target_p is the player who you want CBR values for . Things get confusing in subgame solving . Suppose we are doing subgame solving for P0 . We might say cfr_target_p is 0 . Then I want T - values for P1 . So I pass in 1 to Compute () . We ' ll need the reach probs of P1 ' s opponent who is P0 .
shared_ptr<double []> DynamicCBR::Compute(Node *node, const ReachProbs &reach_probs, int gbd,
					  const HandTree *hand_tree, int target_p, bool cfrs,
					  bool zero_sum, bool current, bool purify_opp) {
  cfrs_ = cfrs;
  br_current_ = current;
  if (purify_opp) {
    if (current) {
      prob_method_ = ProbMethod::FTL;
    } else {
      prob_method_ = ProbMethod::PURE;
    }
  } else {
    prob_method_ = ProbMethod::REGRET_MATCHING;
  }
  if (zero_sum) {
    shared_ptr<double []> p0_cvs = Compute(node, 0, reach_probs.Get(1), gbd, hand_tree);
    shared_ptr<double []> p1_cvs = Compute(node, 1, reach_probs.Get(0), gbd, hand_tree);
    int st = node->Street();
    int num_hole_card_pairs = Game::NumHoleCardPairs(st);
    const CanonicalCards *hands = hand_tree->Hands(st, gbd);
    ZeroSumCVs(p0_cvs.get(), p1_cvs.get(), num_hole_card_pairs, reach_probs, hands);
    if (target_p == 1) return p1_cvs;
    else               return p0_cvs;
  } else {
    return Compute(node, target_p, reach_probs.Get(target_p^1), gbd, hand_tree);
  }
}
shared_ptr < double [ ] > DynamicCBR :: Compute ( Node * node , const ReachProbs & reach_probs , int gbd , const HandTree * hand_tree , int target_p , bool cfrs , bool zero_sum , bool current , bool purify_opp ) { cfrs_ = cfrs ; br_current_ = current ; if ( purify_opp ) { if ( current ) { prob_method_ = ProbMethod :: FTL ; } else { prob_method_ = ProbMethod :: PURE ; } } else { prob_method_ = ProbMethod :: REGRET_MATCHING ; } if ( zero_sum ) { shared_ptr < double [ ] > p0_cvs = Compute ( node , 0 , reach_probs . Get ( 1 ) , gbd , hand_tree ) ; shared_ptr < double [ ] > p1_cvs = Compute ( node , 1 , reach_probs . Get ( 0 ) , gbd , hand_tree ) ; int st = node -> Street ( ) ; int num_hole_card_pairs = Game :: NumHoleCardPairs ( st ) ; const CanonicalCards * hands = hand_tree -> Hands ( st , gbd ) ; ZeroSumCVs ( p0_cvs . get ( ) , p1_cvs . get ( ) , num_hole_card_pairs , reach_probs , hands ) ; if ( target_p == 1 ) return p1_cvs ; else return p0_cvs ; } else { return Compute ( node , target_p , reach_probs . Get ( target_p ^ 1 ) , gbd , hand_tree ) ; } }
target_p is the player who you want CBR values for.
target_p is the player who you want CBR values for .