-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_opponent_tracking.py
More file actions
95 lines (76 loc) · 3.33 KB
/
test_opponent_tracking.py
File metadata and controls
95 lines (76 loc) · 3.33 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python3
"""
Test script to verify opponent tracking is working correctly.
"""
import sys
sys.path.insert(0, 'src')
from poker_bot.evaluation import OpponentTracker
def test_opponent_tracking():
"""Test opponent tracking with simulated game states."""
tracker = OpponentTracker()
print("=" * 60)
print("TESTING OPPONENT TRACKING")
print("=" * 60)
# Simulate recording some actions
print("\n1. Recording opponent actions...")
tracker.record_action("villain1", "raise", 100, "PREFLOP")
tracker.record_action("villain1", "call", 50, "FLOP")
tracker.record_action("villain1", "fold", 0, "TURN")
tracker.record_action("villain2", "call", 20, "PREFLOP")
tracker.record_action("villain2", "raise", 200, "FLOP")
tracker.record_action("villain2", "raise", 400, "TURN")
tracker.record_action("villain2", "call", 100, "RIVER")
tracker.record_action("villain3", "fold", 0, "PREFLOP")
tracker.record_action("villain3", "fold", 0, "PREFLOP")
tracker.record_action("villain3", "fold", 0, "PREFLOP")
print("✅ Actions recorded")
# Record hand results
print("\n2. Recording hand results...")
tracker.record_hand_result("villain1", False, -150)
tracker.record_hand_result("villain2", True, 500)
tracker.record_hand_result("villain3", False, -20)
print("✅ Hand results recorded")
# Get opponent profiles
print("\n3. Generating opponent profiles...")
players = [
{"id": "villain1", "chips": 850, "folded": False},
{"id": "villain2", "chips": 1500, "folded": False},
{"id": "villain3", "chips": 980, "folded": True}
]
profiles = tracker.get_opponent_profiles(players)
print("\n" + "=" * 60)
print("OPPONENT PROFILES")
print("=" * 60)
for profile in profiles:
print(f"\n{profile['id'].upper()}:")
print(f" Player Type: {profile['player_type']}")
print(f" Aggression Factor: {profile['aggression_factor']:.2f}")
print(f" VPIP: {profile['vpip']:.2%}")
print(f" PFR: {profile['pfr']:.2%}")
print(f" Chips: ${profile['chips']}")
print(f" Stack Size: {'SHORT' if profile['is_short_stack'] else 'BIG' if profile['is_big_stack'] else 'NORMAL'}")
# Get detailed tendencies
print("\n" + "=" * 60)
print("DETAILED TENDENCIES")
print("=" * 60)
for player_id in ["villain1", "villain2", "villain3"]:
tendency = tracker.get_player_tendency(player_id)
print(f"\n{player_id.upper()}:")
print(f" Type: {tendency['player_type']}")
print(f" Aggression: {tendency['aggression_factor']:.2f}")
print(f" VPIP: {tendency['vpip']:.2%}")
print(f" PFR: {tendency['pfr']:.2%}")
print(f" Win Rate: {tendency['win_rate']:.2%}")
print(f" Hands Played: {tendency['hands_played']}")
print(f" Confidence: {tendency['confidence']:.2%}")
# Get suggested adjustment
adjustment = tracker.suggest_adjustment({"player_type": tendency['player_type']})
print(f" Strategy: {adjustment['description']}")
print("\n" + "=" * 60)
print("✅ OPPONENT TRACKING TEST PASSED!")
print("=" * 60)
print("\nAll opponent stats are being recorded correctly.")
print("The tracking system is ready for live games.")
print("=" * 60)
if __name__ == "__main__":
test_opponent_tracking()