graph-games-proto 0.3.1952__py3-none-any.whl → 0.3.1953__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 +6 -15
- {graph_games_proto-0.3.1952.dist-info → graph_games_proto-0.3.1953.dist-info}/METADATA +1 -1
- {graph_games_proto-0.3.1952.dist-info → graph_games_proto-0.3.1953.dist-info}/RECORD +5 -5
- {graph_games_proto-0.3.1952.dist-info → graph_games_proto-0.3.1953.dist-info}/WHEEL +0 -0
- {graph_games_proto-0.3.1952.dist-info → graph_games_proto-0.3.1953.dist-info}/top_level.txt +0 -0
graph_games_proto/fns.py
CHANGED
@@ -1947,6 +1947,7 @@ class StateKernel(PClass):
|
|
1947
1947
|
edgeuuid2idx = field(type=dict) # Dict[str, int]
|
1948
1948
|
carduuid2card = field(type=dict) # Dict[str, Card]
|
1949
1949
|
edgetuple2uuid = field(type=dict) # Dict[Tuple[int, int], str]
|
1950
|
+
nodeuuid2idx = field(type=dict) # Dict[str, int]
|
1950
1951
|
def __todict__(self):
|
1951
1952
|
return {
|
1952
1953
|
"rng": rng2json(self.rng),
|
@@ -1963,6 +1964,7 @@ class StateKernel(PClass):
|
|
1963
1964
|
"edgeuuid2idx": self.edgeuuid2idx,
|
1964
1965
|
"carduuid2card": {k: v.__todict__() for k, v in self.carduuid2card.items()},
|
1965
1966
|
"edgetuple2uuid": [{"k": list(k), "v": v} for k, v in self.edgetuple2uuid.items()],
|
1967
|
+
"nodeuuid2idx": self.nodeuuid2idx,
|
1966
1968
|
}
|
1967
1969
|
@staticmethod
|
1968
1970
|
def __fromdict__(d):
|
@@ -1981,6 +1983,7 @@ class StateKernel(PClass):
|
|
1981
1983
|
edgeuuid2idx=d["edgeuuid2idx"],
|
1982
1984
|
carduuid2card={k: Card.__fromdict(v) for k, v in d["carduuid2card"].items()},
|
1983
1985
|
edgetuple2uuid={tuple(item["k"]): item["v"] for item in d["edgetuple2uuid"]},
|
1986
|
+
nodeuuid2idx=d["nodeuuid2idx"],
|
1984
1987
|
)
|
1985
1988
|
|
1986
1989
|
|
@@ -2032,6 +2035,7 @@ def init_state_kernel(**kwargs):
|
|
2032
2035
|
carduuid2card=carduuid2card,
|
2033
2036
|
pieceuuid2piece=pieceuuid2piece,
|
2034
2037
|
edgetuple2uuid=edgetuple2uuid,
|
2038
|
+
nodeuuid2idx=nodeuuid2idx,
|
2035
2039
|
)
|
2036
2040
|
|
2037
2041
|
|
@@ -2049,7 +2053,6 @@ class State(PClass):
|
|
2049
2053
|
player_graphs = field(type=list) # List[PlayerGraph]
|
2050
2054
|
goals = field(type=list) # List[Goal]
|
2051
2055
|
nodes = field(type=list) # List[Node]
|
2052
|
-
nodeuuid2idx = field(type=dict) # Dict[str, int]
|
2053
2056
|
edges = field(type=list) # List[BiEdge]
|
2054
2057
|
regions = field(type=list) # List[Region]
|
2055
2058
|
legal_actions_3 = field(type=list) # List[LegalAction]
|
@@ -2076,7 +2079,6 @@ class State(PClass):
|
|
2076
2079
|
"player_graphs": [x.__todict__() for x in self.player_graphs],
|
2077
2080
|
"goals": [goal.__todict__() for goal in self.goals],
|
2078
2081
|
"nodes": [node.__todict__() for node in self.nodes],
|
2079
|
-
"nodeuuid2idx": self.nodeuuid2idx,
|
2080
2082
|
"edges": [edge.__todict__() for edge in self.edges],
|
2081
2083
|
"regions": [region.__todict__() for region in self.regions],
|
2082
2084
|
"legal_actions_3": [x.__todict__() for x in self.legal_actions_3],
|
@@ -2105,7 +2107,6 @@ class State(PClass):
|
|
2105
2107
|
player_graphs=[PlayerGraph.__fromdict__(x) for x in d["player_graphs"]],
|
2106
2108
|
goals=[FrozenGoal.__fromdict__(goal) for goal in d["goals"]],
|
2107
2109
|
nodes=[Node.__fromdict__(n) for n in d["nodes"]],
|
2108
|
-
nodeuuid2idx=d["nodeuuid2idx"],
|
2109
2110
|
edges=[BiEdge.__fromdict__(e) for e in d["edges"]],
|
2110
2111
|
regions=[Region.__fromdict__(r) for r in d["regions"]],
|
2111
2112
|
legal_actions_3=[LegalAction.__fromdict__(x) for x in d["legal_actions_3"]],
|
@@ -2661,7 +2662,6 @@ def getinitialstate(game_config):
|
|
2661
2662
|
],
|
2662
2663
|
goals = board_config.goals,
|
2663
2664
|
nodes = nodes,
|
2664
|
-
nodeuuid2idx = nodeuuid2idx,
|
2665
2665
|
edges = edges,
|
2666
2666
|
regions = get_regions(board_config),
|
2667
2667
|
legal_actions_3=[],
|
@@ -4468,19 +4468,10 @@ def get_goal_completions(s, player_idx):
|
|
4468
4468
|
]
|
4469
4469
|
|
4470
4470
|
|
4471
|
+
@dispatch(State, FrozenGoal, int)
|
4471
4472
|
def is_goal_complete(s, goal, player_idx):
|
4472
4473
|
graph = s.player_graphs[player_idx].neighbors
|
4473
|
-
|
4474
|
-
node_idxs = [nodeuuid2idx[node_uuid] for node_uuid in goal.node_uuids]
|
4475
|
-
if goal.uuid == "d9ef7d75-63d4-4ceb-adce-f889db3c75f0":
|
4476
|
-
print("goal.uuid: ", goal.uuid)
|
4477
|
-
print("goal.node_uuids: ", goal.node_uuids)
|
4478
|
-
print(f"player: {player_idx} goal: ", goal.uuid)
|
4479
|
-
print("graph: ", graph)
|
4480
|
-
print("node_idxs: ", node_idxs)
|
4481
|
-
print("are_nodes_connected(graph, node_idxs): ", are_nodes_connected(graph, node_idxs))
|
4482
|
-
for node in s.nodes:
|
4483
|
-
print(f"node: {node}")
|
4474
|
+
node_idxs = [s.kernel.nodeuuid2idx[node_uuid] for node_uuid in goal.node_uuids]
|
4484
4475
|
return are_nodes_connected(
|
4485
4476
|
graph,
|
4486
4477
|
node_idxs,
|
@@ -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=Y880m_lmU6FCvxx4zowDu9Lrgcco4pOdDYYYQXzrQNY,182121
|
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.1953.dist-info/METADATA,sha256=ZAxOkRoFWLDz0NzLq1q15j0-FWw_gYTHWiqVvOH_Is8,188
|
7
|
+
graph_games_proto-0.3.1953.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
8
|
+
graph_games_proto-0.3.1953.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
|
9
|
+
graph_games_proto-0.3.1953.dist-info/RECORD,,
|
File without changes
|
File without changes
|