graph-games-proto 0.3.1755__py3-none-any.whl → 0.3.1757__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
@@ -2363,19 +2363,76 @@ class PublicPlayerScore(PClass):
2363
2363
  )
2364
2364
 
2365
2365
 
2366
+ class ScoreItemBonus(PClass):
2367
+ bonus_uuid = field(type=str)
2368
+ def __todict__(self):
2369
+ return {
2370
+ "bonus_uuid": self.bonus_uuid,
2371
+ }
2372
+ @staticmethod
2373
+ def __fromdict__(d):
2374
+ return ScoreItemBonus(
2375
+ bonus_uuid=d["bonus_uuid"],
2376
+ )
2377
+
2378
+
2379
+ class ScoreItemGoal(PClass):
2380
+ goal_uuid = field(type=str)
2381
+ complete = field(type=bool)
2382
+ def __todict__(self):
2383
+ return {
2384
+ "goal_uuid": self.goal_uuid,
2385
+ "complete": self.complete,
2386
+ }
2387
+ @staticmethod
2388
+ def __fromdict__(d):
2389
+ return ScoreItemGoal(
2390
+ goal_uuid=d["goal_uuid"],
2391
+ complete=d["complete"],
2392
+ )
2393
+
2394
+
2395
+ class ScoreItemOwnsPath(PClass):
2396
+ path_idx = field(type=int)
2397
+ edge_uuid = field(type=str)
2398
+ length = field(type=int)
2399
+ def __todict__(self):
2400
+ return {
2401
+ "path_idx": self.path_idx,
2402
+ "edge_uuid": self.edge_uuid,
2403
+ "length": self.length,
2404
+ }
2405
+ @staticmethod
2406
+ def __fromdict__(d):
2407
+ return ScoreItemOwnsPath(
2408
+ path_idx=d["path_idx"],
2409
+ edge_uuid=d["edge_uuid"],
2410
+ length=d["length"],
2411
+ )
2412
+
2413
+
2366
2414
  class ScoreItem2(PClass):
2367
2415
  amount = field(type=int)
2368
2416
  description = field(type=(str, type(None)), initial=None)
2417
+ owns_path = field(type=(ScoreItemOwnsPath, type(None)), initial=None) # Optional[ScoreItemOwnsPath]
2418
+ goal = field(type=(ScoreItemGoal, type(None)), initial=None) # Optional[FrozenGoal]
2419
+ bonus = field(type=(ScoreItemBonus, type(None)), initial=None) # Optional[FrozenGoal]
2369
2420
  def __todict__(self):
2370
2421
  return {
2371
2422
  "amount": self.amount,
2372
2423
  "description": self.description,
2424
+ "owns_path": self.owns_path.__todict__() if self.owns_path else None,
2425
+ "goal": self.goal.__todict__() if self.goal else None,
2426
+ "bonus": self.bonus.__todict__() if self.bonus else None,
2373
2427
  }
2374
2428
  @staticmethod
2375
2429
  def __fromdict__(d):
2376
2430
  return ScoreItem2(
2377
2431
  amount=d["amount"],
2378
- description=d.get("description") # Handle None case
2432
+ description=d.get("description"), # Handle None case
2433
+ owns_path=ScoreItemOwnsPath.__fromdict__(d["owns_path"]) if d.get("owns_path") else None,
2434
+ goal=ScoreItemGoal.__fromdict__(d["goal"]) if d.get("goal") else None,
2435
+ bonus=ScoreItemBonus.__fromdict__(d["bonus"]) if d.get("bonus") else None,
2379
2436
  )
2380
2437
 
2381
2438
 
@@ -2985,7 +3042,15 @@ def score_public_items(game, player_idx):
2985
3042
  first_piece = game.pieceuuid2piece[first_segment.pieces[0]]
2986
3043
  if first_piece.player_idx == player_idx:
2987
3044
  items.append(
2988
- ScoreItem2(amount=edge.score, description="Player {} owns edge {}".format(player_idx, edge.uuid))
3045
+ ScoreItem2(
3046
+ amount=edge.score,
3047
+ owns_path=ScoreItemOwnsPath(
3048
+ path_idx=path.idx,
3049
+ edge_uuid=edge.uuid,
3050
+ length=len(path.segments),
3051
+ ),
3052
+ description="Player {} owns edge {}".format(player_idx, edge.uuid),
3053
+ )
2989
3054
  )
2990
3055
  for bonus_status in game.bonus_statuses:
2991
3056
  bonus_idx = game.bonusuuid2bonusidx.get(bonus_status.bonus_uuid)
@@ -2993,7 +3058,11 @@ def score_public_items(game, player_idx):
2993
3058
  if bonus:
2994
3059
  if player_idx in bonus_status.winners:
2995
3060
  items.append(
2996
- ScoreItem2(amount=bonus.score, description="Player {} wins bonus {}".format(player_idx, bonus.code))
3061
+ ScoreItem2(
3062
+ amount=bonus.score,
3063
+ description="Player {} wins bonus {}".format(player_idx, bonus.code),
3064
+ bonus=ScoreItemBonus(bonus_uuid=bonus.uuid),
3065
+ )
2997
3066
  )
2998
3067
  return items
2999
3068
 
@@ -3007,12 +3076,20 @@ def score_private_items(game, player_idx):
3007
3076
  for complete_goal_uuid in complete_goal_uuids:
3008
3077
  goal = goaluuid2goal[complete_goal_uuid]
3009
3078
  items.append(
3010
- ScoreItem2(amount=goal.score, description="Player {} completed goal {}".format(player_idx, complete_goal_uuid))
3079
+ ScoreItem2(
3080
+ amount=goal.score,
3081
+ description="Player {} completed goal {}".format(player_idx, complete_goal_uuid),
3082
+ goal=ScoreItemGoal(goal_uuid=complete_goal_uuid, complete=True)
3083
+ )
3011
3084
  )
3012
3085
  for incomplete_goal_uuid in incomplete_goal_uuids:
3013
3086
  goal = goaluuid2goal[incomplete_goal_uuid]
3014
3087
  items.append(
3015
- ScoreItem2(amount=(-1*goal.score), description="Player {} incomplete goal {}".format(player_idx, incomplete_goal_uuid))
3088
+ ScoreItem2(
3089
+ amount=(-1*goal.score),
3090
+ description="Player {} incomplete goal {}".format(player_idx, incomplete_goal_uuid),
3091
+ goal=ScoreItemGoal(goal_uuid=incomplete_goal_uuid, complete=False)
3092
+ )
3016
3093
  )
3017
3094
  return items
3018
3095
 
@@ -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.1757
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=6yx3VjDwYJuHTuOieunbSOS3AAFo8s62E2brZs2r4yQ,239571
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.1757.dist-info/METADATA,sha256=8Ti-bHAVP6pBkaRIpaqEcG5CZOVchOirDbHhebypDtY,188
7
+ graph_games_proto-0.3.1757.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1757.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1757.dist-info/RECORD,,