graph-games-proto 0.3.1780__py3-none-any.whl → 0.3.1784__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
@@ -3309,37 +3309,42 @@ def append_follow_up_draw_legal_actions(game, action):
3309
3309
  if len(game.history) >= 2:
3310
3310
  last_action = game.history[-2]
3311
3311
  if (last_action.legal_action.player_idx != legal_action.player_idx) or last_action.legal_action.name == "INITIAL-GOAL-KEEP":
3312
- game = append_to_legal_actions(
3313
- game,
3314
- LegalAction(
3315
- auto_preferred=True,
3316
- player_idx=legal_action.player_idx,
3317
- name="DRAW",
3318
- instruction="draw a unit",
3319
- allotted_seconds=DEFAULT_ALLOTTED_SECONDS,
3320
- allotted_since_action_idx=(len(game.history) - 1),
3321
- draw=LegalActionDraw(
3322
- deck_idx=0,
3323
- quantity=1,
3312
+
3313
+ if len(game.decks[0].facedown_stack) >= 1:
3314
+ game = append_to_legal_actions(
3315
+ game,
3316
+ LegalAction(
3317
+ auto_preferred=True,
3318
+ player_idx=legal_action.player_idx,
3319
+ name="DRAW",
3320
+ instruction="draw a unit",
3321
+ allotted_seconds=DEFAULT_ALLOTTED_SECONDS,
3322
+ allotted_since_action_idx=(len(game.history) - 1),
3323
+ draw=LegalActionDraw(
3324
+ deck_idx=0,
3325
+ quantity=1,
3326
+ )
3324
3327
  )
3325
3328
  )
3326
- )
3329
+
3327
3330
  for card_uuid in game.decks[0].faceup_spots:
3328
- if not game.carduuid2card[card_uuid].is_wild:
3329
- game = append_to_legal_actions(
3330
- game,
3331
- LegalAction(
3332
- player_idx=legal_action.player_idx,
3333
- name="FACEUP-DRAW",
3334
- instruction="draw a faceup unit",
3335
- allotted_seconds=DEFAULT_ALLOTTED_SECONDS,
3336
- allotted_since_action_idx=(len(game.history) - 1),
3337
- faceup_draw=LegalActionFaceupDraw(
3338
- deck_idx=0,
3339
- card_uuid=card_uuid,
3331
+ if card_uuid:
3332
+ if not game.carduuid2card[card_uuid].is_wild:
3333
+ game = append_to_legal_actions(
3334
+ game,
3335
+ LegalAction(
3336
+ player_idx=legal_action.player_idx,
3337
+ name="FACEUP-DRAW",
3338
+ instruction="draw a faceup unit",
3339
+ allotted_seconds=DEFAULT_ALLOTTED_SECONDS,
3340
+ allotted_since_action_idx=(len(game.history) - 1),
3341
+ faceup_draw=LegalActionFaceupDraw(
3342
+ deck_idx=0,
3343
+ card_uuid=card_uuid,
3344
+ )
3340
3345
  )
3341
3346
  )
3342
- )
3347
+
3343
3348
  return game
3344
3349
 
3345
3350
 
@@ -6628,7 +6633,8 @@ DEFAULT_LEGAL_ACTIONS_HOOK = """def handler(game, player_idx):
6628
6633
  allotted_seconds = DEFAULT_ALLOTTED_SECONDS
6629
6634
  allotted_since_action_idx = len(game.history) - 1
6630
6635
 
6631
- game = append_to_legal_actions(
6636
+ if len(game.decks[1].facedown_stack) >= 1:
6637
+ game = append_to_legal_actions(
6632
6638
  game,
6633
6639
  LegalAction(
6634
6640
  player_idx=player_idx,
@@ -6644,53 +6650,56 @@ DEFAULT_LEGAL_ACTIONS_HOOK = """def handler(game, player_idx):
6644
6650
  )
6645
6651
  )
6646
6652
 
6647
- game = append_to_legal_actions(
6648
- game,
6649
- LegalAction(
6650
- auto_preferred=True,
6651
- player_idx=player_idx,
6652
- name="DRAW",
6653
- instruction="draw a unit",
6654
- allotted_seconds=allotted_seconds,
6655
- allotted_since_action_idx=allotted_since_action_idx,
6656
- draw=LegalActionDraw(
6657
- deck_idx=0,
6658
- quantity=1,
6659
- )
6660
- )
6661
- )
6662
-
6663
- game = append_to_legal_actions(
6664
- game,
6665
- LegalAction(
6666
- player_idx=player_idx,
6667
- name="DRAW-DOUBLE",
6668
- instruction="draw 2 units",
6669
- allotted_seconds=allotted_seconds,
6670
- allotted_since_action_idx=allotted_since_action_idx,
6671
- draw=LegalActionDraw(
6672
- deck_idx=0,
6673
- quantity=2,
6653
+ if len(game.decks[0].facedown_stack) >= 1:
6654
+ game = append_to_legal_actions(
6655
+ game,
6656
+ LegalAction(
6657
+ auto_preferred=True,
6658
+ player_idx=player_idx,
6659
+ name="DRAW",
6660
+ instruction="draw a unit",
6661
+ allotted_seconds=allotted_seconds,
6662
+ allotted_since_action_idx=allotted_since_action_idx,
6663
+ draw=LegalActionDraw(
6664
+ deck_idx=0,
6665
+ quantity=1,
6666
+ )
6674
6667
  )
6675
6668
  )
6676
- )
6677
6669
 
6678
- for card_uuid in game.decks[0].faceup_spots:
6670
+ if len(game.decks[0].facedown_stack) >= 2:
6679
6671
  game = append_to_legal_actions(
6680
6672
  game,
6681
6673
  LegalAction(
6682
6674
  player_idx=player_idx,
6683
- name="FACEUP-DRAW",
6684
- instruction="draw a faceup unit",
6675
+ name="DRAW-DOUBLE",
6676
+ instruction="draw 2 units",
6685
6677
  allotted_seconds=allotted_seconds,
6686
6678
  allotted_since_action_idx=allotted_since_action_idx,
6687
- faceup_draw=LegalActionFaceupDraw(
6679
+ draw=LegalActionDraw(
6688
6680
  deck_idx=0,
6689
- card_uuid=card_uuid,
6681
+ quantity=2,
6690
6682
  )
6691
6683
  )
6692
6684
  )
6693
6685
 
6686
+ for card_uuid in game.decks[0].faceup_spots:
6687
+ if card_uuid:
6688
+ game = append_to_legal_actions(
6689
+ game,
6690
+ LegalAction(
6691
+ player_idx=player_idx,
6692
+ name="FACEUP-DRAW",
6693
+ instruction="draw a faceup unit",
6694
+ allotted_seconds=allotted_seconds,
6695
+ allotted_since_action_idx=allotted_since_action_idx,
6696
+ faceup_draw=LegalActionFaceupDraw(
6697
+ deck_idx=0,
6698
+ card_uuid=card_uuid,
6699
+ )
6700
+ )
6701
+ )
6702
+
6694
6703
  game = append_all_to_legal_actions(
6695
6704
  game,
6696
6705
  get_legal_actions_for_paths(game, player_idx),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graph_games_proto
3
- Version: 0.3.1780
3
+ Version: 0.3.1784
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=8zJq6ad-wfhCJ0rbpVFy5Jo2zP3JgAcKqaEeDM3o7V0,240366
3
+ graph_games_proto/fns.py,sha256=Za7-8Qj431HKfbjp7eQkErFwhafx8LcwRsFQ17-tow8,240941
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.1780.dist-info/METADATA,sha256=8EOwV5o7T3WlRFeXfNQj1wpoyiGXH8uapKl-CE0FXUA,188
7
- graph_games_proto-0.3.1780.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1780.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1780.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1784.dist-info/METADATA,sha256=sgqj-1XoRKE-eW7ii1bOmLU79Aky6CxllUlgBEM7JN0,188
7
+ graph_games_proto-0.3.1784.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1784.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1784.dist-info/RECORD,,