Docs: has_all and has_any (#1725)

Co-authored-by: el-u <109771707+el-u@users.noreply.github.com>
This commit is contained in:
Fabian Dill 2023-04-16 12:59:53 +02:00 committed by GitHub
parent ea03c90152
commit f395a6d184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -741,9 +741,11 @@ class CollectionState():
return self.prog_items[item, player] >= count
def has_all(self, items: Set[str], player: int) -> bool:
"""Returns True if each item name of items is in state at least once."""
return all(self.prog_items[item, player] for item in items)
def has_any(self, items: Set[str], player: int) -> bool:
"""Returns True if at least one item name of items is in state at least once."""
return any(self.prog_items[item, player] for item in items)
def count(self, item: str, player: int) -> int: