Changes in normal_form_game #226

merged 5 commits into from Feb 16, 2016


None yet

2 participants

oyamad commented Jan 24, 2016

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]])
>>> 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.)

@oyamad oyamad referenced this pull request in QuantEcon/QuantEcon.jl Jan 24, 2016

Add game_theory/normal_form_game.jl #95

2 of 3 tasks complete
mmcky commented Jan 25, 2016

@oyamad Thanks for these updates. Is this PR waiting on the referenced Julia PR or can we go ahead and merge this?

oyamad commented Jan 26, 2016

@mmcky Let's wait for one more day to see if someone wants to comment, in particular on __repr__.

@oyamad oyamad NormalFormGame: Modify __repr__ and __str__
Add information on shape and dtype
oyamad commented Feb 2, 2016

Modified NormalFormGame.__repr__ and __str__:

>>> player0 = Player([[3, 1], [0, 2]])
>>> player1 = Player([[2, 0], [1, 3]])
>>> g = NormalFormGame((player0, player1))
>>> g
<2x2 2-player NormalFormGame of dtype int64>
>>> print(g)
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>
mmcky commented Feb 15, 2016

@oyamad I see you've updated the __repr__ and __str__. Are you happy with these representations? Shall I merge this PR?

oyamad commented Feb 16, 2016

@mmcky Yes please.

@mmcky mmcky merged commit 2673021 into master Feb 16, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
@mmcky mmcky deleted the normal_form_game branch Feb 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment