Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in normal_form_game #226

Merged
merged 5 commits into from
Feb 16, 2016
Merged

Changes in normal_form_game #226

merged 5 commits into from
Feb 16, 2016

Conversation

oyamad
Copy link
Member

@oyamad 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.)

@mmcky
Copy link
Contributor

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
Copy link
Member Author

oyamad commented Jan 26, 2016

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

Add information on shape and dtype
@oyamad
Copy link
Member Author

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
Copy link
Contributor

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
Copy link
Member Author

oyamad commented Feb 16, 2016

@mmcky Yes please.

mmcky added a commit that referenced this pull request Feb 16, 2016
@mmcky mmcky merged commit 2673021 into master Feb 16, 2016
@mmcky mmcky deleted the normal_form_game branch February 16, 2016 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants