File size: 1,808 Bytes
463f868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
import sys

import numpy as np

sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))

from game.game_state import GameState, MemberCard


def test():
    game = GameState(verbose=True)
    p0 = game.players[0]

    # Setup Deck
    print("Setting up deck...")
    p0.main_deck = list(range(1, 11))
    for i in range(1, 11):
        game.member_db[i] = MemberCard(
            card_id=i,
            card_no=f"M{i}",
            name=f"Member {i}",
            cost=1,
            hearts=np.zeros(6),
            blade_hearts=np.zeros(6),
            blades=1,
            group="Group",
            unit="",
            img_path="",
        )

    print(f"Deck: {p0.main_deck}")

    # 1. Look Deck
    game.looked_cards = []
    for _ in range(5):
        if p0.main_deck:
            game.looked_cards.append(p0.main_deck.pop(0))
    print(f"Looked Cards: {game.looked_cards}")

    # 2. Setup Choice
    # Manual setup mimicking _resolve_pending_effect
    candidates = game.looked_cards.copy()
    game.pending_choices.append(("SELECT_FROM_LIST", {"cards": candidates, "reason": "look_and_choose"}))
    print("Choice setup complete.")

    # 3. Execute
    action_id = 602  # Index 2 -> Card 3
    print(f"Executing action {action_id}...")
    game = game.step(action_id)
    p0 = game.players[0]

    print(f"Hand: {p0.hand}")
    print(f"Discard: {p0.discard}")
    print(f"Looked (Game): {game.looked_cards}")

    if 3 in p0.hand:
        print("PASS: Card 3 in hand")
    else:
        print("FAIL: Card 3 not in hand")

    if set(p0.discard) == {1, 2, 4, 5}:
        print("PASS: Discard correct")
    else:
        print("FAIL: Discard incorrect")


if __name__ == "__main__":
    test()