graph-games-proto 0.3.1917__py3-none-any.whl → 0.3.1919__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
@@ -1942,9 +1942,7 @@ class StateKernal(PClass):
1942
1942
  player_idxs = field(type=list) # List[int]
1943
1943
  history = field(type=list) # List[PublicAction]
1944
1944
  player_scores = field(type=list) # List[PlayerScore]
1945
- uuid2edge = field(type=dict) # Dict[str, BiEdge]
1946
1945
  idx2path = field(type=list) # List[Path2]
1947
- uuid2segment = field(type=dict) # Dict[str, Segment]
1948
1946
  pieceuuid2piece = field(type=dict) # Dict[str, Piece]
1949
1947
  edgeuuid2idx = field(type=dict) # Dict[str, int]
1950
1948
  carduuid2card = field(type=dict) # Dict[str, Card]
@@ -1959,9 +1957,7 @@ class StateKernal(PClass):
1959
1957
  "player_idxs": self.player_idxs,
1960
1958
  "history": [action.__todict__() for action in self.history],
1961
1959
  "player_scores": [score.__todict__() for score in self.player_scores],
1962
- "uuid2edge": {k: v.__todict() for k, v in self.uuid2edge.items()},
1963
1960
  "idx2path": [v.__todict__() for v in self.idx2path],
1964
- "uuid2segment": {k: v.__todict__() for k, v in self.uuid2segment.items()},
1965
1961
  "pieceuuid2piece": {k: v.__todict__() for k, v in self.pieceuuid2piece.items()},
1966
1962
  "edgeuuid2idx": self.edgeuuid2idx,
1967
1963
  "carduuid2card": {k: v.__todict__() for k, v in self.carduuid2card.items()},
@@ -1978,30 +1974,23 @@ class StateKernal(PClass):
1978
1974
  player_idxs=d["player_idxs"],
1979
1975
  history=[PublicAction.__fromdict__(action) for action in d["history"]],
1980
1976
  player_scores=[PlayerScore.__fromdict__(score) for score in d["player_scores"]],
1981
- uuid2edge={k: BiEdge.__fromdict(v) for k, v in d["uuid2edge"].items()},
1982
1977
  idx2path=[Path2.__fromdict(v) for v in d["idx2path"]],
1983
- uuid2segment={k: Segment2.__fromdict(v) for k, v in d["uuid2segment"].items()},
1984
1978
  pieceuuid2piece={k: Piece.__fromdict(v) for k, v in d["pieceuuid2piece"].items()},
1985
1979
  edgeuuid2idx=d["edgeuuid2idx"],
1986
1980
  carduuid2card={k: Card.__fromdict(v) for k, v in d["carduuid2card"].items()},
1987
1981
  )
1988
1982
 
1989
1983
 
1990
- def init_state_kernal(**kwargs):
1984
+ def init_state_kernel(**kwargs):
1991
1985
  game_config = kwargs.get('game_config')
1992
1986
  fig = game_config.fig
1993
1987
  board_config = fig.board_config
1994
1988
  edges = kwargs.get('edges', [])
1995
- uuid2edge = {}
1996
1989
  idx2path = []
1997
- uuid2segment = {}
1998
1990
  edgeuuid2idx = {edge.uuid: idx for idx, edge in enumerate(edges)}
1999
1991
  for edge in edges:
2000
- uuid2edge[edge.uuid] = edge
2001
1992
  for path in edge.paths:
2002
1993
  idx2path.append(path)
2003
- for segment in path.segments:
2004
- uuid2segment[segment.uuid] = segment
2005
1994
  pieceuuid2piece = {}
2006
1995
  for piece_template in board_config.piece_templates:
2007
1996
  if piece_template.has_player:
@@ -2025,9 +2014,7 @@ def init_state_kernal(**kwargs):
2025
2014
  player_idxs=kwargs.get('player_idxs'),
2026
2015
  history=kwargs.get('history'),
2027
2016
  player_scores=kwargs.get('player_scores'),
2028
- uuid2edge=uuid2edge,
2029
2017
  idx2path=idx2path,
2030
- uuid2segment=uuid2segment,
2031
2018
  edgeuuid2idx=edgeuuid2idx,
2032
2019
  carduuid2card=carduuid2card,
2033
2020
  pieceuuid2piece=pieceuuid2piece,
