diff --git a/poetry.lock b/poetry.lock index bc52a50..ef8ae96 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1078,3 +1078,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more lock-version = "2.0" python-versions = "^3.8" content-hash = "0ed8c23d1db43691989d749ec6d9cc20e2532f94bc3f88f0a74edbf549f3d648" + diff --git a/pyproject.toml b/pyproject.toml index f666cb4..334a761 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,9 @@ sphinx-rtd-theme = "^1.2.0" black = "^23.7.0" coverage = "^7.1.0" +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.0" + [tool.pylint.master] disable = ["import-error", "missing-module-docstring", "unknown-option-value"] diff --git a/texasholdem/game/game.py b/texasholdem/game/game.py index f3b53be..39b865e 100644 --- a/texasholdem/game/game.py +++ b/texasholdem/game/game.py @@ -1284,10 +1284,11 @@ def _import_history(history: History) -> Iterator[TexasHoldEm]: game.take_action(action, total=total) yield game - def copy(self, shuffle: bool = True): + def copy(self, shuffle: bool = True, cards_players_to_keep: List = None): """ Arguments: shuffle (bool): Shuffle the deck, defaults to true. + cards_players_to_keep (List): List of player ids to keep cards for. Returns: TexasHoldEm: A copy of the game. @@ -1349,7 +1350,8 @@ def copy(self, shuffle: bool = True): game.start_hand() for i, cards in self.hands.items(): - game.hands[i] = cards.copy() + if cards_players_to_keep and i in cards_players_to_keep: + game.hands[i] = cards.copy() # swap decks game._deck = deck