graph-games-proto 0.3.1900__py3-none-any.whl → 0.3.1902__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
@@ -4070,6 +4070,7 @@ def calc_legal_actions3(state_kernal):
4070
4070
 
4071
4071
 
4072
4072
  class StateKernal(PClass):
4073
+ game_config = field(type=GameConfig)
4073
4074
  edges = field(type=list) # List[BiEdge]
4074
4075
  decks = field(type=list) # List[Deck]
4075
4076
  piles = field(type=list) # List[Pile]
@@ -4077,14 +4078,18 @@ class StateKernal(PClass):
4077
4078
  player_idxs = field(type=list) # List[int]
4078
4079
  history = field(type=list) # List[PublicAction]
4079
4080
  player_scores = field(type=list) # List[PlayerScore]
4080
- game_config = field(type=GameConfig)
4081
4081
  uuid2edge = field(type=dict) # Dict[str, BiEdge]
4082
4082
  idx2path = field(type=list) # List[Path2]
4083
4083
  uuid2segment = field(type=dict) # Dict[str, Segment]
4084
+ pieceuuid2piece = field(type=dict) # Dict[str, Piece]
4084
4085
  edgeuuid2idx = field(type=dict) # Dict[str, int]
4086
+ carduuid2card = field(type=dict) # Dict[str, Card]
4085
4087
 
4086
4088
 
4087
4089
  def init_state_kernal(**kwargs):
4090
+ game_config = kwargs.get('game_config')
4091
+ fig = game_config.fig
4092
+ board_config = fig.board_config
4088
4093
  edges = kwargs.get('edges', [])
4089
4094
  uuid2edge = {}
4090
4095
  idx2path = []
@@ -4096,7 +4101,21 @@ def init_state_kernal(**kwargs):
4096
4101
  idx2path.append(path)
4097
4102
  for segment in path.segments:
4098
4103
  uuid2segment[segment.uuid] = segment
4104
+ pieceuuid2piece = {}
4105
+ for piece_template in board_config.piece_templates:
4106
+ if piece_template.has_player:
4107
+ for player_idx in range(game_config.num_players):
4108
+ pieces = generate_pieces(piece_template, player_idx)
4109
+ for piece in pieces:
4110
+ pieceuuid2piece[piece.uuid] = piece
4111
+ carduuid2card = {}
4112
+ for dek in board_config.deks:
4113
+ cards = generate_cards(dek)
4114
+ for card in cards:
4115
+ carduuid2card[card.uuid] = card
4116
+
4099
4117
  return StateKernal(
4118
+ game_config=game_config,
4100
4119
  edges=edges,
4101
4120
  decks=kwargs.get('decks'),
4102
4121
  piles=kwargs.get('piles'),
@@ -4104,11 +4123,12 @@ def init_state_kernal(**kwargs):
4104
4123
  player_idxs=kwargs.get('player_idxs'),
4105
4124
  history=kwargs.get('history'),
4106
4125
  player_scores=kwargs.get('player_scores'),
4107
- game_config=kwargs.get('game_config'),
4108
4126
  uuid2edge=uuid2edge,
4109
4127
  idx2path=idx2path,
4110
4128
  uuid2segment=uuid2segment,
4111
4129
  edgeuuid2idx=edgeuuid2idx,
4130
+ carduuid2card=carduuid2card,
4131
+ pieceuuid2piece=pieceuuid2piece,
4112
4132
  )
4113
4133
 
4114
4134
 
@@ -4124,6 +4144,7 @@ def getnextstate2(s, a, log=False):
4124
4144
  s = run_state_action_hooks(s, a, EMPTY_LEGAL_ACTIONS_HOOKS, log)
4125
4145
 
4126
4146
  state_kernal = init_state_kernal(
4147
+ game_config=s.game_config,
4127
4148
  edges=s.edges,
4128
4149
  decks=s.decks,
4129
4150
  piles=s.piles,
@@ -4131,7 +4152,6 @@ def getnextstate2(s, a, log=False):
4131
4152
  player_idxs=s.player_idxs,
4132
4153
  history=s.history,
4133
4154
  player_scores=s.player_scores,
4134
- game_config=s.game_config,
4135
4155
  )
4136
4156
  s = s.set(legal_actions_3=calc_legal_actions3(state_kernal))
4137
4157
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1900
3
+ Version: 0.3.1902
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=UaOPciy5NGI80NFPQ7UkCAh76MTngEOQfwdd9v-Zgs4,187990
3
+ graph_games_proto/fns.py,sha256=2KcO1B2jFlcwcddwGFzkjV5d9nxZz9m5sm0kOmZ9NkI,188787
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.1900.dist-info/METADATA,sha256=AHrt9_-p3mdMs6pDQ0nrl_Vzly7iMgnU7IeqofXelbk,188
7
- graph_games_proto-0.3.1900.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1900.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1900.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1902.dist-info/METADATA,sha256=gvmEGj3QttF1wrG5ynpGKh3fOsSr6tBeRmWDSFElNIo,188
7
+ graph_games_proto-0.3.1902.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1902.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1902.dist-info/RECORD,,