src/dynamic_cbr.cpp
// Note that we may be working with sumprobs that are specific to a subgame.
// If so, they will be for the subgame rooted at root_bd_st and root_bd.
// So we must map our global board index gbd into a local board index lbd
// whenever we access hand_tree or the probabilities inside sumprobs.
Note that we may be working with sumprobs that are specific to a subgame.
If so, they will be for the subgame rooted at root_bd_st and root_bd.
So we must map our global board index gbd into a local board index lbd
whenever we access hand_tree or the probabilities inside sumprobs.
Note that we may be working with sumprobs that are specific to a subgame . If so they will be for the subgame rooted at root_bd_st and root_bd . So we must map our global board index gbd into a local board index lbd whenever we access hand_tree or the probabilities inside sumprobs .
shared_ptr<double []> DynamicCBR::Compute(Node *node, int p, const shared_ptr<double []> &opp_probs,
					  int gbd, const HandTree *hand_tree) {
  int st = node->Street();
  int num_hole_card_pairs = Game::NumHoleCardPairs(st);
  const CanonicalCards *hands = hand_tree->Hands(st, gbd);
  string action_sequence = "x";
  shared_ptr<double []> vals = ProcessSubgame(node, node, gbd, p, opp_probs, hand_tree,
					      action_sequence);
  for (int i = 0; i < num_hole_card_pairs; ++i) {
    vals[i] = (float)vals[i];
  }
#if 0
  int num_hole_cards = Game::NumCardsForStreet(0);
  int num_cards_in_deck = Game::NumCardsInDeck();
  int num_remaining = num_cards_in_deck - num_hole_cards;
  int num_opp_hole_card_pairs;
  if (num_hole_cards == 1) {
    num_opp_hole_card_pairs = num_remaining;
  } else {
    num_opp_hole_card_pairs = num_remaining * (num_remaining - 1) / 2;
  }
  double sum = 0;
  for (int i = 0; i < num_hole_card_pairs; ++i) {
    sum += vals[i] / num_opp_hole_card_pairs;
  }
  double ev = sum / num_hole_card_pairs;
#endif
  FloorCVs(node, opp_probs.get(), hands, vals.get());
  return vals;
}
shared_ptr < double [ ] > DynamicCBR :: Compute ( Node * node , int p , const shared_ptr < double [ ] > & opp_probs , int gbd , const HandTree * hand_tree ) { int st = node -> Street ( ) ; int num_hole_card_pairs = Game :: NumHoleCardPairs ( st ) ; const CanonicalCards * hands = hand_tree -> Hands ( st , gbd ) ; string action_sequence = " " ; shared_ptr < double [ ] > vals = ProcessSubgame ( node , node , gbd , p , opp_probs , hand_tree , action_sequence ) ; for ( int i = 0 ; i < num_hole_card_pairs ; ++ i ) { vals [ i ] = ( float ) vals [ i ] ; } #if 0 int num_hole_cards = Game :: NumCardsForStreet ( 0 ) ; int num_cards_in_deck = Game :: NumCardsInDeck ( ) ; int num_remaining = num_cards_in_deck - num_hole_cards ; int num_opp_hole_card_pairs ; if ( num_hole_cards == 1 ) { num_opp_hole_card_pairs = num_remaining ; } else { num_opp_hole_card_pairs = num_remaining * ( num_remaining - 1 ) / 2 ; } double sum = 0 ; for ( int i = 0 ; i < num_hole_card_pairs ; ++ i ) { sum += vals [ i ] / num_opp_hole_card_pairs ; } double ev = sum / num_hole_card_pairs ; #endif FloorCVs ( node , opp_probs . get ( ) , hands , vals . get ( ) ) ; return vals ; }
Note that we may be working with sumprobs that are specific to a subgame.
Note that we may be working with sumprobs that are specific to a subgame .
// time_t start_t = time(NULL); // Should set this appropriately // Temporary?  Make our T values like T values constructed by build_cbrs, // by casting to float. // EVs for our hands are summed over all opponent hole card pairs.  To // compute properly normalized EV, need to divide by that number.