graph-games-proto 0.3.1802__py3-none-any.whl → 0.3.1826__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
@@ -1678,7 +1678,7 @@ class LegalAction(PClass):
1678
1678
  draw_discard = field(type=(LegalActionDrawDiscard, type(None)), initial=None) # LegalActionDrawDiscard
1679
1679
  faceup_draw = field(type=(LegalActionFaceupDraw, type(None)), initial=None) # LegalActionFaceupDraw
1680
1680
  move_pieces_to_path = field(type=(LegalActionMovePiecesToPath, type(None)), initial=None) # LegalActionMovePiecesToPath
1681
- auto_preferred = field(type=bool, initial=False) # bool
1681
+ auto_preferred = field(type=bool) # bool
1682
1682
  def get_default_action(self, state):
1683
1683
  submitted_at = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
1684
1684
  if self.discard:
@@ -1705,6 +1705,8 @@ class LegalAction(PClass):
1705
1705
  faceup_draw=self.faceup_draw.get_public(state) if self.faceup_draw else None,
1706
1706
  move_pieces_to_path=self.move_pieces_to_path.get_public(state) if self.move_pieces_to_path else None,
1707
1707
  )
1708
+ def __eq__(self, other):
1709
+ return self.__todict__() == other.__todict__()
1708
1710
  def __todict__(self):
1709
1711
  return {
1710
1712
  "player_idx": self.player_idx,
@@ -1738,7 +1740,7 @@ class LegalAction(PClass):
1738
1740
  draw_discard=LegalActionDrawDiscard.__fromdict__(d["draw_discard"]) if d.get("draw_discard") else None,
1739
1741
  faceup_draw=LegalActionFaceupDraw.__fromdict__(d["faceup_draw"]) if d.get("faceup_draw") else None,
1740
1742
  move_pieces_to_path=LegalActionMovePiecesToPath.__fromdict__(d["move_pieces_to_path"]) if d.get("move_pieces_to_path") else None,
1741
- auto_preferred=d.get("auto_preferred", False), # Handle None case
1743
+ auto_preferred=d.get("auto_preferred"), # Handle None case
1742
1744
  )
1743
1745
 
1744
1746
 
@@ -4403,6 +4405,8 @@ def isactionlegal2(s, a):
4403
4405
 
4404
4406
 
4405
4407
  def getnextstate2(s, a, log=False):
4408
+ if not isactionlegal2(s, a):
4409
+ raise ValueError(f"Action is not legal: {a}")
4406
4410
  s = run_state_action_hooks(s, a, AFTER_ACCEPT_ACTION_HOOKS, log)
4407
4411
  s = run_state_action_hooks(s, a, HANDLE_ACTION_HOOKS, log)
4408
4412
  s = run_state_hooks(s, HANDLE_SCORING_HOOKS, log)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1802
3
+ Version: 0.3.1826
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=O5XjRfe3DlxbJn4zezDvvy7cXvL4IzIRPZCL3Y-n7s8,776
2
2
  graph_games_proto/all_types.py,sha256=IpbwftEcHS5Ewz-saFNk0lO9FvcbuHG36odRTayCXUk,54911
3
- graph_games_proto/fns.py,sha256=H2is5w_JV0jaBI17Xvpkj9HEAs62B7jC4x9EBwYKJiU,241983
3
+ graph_games_proto/fns.py,sha256=gJ-iFMhLfgaK8-RdOFVU3EuCO1w9pdtFIi-oH4mgvNo,242132
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.1802.dist-info/METADATA,sha256=-cSB_NKPyGGFS1gt87wPi8_Za_kNmG7WuGgrpqQaa0Y,188
7
- graph_games_proto-0.3.1802.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1802.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1802.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1826.dist-info/METADATA,sha256=3EQjXOqCf7xKaESOyqa91O8hXpWBf3SBOy0lHEnyu_A,188
7
+ graph_games_proto-0.3.1826.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1826.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1826.dist-info/RECORD,,