@@ -2035,12 +2022,9 @@ def init_state_kernal(**kwargs):
2035
2022
 
2036
2023
 
2037
2024
  class State(PClass):
2038
- kernal = field(type=StateKernal)
2039
- uuid2edge = field(type=dict) # Dict[str, BiEdge]
2025
+ kernel = field(type=StateKernal)
2040
2026
  idx2path = field(type=list) # List[Path2]
2041
- uuid2segment = field(type=dict) # Dict[str, Segment]
2042
2027
  pieceuuid2piece = field(type=dict) # Dict[str, Piece]
2043
- carduuid2card = field(type=dict) # Dict[str, Card]
2044
2028
  bonus_statuses = field(type=list) # List[BonusStatus]
2045
2029
  bonusuuid2bonusidx = field(type=dict) # Dict[str, int]
2046
2030
  carduuid2deckidx = field(type=dict) # Dict[str, int]
@@ -2067,12 +2051,9 @@ class State(PClass):
2067
2051
  winners = field(type=list) # List[int]
2068
2052
  def __todict__(self):
2069
2053
  return {
2070
- "kernal": self.kernal.__todict__(),
2071
- "uuid2edge": {k: v.__todict__() for k, v in self.uuid2edge.items()},
2054
+ "kernel": self.kernel.__todict__(),
2072
2055
  "idx2path": [v.__todict__() for v in self.idx2path],
2073
- "uuid2segment": {k: v.__todict__() for k, v in self.uuid2segment.items()},
2074
2056
  "pieceuuid2piece": {k: v.__todict__() for k, v in self.pieceuuid2piece.items()},
2075
- "carduuid2card": {k: v.__todict__() for k, v in self.carduuid2card.items()},
2076
2057
  "bonus_statuses": [status.__todict__() for status in self.bonus_statuses],
2077
2058
  "bonusuuid2bonusidx": self.bonusuuid2bonusidx,
2078
2059
  "carduuid2deckidx": self.carduuid2deckidx,
@@ -2101,12 +2082,9 @@ class State(PClass):
2101
2082
  @staticmethod
2102
2083
  def __fromdict__(d):
2103
2084
  return State(
2104
- kernal=StateKernal.__fromdict__(d["kernal"]),
2105
- uuid2edge={k: BiEdge.__fromdict__(v) for k, v in d["uuid2edge"].items()},
2085
+ kernel=StateKernal.__fromdict__(d["kernel"]),
2106
2086
  idx2path=[Path2.__fromdict__(v) for v in d["idx2path"]],
2107
- uuid2segment={k: Segment2.__fromdict__(v) for k, v in d["uuid2segment"].items()},
2108
2087
  pieceuuid2piece={k: Piece.__fromdict__(v) for k, v in d["pieceuuid2piece"].items()},
2109
- carduuid2card={k: Card.__fromdict__(v) for k, v in d["carduuid2card"].items()},
2110
2088
  bonus_statuses=[BonusStatus.__fromdict__(x) for x in d["bonus_statuses"]],
2111
2089
  bonusuuid2bonusidx=d["bonusuuid2bonusidx"],
2112
2090
  carduuid2deckidx=d["carduuid2deckidx"],
@@ -2610,13 +2588,11 @@ def getinitialstate(game_config):
2610
2588
  )
2611
2589
  piles.append(pile)
2612
2590
 
2613
- carduuid2card = {}
2614
2591
  carduuid2deckidx = {}
2615
2592
  decks = []
2616
2593
  for dek in board_config.deks:
2617
2594
  cards = generate_cards(dek)
2618
2595
  for card in cards:
2619
- carduuid2card[card.uuid] = card
2620
2596
  carduuid2deckidx[card.uuid] = dek.idx
2621
2597
  deck_obj = Deck(
2622
2598
  uuid=dek.uuid,
@@ -2638,17 +2614,11 @@ def getinitialstate(game_config):
2638
2614
  edge_tuple = (min(node_1_idx, node_2_idx), max(node_1_idx, node_2_idx))
2639
2615
  edgetuple2uuid[edge_tuple] = edge.uuid
2640
2616
 
2641
-
2642
- uuid2edge = {}
2643
2617
  idx2path = []
2644
- uuid2segment = {}
2645
2618
 
2646
2619
  for edge in edges:
2647
- uuid2edge[edge.uuid] = edge
2648
2620
  for path in edge.paths:
2649
2621
  idx2path.append(path)
2650
- for segment in path.segments:
2651
- uuid2segment[segment.uuid] = segment
2652
2622
 
2653
2623
  bonuses = game_config.fig.board_config.bonuses
2654
2624
  bonusuuid2bonusidx = {bonus.uuid: idx for idx, bonus in enumerate(bonuses)}
@@ -2669,11 +2639,8 @@ def getinitialstate(game_config):
2669
2639
  ]
2670
2640
 
2671
2641
  state = State(
2672
- uuid2edge=uuid2edge,
2673
2642
  idx2path=idx2path,
2674
- uuid2segment=uuid2segment,
2675
2643
  pieceuuid2piece=pieceuuid2piece,
2676
- carduuid2card=carduuid2card,
2677
2644
  bonus_statuses=bonus_statuses,
2678
2645
  bonusuuid2bonusidx=bonusuuid2bonusidx,
2679
2646
  carduuid2deckidx=carduuid2deckidx,
@@ -2711,7 +2678,7 @@ def getinitialstate(game_config):
2711
2678
 
2712
2679
  state = run_state_hooks(state, INITIALIZATION_HOOKS, True)
2713
2680
 
2714
- kernal = init_state_kernal(
2681
+ kernel = init_state_kernel(
2715
2682
  rng=rng,
2716
2683
  game_config=state.game_config,
2717
2684
  edges=state.edges,
@@ -2723,8 +2690,8 @@ def getinitialstate(game_config):
2723
2690
  player_scores=state.player_scores,
2724
2691
  )
2725
2692
 
2726
- state = state.set(kernal=kernal)
2727
- state = state.set(legal_actions_3=calc_legal_actions3(kernal))
2693
+ state = state.set(kernel=kernel)
2694
+ state = state.set(legal_actions_3=calc_legal_actions3(kernel))
2728
2695
 
2729
2696
  return state
2730
2697
 
@@ -3098,7 +3065,7 @@ def get_follow_up_draw_legal_actions(game, action):
3098
3065
 
3099
3066
  for card_uuid in game.decks[0].faceup_spots:
3100
3067
  if card_uuid:
3101
- if not game.carduuid2card[card_uuid].is_wild:
3068
+ if not game.kernel.carduuid2card[card_uuid].is_wild:
3102
3069
  to_return.append(
3103
3070
  LegalAction(
3104
3071
  player_idx=legal_action.player_idx,
@@ -3141,7 +3108,7 @@ def append_follow_up_draw_legal_actions(game, action):
3141
3108
 
3142
3109
  for card_uuid in game.decks[0].faceup_spots:
3143
3110
  if card_uuid:
3144
- if not game.carduuid2card[card_uuid].is_wild:
3111
+ if not game.kernel.carduuid2card[card_uuid].is_wild:
3145
3112
  game = append_to_legal_actions(
3146
3113
  game,
3147
3114
  LegalAction(
@@ -3165,7 +3132,7 @@ def get_num_faceup_wilds(game, deck_idx):
3165
3132
  non_empty_spots = [spot for spot in deck.faceup_spots if spot]
3166
3133
  if not non_empty_spots:
3167
3134
  return 0
3168
- return sum(1 for card_uuid in non_empty_spots if game.carduuid2card[card_uuid].is_wild)
3135
+ return sum(1 for card_uuid in non_empty_spots if game.kernel.carduuid2card[card_uuid].is_wild)
3169
3136
 
3170
3137
 
3171
3138
  def ensure_faceup_spots_valid(game):
@@ -3211,7 +3178,7 @@ def handle_faceup_draw_action(game, action):
3211
3178
  game = replenish_faceup_spot_if_needed(game, faceup_draw.deck_idx, spot_idx)
3212
3179
 
3213
3180
  # Prevent an extra draw if last draw was a face-wild-draw
3214
- if not game.carduuid2card[drawn_card].is_wild:
3181
+ if not game.kernel.carduuid2card[drawn_card].is_wild:
3215
3182
  # TODO: extract this out to user-defined function/hook
3216
3183
  game = append_follow_up_draw_legal_actions(game, action)
3217
3184
 
@@ -3343,7 +3310,7 @@ def handle_move_longest_path_card(game, action):
3343
3310
  player_with_card = find_player_with_longest_path_card(game)
3344
3311
  if player_with_card:
3345
3312
  # Find the index of the card from the player's cards, then pop it
3346
- card_idx = next((i for i, card_uuid in enumerate(player_with_card.cards) if game.carduuid2card[card_uuid].deck_idx == 2), None)
3313
+ card_idx = next((i for i, card_uuid in enumerate(player_with_card.cards) if game.kernel.carduuid2card[card_uuid].deck_idx == 2), None)
3347
3314
  if card_idx is not None:
3348
3315
  longest_path_card = player_with_card.cards.pop(card_idx)
3349
3316
 
@@ -3359,7 +3326,7 @@ def handle_move_longest_path_card(game, action):
3359
3326
 
3360
3327
  def find_player_with_longest_path_card(game):
3361
3328
  for player in game.players:
3362
- if any(game.carduuid2card[card_uuid].deck_idx == 2 for card_uuid in player.cards):
3329
+ if any(game.kernel.carduuid2card[card_uuid].deck_idx == 2 for card_uuid in player.cards):
3363
3330
  return player
3364
3331
  return None
3365
3332
 
@@ -3401,7 +3368,7 @@ def handle_move_pieces_to_path_action(game, action):
3401
3368
  # Remove the card from player's cards
3402
3369
  card_uuid = player.cards.pop(card_idx)
3403
3370
  # add to discard
3404
- game.decks[game.carduuid2card[card_uuid].deck_idx].discard.append(card_uuid)
3371
+ game.decks[game.kernel.carduuid2card[card_uuid].deck_idx].discard.append(card_uuid)
3405
3372
 
3406
3373
  game = recycle_decks_if_needed(game)
3407
3374
  game = replenish_decks_if_needed(game)
@@ -3910,7 +3877,7 @@ HOOK_NAMESPACE = {
3910
3877
 
3911
3878
  def get_wild_unit_uuids(game):
3912
3879
  wild_unit_uuids = []
3913
- for card in game.carduuid2card.values():
3880
+ for card in game.kernel.carduuid2card.values():
3914
3881
  if card.is_wild:
3915
3882
  wild_unit_uuids.append(card.resource_uuid)
3916
3883
  return wild_unit_uuids
@@ -3924,7 +3891,7 @@ def match_strict_wild(game, fulfillment, cards, segments):
3924
3891
 
3925
3892
  for segment in segments:
3926
3893
  if segment.unit_uuid and segment.unit_uuid in wild_unit_uuids:
3927
- first_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
3894
+ first_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.kernel.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
3928
3895
  if first_matching_idx is not None:
3929
3896
  new_fulfillment.append(new_cards.pop(first_matching_idx))
3930
3897
  else:
@@ -3942,8 +3909,8 @@ def match_non_wild_non_empty(game, fulfillment, cards, segments, log=False):
3942
3909
  new_segments = []
3943
3910
 
3944
3911
  for segment in segments:
3945
- first_strict_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
3946
- first_wild_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.carduuid2card[card_uuid].resource_uuid in wild_unit_uuids), None)
3912
+ first_strict_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.kernel.carduuid2card[card_uuid].resource_uuid == segment.unit_uuid), None)
3913
+ first_wild_matching_idx = next((i for i, card_uuid in enumerate(new_cards) if game.kernel.carduuid2card[card_uuid].resource_uuid in wild_unit_uuids), None)
3947
3914
  first_matching_idx = first_strict_matching_idx if first_strict_matching_idx is not None else first_wild_matching_idx
3948
3915
  if first_matching_idx is not None:
3949
3916
  new_fulfillment.append(new_cards.pop(first_matching_idx))
@@ -3982,14 +3949,14 @@ def match_empty(game, fulfillment, cards, segments):
3982
3949
 
3983
3950
 
3984
3951
  def get_uniform_sets(game, cards, min_length):
3985
- wilds = [card_uuid for card_uuid in cards if game.carduuid2card[card_uuid].is_wild]
3986
- non_wilds = [card_uuid for card_uuid in cards if not game.carduuid2card[card_uuid].is_wild]
3952
+ wilds = [card_uuid for card_uuid in cards if game.kernel.carduuid2card[card_uuid].is_wild]
3953
+ non_wilds = [card_uuid for card_uuid in cards if not game.kernel.carduuid2card[card_uuid].is_wild]
3987
3954
  # print("********************* cards: ", cards)
3988
3955
  # print("********************* wilds: ", wilds)
3989
3956
  # print("********************* non_wilds: ", non_wilds)
3990
3957
  unit_uuid_2_cards = {}
3991
3958
  for card_uuid in non_wilds:
3992
- card = game.carduuid2card[card_uuid]
3959
+ card = game.kernel.carduuid2card[card_uuid]
3993
3960
  if card.resource_uuid not in unit_uuid_2_cards:
3994
3961
  unit_uuid_2_cards[card.resource_uuid] = []
3995
3962
  unit_uuid_2_cards[card.resource_uuid].append(card_uuid)
@@ -4038,7 +4005,7 @@ def get_sample_actionclaimpath(game, player_idx, path_idx):
4038
4005
 
4039
4006
  def get_sample_path_fulfillment(game, player_idx, path_idx):
4040
4007
  path = game.idx2path[path_idx]
4041
- remaining_card_uuids = [card_uuid for card_uuid in game.players[player_idx].cards if game.carduuid2card[card_uuid].deck_idx == 0]
4008
+ remaining_card_uuids = [card_uuid for card_uuid in game.players[player_idx].cards if game.kernel.carduuid2card[card_uuid].deck_idx == 0]
4042
4009
  remaining_pieces = [
4043
4010
  piece_uuid
4044
4011
  for piece_uuid in game.players[player_idx].pieces
@@ -4178,19 +4145,19 @@ def isactionlegal2(s, a):
4178
4145
  return run_accept_action_hooks(s, a, ACCEPT_ACTION_HOOKS, False)
4179
4146
 
4180
4147
 
4181
- def calc_legal_actions3(state_kernal):
4182
- history = state_kernal.history
4148
+ def calc_legal_actions3(state_kernel):
4149
+ history = state_kernel.history
4183
4150
  last_action = history[-1] if len(history) > 0 else None
4184
4151
 
4185
4152
  if last_action is None or last_action.legal_action.name == "INITIAL-GOAL-KEEP":
4186
4153
 
4187
4154
  yet_to_make_initial_move = [
4188
- player for player in state_kernal.players if len(player.discard_tray) > 0
4155
+ player for player in state_kernel.players if len(player.discard_tray) > 0
4189
4156
  ]
4190
4157
 
4191
4158
  if len(yet_to_make_initial_move) == 0:
4192
4159
  # All players have made their initial move, proceed to the first player's turn
4193
- return get_default_legal_actions(state_kernal, state_kernal.player_idxs[0])
4160
+ return get_default_legal_actions(state_kernel, state_kernel.player_idxs[0])
4194
4161
 
4195
4162
  return [
4196
4163
  LegalAction(
@@ -4209,27 +4176,27 @@ def calc_legal_actions3(state_kernal):
4209
4176
 
4210
4177
  elif last_action.legal_action.faceup_draw:
4211
4178
  faceup_draw = last_action.legal_action.faceup_draw
4212
- if not state_kernal.carduuid2card[faceup_draw.card_uuid].is_wild:
4213
- legal_actions = get_follow_up_draw_legal_actions(state_kernal, last_action)
4179
+ if not state_kernel.carduuid2card[faceup_draw.card_uuid].is_wild:
4180
+ legal_actions = get_follow_up_draw_legal_actions(state_kernel, last_action)
4214
4181
  if legal_actions:
4215
4182
  return legal_actions
4216
4183
 
4217
4184
  elif last_action.legal_action.draw:
4218
4185
  if last_action.legal_action.draw.quantity == 1:
4219
- legal_actions = get_follow_up_draw_legal_actions(state_kernal, last_action)
4186
+ legal_actions = get_follow_up_draw_legal_actions(state_kernel, last_action)
4220
4187
  if legal_actions:
4221
4188
  return legal_actions
4222
4189
 
4223
4190
  elif last_action.legal_action.draw_discard:
4224
4191
  draw_discard = last_action.legal_action.draw_discard
4225
- player = state_kernal.players[last_action.legal_action.player_idx]
4192
+ player = state_kernel.players[last_action.legal_action.player_idx]
4226
4193
  return [
4227
4194
  LegalAction(
4228
4195
  player_idx=player.idx,
4229
4196
  name="GOAL-KEEP",
4230
4197
  instruction="Your move. Please select the routes you want to keep.",
4231
4198
  allotted_seconds=INITIAL_ALLOTTED_SECONDS,
4232
- allotted_since_action_idx=(len(state_kernal.history) - 1),
4199
+ allotted_since_action_idx=(len(state_kernel.history) - 1),
4233
4200
  keep=LegalActionKeep(
4234
4201
  deck_idx=draw_discard.deck_idx,
4235
4202
  min=draw_discard.min,
@@ -4238,38 +4205,36 @@ def calc_legal_actions3(state_kernal):
4238
4205
  )
4239
4206
  ]
4240
4207
 
4241
- next_player_idx = get_next_player_shuffled_idx(state_kernal, last_action)
4242
- return get_default_legal_actions(state_kernal, state_kernal.player_idxs[next_player_idx])
4208
+ next_player_idx = get_next_player_shuffled_idx(state_kernel, last_action)
4209
+ return get_default_legal_actions(state_kernel, state_kernel.player_idxs[next_player_idx])
4243
4210
 
4244
4211
 
4245
- def get_next_player_shuffled_idx(state_kernal, last_action):
4212
+ def get_next_player_shuffled_idx(state_kernel, last_action):
4246
4213
  last_player_idx = last_action.legal_action.player_idx
4247
- last_player_shuffled_idx = state_kernal.player_idxs.index(last_player_idx)
4248
- next_player_shuffled_idx = (last_player_shuffled_idx + 1) % len(state_kernal.player_idxs)
4214
+ last_player_shuffled_idx = state_kernel.player_idxs.index(last_player_idx)
4215
+ next_player_shuffled_idx = (last_player_shuffled_idx + 1) % len(state_kernel.player_idxs)
4249
4216
  return next_player_shuffled_idx
4250
4217
 
4251
4218
 
4252
- def init_state(kernal):
4219
+ def init_state(kernel):
4253
4220
  state = State(
4254
- rng=kernal.rng,
4255
- game_config=kernal.game_config,
4256
- edges=kernal.edges,
4257
- decks=kernal.decks,
4258
- piles=kernal.piles,
4259
- players=kernal.players,
4260
- player_idxs=kernal.player_idxs,
4261
- history=kernal.history,
4262
- player_scores=kernal.player_scores,
4221
+ rng=kernel.rng,
4222
+ game_config=kernel.game_config,
4223
+ edges=kernel.edges,
4224
+ decks=kernel.decks,
4225
+ piles=kernel.piles,
4226
+ players=kernel.players,
4227
+ player_idxs=kernel.player_idxs,
4228
+ history=kernel.history,
4229
+ player_scores=kernel.player_scores,
4263
4230
  legal_actions_3=[],
4264
4231
  is_terminal=False,
4265
- uuid2edge=kernal.uuid2edge,
4266
- idx2path=kernal.idx2path,
4267
- uuid2segment=kernal.uuid2segment,
4268
- pieceuuid2piece=kernal.pieceuuid2piece,
4269
- edgeuuid2idx=kernal.edgeuuid2idx,
4270
- carduuid2card=kernal.carduuid2card,
4232
+ idx2path=kernel.idx2path,
4233
+ pieceuuid2piece=kernel.pieceuuid2piece,
4234
+ edgeuuid2idx=kernel.edgeuuid2idx,
4235
+ carduuid2card=kernel.carduuid2card,
4271
4236
  )
4272
- state = state.set(legal_actions_3=calc_legal_actions3(kernal))
4237
+ state = state.set(legal_actions_3=calc_legal_actions3(kernel))
4273
4238
  return state
4274
4239
 
4275
4240
 
@@ -4282,7 +4247,7 @@ def getnextstate2(s, a, log=False):
4282
4247
  s = run_state_hooks(s, HANDLE_SCORING_HOOKS, log)
4283
4248
  s = run_state_hooks(s, HANDLE_TERMINAL_HOOKS, log)
4284
4249
 
4285
- state_kernal = init_state_kernal(
4250
+ state_kernel = init_state_kernel(
4286
4251
  rng=s.rng,
4287
4252
  game_config=s.game_config,
4288
4253
  edges=s.edges,
@@ -4293,7 +4258,7 @@ def getnextstate2(s, a, log=False):
4293
4258
  history=s.history,
4294
4259
  player_scores=s.player_scores,
4295
4260
  )
4296
- s = s.set(legal_actions_3=calc_legal_actions3(state_kernal))
4261
+ s = s.set(legal_actions_3=calc_legal_actions3(state_kernel))
4297
4262
 
4298
4263
  return s
4299
4264
 
@@ -4435,7 +4400,7 @@ def imagine_decks(public_state, private_state):
4435
4400
 
4436
4401
 
4437
4402
  def imagine_state(public_state, private_state):
4438
- kernal = init_state_kernal(
4403
+ kernel = init_state_kernel(
4439
4404
  rng=random.Random(),
4440
4405
  game_config=public_state.game_config,
4441
4406
  player_idxs=public_state.player_idxs,
@@ -4446,7 +4411,7 @@ def imagine_state(public_state, private_state):
4446
4411
  history=imagine_history(public_state, private_state),
4447
4412
  player_scores=imagine_player_scores(public_state, private_state),
4448
4413
  )
4449
- imagined_state = init_state(kernal)
4414
+ imagined_state = init_state(kernel)
4450
4415
  return imagined_state
4451
4416
 
4452
4417
 
@@ -5599,12 +5564,12 @@ HANDLE_TERMINAL_HOOKS = [
5599
5564
  ),
5600
5565
  ]
5601
5566
 
5602
- def get_default_legal_actions(state_kernal, player_idx):
5567
+ def get_default_legal_actions(state_kernel, player_idx):
5603
5568
  allotted_seconds = DEFAULT_ALLOTTED_SECONDS
5604
- allotted_since_action_idx = len(state_kernal.history) - 1
5569
+ allotted_since_action_idx = len(state_kernel.history) - 1
5605
5570
  legal_actions = []
5606
5571
 
5607
- if len(state_kernal.decks[1].facedown_stack) >= 1:
5572
+ if len(state_kernel.decks[1].facedown_stack) >= 1:
5608
5573
  legal_actions.append(
5609
5574
  LegalAction(
5610
5575
  player_idx=player_idx,
@@ -5620,7 +5585,7 @@ def get_default_legal_actions(state_kernal, player_idx):
5620
5585
  )
5621
5586
  )
5622
5587
 
5623
- if len(state_kernal.decks[0].facedown_stack) >= 1:
5588
+ if len(state_kernel.decks[0].facedown_stack) >= 1:
5624
5589
  legal_actions.append(
5625
5590
  LegalAction(
5626
5591
  auto_preferred=True,
@@ -5636,7 +5601,7 @@ def get_default_legal_actions(state_kernal, player_idx):
5636
5601
  )
5637
5602
  )
5638
5603
 
5639
- if len(state_kernal.decks[0].facedown_stack) >= 2:
5604
+ if len(state_kernel.decks[0].facedown_stack) >= 2:
5640
5605
  legal_actions.append(
5641
5606
  LegalAction(
5642
5607
  player_idx=player_idx,
@@ -5651,7 +5616,7 @@ def get_default_legal_actions(state_kernal, player_idx):
5651
5616
  )
5652
5617
  )
5653
5618
 
5654
- for card_uuid in state_kernal.decks[0].faceup_spots:
5619
+ for card_uuid in state_kernel.decks[0].faceup_spots:
5655
5620
  if card_uuid:
5656
5621
  legal_actions.append(
5657
5622
  LegalAction(
@@ -5667,7 +5632,7 @@ def get_default_legal_actions(state_kernal, player_idx):
5667
5632
  )
5668
5633
  )
5669
5634
 
5670
- for legal_action in get_legal_actions_for_paths(state_kernal, player_idx):
5635
+ for legal_action in get_legal_actions_for_paths(state_kernel, player_idx):
5671
5636
  legal_actions.append(legal_action)
5672
5637
 
5673
5638
  return legal_actions
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1917
3
+ Version: 0.3.1919
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=yH7roM_wtAdsgFfeQA8wahPykXQrdCoySKm3f8U5Diw,193316
3
+ graph_games_proto/fns.py,sha256=W9NSec9UZD-ChyDnis0obBz4d-1ckBGJzdCeSKpEu9M,191615
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.1917.dist-info/METADATA,sha256=Nzsbrk3Z0TxOO5hmViO9MlS4_Lw-kTunuJoJiB3N9FU,188
7
- graph_games_proto-0.3.1917.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1917.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1917.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1919.dist-info/METADATA,sha256=73zemgEdGj4B_AXQf-VpDmV-JkWw5uA1PhDUAvwA__U,188
7
+ graph_games_proto-0.3.1919.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1919.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1919.dist-info/RECORD,,