@@ -122,39 +122,26 @@ class PureStrategyProfile {
122122
123123class StrategyContingencies {
124124 StrategySupportProfile m_support;
125- std::vector<GamePlayer> m_unfrozen;
126- std::vector<GameStrategy> m_frozen;
127125
128126public:
129127 class iterator {
130128 StrategyContingencies *m_cont;
131129 bool m_atEnd{false };
132-
133- // One index per unfrozen player (odometer digits)
134130 std::vector<size_t > m_pos;
135-
136- // Current pure-strategy profile
137131 PureStrategyProfile m_profile;
138132
139133 public:
140- iterator (StrategyContingencies *cont, bool end)
141- : m_cont(cont), m_atEnd(end), m_profile(cont->m_support.GetGame()->NewPureStrategyProfile ())
134+ iterator (StrategyContingencies *cont, bool p_end)
135+ : m_cont(cont), m_atEnd(p_end),
136+ m_profile (cont->m_support.GetGame()->NewPureStrategyProfile())
142137 {
143138 if (m_atEnd) {
144139 return ;
145140 }
146-
147- // Apply frozen strategies
148- for (const auto &s : m_cont->m_frozen ) {
149- m_profile->SetStrategy (s);
150- }
151-
152- // Initialise odometer
153- const size_t n = m_cont->m_unfrozen .size ();
141+ const size_t n = m_cont->m_support .GetPlayers ().size ();
154142 m_pos.assign (n, 0 );
155-
156143 for (size_t i = 0 ; i < n; ++i) {
157- const GamePlayer player = m_cont->m_unfrozen [i] ;
144+ const GamePlayer player = m_cont->m_support . GetGame ()-> GetPlayer (i + 1 ) ;
158145 auto support = m_cont->m_support .GetStrategies (player);
159146 m_profile->SetStrategy (support[0 ]);
160147 }
@@ -163,23 +150,18 @@ class StrategyContingencies {
163150 iterator &operator ++()
164151 {
165152 const size_t n = m_pos.size ();
166-
167153 for (size_t i = 0 ; i < n; ++i) {
168- const GamePlayer player = m_cont->m_unfrozen [i] ;
154+ const GamePlayer player = m_cont->m_support . GetGame ()-> GetPlayer (i + 1 ) ;
169155 auto support = m_cont->m_support .GetStrategies (player);
170-
171156 ++m_pos[i];
172157 if (m_pos[i] < support.size ()) {
173158 m_profile->SetStrategy (support[m_pos[i]]);
174159 return *this ;
175160 }
176-
177- // rollover this dimension
178161 m_pos[i] = 0 ;
179162 m_profile->SetStrategy (support[0 ]);
180163 }
181164
182- // overflow in all dimensions → end
183165 m_atEnd = true ;
184166 return *this ;
185167 }
@@ -201,31 +183,8 @@ class StrategyContingencies {
201183 const PureStrategyProfile &operator *() const { return m_profile; }
202184 };
203185
204- explicit StrategyContingencies (const Game &p_game) : m_support(StrategySupportProfile(p_game))
205- {
206- for (const auto &player : p_game->GetPlayers ()) {
207- m_unfrozen.push_back (player);
208- }
209- }
210- explicit StrategyContingencies (const StrategySupportProfile &support,
211- const std::vector<GameStrategy> &frozen = {})
212- : m_support(support), m_frozen(frozen)
213- {
214- // Determine unfrozen players
215- auto players = m_support.GetPlayers ();
216- for (auto player : players) {
217- bool is_frozen = false ;
218- for (const auto &s : m_frozen) {
219- if (s->GetPlayer () == player) {
220- is_frozen = true ;
221- break ;
222- }
223- }
224- if (!is_frozen) {
225- m_unfrozen.push_back (player);
226- }
227- }
228- }
186+ explicit StrategyContingencies (const Game &p_game) : m_support(StrategySupportProfile(p_game)) {}
187+ explicit StrategyContingencies (const StrategySupportProfile &support) : m_support(support) {}
229188
230189 iterator begin () { return {this , false }; }
231190 iterator end () { return {this , true }; }
0 commit comments