@@ -852,22 +852,26 @@ void GameTreeRep::MakeReducedStrategies() const
852852 }
853853
854854 auto [action, node] = *current_iter;
855- if (current_iter == node->GetParent ()->GetActions ().begin ()) {
855+ if (!node->GetParent ()->GetPlayer ()->IsChance () &&
856+ current_iter == node->GetParent ()->GetActions ().begin ()) {
856857 // Update behaviors conditional on parent information set being reachable
857- std::list<StrategyMap> new_behaviors;
858- for (const auto &behav : behaviors[node->GetParent ()->GetPlayer ()]) {
859- if (MatchesPartialHistory (behav, history, node->GetParent ()->GetInfoset ())) {
860- for (const auto &action : node->GetParent ()->GetInfoset ()->GetActions ()) {
861- StrategyMap behav_copy = behav;
862- behav_copy[node->GetParent ()->GetInfoset ().get ()] = action;
863- new_behaviors.push_back (behav_copy);
858+ auto behav = behaviors[node->GetParent ()->GetPlayer ()].begin ();
859+ while (behav != behaviors[node->GetParent ()->GetPlayer ()].end ()) {
860+ if (MatchesPartialHistory (*behav, history, node->GetParent ()->GetInfoset ())) {
861+ auto act = node->GetParent ()->GetInfoset ()->GetActions ().begin ();
862+ (*behav)[node->GetParent ()->GetInfoset ().get ()] = *act;
863+ ++behav;
864+ ++act;
865+ while (act != node->GetParent ()->GetInfoset ()->GetActions ().end ()) {
866+ behaviors[node->GetParent ()->GetPlayer ()].insert (behav, *std::prev (behav));
867+ (*std::prev (behav))[node->GetParent ()->GetInfoset ().get ()] = *act;
868+ ++act;
864869 }
865870 }
866871 else {
867- new_behaviors. push_back ( behav) ;
872+ ++ behav;
868873 }
869874 }
870- behaviors[node->GetParent ()->GetPlayer ()] = new_behaviors;
871875 }
872876 history[position.top ().GetOwner ()->GetInfoset ().get ()] = action;
873877
@@ -897,7 +901,6 @@ void GameTreeRep::MakeReducedStrategies() const
897901 std::make_shared<GameStrategyRep>(player.get (), player->m_strategies .size () + 1 , label);
898902 for (const auto &[infoset, action] : behav) {
899903 strategy->m_behav [infoset] = action->GetNumber ();
900- std::cout << action->GetNumber () << std::endl;
901904 }
902905 player->m_strategies .push_back (strategy);
903906 }
0 commit comments