graph-games-proto 0.3.1831__py3-none-any.whl → 0.3.1864__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
@@ -3887,16 +3887,19 @@ def append_to_legal_actions(game, legal_action):
3887
3887
 
3888
3888
 
3889
3889
  def default_accept_action(game, action):
3890
+ if not game or not action or not action.legal_action:
3891
+ return False
3892
+
3890
3893
  # Returns true if action.legal_action is found in game.legal_actions_2
3891
3894
  # The comparision is by value, not by reference
3892
- if not game or not action or not action.legal_action:
3895
+ if action.legal_action not in game.legal_actions_2:
3893
3896
  return False
3894
3897
 
3895
3898
  # Check if "action.move_pieces_to_path" is not None
3896
3899
  if action.move_pieces_to_path:
3897
3900
  return is_move_pieces_to_path_action_legal(game, action)
3898
-
3899
- return action.legal_action in game.legal_actions_2
3901
+
3902
+ return True
3900
3903
 
3901
3904
 
3902
3905
  def is_move_pieces_to_path_action_legal(game, action):
@@ -3961,11 +3964,13 @@ def append_default_legal_actions_for_initial_player(game, action, log=False):
3961
3964
  return result
3962
3965
 
3963
3966
  except SyntaxError as e:
3964
- logging.error(f"Syntax error in initialization hook --TODO--: {str(e)}", exc_info=True)
3965
- return game
3967
+ msg = f"Syntax error in initialization hook: {str(e)}"
3968
+ logging.error(msg, exc_info=True)
3969
+ raise SyntaxError(msg) from e
3966
3970
  except Exception as e:
3967
- logging.error(f"Error in initialization hook --TODO--: {str(e)}", exc_info=True)
3968
- return game
3971
+ msg = f"Error in initialization hook: {str(e)}"
3972
+ logging.error(msg, exc_info=True)
3973
+ raise Exception(msg) from e
3969
3974
 
3970
3975
 
3971
3976
  def append_default_legal_actions_for_next_player(game, action, log=False):
@@ -3995,11 +4000,13 @@ def append_default_legal_actions_for_next_player(game, action, log=False):
3995
4000
  return result
3996
4001
 
3997
4002
  except SyntaxError as e:
3998
- logging.error(f"Syntax error in initialization hook --TODO--: {str(e)}", exc_info=True)
3999
- return game
4003
+ msg = f"Syntax error in initialization hook: {str(e)}"
4004
+ logging.error(msg, exc_info=True)
4005
+ raise SyntaxError(msg) from e
4000
4006
  except Exception as e:
4001
- logging.error(f"Error in initialization hook --TODO--: {str(e)}", exc_info=True)
4002
- return game
4007
+ msg = f"Error in initialization hook: {str(e)}"
4008
+ logging.error(msg, exc_info=True)
4009
+ raise Exception(msg) from e
4003
4010
 
4004
4011
 
4005
4012
  def get_total_path_count(game):
@@ -4336,11 +4343,13 @@ def run_state_action_hook(state, action, hook, log=False):
4336
4343
  return result
4337
4344
 
4338
4345
  except SyntaxError as e:
4339
- logging.error(f"Syntax error in initialization hook {hook.uuid}: {str(e)}", exc_info=True)
4340
- return state
4346
+ msg = f"Syntax error in initialization hook {hook.uuid}: {str(e)}"
4347
+ logging.error(msg, exc_info=True)
4348
+ raise SyntaxError(msg) from e
4341
4349
  except Exception as e:
4342
- logging.error(f"Error in initialization hook {hook.uuid}: {str(e)}", exc_info=True)
4343
- return state
4350
+ msg = f"Error in initialization hook {hook.uuid}: {str(e)}"
4351
+ logging.error(msg, exc_info=True)
4352
+ raise Exception(msg) from e
4344
4353
 
4345
4354
 
4346
4355
  def run_state_hook(state, hook, log=False):
@@ -4365,11 +4374,13 @@ def run_state_hook(state, hook, log=False):
4365
4374
  return result
4366
4375
 
4367
4376
  except SyntaxError as e:
4368
- logging.error(f"Syntax error in initialization hook {hook.uuid}: {str(e)}", exc_info=True)
4369
- return state
4377
+ msg = f"Syntax error in initialization hook {hook.uuid}: {str(e)}"
4378
+ logging.error(msg, exc_info=True)
4379
+ raise SyntaxError(msg) from e
4370
4380
  except Exception as e:
4371
- logging.error(f"Error in initialization hook {hook.uuid}: {str(e)}", exc_info=True)
4372
- return state
4381
+ msg = f"Error in initialization hook {hook.uuid}: {str(e)}"
4382
+ logging.error(msg, exc_info=True)
4383
+ raise Exception(msg) from e
4373
4384
 
4374
4385
 
4375
4386
  # Implementing the following Julia function:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1831
3
+ Version: 0.3.1864
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=G8b4U3nyB25fGUwnxviCHTInIUwEMUaEdLSXOZ4jI6g,242116
3
+ graph_games_proto/fns.py,sha256=PosUF9Gr77oZzIaEpfhJteapz6te67HhrbwXWhxgo20,242399
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.1831.dist-info/METADATA,sha256=Uzq8yQH8ETzIAg_d50hLzfA6WyRcpJ21oTr5QSi9FSg,188
7
- graph_games_proto-0.3.1831.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1831.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1831.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1864.dist-info/METADATA,sha256=2-OMsPvMLX071_QjZDvVDm8yKWj7NlSwB_Agv14gPtY,188
7
+ graph_games_proto-0.3.1864.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1864.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1864.dist-info/RECORD,,