graph-games-proto 0.3.2276__py3-none-any.whl → 0.3.2295__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
@@ -1036,13 +1036,13 @@ class Player(PClass):
1036
1036
  idx = field(type=int)
1037
1037
  pieces = field(type=list) # List[Piece]
1038
1038
  cards = field(type=list) # List[Card]
1039
- discard_tray = field(type=PVector) # PVector[Card]
1039
+ discard_tray = field(type=PVector) # PVector[str]
1040
1040
  def __todict__(self):
1041
1041
  return {
1042
1042
  "idx": self.idx,
1043
1043
  "pieces": self.pieces,
1044
1044
  "cards": self.cards,
1045
- "discard_tray": [x.__todict__() for x in self.discard_tray],
1045
+ "discard_tray": list(self.discard_tray),
1046
1046
  }
1047
1047
  @staticmethod
1048
1048
  def __fromdict__(d):
@@ -1050,7 +1050,7 @@ class Player(PClass):
1050
1050
  idx=d["idx"],
1051
1051
  pieces=d["pieces"],
1052
1052
  cards=d["cards"],
1053
- discard_tray=[Card.__fromdict__(x) for x in d["discard_tray"]]
1053
+ discard_tray=v(d["discard_tray"])
1054
1054
  )
1055
1055
 
1056
1056
 
@@ -3334,7 +3334,9 @@ def handle_draw_discard_action(kernel, action):
3334
3334
  return kernel
3335
3335
  legal_action = action.legal_action
3336
3336
  draw_discard = legal_action.draw_discard
3337
- player = kernel.players[legal_action.player_idx]
3337
+
3338
+ p_idx = legal_action.player_idx
3339
+ player = kernel.players[p_idx]
3338
3340
  deck = kernel.decks[draw_discard.deck_idx]
3339
3341
 
3340
3342
  if len(deck.facedown_stack.cards) == 0:
@@ -3342,8 +3344,9 @@ def handle_draw_discard_action(kernel, action):
3342
3344
 
3343
3345
  for _ in range(draw_discard.quantity):
3344
3346
  drawn_card = deck.facedown_stack.cards.pop()
3345
- player.discard_tray.append(drawn_card)
3346
-
3347
+ player = player.set(discard_tray=player.discard_tray.append(drawn_card))
3348
+
3349
+ kernel.players[p_idx] = player # TODO: make it this: players=kernel.players.set(p_idx, player)
3347
3350
  return kernel.set(
3348
3351
  players=kernel.players,
3349
3352
  decks=kernel.decks,
@@ -3981,14 +3984,16 @@ def deal_cards_to_each_player_discard_tray(kernel, deck_idx, num_cards):
3981
3984
  if not deck or not deck.facedown_stack.cards:
3982
3985
  return kernel
3983
3986
 
3987
+ updated_players = []
3984
3988
  for player in kernel.players:
3985
3989
  # Deal cards to the player's discard tray
3986
3990
  for _ in range(num_cards):
3987
3991
  if deck.facedown_stack.cards:
3988
3992
  card = deck.facedown_stack.cards.pop()
3989
- player.discard_tray.append(card)
3993
+ player = player.set(discard_tray=player.discard_tray.append(card))
3994
+ updated_players.append(player)
3990
3995
 
3991
- return kernel.set(players=kernel.players, decks=kernel.decks)
3996
+ return kernel.set(players=updated_players, decks=kernel.decks)
3992
3997
 
3993
3998
 
3994
3999
  @dispatch(StateKernel, int, int)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.2276
3
+ Version: 0.3.2295
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=3XawPcYk9Zk-Hj4M8eNBdGzBccKG8dWj8ZZGRkWnmA4,735
2
2
  graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
3
- graph_games_proto/fns.py,sha256=c7tdY79fni3W8faZh60jT-ecH1aE_DY4kex2gPFHI6Y,211095
3
+ graph_games_proto/fns.py,sha256=xjr4XTbtkjEWbmM1iZCDva1bxnV65DnVefz2pP2IRkE,211300
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.2276.dist-info/METADATA,sha256=ajShthAweA4aD7Z819bMFrRP_NByfaefGX1y5oCVpUw,188
7
- graph_games_proto-0.3.2276.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.2276.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.2276.dist-info/RECORD,,
6
+ graph_games_proto-0.3.2295.dist-info/METADATA,sha256=y6KCMe_kGXjuIAH_C5ieEP-7aJanwrIoq9NoVF0PyGE,188
7
+ graph_games_proto-0.3.2295.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.2295.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.2295.dist-info/RECORD,,