diff --git a/src/games/behavspt.cc b/src/games/behavspt.cc index 2187124af..b7cef24f1 100644 --- a/src/games/behavspt.cc +++ b/src/games/behavspt.cc @@ -193,8 +193,9 @@ void BehaviorSupportProfile::AddAction(const GameAction &s) } List startlist(ReachableMembers(s->GetInfoset())); - for (int i = 1; i <= startlist.Length(); i++) - DeactivateSubtree(startlist[i]); + for (auto node : ReachableMembers(s->GetInfoset())) { + DeactivateSubtree(node); + } } int BehaviorSupportProfile::NumSequences(int j) const @@ -434,7 +435,7 @@ bool BehaviorSupportProfile::Dominates(const GameAction &a, const GameAction &b, else { List nodelist = ReachableMembers(infoset); - if (nodelist.Length() == 0) { + if (nodelist.empty()) { // This may not be a good idea; I suggest checking for this // prior to entry for (int i = 1; i <= infoset->NumMembers(); i++) { diff --git a/src/games/gamebagg.h b/src/games/gamebagg.h index d5c39e9df..1b3012ab3 100644 --- a/src/games/gamebagg.h +++ b/src/games/gamebagg.h @@ -81,7 +81,7 @@ class GameBagentRep : public GameRep { /// @name Players //@{ /// Returns the number of players in the game - int NumPlayers() const override { return m_players.Length(); } + int NumPlayers() const override { return m_players.size(); } /// Returns the pl'th player in the game GamePlayer GetPlayer(int pl) const override { return m_players[pl]; } /// Returns the set of players in the game diff --git a/src/games/gameexpl.h b/src/games/gameexpl.h index b835d7e12..fc5215208 100644 --- a/src/games/gameexpl.h +++ b/src/games/gameexpl.h @@ -73,7 +73,7 @@ class GameExplicitRep : public GameRep { /// @name Players //@{ /// Returns the number of players in the game - int NumPlayers() const override { return m_players.Length(); } + int NumPlayers() const override { return m_players.size(); } /// Returns the pl'th player in the game GamePlayer GetPlayer(int pl) const override { return m_players[pl]; } /// Returns the set of players in the game @@ -83,7 +83,7 @@ class GameExplicitRep : public GameRep { /// @name Outcomes //@{ /// Returns the number of outcomes defined in the game - int NumOutcomes() const override { return m_outcomes.Length(); } + int NumOutcomes() const override { return m_outcomes.size(); } /// Returns the index'th outcome defined in the game GameOutcome GetOutcome(int index) const override { return m_outcomes[index]; } /// Creates a new outcome in the game diff --git a/src/games/nash.cc b/src/games/nash.cc index ba54f0d12..e974012f5 100644 --- a/src/games/nash.cc +++ b/src/games/nash.cc @@ -210,8 +210,8 @@ BehavViaStrategySolver::Solve(const BehaviorSupportProfile &p_support) const { List > output = m_solver->Solve(p_support.GetGame()); List > solutions; - for (int i = 1; i <= output.Length(); i++) { - solutions.push_back(MixedBehaviorProfile(output[i])); + for (auto profile : output) { + solutions.push_back(MixedBehaviorProfile(profile)); } return solutions; } @@ -290,7 +290,7 @@ void SubgameBehavSolver::SolveSubgames(const BehaviorSupportProfile &p_suppor SolveSubgames(p_support, p_templateSolution, subroots[i], subsolns, subvalues); - if (subsolns.Length() == 0) { + if (subsolns.empty()) { solns = List >(); return; } @@ -360,7 +360,7 @@ void SubgameBehavSolver::SolveSubgames(const BehaviorSupportProfile &p_suppor List > sol = m_solver->Solve(subsupport); - if (sol.Length() == 0) { + if (sol.empty()) { solns = List >(); //printf("No solutions found\n"); return; diff --git a/src/games/stratspt.h b/src/games/stratspt.h index cf8fdf7af..c182f6487 100644 --- a/src/games/stratspt.h +++ b/src/games/stratspt.h @@ -78,7 +78,7 @@ class StrategySupportProfile { Game GetGame() const { return m_nfg; } /// Returns the number of strategies in the support for player pl. - int NumStrategies(int pl) const { return m_support[pl].Length(); } + int NumStrategies(int pl) const { return m_support[pl].size(); } /// Returns the number of strategies in the support for all players. Array NumStrategies() const; diff --git a/src/solvers/linalg/lptab.imp b/src/solvers/linalg/lptab.imp index 45b8557e7..ec784ca69 100644 --- a/src/solvers/linalg/lptab.imp +++ b/src/solvers/linalg/lptab.imp @@ -395,7 +395,7 @@ void LPTableau::ReversePivots(List > &PivotList) // gout << "\nafter checking cols, BestSet = "; // BestSet.Dump(gout); - if(BestSet.Length()>0) + if (!BestSet.empty()) for(i=1;i<=BestSet.Length();i++) { pivot[1] = BestSet[i]; pivot[2] = j;