Relatively minor changes:
NormalFormGame now requires the Player instances to be homogeneous in dtype (as in the Julia version).
NormalFormGame.__getitem__ returns an ndarray of the common dtype (previously, it was list).
Player.__repr__ has been changed:
>>> player = Player([[4, 0], [3, 2]])
(NormalFormGame.__repr__ kept unchanged. Constructing a payoff profile array is costly, so it is printed by an explicit call of print.)
NormalFormGame: Require homogeneity in dtype of Players
NormalFormGame: Let __getitem__ return ndarray
Player: Re-implement __repr__
@oyamad Thanks for these updates. Is this PR waiting on the referenced Julia PR or can we go ahead and merge this?
@mmcky Let's wait for one more day to see if someone wants to comment, in particular on __repr__.
NormalFormGame: Modify __repr__ and __str__
Add information on shape and dtype
Modified NormalFormGame.__repr__ and __str__:
>>> player0 = Player([[3, 1], [0, 2]])
>>> player1 = Player([[2, 0], [1, 3]])
>>> g = NormalFormGame((player0, player1))
<2x2 2-player NormalFormGame of dtype int64>
2-player NormalFormGame with payoff profile array:
[[[3, 2], [1, 1]],
[[0, 0], [2, 3]]]
>>> NormalFormGame((2, 2, 2))
<2x2x2 3-player NormalFormGame of dtype float64>
@oyamad I see you've updated the __repr__ and __str__. Are you happy with these representations? Shall I merge this PR?
@mmcky Yes please.