graph-games-proto 0.3.1915__py3-none-any.whl → 0.3.1916__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
@@ -2607,6 +2607,8 @@ def getinitialstate(game_config):
2607
2607
  state = run_state_hooks(state, INITIALIZATION_HOOKS, True)
2608
2608
 
2609
2609
  state_kernal = init_state_kernal(
2610
+ rng=rng,
2611
+ game_config=state.game_config,
2610
2612
  edges=state.edges,
2611
2613
  decks=state.decks,
2612
2614
  piles=state.piles,
@@ -2614,7 +2616,6 @@ def getinitialstate(game_config):
2614
2616
  player_idxs=state.player_idxs,
2615
2617
  history=state.history,
2616
2618
  player_scores=state.player_scores,
2617
- game_config=state.game_config,
2618
2619
  )
2619
2620
  state = state.set(legal_actions_3=calc_legal_actions3(state_kernal))
2620
2621
 
@@ -4142,6 +4143,7 @@ def get_next_player_shuffled_idx(state_kernal, last_action):
4142
4143
 
4143
4144
 
4144
4145
  class StateKernal(PClass):
4146
+ rng = field(type=random.Random)
4145
4147
  game_config = field(type=GameConfig)
4146
4148
  edges = field(type=list) # List[BiEdge]
4147
4149
  decks = field(type=list) # List[Deck]
@@ -4187,6 +4189,7 @@ def init_state_kernal(**kwargs):
4187
4189
  carduuid2card[card.uuid] = card
4188
4190
 
4189
4191
  return StateKernal(
4192
+ rng=kwargs.get('rng'),
4190
4193
  game_config=game_config,
4191
4194
  edges=edges,
4192
4195
  decks=kwargs.get('decks'),
@@ -4214,6 +4217,7 @@ def getnextstate2(s, a, log=False):
4214
4217
  s = run_state_hooks(s, HANDLE_TERMINAL_HOOKS, log)
4215
4218
 
4216
4219
  state_kernal = init_state_kernal(
4220
+ rng=s.rng,
4217
4221
  game_config=s.game_config,
4218
4222
  edges=s.edges,
4219
4223
  decks=s.decks,
@@ -4344,10 +4348,14 @@ def get_public_player_scores(s):
4344
4348
  # goal_completions = field(type=list, initial=[]) # List[GoalCompletion]
4345
4349
 
4346
4350
 
4347
-
4348
4351
  def get_public_history(s):
4349
4352
  return [action.get_public(s) for action in s.history]
4350
4353
 
4354
+
4355
+ def imagine_rng():
4356
+ return random.Random()
4357
+
4358
+
4351
4359
  def imagine_history(public_state, private_state):
4352
4360
  pass
4353
4361
 
@@ -4363,41 +4371,21 @@ def imagine_players(public_state, private_state):
4363
4371
  def imagine_decks(public_state, private_state):
4364
4372
  pass
4365
4373
 
4366
- def imagine_rng(public_state, private_state):
4367
- pass
4368
-
4369
4374
 
4370
4375
  def imagine_state(public_state, private_state):
4371
- return State(
4372
- uuid2edge = public_state.uuid2edge,
4373
- idx2path = public_state.idx2path,
4374
- uuid2segment = public_state.uuid2segment,
4375
- pieceuuid2piece = public_state.pieceuuid2piece,
4376
- carduuid2card = public_state.carduuid2card,
4377
- bonus_statuses = public_state.bonus_statuses,
4378
- bonusuuid2bonusidx = public_state.bonusuuid2bonusidx,
4379
- carduuid2deckidx = public_state.carduuid2deckidx,
4380
- starting_decks = public_state.starting_decks,
4381
- starting_piles = public_state.starting_piles,
4382
- player_graphs = public_state.player_graphs,
4383
- goals = public_state.goals,
4384
- nodes = public_state.nodes,
4385
- nodeuuid2idx = public_state.nodeuuid2idx,
4386
- edges = public_state.edges,
4387
- edgeuuid2idx = public_state.edgeuuid2idx,
4388
- edgetuple2uuid = public_state.edgetuple2uuid,
4389
- regions = public_state.regions,
4390
- last_to_play = public_state.last_to_play,
4391
- winners = public_state.winners,
4392
- piles = public_state.piles,
4393
- player_idxs = public_state.player_idxs,
4394
- game_config = public_state.game_config,
4395
- players = imagine_players(public_state, private_state),
4396
- decks = imagine_decks(public_state, private_state),
4397
- rng = imagine_rng(public_state, private_state),
4398
- history = imagine_history(public_state, private_state),
4399
- player_scores = imagine_player_scores(public_state, private_state),
4376
+ kernal = init_state_kernal(
4377
+ rng=imagine_rng(),
4378
+ game_config=public_state.game_config,
4379
+ player_idxs=public_state.player_idxs,
4380
+ piles=public_state.piles,
4381
+ edges=public_state.edges,
4382
+ decks=imagine_decks(public_state, private_state),
4383
+ players=imagine_players(public_state, private_state),
4384
+ history=imagine_history(public_state, private_state),
4385
+ player_scores=imagine_player_scores(public_state, private_state),
4400
4386
  )
4387
+ imagined_state = init_state(kernal)
4388
+ return imagined_state
4401
4389
 
4402
4390
 
4403
4391
  def isterminal(s):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1915
3
+ Version: 0.3.1916
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=Rj9ALtDUBPp5C0sn7ExUcuXrzOabAw7A1Xsf-LKL7Sg,191027
3
+ graph_games_proto/fns.py,sha256=W7tRrFF1jmt6x8BD5HOomrwiRJ6xWjMyhlD5OAw6jUQ,190223
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.1915.dist-info/METADATA,sha256=8DzNZJm4Rg3_o3wwY0t6DEQIjF8wFibw9dK6jrRntd4,188
7
- graph_games_proto-0.3.1915.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1915.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1915.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1916.dist-info/METADATA,sha256=tx8X1XVD9ogkC-atGxhajgT-xu_FTZPH7-EkYfmTWUI,188
7
+ graph_games_proto-0.3.1916.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1916.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1916.dist-info/RECORD,,