Skip to content

Commit

Permalink
Add __repr__ for PolymatrixGame
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamad committed Dec 8, 2024
1 parent b733469 commit 7ff0896
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion quantecon/game_theory/polymatrix_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# from typing import TypeAlias, Self
from numpy.typing import NDArray

from .normal_form_game import NormalFormGame, Player
from .normal_form_game import NormalFormGame, Player, _nums_actions2string


def hh_payoff_player(
Expand Down Expand Up @@ -155,6 +155,10 @@ class PolymatrixGame:
Maps each pair of player numbers to a matrix.
"""
def __repr__(self):
s = '<{nums_actions} {N}-player PolymatrixGame>'
return s.format(nums_actions=_nums_actions2string(self.nums_actions),
N=self.N)

def __str__(self) -> str:
str_builder = (
Expand Down

0 comments on commit 7ff0896

Please sign in to comment.