Skip to content

Commit

Permalink
STL compatibility replacing Length with size.
Browse files Browse the repository at this point in the history
  • Loading branch information
tturocy committed Apr 5, 2023
1 parent aa2ac0b commit 03f171c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/games/behavspt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ void BehaviorSupportProfile::AddAction(const GameAction &s)
}

List<GameNode> 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
Expand Down Expand Up @@ -434,7 +435,7 @@ bool BehaviorSupportProfile::Dominates(const GameAction &a, const GameAction &b,

else {
List<GameNode> 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++) {
Expand Down
2 changes: 1 addition & 1 deletion src/games/gamebagg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/games/gameexpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/games/nash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ BehavViaStrategySolver<T>::Solve(const BehaviorSupportProfile &p_support) const
{
List<MixedStrategyProfile<T> > output = m_solver->Solve(p_support.GetGame());
List<MixedBehaviorProfile<T> > solutions;
for (int i = 1; i <= output.Length(); i++) {
solutions.push_back(MixedBehaviorProfile<T>(output[i]));
for (auto profile : output) {
solutions.push_back(MixedBehaviorProfile<T>(profile));
}
return solutions;
}
Expand Down Expand Up @@ -290,7 +290,7 @@ void SubgameBehavSolver<T>::SolveSubgames(const BehaviorSupportProfile &p_suppor
SolveSubgames(p_support, p_templateSolution,
subroots[i], subsolns, subvalues);

if (subsolns.Length() == 0) {
if (subsolns.empty()) {
solns = List<DVector<T> >();
return;
}
Expand Down Expand Up @@ -360,7 +360,7 @@ void SubgameBehavSolver<T>::SolveSubgames(const BehaviorSupportProfile &p_suppor

List<MixedBehaviorProfile<T> > sol = m_solver->Solve(subsupport);

if (sol.Length() == 0) {
if (sol.empty()) {
solns = List<DVector<T> >();
//printf("No solutions found\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion src/games/stratspt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<int> NumStrategies() const;
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/linalg/lptab.imp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void LPTableau<T>::ReversePivots(List<Array<int> > &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;
Expand Down

0 comments on commit 03f171c

Please sign in to comment.