src/betting_tree.cpp
// Maintain a map from ids to shared pointers to nodes.
Maintain a map from ids to shared pointers to nodes.
Maintain a map from ids to shared pointers to nodes .
void BettingTree::Initialize(int target_player, const BettingAbstraction &ba) {
  char buf[500];
  if (ba.Asymmetric()) {
    sprintf(buf, "%s/betting_tree.%s.%u.%s.%u", Files::StaticBase(),
	    Game::GameName().c_str(), Game::NumPlayers(),
	    ba.BettingAbstractionName().c_str(), target_player);
  } else {
    sprintf(buf, "%s/betting_tree.%s.%u.%s", Files::StaticBase(),
	    Game::GameName().c_str(), Game::NumPlayers(),
	    ba.BettingAbstractionName().c_str());
  }
  Reader reader(buf);
  initial_street_ = ba.InitialStreet();
  root_ = nullptr;
  num_terminals_ = 0;
  int max_street = Game::MaxStreet();
  int num_players = Game::NumPlayers();
  int num_maps = (max_street + 1) * num_players;
  unique_ptr<unordered_map< int, shared_ptr<Node> > []>
    maps(new unordered_map< int, shared_ptr<Node> > [num_maps]);
  root_ = Read(&reader, maps.get());
  FillTerminalArray();
  num_nonterminals_.reset(new int[num_players * (max_street + 1)]);
  CountNumNonterminals(this, num_nonterminals_.get());
}
void BettingTree :: Initialize ( int target_player , const BettingAbstraction & ba ) { char buf [ 500 ] ; if ( ba . Asymmetric ( ) ) { sprintf ( buf , " " , Files :: StaticBase ( ) , Game :: GameName ( ) . c_str ( ) , Game :: NumPlayers ( ) , ba . BettingAbstractionName ( ) . c_str ( ) , target_player ) ; } else { sprintf ( buf , " " , Files :: StaticBase ( ) , Game :: GameName ( ) . c_str ( ) , Game :: NumPlayers ( ) , ba . BettingAbstractionName ( ) . c_str ( ) ) ; } Reader reader ( buf ) ; initial_street_ = ba . InitialStreet ( ) ; root_ = nullptr ; num_terminals_ = 0 ; int max_street = Game :: MaxStreet ( ) ; int num_players = Game :: NumPlayers ( ) ; int num_maps = ( max_street + 1 ) * num_players ; unique_ptr < unordered_map < int , shared_ptr < Node > > [ ] > maps ( new unordered_map < int , shared_ptr < Node > > [ num_maps ] ) ; root_ = Read ( & reader , maps . get ( ) ) ; FillTerminalArray ( ) ; num_nonterminals_ . reset ( new int [ num_players * ( max_street + 1 ) ] ) ; CountNumNonterminals ( this , num_nonterminals_ . get ( ) ) ; }
Maintain a map from ids to shared pointers to nodes.
Maintain a map from ids to shared pointers to nodes .