graph-games-proto 0.3.1989__py3-none-any.whl → 0.3.1991__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
@@ -2066,8 +2066,16 @@ def init_state_kernel(**kwargs):
2066
2066
 
2067
2067
 
2068
2068
  class State(PClass):
2069
- # Identity
2070
2069
  kernel = field(type=StateKernel)
2070
+
2071
+ # Identity: these fields should be in the kernel (set once at the start of the game and never changes)
2072
+ rng = field(type=random.Random)
2073
+
2074
+ # Identity: these fields should be in the kernel (can only be changed in "get_initial_state")
2075
+ player_idxs = field(type=list) # List[int]
2076
+
2077
+ # Identity - these fields should be in the kernel (can only be changed in "get_initial_state" and "get_next_state")
2078
+ # The struture should be this: uuid2segment, uuid2edge, uuid2path, uuid2region, uuid2node
2071
2079
  history = field(type=list) # List[Action2]
2072
2080
  players = field(type=list) # List[Player]
2073
2081
  nodes = field(type=list) # List[Node]
@@ -2075,14 +2083,11 @@ class State(PClass):
2075
2083
  regions = field(type=list) # List[Region]
2076
2084
  piles = field(type=list) # List[Pile]
2077
2085
  last_to_play = field(type=(int, type(None)), initial=None)
2086
+ decks = field(type=list) # List[Deck]
2078
2087
 
2088
+ # Not sure yet
2079
2089
  idx2path = field(type=list) # List[Path2]
2080
2090
 
2081
- # Scoring
2082
- player_idxs = field(type=list) # List[int]
2083
- decks = field(type=list) # List[Deck]
2084
- rng = field(type=random.Random)
2085
-
2086
2091
  # Memoized
2087
2092
  player_graphs = field(type=list) # List[PlayerGraph]
2088
2093
  legal_actions_3 = field(type=list) # List[LegalAction]
@@ -4073,7 +4078,11 @@ def get_next_player_shuffled_idx(state_kernel, last_action):
4073
4078
 
4074
4079
 
4075
4080
  def init_state(kernel):
4076
- state = State(
4081
+
4082
+ legal_actions_3 = calc_legal_actions3(kernel)
4083
+
4084
+ return State(
4085
+ kernel=kernel,
4077
4086
  rng=kernel.rng,
4078
4087
  game_config=kernel.game_config,
4079
4088
  edges=kernel.edges,
@@ -4083,13 +4092,11 @@ def init_state(kernel):
4083
4092
  player_idxs=kernel.player_idxs,
4084
4093
  history=kernel.history,
4085
4094
  player_scores=kernel.player_scores,
4086
- legal_actions_3=[],
4087
4095
  is_terminal=False,
4088
4096
  idx2path=kernel.idx2path,
4089
4097
  carduuid2card=kernel.carduuid2card,
4098
+ legal_actions_3=legal_actions_3,
4090
4099
  )
4091
- state = state.set(legal_actions_3=calc_legal_actions3(kernel))
4092
- return state
4093
4100
 
4094
4101
 
4095
4102
  def getnextstate2(s, a, log=False):
@@ -4257,7 +4264,7 @@ def imagine_decks(public_state, private_state):
4257
4264
 
4258
4265
 
4259
4266
  def imagine_state(public_state, private_state):
4260
- kernel = init_state_kernel(
4267
+ imagined_kernel = init_state_kernel(
4261
4268
  rng=random.Random(),
4262
4269
  game_config=public_state.game_config,
4263
4270
  player_idxs=public_state.player_idxs,
@@ -4268,8 +4275,7 @@ def imagine_state(public_state, private_state):
4268
4275
  history=imagine_history(public_state, private_state),
4269
4276
  player_scores=imagine_player_scores(public_state, private_state),
4270
4277
  )
4271
- imagined_state = init_state(kernel)
4272
- return imagined_state
4278
+ return init_state(imagined_kernel)
4273
4279
 
4274
4280
 
4275
4281
  def isterminal(s):
@@ -4290,7 +4296,7 @@ def getpublicstate(s):
4290
4296
  history=get_public_history(s),
4291
4297
  player_scores=get_public_player_scores(s),
4292
4298
  player_graphs=s.player_graphs,
4293
- goals=s.goals,
4299
+ goals=s.kernel.goals,
4294
4300
  nodes=s.nodes,
4295
4301
  edges=s.edges,
4296
4302
  regions=s.regions,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1989
3
+ Version: 0.3.1991
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=I5TKswJWFPFWBORV9VOArGWBlXgUW3GXb-1GP0HVhxE,182680
3
+ graph_games_proto/fns.py,sha256=6Ige7fQpiwFfp_8hs0Y8UigGukPcZikTOlvqUH9SFnI,183080
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.1989.dist-info/METADATA,sha256=Mv0DRZjDx42RK5lO5oFiwkJofNq6YmNqokhkaH2rwVA,188
7
- graph_games_proto-0.3.1989.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1989.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1989.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1991.dist-info/METADATA,sha256=yRJWt5u49G0lNdYHF4reIbt_djNo4HoYPH61eCrd_SU,188
7
+ graph_games_proto-0.3.1991.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1991.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1991.dist-info/RECORD,,