graph-games-proto 0.3.1773__py3-none-any.whl → 0.3.1781__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
@@ -3388,8 +3388,11 @@ def handle_faceup_draw_action(game, action):
3388
3388
  spot_idx = next((i for i, card_uuid in enumerate(deck.faceup_spots) if card_uuid == faceup_draw.card_uuid), None)
3389
3389
  drawn_card = deck.faceup_spots[spot_idx] if spot_idx is not None else None
3390
3390
  player.cards.append(drawn_card)
3391
- if len(deck.facedown_stack) > 0 and spot_idx is not None:
3391
+
3392
+ if len(deck.facedown_stack) > 0:
3392
3393
  deck.faceup_spots[spot_idx] = deck.facedown_stack.pop()
3394
+ else:
3395
+ deck.faceup_spots[spot_idx] = None
3393
3396
 
3394
3397
  game = ensure_faceup_spots_valid(game)
3395
3398
 
@@ -6625,7 +6628,8 @@ DEFAULT_LEGAL_ACTIONS_HOOK = """def handler(game, player_idx):
6625
6628
  allotted_seconds = DEFAULT_ALLOTTED_SECONDS
6626
6629
  allotted_since_action_idx = len(game.history) - 1
6627
6630
 
6628
- game = append_to_legal_actions(
6631
+ if len(game.decks[1].facedown_stack) >= 1:
6632
+ game = append_to_legal_actions(
6629
6633
  game,
6630
6634
  LegalAction(
6631
6635
  player_idx=player_idx,
@@ -6641,53 +6645,56 @@ DEFAULT_LEGAL_ACTIONS_HOOK = """def handler(game, player_idx):
6641
6645
  )
6642
6646
  )
6643
6647
 
6644
- game = append_to_legal_actions(
6645
- game,
6646
- LegalAction(
6647
- auto_preferred=True,
6648
- player_idx=player_idx,
6649
- name="DRAW",
6650
- instruction="draw a unit",
6651
- allotted_seconds=allotted_seconds,
6652
- allotted_since_action_idx=allotted_since_action_idx,
6653
- draw=LegalActionDraw(
6654
- deck_idx=0,
6655
- quantity=1,
6656
- )
6657
- )
6658
- )
6659
-
6660
- game = append_to_legal_actions(
6661
- game,
6662
- LegalAction(
6663
- player_idx=player_idx,
6664
- name="DRAW-DOUBLE",
6665
- instruction="draw 2 units",
6666
- allotted_seconds=allotted_seconds,
6667
- allotted_since_action_idx=allotted_since_action_idx,
6668
- draw=LegalActionDraw(
6669
- deck_idx=0,
6670
- quantity=2,
6648
+ if len(game.decks[0].facedown_stack) >= 1:
6649
+ game = append_to_legal_actions(
6650
+ game,
6651
+ LegalAction(
6652
+ auto_preferred=True,
6653
+ player_idx=player_idx,
6654
+ name="DRAW",
6655
+ instruction="draw a unit",
6656
+ allotted_seconds=allotted_seconds,
6657
+ allotted_since_action_idx=allotted_since_action_idx,
6658
+ draw=LegalActionDraw(
6659
+ deck_idx=0,
6660
+ quantity=1,
6661
+ )
6671
6662
  )
6672
6663
  )
6673
- )
6674
6664
 
6675
- for card_uuid in game.decks[0].faceup_spots:
6665
+ if len(game.decks[0].facedown_stack) >= 2:
6676
6666
  game = append_to_legal_actions(
6677
6667
  game,
6678
6668
  LegalAction(
6679
6669
  player_idx=player_idx,
6680
- name="FACEUP-DRAW",
6681
- instruction="draw a faceup unit",
6670
+ name="DRAW-DOUBLE",
6671
+ instruction="draw 2 units",
6682
6672
  allotted_seconds=allotted_seconds,
6683
6673
  allotted_since_action_idx=allotted_since_action_idx,
6684
- faceup_draw=LegalActionFaceupDraw(
6674
+ draw=LegalActionDraw(
6685
6675
  deck_idx=0,
6686
- card_uuid=card_uuid,
6676
+ quantity=2,
6687
6677
  )
6688
6678
  )
6689
6679
  )
6690
6680
 
6681
+ for card_uuid in game.decks[0].faceup_spots:
6682
+ if card_uuid:
6683
+ game = append_to_legal_actions(
6684
+ game,
6685
+ LegalAction(
6686
+ player_idx=player_idx,
6687
+ name="FACEUP-DRAW",
6688
+ instruction="draw a faceup unit",
6689
+ allotted_seconds=allotted_seconds,
6690
+ allotted_since_action_idx=allotted_since_action_idx,
6691
+ faceup_draw=LegalActionFaceupDraw(
6692
+ deck_idx=0,
6693
+ card_uuid=card_uuid,
6694
+ )
6695
+ )
6696
+ )
6697
+
6691
6698
  game = append_all_to_legal_actions(
6692
6699
  game,
6693
6700
  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.1773
3
+ Version: 0.3.1781
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=sHXD_sSRw2wv-x3EnLSHTYuFelW_4Is3SZyamCkZgjE,240333
3
+ graph_games_proto/fns.py,sha256=q80TzVkBDwgTbbaouhJJQtfFqysgoQT1T53xUFc3GN0,240705
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.1773.dist-info/METADATA,sha256=HaLYNyx99uAKOpwZzP4Rs024Dj_YcYiXoRxbubKfoUU,188
7
- graph_games_proto-0.3.1773.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
- graph_games_proto-0.3.1773.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
- graph_games_proto-0.3.1773.dist-info/RECORD,,
6
+ graph_games_proto-0.3.1781.dist-info/METADATA,sha256=bKw7-SvRTUBQoSPfBj7uniqcYSfcFO2DJD7Uak6mvHI,188
7
+ graph_games_proto-0.3.1781.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
8
+ graph_games_proto-0.3.1781.dist-info/top_level.txt,sha256=-4QSrBMf_MM4BGsr2QXBpqDx8c8k_OPnzGyFjqjakes,18
9
+ graph_games_proto-0.3.1781.dist-info/RECORD,,