Repository navigation
Fix death-birth MoranProcess pairing wrong players - #1502
barlowa124 wants to merge 2 commits into
Conversation
In mode="db", _matchup_indices() used the enumerate position in the dead node's neighbour list as the player index, so score_all() played and credited the wrong players. Use self.index[source] so both modes use global player positions. Fixes Axelrod-Python#1499.
|
The test is failing because the black formatter needs to be run. |
|
Took this for a spin locally on top of 153335c: |
|
Thanks for this @barlowa124. The only thing stopping CI from passing is the formatting of the new test. Could you run: and push the result? |
|
Done in 73fb176. Ran |
Fixes #1499.
In
MoranProcesswithmode="db",_matchup_indices()built matchupsfrom two different index spaces:
enumerate(sources)produced positionsin the dead node's neighbour list, while
self.index[target]producedglobal player positions.
score_all()then played and credited the wrongplayers. Nothing raised, which kept it hidden.
Birth-death mode was unaffected only by accident: there
sourcescoversevery vertex, so the enumerate counter coincides with
self.index[source].The change uses
self.index[source]in both modes, so matchup pairs arealways global player positions. On the issue's reproduction (5-cycle,
player 2 dead) matchups go from
{(0, 0), (1, 4)}to{(1, 0), (3, 4)}:the dead node's neighbours (players 1 and 3) each play their own
out-neighbours, and the dead vertex is skipped.
A regression test pins the matchup set and the resulting scores in the
exact internal state
__next__creates beforescore_all().pytest axelrod/tests/unit/test_moran.pypasses: 44 tests.