File size: 1,478 Bytes
13d61dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from game import game_engine
import time

def test_game_logic():
    print("Starting game test...")
    session_id, game = game_engine.start_game("medium")
    print(f"Game started. Session ID: {session_id}")
    print(f"Scenario: {game.scenario['title']}")
    
    # Test Agent Creation
    print("Checking agents...")
    for suspect in game.scenario["suspects"]:
        agent = game.llm_manager.get_agent(suspect["id"])
        if agent:
            print(f"Agent created for {suspect['name']}")
        else:
            print(f"FAILED to create agent for {suspect['name']}")
            
    # Test Questioning (Mock mode likely if no key)
    print("\nTesting Questioning...")
    suspect_id = game.scenario["suspects"][0]["id"]
    response = game.question_suspect(suspect_id, "Where were you?")
    print(f"Response from {suspect_id}: {response}")
    
    # Test Tools
    print("\nTesting Tools...")
    # Use a valid phone number from scenario
    phone = game.scenario["suspects"][0]["phone_number"]
    res = game.use_tool("get_location", phone_number=phone, timestamp="8:47 PM")
    print(f"Tool Result: {res}")
    
    if "error" in res:
        print("Tool test FAILED (unless expected error)")
        
    # Test Round Advance
    print("\nTesting Round Advance...")
    print(f"Current Round: {game.round}")
    game.advance_round()
    print(f"New Round: {game.round}")
    
    print("\nTest Complete.")

if __name__ == "__main__":
    test_game_logic()