File size: 974 Bytes
bb3fbf9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import os
import sys

# Ensure we can import engine
sys.path.append(os.getcwd())

import engine_rust


def test_dir():
    # Load DB
    db_path = "engine/data/cards_compiled.json"
    with open(db_path, "r", encoding="utf-8") as f:
        cards_data_raw = f.read()

    db = engine_rust.PyCardDatabase(cards_data_raw)
    state = engine_rust.PyGameState(db)
    p0 = state.get_player(0)

    print("--- PyGameState Attributes ---")
    print(dir(state))
    print("\n--- PyPlayerState Attributes ---")
    print(dir(p0))

    # Try setting current_player
    try:
        state.current_player = 1
        print("Set state.current_player = 1 success")
    except Exception as e:
        print(f"Set state.current_player = 1 failed: {e}")

    try:
        p0.stage = [249, -1, -1]
        print("Set p0.stage success")
    except Exception as e:
        print(f"Set p0.stage failed: {e}")


if __name__ == "__main__":
    test_dir()