src/mp_betting_tree.cpp
// num_players_to_act is (re)initialized when a player bets.  It gets
// decremented every time a player calls or folds.  When it reaches zero
// the action on the current street is complete.
num_players_to_act is (re)initialized when a player bets.  It gets
decremented every time a player calls or folds.  When it reaches zero
the action on the current street is complete.
num_players_to_act is ( re ) initialized when a player bets . It gets decremented every time a player calls or folds . When it reaches zero the action on the current street is complete .
shared_ptr<Node> BettingTreeBuilder::CreateMPCallSucc(int street, int last_bet_size, int bet_to,
						      int num_street_bets, int num_bets,
						      int player_acting, int num_players_to_act,
						      bool *folded, int target_player,
						      string *key, int *terminal_id) {
  bool advance_street = (num_players_to_act == 1);
  shared_ptr<Node> call_succ;
  int max_street = Game::MaxStreet();
  int num_players = Game::NumPlayers();
  int num_players_remaining = 0;
  for (int p = 0; p < num_players; ++p) {
    if (! folded[p]) ++num_players_remaining;
  }
  if (folded[player_acting]) {
    fprintf(stderr, "CreateMPCallSucc: Player already folded\n");
    exit(-1);
  }
  if (num_players_to_act == 0) exit(-1);
  if (num_players_to_act > 1000000) exit(-1);
  if (num_players_to_act > num_players_remaining) exit(-1);
  string new_key = *key;
  if (betting_abstraction_.BettingKey(street)) {
    AddStringToKey("c", &new_key);
  }
  if (street < max_street && advance_street) {
    call_succ = CreateMPStreet(street + 1, bet_to, num_bets, folded,
			       target_player, &new_key, terminal_id);
  } else if (! advance_street) {
    int next_player_to_act =
      NextPlayerToAct((player_acting + 1) % num_players, folded);
    if (next_player_to_act == player_acting) exit(-1);
    call_succ = CreateMPSubtree(street, 0, bet_to, num_street_bets, num_bets, next_player_to_act,
				num_players_to_act - 1,	folded, target_player, &new_key,
				terminal_id);
  } else {
    call_succ.reset(new Node((*terminal_id)++, street, 255, nullptr, nullptr, nullptr,
			     num_players_remaining, bet_to));
  }
  return call_succ;
}
shared_ptr < Node > BettingTreeBuilder :: CreateMPCallSucc ( int street , int last_bet_size , int bet_to , int num_street_bets , int num_bets , int player_acting , int num_players_to_act , bool * folded , int target_player , string * key , int * terminal_id ) { bool advance_street = ( num_players_to_act == 1 ) ; shared_ptr < Node > call_succ ; int max_street = Game :: MaxStreet ( ) ; int num_players = Game :: NumPlayers ( ) ; int num_players_remaining = 0 ; for ( int p = 0 ; p < num_players ; ++ p ) { if ( ! folded [ p ] ) ++ num_players_remaining ; } if ( folded [ player_acting ] ) { fprintf ( stderr , " \n " ) ; exit ( -1 ) ; } if ( num_players_to_act == 0 ) exit ( -1 ) ; if ( num_players_to_act > 1000000 ) exit ( -1 ) ; if ( num_players_to_act > num_players_remaining ) exit ( -1 ) ; string new_key = * key ; if ( betting_abstraction_ . BettingKey ( street ) ) { AddStringToKey ( " " , & new_key ) ; } if ( street < max_street && advance_street ) { call_succ = CreateMPStreet ( street + 1 , bet_to , num_bets , folded , target_player , & new_key , terminal_id ) ; } else if ( ! advance_street ) { int next_player_to_act = NextPlayerToAct ( ( player_acting + 1 ) % num_players , folded ) ; if ( next_player_to_act == player_acting ) exit ( -1 ) ; call_succ = CreateMPSubtree ( street , 0 , bet_to , num_street_bets , num_bets , next_player_to_act , num_players_to_act - 1 , folded , target_player , & new_key , terminal_id ) ; } else { call_succ . reset ( new Node ( ( * terminal_id ) ++ , street , 255 , nullptr , nullptr , nullptr , num_players_remaining , bet_to ) ) ; } return call_succ ; }
num_players_to_act is (re)initialized when a player bets.
num_players_to_act is ( re ) initialized when a player bets .
// Call completes action on current street. // This is a check or call that does not advance the street // Shouldn't happen // This is a call on the final street