-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_benchmark.py
More file actions
38 lines (31 loc) · 1.31 KB
/
Copy pathverify_benchmark.py
File metadata and controls
38 lines (31 loc) · 1.31 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
import time
from poker.card import Card
from engine.simulator import MonteCarloSimulator
def run_benchmark():
print("Initializing Simulator and Lookup Tables...")
start_init = time.time()
sim = MonteCarloSimulator()
print(f"Init Time: {time.time() - start_init:.4f}s")
# Test Hand: Ace King vs Random
hero_hand = [Card("A", "H"), Card("K", "D")]
board = [] # Preflop
print("\nRunning Simulation (Preflop AK vs Random)...")
start_sim = time.time()
iterations = 20000
equity = sim.calculate_equity(hero_hand, board, iterations=iterations)
end_sim = time.time()
duration = end_sim - start_sim
print(f"Iterations: {iterations}")
print(f"Time Taken: {duration:.4f}s")
print(f"Speed: {iterations / duration:.0f} hands/sec")
print(f"Equity: {equity * 100:.2f}% (Expected ~65-67%)")
# Test Postflop: Flush Draw
print("\nRunning Simulation (Flush Draw vs Random)...")
# Hero: Ah 2h. Board: Kh 8h 5c. (Flush draw)
hero_hand = [Card("A", "H"), Card("2", "H")]
board = [Card("K", "H"), Card("8", "H"), Card("5", "C")]
print("\nRunning Simulation (Flush Draw vs Random)...")
equity = sim.calculate_equity(hero_hand, board, iterations=10000)
print(f"Equity: {equity * 100:.2f}%")
if __name__ == "__main__":
run_benchmark()