graph-games-proto 0.3.1983__py3-none-any.whl → 0.3.1986__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 +18 -15
- {graph_games_proto-0.3.1983.dist-info → graph_games_proto-0.3.1986.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1983.dist-info → graph_games_proto-0.3.1986.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1983.dist-info → graph_games_proto-0.3.1986.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1983.dist-info → graph_games_proto-0.3.1986.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -1950,6 +1950,8 @@ class StateKernel(PClass):
|
|
1950
1950
|
nodeuuid2idx = field(type=dict) # Dict[str, int]
|
1951
1951
|
carduuid2deckidx = field(type=dict) # Dict[str, int]
|
1952
1952
|
bonusuuid2bonusidx = field(type=dict) # Dict[str, int]
|
1953
|
+
starting_decks = field(type=list) # List[Deck]
|
1954
|
+
starting_piles = field(type=list) # List[Pile]
|
1953
1955
|
def __todict__(self):
|
1954
1956
|
return {
|
1955
1957
|
"rng": rng2json(self.rng),
|
@@ -1969,6 +1971,8 @@ class StateKernel(PClass):
|
|
1969
1971
|
"nodeuuid2idx": self.nodeuuid2idx,
|
1970
1972
|
"carduuid2deckidx": self.carduuid2deckidx,
|
1971
1973
|
"bonusuuid2bonusidx": self.bonusuuid2bonusidx,
|
1974
|
+
"starting_decks": [deck.__todict__() for deck in self.starting_decks],
|
1975
|
+
"starting_piles": [pile.__todict__() for pile in self.starting_piles],
|
1972
1976
|
}
|
1973
1977
|
@staticmethod
|
1974
1978
|
def __fromdict__(d):
|
@@ -1990,6 +1994,8 @@ class StateKernel(PClass):
|
|
1990
1994
|
nodeuuid2idx=d["nodeuuid2idx"],
|
1991
1995
|
carduuid2deckidx=d["carduuid2deckidx"],
|
1992
1996
|
bonusuuid2bonusidx=d["bonusuuid2bonusidx"],
|
1997
|
+
starting_decks=[Deck.__fromdict__(x) for x in d["starting_decks"]],
|
1998
|
+
starting_piles=[Pile.__fromdict__(x) for x in d["starting_piles"]],
|
1993
1999
|
)
|
1994
2000
|
|
1995
2001
|
|
@@ -2049,7 +2055,9 @@ def init_state_kernel(**kwargs):
|
|
2049
2055
|
edgetuple2uuid=edgetuple2uuid,
|
2050
2056
|
nodeuuid2idx=nodeuuid2idx,
|
2051
2057
|
carduuid2deckidx=carduuid2deckidx,
|
2052
|
-
bonusuuid2bonusidx=bonusuuid2bonusidx
|
2058
|
+
bonusuuid2bonusidx=bonusuuid2bonusidx,
|
2059
|
+
starting_decks=kwargs.get('starting_decks'),
|
2060
|
+
starting_piles=kwargs.get('starting_piles'),
|
2053
2061
|
)
|
2054
2062
|
|
2055
2063
|
|
@@ -2057,8 +2065,6 @@ class State(PClass):
|
|
2057
2065
|
kernel = field(type=StateKernel)
|
2058
2066
|
idx2path = field(type=list) # List[Path2]
|
2059
2067
|
bonus_statuses = field(type=list) # List[BonusStatus]
|
2060
|
-
starting_decks = field(type=list) # List[Deck]
|
2061
|
-
starting_piles = field(type=list)
|
2062
2068
|
history = field(type=list) # List[Action2]
|
2063
2069
|
player_scores = field(type=list) # List[PlayerScore2]
|
2064
2070
|
player_graphs = field(type=list) # List[PlayerGraph]
|
@@ -2079,8 +2085,6 @@ class State(PClass):
|
|
2079
2085
|
"kernel": self.kernel.__todict__(),
|
2080
2086
|
"idx2path": [v.__todict__() for v in self.idx2path],
|
2081
2087
|
"bonus_statuses": [status.__todict__() for status in self.bonus_statuses],
|
2082
|
-
"starting_decks": [deck.__todict__() for deck in self.starting_decks],
|
2083
|
-
"starting_piles": [pile.__todict__() for pile in self.starting_piles],
|
2084
2088
|
"history": [x.__todict__() for x in self.history],
|
2085
2089
|
"player_scores": [x.__todict__() for x in self.player_scores],
|
2086
2090
|
"player_graphs": [x.__todict__() for x in self.player_graphs],
|
@@ -2103,8 +2107,6 @@ class State(PClass):
|
|
2103
2107
|
kernel=StateKernel.__fromdict__(d["kernel"]),
|
2104
2108
|
idx2path=[Path2.__fromdict__(v) for v in d["idx2path"]],
|
2105
2109
|
bonus_statuses=[BonusStatus.__fromdict__(x) for x in d["bonus_statuses"]],
|
2106
|
-
starting_decks=[Deck.__fromdict__(x) for x in d["starting_decks"]],
|
2107
|
-
starting_piles=[Pile.__fromdict__(x) for x in d["starting_piles"]],
|
2108
2110
|
history=[Action2.__fromdict__(x) for x in d["history"]],
|
2109
2111
|
player_scores=[PlayerScore2.__fromdict__(x) for x in d["player_scores"]],
|
2110
2112
|
player_graphs=[PlayerGraph.__fromdict__(x) for x in d["player_graphs"]],
|
@@ -2637,16 +2639,13 @@ def getinitialstate(game_config):
|
|
2637
2639
|
)
|
2638
2640
|
for bonus in bonuses
|
2639
2641
|
]
|
2642
|
+
|
2643
|
+
starting_decks=[Deck.__fromdict__(x.__todict__()) for x in decks]
|
2644
|
+
starting_piles=[Pile.__fromdict__(x.__todict__()) for x in piles]
|
2640
2645
|
|
2641
2646
|
state = State(
|
2642
2647
|
idx2path=idx2path,
|
2643
2648
|
bonus_statuses=bonus_statuses,
|
2644
|
-
starting_decks=[
|
2645
|
-
Deck.__fromdict__(x.__todict__()) for x in decks
|
2646
|
-
],
|
2647
|
-
starting_piles=[
|
2648
|
-
Pile.__fromdict__(x.__todict__()) for x in piles
|
2649
|
-
],
|
2650
2649
|
history=[],
|
2651
2650
|
player_scores=[PlayerScore2(public_items=[], private_items=[]) for _ in range(game_config.num_players)],
|
2652
2651
|
player_graphs=[
|
@@ -2681,6 +2680,8 @@ def getinitialstate(game_config):
|
|
2681
2680
|
player_idxs=state.player_idxs,
|
2682
2681
|
history=state.history,
|
2683
2682
|
player_scores=state.player_scores,
|
2683
|
+
starting_decks=starting_decks,
|
2684
|
+
starting_piles=starting_piles,
|
2684
2685
|
)
|
2685
2686
|
|
2686
2687
|
state = state.set(kernel=kernel)
|
@@ -4101,6 +4102,8 @@ def getnextstate2(s, a, log=False):
|
|
4101
4102
|
player_idxs=s.player_idxs,
|
4102
4103
|
history=s.history,
|
4103
4104
|
player_scores=s.player_scores,
|
4105
|
+
starting_decks=s.kernel.starting_decks,
|
4106
|
+
starting_piles=s.kernel.starting_piles,
|
4104
4107
|
)
|
4105
4108
|
s = s.set(legal_actions_3=calc_legal_actions3(state_kernel))
|
4106
4109
|
|
@@ -4272,8 +4275,8 @@ def getpublicstate(s):
|
|
4272
4275
|
all_pieces=list(s.kernel.pieceuuid2piece.values()),
|
4273
4276
|
to_play_2=getpublictoplay(s),
|
4274
4277
|
bonus_statuses=s.bonus_statuses,
|
4275
|
-
starting_decks=s.starting_decks,
|
4276
|
-
starting_piles=s.starting_piles,
|
4278
|
+
starting_decks=s.kernel.starting_decks,
|
4279
|
+
starting_piles=s.kernel.starting_piles,
|
4277
4280
|
history=get_public_history(s),
|
4278
4281
|
player_scores=get_public_player_scores(s),
|
4279
4282
|
player_graphs=s.player_graphs,
|
@@ -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=CfVDjz6q53feWv71XmCFGOGFI40s8Op0jiq6BzEuVLI,182494
|
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.1986.dist-info/METADATA,sha256=idZgHPywS8D8vXzhRPJefE30f5kr5NrL1MeSjcbDtgI,188
|
7
|
+
graph_games_proto-0.3.1986.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1986.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1986.dist-info/RECORD,,
|
File without changes
|
File without changes
|