graph-games-proto 0.3.2030__py3-none-any.whl → 0.3.2035__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
@@ -2090,10 +2090,6 @@ class State(PClass):
2090
2090
  player_scores_3 = field(type=list) # List[PlayerScore2]
2091
2091
  winners = field(type=list) # List[int]
2092
2092
 
2093
- player_graphs = field(type=list) # List[PlayerGraph]
2094
- player_scores = field(type=list) # List[PlayerScore2]
2095
- bonus_statuses = field(type=list) # List[BonusStatus]
2096
-
2097
2093
  def __todict__(self):
2098
2094
  return {
2099
2095
  "kernel": self.kernel.__todict__(),
@@ -2864,7 +2860,7 @@ def handle_last_to_play(game):
2864
2860
  for player in game.players:
2865
2861
  if len(player.pieces) < 3:
2866
2862
  return game.set(last_to_play=player.idx)
2867
- elif game.last_to_play == game.history[-1].legal_action.player_idx:
2863
+ elif game.last_to_play == game.kernel.history[-1].legal_action.player_idx:
2868
2864
  if not game.legal_actions_3:
2869
2865
  return game.set(terminal=True)
2870
2866
  return game
@@ -3170,14 +3166,15 @@ def handle_draw_discard_action(kernel, action):
3170
3166
  )
3171
3167
 
3172
3168
 
3173
- def get_follow_up_draw_legal_actions(game, action):
3169
+ @dispatch(State, Action2)
3170
+ def get_follow_up_draw_legal_actions(state, action):
3174
3171
  to_return = []
3175
3172
  legal_action = action.legal_action
3176
- if len(game.history) >= 2:
3177
- last_action = game.history[-2]
3173
+ if len(state.kernel.history) >= 2:
3174
+ last_action = state.kernel.history[-2]
3178
3175
  if (last_action.legal_action.player_idx != legal_action.player_idx) or last_action.legal_action.name == "INITIAL-GOAL-KEEP":
3179
3176
 
3180
- if len(game.decks[0].facedown_stack) >= 1:
3177
+ if len(state.kernel.decks[0].facedown_stack) >= 1:
3181
3178
  to_return.append(
3182
3179
  LegalAction(
3183
3180
  auto_preferred=True,
@@ -3185,7 +3182,7 @@ def get_follow_up_draw_legal_actions(game, action):
3185
3182
  name="DRAW",
3186
3183
  instruction="draw a unit",
3187
3184
  allotted_seconds=DEFAULT_ALLOTTED_SECONDS,
3188
- allotted_since_action_idx=(len(game.history) - 1),
3185
+ allotted_since_action_idx=(len(state.kernel.history) - 1),
3189
3186
  draw=LegalActionDraw(
3190
3187
  deck_idx=0,
3191
3188
  quantity=1,
@@ -3193,16 +3190,16 @@ def get_follow_up_draw_legal_actions(game, action):
3193
3190
  )
3194
3191
  )
3195
3192
 
3196
- for card_uuid in game.decks[0].faceup_spots:
3193
+ for card_uuid in state.kernel.decks[0].faceup_spots:
3197
3194
  if card_uuid:
3198
- if not game.carduuid2card[card_uuid].is_wild:
3195
+ if not state.kernel.carduuid2card[card_uuid].is_wild:
3199
3196
  to_return.append(
3200
3197
  LegalAction(
3201
3198
  player_idx=legal_action.player_idx,
3202
3199
  name="FACEUP-DRAW",
3203
3200
  instruction="draw a faceup unit",
3204
3201
  allotted_seconds=DEFAULT_ALLOTTED_SECONDS,
3205
- allotted_since_action_idx=(len(game.history) - 1),
3202
+ allotted_since_action_idx=(len(state.kernel.history) - 1),
3206
3203
  faceup_draw=LegalActionFaceupDraw(
3207
3204
  deck_idx=0,
3208
3205
  card_uuid=card_uuid,
@@ -4468,6 +4465,7 @@ def get_player_max_allotted_time(s, player_idx):
4468
4465
  return None
4469
4466
 
4470
4467
 
4468
+ @dispatch(State, AllottedTime)
4471
4469
  def get_deadline(s, max_allotted_time):
4472
4470
  if not max_allotted_time:
4473
4471
  return None
@@ -4478,7 +4476,7 @@ def get_deadline(s, max_allotted_time):
4478
4476
  "%Y-%m-%d %H:%M:%S"
4479
4477
  )
4480
4478
  else:
4481
- since_action = s.history[since_action_idx]
4479
+ since_action = s.kernel.history[since_action_idx]
4482
4480
  submitted_at = since_action.submitted_at
4483
4481
  allotted_since = datetime.strptime(submitted_at, "%Y-%m-%d %H:%M:%S")
4484
4482
  deadline = allotted_since + timedelta(seconds=max_allotted_time.seconds)
@@ -4532,8 +4530,9 @@ def get_public_player_scores(s):
4532
4530
  # goal_completions = field(type=list, initial=[]) # List[GoalCompletion]
4533
4531
 
4534
4532
 
4533
+ @dispatch(State)
4535
4534
  def get_public_history(s):
4536
- return [action.get_public(s) for action in s.history]
4535
+ return [action.get_public(s) for action in s.kernel.history]
4537
4536
 
4538
4537
 
4539
4538
  def imagine_history(public_state, private_state):
@@ -5265,7 +5264,7 @@ def json2rng(json_str):
5265
5264
  @dispatch(State, int)
5266
5265
  def getprivatestate(s, player_idx):
5267
5266
  return PrivateState(
5268
- my_history=[a for a in s.history if a.legal_action.player_idx == player_idx],
5267
+ my_history=[a for a in s.kernel.history if a.legal_action.player_idx == player_idx],
5269
5268
  player_score=getprivateplayerscore(s, s.player_scores[player_idx]),
5270
5269
  player=s.players[player_idx],
5271
5270
  legal_actions_3 = get_legal_actions3(s, player_idx),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.2030
3
+ Version: 0.3.2035
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=_EVQR-51XehfH45XZlba1WPdx3omS3Gm1nTwrgGyn2Q,667
2
2
  graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
3
- graph_games_proto/fns.py,sha256=f3K8SmCxm0KTxHcsfOPI0o-JlRJv67COHyrIY1BC_FM,194428
3
+ graph_games_proto/fns.py,sha256=L45L9Sp5X2aJ0vPgxQZ7U5VegWXXAMyzcHsE_ct67Tk,194410
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.2030.dist-info/METADATA,sha256=L8VWWI9QG4dCrsqIewe1uQfM-WT9qWPMDfqALiuYiyM,188
7
- graph_games_proto-0.3.2030.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.2030.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.2030.dist-info/RECORD,,
6
+ graph_games_proto-0.3.2035.dist-info/METADATA,sha256=k38aDe-Rv5buIekgLRJ7AAbgCMT-Taw6WjZSnNehyAQ,188
7
+ graph_games_proto-0.3.2035.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.2035.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.2035.dist-info/RECORD,,