@@ -290,6 +290,7 @@ class GameStrategyRep : public GameObject {
290290
291291// / A player in a game
292292class GamePlayerRep : public GameObject {
293+ friend class GameRep ;
293294 friend class GameExplicitRep ;
294295 friend class GameTreeRep ;
295296 friend class GameTableRep ;
@@ -311,7 +312,7 @@ class GamePlayerRep : public GameObject {
311312 int m_number;
312313 std::string m_label;
313314 std::vector<GameInfosetRep *> m_infosets;
314- Array <GameStrategyRep *> m_strategies;
315+ std::vector <GameStrategyRep *> m_strategies;
315316
316317 GamePlayerRep (GameRep *p_game, int p_id) : m_game(p_game), m_number(p_id) {}
317318 GamePlayerRep (GameRep *p_game, int p_id, int m_strats);
@@ -553,11 +554,21 @@ class GameRep : public BaseGameRep {
553554 // / Remove the strategy from the game
554555 virtual void DeleteStrategy (const GameStrategy &p_strategy) { throw UndefinedException (); }
555556 // / Returns the number of strategy contingencies in the game
556- virtual int NumStrategyContingencies () const = 0;
557+ int NumStrategyContingencies () const
558+ {
559+ BuildComputedValues ();
560+ return std::transform_reduce (m_players.begin (), m_players.end (), 0 , std::multiplies<>(),
561+ [](const GamePlayerRep *p) { return p->m_strategies .size (); });
562+ }
557563 // / Returns the total number of actions in the game
558564 virtual int BehavProfileLength () const = 0;
559565 // / Returns the total number of strategies in the game
560- virtual int MixedProfileLength () const = 0;
566+ int MixedProfileLength () const
567+ {
568+ BuildComputedValues ();
569+ return std::transform_reduce (m_players.begin (), m_players.end (), 0 , std::plus<>(),
570+ [](const GamePlayerRep *p) { return p->m_strategies .size (); });
571+ }
561572 // @}
562573
563574 virtual PureStrategyProfile NewPureStrategyProfile () const = 0;
@@ -696,7 +707,7 @@ inline size_t GamePlayerRep::NumStrategies() const
696707inline GameStrategy GamePlayerRep::GetStrategy (int st) const
697708{
698709 m_game->BuildComputedValues ();
699- return m_strategies[st] ;
710+ return m_strategies. at (st - 1 ) ;
700711}
701712
702713// =======================================================================
0 commit comments