Skip to content

Commit

Permalink
solves dual problem for single dual
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-s-s authored and drvinceknight committed Aug 3, 2017
1 parent 26f27e1 commit 95080a2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions axelrod/strategy_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ def reduce_for_decorated_class(self_):
"__reduce__": reduce_for_decorated_class,
})

if strategy_wrapper == dual_wrapper:
setattr(new_class, 'for_dual', PlayerClass)

return new_class
return Decorator

Expand Down Expand Up @@ -317,10 +320,10 @@ def dual_wrapper(player, opponent: Player, proposed_action: Action) -> Action:

flip_play_attributes(player)

if is_strategy_static(player.original_class):
action = player.original_class.strategy(opponent)
if is_strategy_static(player.for_dual):
action = player.for_dual.strategy(opponent)
else:
action = player.original_class.strategy(player, opponent)
action = player.for_dual.strategy(player, opponent)

flip_play_attributes(player)

Expand Down

0 comments on commit 95080a2

Please sign in to comment.