graph-games-proto 0.3.1756__py3-none-any.whl → 0.3.1758__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
@@ -15,8 +15,8 @@ from functools import cmp_to_key
15
15
  from itertools import combinations as itertools_combinations, chain
16
16
  from collections import deque
17
17
 
18
- DEFAULT_ALLOTTED_SECONDS = 20
19
- INITIAL_ALLOTTED_SECONDS = 30
18
+ DEFAULT_ALLOTTED_SECONDS = 60
19
+ INITIAL_ALLOTTED_SECONDS = 120
20
20
 
21
21
  class NoAction(PClass):
22
22
  pass
@@ -1669,7 +1669,7 @@ class LegalAction(PClass):
1669
1669
  name = field(type=str)
1670
1670
  title = field(type=(str, type(None)), initial=None) # Optional[str]
1671
1671
  instruction = field(type=(str, type(None)), initial=None) # Optional[str]
1672
- allotted_seconds = field(type=int, initial=120) # int
1672
+ allotted_seconds = field(type=int, initial=INITIAL_ALLOTTED_SECONDS) # int
1673
1673
  allotted_since_action_idx = field(type=int, initial=-1) # int
1674
1674
  btn_text = field(type=(str, type(None)), initial=None) # Optional[str]
1675
1675
  discard = field(type=(LegalActionDiscard, type(None)), initial=None) # LegalActionDiscard
@@ -2361,6 +2361,35 @@ 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 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
+ )
2364
2393
 
2365
2394
 
2366
2395
  class ScoreItemOwnsPath(PClass):
@@ -2386,18 +2415,24 @@ class ScoreItem2(PClass):
2386
2415
  amount = field(type=int)
2387
2416
  description = field(type=(str, type(None)), initial=None)
2388
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]
2389
2420
  def __todict__(self):
2390
2421
  return {
2391
2422
  "amount": self.amount,
2392
2423
  "description": self.description,
2393
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,
2394
2427
  }
2395
2428
  @staticmethod
2396
2429
  def __fromdict__(d):
2397
2430
  return ScoreItem2(
2398
2431
  amount=d["amount"],
2399
2432
  description=d.get("description"), # Handle None case
2400
- owns_path=ScoreItemOwnsPath.__fromdict__(d["owns_path"]) if d.get("owns_path") else None
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,
2401
2436
  )
2402
2437
 
2403
2438
 
@@ -3026,6 +3061,7 @@ def score_public_items(game, player_idx):
3026
3061
  ScoreItem2(
3027
3062
  amount=bonus.score,
3028
3063
  description="Player {} wins bonus {}".format(player_idx, bonus.code),
3064
+ bonus=ScoreItemBonus(bonus_uuid=bonus.uuid),
3029
3065
  )
3030
3066
  )
3031
3067
  return items
@@ -3040,12 +3076,20 @@ def score_private_items(game, player_idx):
3040
3076
  for complete_goal_uuid in complete_goal_uuids:
3041
3077
  goal = goaluuid2goal[complete_goal_uuid]
3042
3078
  items.append(
3043
- 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
+ )
3044
3084
  )
3045
3085
  for incomplete_goal_uuid in incomplete_goal_uuids:
3046
3086
  goal = goaluuid2goal[incomplete_goal_uuid]
3047
3087
  items.append(
3048
- 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
+ )
3049
3093
  )
3050
3094
  return items
3051
3095
 
@@ -3240,7 +3284,7 @@ def handle_draw_discard_action(game, action):
3240
3284
  player_idx=player.idx,
3241
3285
  name="GOAL-KEEP",
3242
3286
  instruction="Your move. Please select the routes you want to keep.",
3243
- allotted_seconds=120,
3287
+ allotted_seconds=INITIAL_ALLOTTED_SECONDS,
3244
3288
  allotted_since_action_idx=(len(game.history) - 1),
3245
3289
  keep=LegalActionKeep(
3246
3290
  deck_idx=draw_discard.deck_idx,
@@ -4408,16 +4452,16 @@ def get_max_allotted_times(s):
4408
4452
 
4409
4453
 
4410
4454
  def get_player_max_allotted_time(s, player_idx):
4411
- max_alotted_seconds = 0
4455
+ max_allotted_seconds = 0
4412
4456
  since_action_idx_of_max = -1
4413
4457
  for legal_action in s.legal_actions_2:
4414
4458
  if legal_action.player_idx == player_idx:
4415
- if legal_action.allotted_seconds > max_alotted_seconds:
4416
- max_alotted_seconds = legal_action.allotted_seconds
4459
+ if legal_action.allotted_seconds > max_allotted_seconds:
4460
+ max_allotted_seconds = legal_action.allotted_seconds
4417
4461
  since_action_idx_of_max = legal_action.allotted_since_action_idx
4418
- if max_alotted_seconds:
4462
+ if max_allotted_seconds:
4419
4463
  return AllottedTime(
4420
- seconds=max_alotted_seconds,
4464
+ seconds=max_allotted_seconds,
4421
4465
  since_action_idx=since_action_idx_of_max,
4422
4466
  )
4423
4467
  return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1756
3
+ Version: 0.3.1758
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=9eEpZsQCdHcRGNp1K-cfbpztqDEHxAA8pnleeRRAovE,238084
3
+ graph_games_proto/fns.py,sha256=LBH9OQXasGZwW9v6zh_PXD0rhlbXM21Cd9yxsHZDi10,239619
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.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,,
6
+ graph_games_proto-0.3.1758.dist-info/METADATA,sha256=buOZtp39_TtX2ab0LyvDvQ6cVTHPI3qIoJklh4D4Zos,188
7
+ graph_games_proto-0.3.1758.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1758.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1758.dist-info/RECORD,,