graph-games-proto 0.3.1979__py3-none-any.whl → 0.3.1981__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- graph_games_proto/fns.py +11 -11
- {graph_games_proto-0.3.1979.dist-info → graph_games_proto-0.3.1981.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1979.dist-info → graph_games_proto-0.3.1981.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1979.dist-info → graph_games_proto-0.3.1981.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1979.dist-info → graph_games_proto-0.3.1981.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -1190,7 +1190,7 @@ class LegalActionKeep(PClass):
|
|
1190
1190
|
deck_idx = legal_action.keep.deck_idx
|
1191
1191
|
card_uuids_matching_deck = [
|
1192
1192
|
card_uuid for card_uuid in discard_tray
|
1193
|
-
if state.carduuid2deckidx[card_uuid] == deck_idx
|
1193
|
+
if state.kernel.carduuid2deckidx[card_uuid] == deck_idx
|
1194
1194
|
]
|
1195
1195
|
num_cards = len(card_uuids_matching_deck)
|
1196
1196
|
actual_min = 0 if legal_action.keep.min is None else legal_action.keep.min
|
@@ -1231,7 +1231,7 @@ class LegalActionDiscard(PClass):
|
|
1231
1231
|
deck_idx = legal_action.discard.deck_idx
|
1232
1232
|
card_uuids_matching_deck = [
|
1233
1233
|
card_uuid for card_uuid in discard_tray
|
1234
|
-
if state.carduuid2deckidx[card_uuid] == deck_idx
|
1234
|
+
if state.kernel.carduuid2deckidx[card_uuid] == deck_idx
|
1235
1235
|
]
|
1236
1236
|
num_cards = len(card_uuids_matching_deck)
|
1237
1237
|
actual_min = 0 if legal_action.discard.min is None else legal_action.discard.min
|
@@ -1535,7 +1535,7 @@ class ActionDiscard(PClass):
|
|
1535
1535
|
card_uuids = field(type=list) # List[int]
|
1536
1536
|
def get_public(self, state):
|
1537
1537
|
return PublicActionDiscard(
|
1538
|
-
deck_idxs=[state.carduuid2deckidx[card_uuid] for card_uuid in self.card_uuids]
|
1538
|
+
deck_idxs=[state.kernel.carduuid2deckidx[card_uuid] for card_uuid in self.card_uuids]
|
1539
1539
|
)
|
1540
1540
|
def __todict__(self):
|
1541
1541
|
return {
|
@@ -1565,7 +1565,7 @@ class ActionKeep(PClass):
|
|
1565
1565
|
card_uuids = field(type=list) # List[int])
|
1566
1566
|
def get_public(self, state):
|
1567
1567
|
return PublicActionKeep(
|
1568
|
-
deck_idxs=[state.carduuid2deckidx[card_uuid] for card_uuid in self.card_uuids]
|
1568
|
+
deck_idxs=[state.kernel.carduuid2deckidx[card_uuid] for card_uuid in self.card_uuids]
|
1569
1569
|
)
|
1570
1570
|
def __todict__(self):
|
1571
1571
|
return {
|
@@ -1948,6 +1948,7 @@ class StateKernel(PClass):
|
|
1948
1948
|
carduuid2card = field(type=dict) # Dict[str, Card]
|
1949
1949
|
edgetuple2uuid = field(type=dict) # Dict[Tuple[int, int], str]
|
1950
1950
|
nodeuuid2idx = field(type=dict) # Dict[str, int]
|
1951
|
+
carduuid2deckidx = field(type=dict) # Dict[str, int]
|
1951
1952
|
def __todict__(self):
|
1952
1953
|
return {
|
1953
1954
|
"rng": rng2json(self.rng),
|
@@ -1965,6 +1966,7 @@ class StateKernel(PClass):
|
|
1965
1966
|
"carduuid2card": {k: v.__todict__() for k, v in self.carduuid2card.items()},
|
1966
1967
|
"edgetuple2uuid": [{"k": list(k), "v": v} for k, v in self.edgetuple2uuid.items()],
|
1967
1968
|
"nodeuuid2idx": self.nodeuuid2idx,
|
1969
|
+
"carduuid2deckidx": self.carduuid2deckidx,
|
1968
1970
|
}
|
1969
1971
|
@staticmethod
|
1970
1972
|
def __fromdict__(d):
|
@@ -1984,6 +1986,7 @@ class StateKernel(PClass):
|
|
1984
1986
|
carduuid2card={k: Card.__fromdict(v) for k, v in d["carduuid2card"].items()},
|
1985
1987
|
edgetuple2uuid={tuple(item["k"]): item["v"] for item in d["edgetuple2uuid"]},
|
1986
1988
|
nodeuuid2idx=d["nodeuuid2idx"],
|
1989
|
+
carduuid2deckidx=d["carduuid2deckidx"],
|
1987
1990
|
)
|
1988
1991
|
|
1989
1992
|
|
@@ -2005,11 +2008,14 @@ def init_state_kernel(**kwargs):
|
|
2005
2008
|
pieces = generate_pieces(piece_template, player_idx)
|
2006
2009
|
for piece in pieces:
|
2007
2010
|
pieceuuid2piece[piece.uuid] = piece
|
2011
|
+
|
2012
|
+
carduuid2deckidx = {}
|
2008
2013
|
carduuid2card = {}
|
2009
2014
|
for dek in board_config.deks:
|
2010
2015
|
cards = generate_cards(dek)
|
2011
2016
|
for card in cards:
|
2012
2017
|
carduuid2card[card.uuid] = card
|
2018
|
+
carduuid2deckidx[card.uuid] = dek.idx
|
2013
2019
|
|
2014
2020
|
nodeuuid2idx = {node.uuid: idx for idx, node in enumerate(board_config.points)}
|
2015
2021
|
edges = get_edges(rng, board_config, nodeuuid2idx)
|
@@ -2036,6 +2042,7 @@ def init_state_kernel(**kwargs):
|
|
2036
2042
|
pieceuuid2piece=pieceuuid2piece,
|
2037
2043
|
edgetuple2uuid=edgetuple2uuid,
|
2038
2044
|
nodeuuid2idx=nodeuuid2idx,
|
2045
|
+
carduuid2deckidx=carduuid2deckidx,
|
2039
2046
|
)
|
2040
2047
|
|
2041
2048
|
|
@@ -2044,7 +2051,6 @@ class State(PClass):
|
|
2044
2051
|
idx2path = field(type=list) # List[Path2]
|
2045
2052
|
bonus_statuses = field(type=list) # List[BonusStatus]
|
2046
2053
|
bonusuuid2bonusidx = field(type=dict) # Dict[str, int]
|
2047
|
-
carduuid2deckidx = field(type=dict) # Dict[str, int]
|
2048
2054
|
starting_decks = field(type=list) # List[Deck]
|
2049
2055
|
starting_piles = field(type=list)
|
2050
2056
|
history = field(type=list) # List[Action2]
|
@@ -2068,7 +2074,6 @@ class State(PClass):
|
|
2068
2074
|
"idx2path": [v.__todict__() for v in self.idx2path],
|
2069
2075
|
"bonus_statuses": [status.__todict__() for status in self.bonus_statuses],
|
2070
2076
|
"bonusuuid2bonusidx": self.bonusuuid2bonusidx,
|
2071
|
-
"carduuid2deckidx": self.carduuid2deckidx,
|
2072
2077
|
"starting_decks": [deck.__todict__() for deck in self.starting_decks],
|
2073
2078
|
"starting_piles": [pile.__todict__() for pile in self.starting_piles],
|
2074
2079
|
"history": [x.__todict__() for x in self.history],
|
@@ -2094,7 +2099,6 @@ class State(PClass):
|
|
2094
2099
|
idx2path=[Path2.__fromdict__(v) for v in d["idx2path"]],
|
2095
2100
|
bonus_statuses=[BonusStatus.__fromdict__(x) for x in d["bonus_statuses"]],
|
2096
2101
|
bonusuuid2bonusidx=d["bonusuuid2bonusidx"],
|
2097
|
-
carduuid2deckidx=d["carduuid2deckidx"],
|
2098
2102
|
starting_decks=[Deck.__fromdict__(x) for x in d["starting_decks"]],
|
2099
2103
|
starting_piles=[Pile.__fromdict__(x) for x in d["starting_piles"]],
|
2100
2104
|
history=[Action2.__fromdict__(x) for x in d["history"]],
|
@@ -2591,12 +2595,9 @@ def getinitialstate(game_config):
|
|
2591
2595
|
)
|
2592
2596
|
piles.append(pile)
|
2593
2597
|
|
2594
|
-
carduuid2deckidx = {}
|
2595
2598
|
decks = []
|
2596
2599
|
for dek in board_config.deks:
|
2597
2600
|
cards = generate_cards(dek)
|
2598
|
-
for card in cards:
|
2599
|
-
carduuid2deckidx[card.uuid] = dek.idx
|
2600
2601
|
deck_obj = Deck(
|
2601
2602
|
uuid=dek.uuid,
|
2602
2603
|
idx=dek.idx,
|
@@ -2638,7 +2639,6 @@ def getinitialstate(game_config):
|
|
2638
2639
|
idx2path=idx2path,
|
2639
2640
|
bonus_statuses=bonus_statuses,
|
2640
2641
|
bonusuuid2bonusidx=bonusuuid2bonusidx,
|
2641
|
-
carduuid2deckidx=carduuid2deckidx,
|
2642
2642
|
starting_decks=[
|
2643
2643
|
Deck.__fromdict__(x.__todict__()) for x in decks
|
2644
2644
|
],
|
@@ -1,9 +1,9 @@
|
|
1
1
|
graph_games_proto/__init__.py,sha256=_EVQR-51XehfH45XZlba1WPdx3omS3Gm1nTwrgGyn2Q,667
|
2
2
|
graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
|
3
|
-
graph_games_proto/fns.py,sha256=
|
3
|
+
graph_games_proto/fns.py,sha256=jK1eZUO8OtrzJUpRs2uNOtelhaZZwGphkw59CpbTSUE,182177
|
4
4
|
graph_games_proto/main.py,sha256=fj2U7KcwrpZtuUhjOX5yVxY18LZvvsxDFYZ_S5mxe04,145
|
5
5
|
graph_games_proto/state.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
graph_games_proto-0.3.
|
7
|
-
graph_games_proto-0.3.
|
8
|
-
graph_games_proto-0.3.
|
9
|
-
graph_games_proto-0.3.
|
6
|
+
graph_games_proto-0.3.1981.dist-info/METADATA,sha256=CD2Hb9yHEm9IyX0_vrROdZ9iqn6TSZuBJeaDqo3HZ18,188
|
7
|
+
graph_games_proto-0.3.1981.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1981.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1981.dist-info/RECORD,,
|
File without changes
|
File without changes
|