graph-games-proto 0.3.1732__py3-none-any.whl → 0.3.1734__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 CHANGED
@@ -2155,7 +2155,7 @@ class BonusStatus(PClass):
2155
2155
 
2156
2156
  class State(PClass):
2157
2157
  uuid2edge = field(type=dict) # Dict[str, BiEdge]
2158
- idx2path = field(type=dict) # Dict[str, Path2]
2158
+ idx2path = field(type=list) # List[Path2]
2159
2159
  uuid2segment = field(type=dict) # Dict[str, Segment]
2160
2160
  pieceuuid2piece = field(type=dict) # Dict[str, Piece]
2161
2161
  carduuid2card = field(type=dict) # Dict[str, Card]
@@ -2199,7 +2199,7 @@ class State(PClass):
2199
2199
  def __todict__(self):
2200
2200
  return {
2201
2201
  "uuid2edge": {k: v.__todict__() for k, v in self.uuid2edge.items()},
2202
- "idx2path": {k: v.__todict__() for k, v in self.idx2path.items()},
2202
+ "idx2path": [v.__todict__() for v in self.idx2path],
2203
2203
  "uuid2segment": {k: v.__todict__() for k, v in self.uuid2segment.items()},
2204
2204
  "pieceuuid2piece": {k: v.__todict__() for k, v in self.pieceuuid2piece.items()},
2205
2205
  "carduuid2card": {k: v.__todict__() for k, v in self.carduuid2card.items()},
@@ -2244,7 +2244,7 @@ class State(PClass):
2244
2244
  def __fromdict__(d):
2245
2245
  return State(
2246
2246
  uuid2edge={k: BiEdge.__fromdict__(v) for k, v in d["uuid2edge"].items()},
2247
- idx2path={k: Path2.__fromdict__(v) for k, v in d["idx2path"].items()},
2247
+ idx2path=[Path2.__fromdict__(v) for v in d["idx2path"]],
2248
2248
  uuid2segment={k: Segment2.__fromdict__(v) for k, v in d["uuid2segment"].items()},
2249
2249
  pieceuuid2piece={k: Piece.__fromdict__(v) for k, v in d["pieceuuid2piece"].items()},
2250
2250
  carduuid2card={k: Card.__fromdict__(v) for k, v in d["carduuid2card"].items()},
@@ -2874,13 +2874,13 @@ def getinitialstate(game_config):
2874
2874
 
2875
2875
 
2876
2876
  uuid2edge = {}
2877
- idx2path = {}
2877
+ idx2path = []
2878
2878
  uuid2segment = {}
2879
2879
 
2880
2880
  for edge in edges:
2881
2881
  uuid2edge[edge.uuid] = edge
2882
2882
  for path in edge.paths:
2883
- idx2path[path.idx] = path
2883
+ idx2path.append(path)
2884
2884
  for segment in path.segments:
2885
2885
  uuid2segment[segment.uuid] = segment
2886
2886
 
@@ -3880,14 +3880,14 @@ def append_default_legal_actions_for_next_player(game, action, log=False):
3880
3880
 
3881
3881
 
3882
3882
  def get_total_path_count(game):
3883
- return len(game.idx2path.values())
3883
+ return len(game.idx2path)
3884
3884
 
3885
3885
 
3886
3886
  def get_legal_actions_for_path(game, player_idx, path_idx):
3887
3887
  # print("****************************** get_legal_actions_for_path 1", path_idx)
3888
- if path_idx not in game.idx2path.keys():
3888
+ if path_idx < 0 or get_total_path_count(game) <= path_idx:
3889
3889
  return []
3890
- # print("****************************** get_legal_actions_for_path 2", path_idx)
3890
+ print("****************************** get_legal_actions_for_path 2", path_idx)
3891
3891
 
3892
3892
  if not is_path_open_to_player(game, path_idx, player_idx):
3893
3893
  return []
@@ -3905,7 +3905,7 @@ def get_legal_actions_for_path(game, player_idx, path_idx):
3905
3905
  allotted_since_action_idx=(len(game.history) - 1),
3906
3906
  btn_text="Claim path",
3907
3907
  move_pieces_to_path=LegalActionMovePiecesToPath(
3908
- path_idx=path_idx,
3908
+ path_idx=int(path_idx),
3909
3909
  default=default
3910
3910
  )
3911
3911
  )
@@ -3917,7 +3917,7 @@ def get_legal_actions_for_path(game, player_idx, path_idx):
3917
3917
  def get_legal_actions_for_paths(game, player_idx):
3918
3918
  legal_actions = []
3919
3919
 
3920
- for path_idx in game.idx2path.keys():
3920
+ for path_idx in range(get_total_path_count(game)):
3921
3921
  legal_actions_for_path = get_legal_actions_for_path(game, player_idx, path_idx)
3922
3922
  if legal_actions_for_path:
3923
3923
  legal_actions.extend(legal_actions_for_path)
@@ -3929,7 +3929,7 @@ def get_legal_actions_for_paths(game, player_idx):
3929
3929
 
3930
3930
  def is_path_open_to_player(game, path_idx, player_idx):
3931
3931
 
3932
- if not game or path_idx not in game.idx2path:
3932
+ if not game or path_idx < 0 or get_total_path_count(game) <= path_idx:
3933
3933
  return False
3934
3934
 
3935
3935
  # Check if edge is too crowded for the number of players
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1732
3
+ Version: 0.3.1734
4
4
  Requires-Dist: multipledispatch==1.0.0
5
5
  Requires-Dist: pyrsistent==0.20.0
6
6
  Requires-Dist: numpy==2.2.4
@@ -1,9 +1,9 @@
1
1
  graph_games_proto/__init__.py,sha256=sI31dBPkrs_UHYsuc1Q2sdYkJfpVPKpB--FuqghA208,864
2
2
  graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
3
- graph_games_proto/fns.py,sha256=Ur9B2VAmCvbkjK5h7uG2FGI0fhuq-Uie6XSIvq5y5ic,264235
3
+ graph_games_proto/fns.py,sha256=k6zmeQgeN6gQo2C2x7BM0GtT_T4TCY7nS62lcNDExKg,264248
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.1732.dist-info/METADATA,sha256=6Pgt0b7Z3G-xgLUCoxrsgW9SQp-yKuLPFIvyH6i1bRw,188
7
- graph_games_proto-0.3.1732.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1732.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1732.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1734.dist-info/METADATA,sha256=mAgaz24fZzDM8nprclZ6IMK6Rds56iDl_r9iDz6TUII,188
7
+ graph_games_proto-0.3.1734.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1734.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1734.dist-info/RECORD,,