|
22 | 22 | import io |
23 | 23 | import itertools |
24 | 24 | import pathlib |
25 | | -import warnings |
26 | 25 |
|
27 | 26 | import numpy as np |
28 | 27 | import scipy.stats |
@@ -2014,11 +2013,20 @@ class Game: |
2014 | 2013 | raise UndefinedOperationError("Cannot delete the only strategy for a player") |
2015 | 2014 | self.game.deref().DeleteStrategy(resolved_strategy.strategy) |
2016 | 2015 |
|
2017 | | - def get_plays(self, node: typing.Union[Node, str]) -> typing.List[Node]: |
2018 | | - resolved_node = cython.cast(Node, self._resolve_node(node, "get_plays", "node_obj")) |
| 2016 | + def get_plays(self, obj: typing.Union[Node, Infoset, Action]) -> typing.List[Node]: |
2019 | 2017 |
|
2020 | | - plays = [] |
2021 | | - for item in self.game.deref().GetPlays(resolved_node.node): |
2022 | | - plays.append(Node.wrap(item)) |
| 2018 | + c_plays = cython.declare(stdvector[c_GameNode]) |
2023 | 2019 |
|
2024 | | - return plays |
| 2020 | + if isinstance(obj, Node): |
| 2021 | + obj = cython.cast(Node, obj) |
| 2022 | + c_plays = self.game.deref().GetPlays(obj.node) |
| 2023 | + elif isinstance(obj, Infoset): |
| 2024 | + obj = cython.cast(Infoset, obj) |
| 2025 | + c_plays = self.game.deref().GetPlays(obj.infoset) |
| 2026 | + elif isinstance(obj, Action): |
| 2027 | + obj = cython.cast(Action, obj) |
| 2028 | + c_plays = self.game.deref().GetPlays(obj.action) |
| 2029 | + else: |
| 2030 | + raise TypeError("The object needs to be either Node, Infoset, or Action") |
| 2031 | + |
| 2032 | + return [Node.wrap(item) for item in c_plays] |
0 commit comments