graph-games-proto 0.3.1755__py3-none-any.whl → 0.3.1756__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
@@ -2361,21 +2361,43 @@ class PublicPlayerScore(PClass):
2361
2361
  items=[ScoreItem2.__fromdict__(x) for x in d["items"]],
2362
2362
  total=d["total"]
2363
2363
  )
2364
+
2365
+
2366
+ class ScoreItemOwnsPath(PClass):
2367
+ path_idx = field(type=int)
2368
+ edge_uuid = field(type=str)
2369
+ length = field(type=int)
2370
+ def __todict__(self):
2371
+ return {
2372
+ "path_idx": self.path_idx,
2373
+ "edge_uuid": self.edge_uuid,
2374
+ "length": self.length,
2375
+ }
2376
+ @staticmethod
2377
+ def __fromdict__(d):
2378
+ return ScoreItemOwnsPath(
2379
+ path_idx=d["path_idx"],
2380
+ edge_uuid=d["edge_uuid"],
2381
+ length=d["length"],
2382
+ )
2364
2383
 
2365
2384
 
2366
2385
  class ScoreItem2(PClass):
2367
2386
  amount = field(type=int)
2368
2387
  description = field(type=(str, type(None)), initial=None)
2388
+ owns_path = field(type=(ScoreItemOwnsPath, type(None)), initial=None) # Optional[ScoreItemOwnsPath]
2369
2389
  def __todict__(self):
2370
2390
  return {
2371
2391
  "amount": self.amount,
2372
2392
  "description": self.description,
2393
+ "owns_path": self.owns_path.__todict__() if self.owns_path else None,
2373
2394
  }
2374
2395
  @staticmethod
2375
2396
  def __fromdict__(d):
2376
2397
  return ScoreItem2(
2377
2398
  amount=d["amount"],
2378
- description=d.get("description") # Handle None case
2399
+ description=d.get("description"), # Handle None case
2400
+ owns_path=ScoreItemOwnsPath.__fromdict__(d["owns_path"]) if d.get("owns_path") else None
2379
2401
  )
2380
2402
 
2381
2403
 
@@ -2985,7 +3007,15 @@ def score_public_items(game, player_idx):
2985
3007
  first_piece = game.pieceuuid2piece[first_segment.pieces[0]]
2986
3008
  if first_piece.player_idx == player_idx:
2987
3009
  items.append(
2988
- ScoreItem2(amount=edge.score, description="Player {} owns edge {}".format(player_idx, edge.uuid))
3010
+ ScoreItem2(
3011
+ amount=edge.score,
3012
+ owns_path=ScoreItemOwnsPath(
3013
+ path_idx=path.idx,
3014
+ edge_uuid=edge.uuid,
3015
+ length=len(path.segments),
3016
+ ),
3017
+ description="Player {} owns edge {}".format(player_idx, edge.uuid),
3018
+ )
2989
3019
  )
2990
3020
  for bonus_status in game.bonus_statuses:
2991
3021
  bonus_idx = game.bonusuuid2bonusidx.get(bonus_status.bonus_uuid)
@@ -2993,7 +3023,10 @@ def score_public_items(game, player_idx):
2993
3023
  if bonus:
2994
3024
  if player_idx in bonus_status.winners:
2995
3025
  items.append(
2996
- ScoreItem2(amount=bonus.score, description="Player {} wins bonus {}".format(player_idx, bonus.code))
3026
+ ScoreItem2(
3027
+ amount=bonus.score,
3028
+ description="Player {} wins bonus {}".format(player_idx, bonus.code),
3029
+ )
2997
3030
  )
2998
3031
  return items
2999
3032
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1755
3
+ Version: 0.3.1756
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=O5XjRfe3DlxbJn4zezDvvy7cXvL4IzIRPZCL3Y-n7s8,776
2
2
  graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
3
- graph_games_proto/fns.py,sha256=tXNB_opKY3SYSh0NHlIH77l_xKaTVaVzIDSQrP6G_hg,236864
3
+ graph_games_proto/fns.py,sha256=9eEpZsQCdHcRGNp1K-cfbpztqDEHxAA8pnleeRRAovE,238084
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.1755.dist-info/METADATA,sha256=GbwVTuU6vysYcnS_l9_wdaFLS3M0XcfYSx-A97huRiA,188
7
- graph_games_proto-0.3.1755.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1755.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1755.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1756.dist-info/METADATA,sha256=FyQgp8JTxy5-lL1ictgC3444TV6pe2kWpDSC_FJYthg,188
7
+ graph_games_proto-0.3.1756.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1756.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1756.dist-info/RECORD,,