Repository navigation
Expand file tree
/
Copy pathexamples.py
More file actions
110 lines (88 loc) · 3.42 KB
/
Copy pathexamples.py
File metadata and controls
110 lines (88 loc) · 3.42 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
"""
Example demonstrating the poker equity evaluation task.
Run this to see sample scenarios and understand the task better.
"""
from poker_utils import generate_random_scenario, calculate_range_equity, format_scenario
from grader import get_prompt, grade
def show_example(scenario=None):
"""Show a complete example of the task."""
if scenario is None:
scenario = generate_random_scenario()
# Show the scenario
print("="*70)
print("SCENARIO")
print("="*70)
print(format_scenario(scenario))
print()
# Calculate correct equity
correct_equity = calculate_range_equity(
scenario["hero_cards"],
scenario["board"],
scenario["opponent_range_desc"],
num_simulations=2000
)
print(f"Correct equity: {correct_equity:.1f}%")
print()
# Show what makes a good answer
print("EVALUATION")
print("-"*70)
test_responses = [
(int(correct_equity), "Exact correct answer"),
(int(correct_equity + 10), "Within tolerance (+10 points)"),
(int(correct_equity - 12), "Within tolerance (-12 points)"),
(int(correct_equity + 20), "Outside tolerance (+20 points)"),
("I think around 50%", "Number with explanation (can work)"),
("50", "Plain number (preferred format)"),
]
for response, description in test_responses:
response_str = str(response)
passed, metadata = grade(response_str, scenario)
status = "✓ PASS" if passed else "✗ FAIL"
error = metadata.get('error', 'N/A')
print(f"{status:8} | Response: {response_str:30} | Error: {error:>6} | {description}")
print()
def show_multiple_examples(n=3):
"""Show multiple random examples."""
print("\n" + "█"*70)
print("POKER EQUITY EVALUATION - EXAMPLES")
print("█"*70 + "\n")
for i in range(n):
print(f"\nEXAMPLE {i+1}/{n}")
show_example()
if i < n - 1:
input("\nPress Enter for next example...")
def show_range_examples():
"""Show examples for each range type."""
print("\n" + "█"*70)
print("EXAMPLES BY OPPONENT RANGE TYPE")
print("█"*70 + "\n")
# Generate examples with different ranges
import random
for seed in range(100, 200):
random.seed(seed)
scenario = generate_random_scenario(seed)
range_desc = scenario["opponent_range_desc"]
# Show one example of each range type
if range_desc not in shown_ranges:
print(f"\n{range_desc.upper()}")
print("-"*70)
show_example(scenario)
shown_ranges.add(range_desc)
if len(shown_ranges) >= 5:
break
if __name__ == "__main__":
import sys
if len(sys.argv) > 1 and sys.argv[1] == "ranges":
# Show examples for each range type
shown_ranges = set()
show_range_examples()
else:
# Show a few random examples
show_multiple_examples(n=3)
print("\n" + "="*70)
print("To run with your model:")
print(" 1. Import: from grader import get_prompt, grade")
print(" 2. Get prompt: prompt, scenario = get_prompt()")
print(" 3. Get response: response = your_model(prompt)")
print(" 4. Grade: passed, metadata = grade(response, scenario)")
print("="*70)