Files
pokerfreak/messung/turnier/bounty_probe.py
T

43 lines
2.5 KiB
Python

"""Turniermotor: wirkt das Kopfgeld? BB gegen einen SB-Jam, je Hand mit und ohne Bounty (gedeckter Gegner).
python bounty_probe.py [exe] (Vorgabe: die Probe-Kopie pokerbench-turnier-bounty.exe)"""
import json, subprocess, sys, os
sys.stdout.reconfigure(encoding="utf-8")
O = r"C:\Users\marcm\pokerfreak-turniermotor"
EXE = sys.argv[1] if len(sys.argv) > 1 else O + r"\pokerbench-turnier-bounty.exe"
P = subprocess.Popen([EXE, "dienst", O + r"\klassen", O + r"\daten"], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
text=True, encoding="utf-8", env={**os.environ, "RAYON_NUM_THREADS": "8"})
NAME = dict(zip("AKQJT98765432", "ACE KING QUEEN JACK TEN NINE EIGHT SEVEN SIX FIVE FOUR THREE TWO".split()))
def frag(q):
P.stdin.write(json.dumps(q) + "\n"); P.stdin.flush()
return json.loads(P.stdout.readline())
def lage(k, kopf, art="bounty"):
"""6 Spieler, 20 bb Tiefe, 3 bezahlt von 6; SB jammt 10 bb, wir BB mit 20 bb, die anderen gefoldet."""
s = ("SPADES", "SPADES") if k.endswith("s") else ("SPADES", "HEARTS")
hist = [{"street": "PREFLOP", "seat": 1, "action": "POST_SB", "amount": 50.0},
{"street": "PREFLOP", "seat": 2, "action": "POST_BB", "amount": 100.0}]
hist += [{"street": "PREFLOP", "seat": x, "action": "FOLD", "amount": 0.0} for x in (3, 4, 5, 6)]
hist += [{"street": "PREFLOP", "seat": 1, "action": "ALL_IN", "amount": 1000.0}]
v = [{"seat": 1, "stack": 0.0, "folded": False}] + [{"seat": x, "stack": 2000.0, "folded": True} for x in (3, 4, 5, 6)]
t = {"payouts": [50.0, 30.0, 20.0], "stacks": [2000.0, 1000.0, 2000.0, 2000.0, 2000.0, 2000.0], "heroIndex": 0}
if kopf:
v[0]["bounty"] = kopf
t["bounty"] = {"art": art, "heroBounty": kopf}
return {"variant": "NLHE", "bigBlind": 100.0, "seats": 6, "heroSeat": 2, "buttonSeat": 6, "street": "PREFLOP",
"heroCards": [{"rank": NAME[k[0]], "suit": s[0]}, {"rank": NAME[k[1]], "suit": s[1]}],
"pot": 1100.0, "toCall": 900.0, "heroStack": 1900.0, "legalActions": ["FOLD", "CALL", "RAISE"],
"minRaiseTo": 2000.0, "maxRaiseTo": 2000.0, "villains": v, "history": hist, "tournament": t, "_turnier": "ICM"}
frag(lage("AA", 0)) # Laden
anders = 0
for k in ["K2o", "Q5o", "J7o", "T8o", "96s", "75s", "A2o", "K7o", "Q9o", "J4s", "84s", "53s", "T2s"]:
a, b, c = (frag(lage(k, x, art))["action"] for x, art in ((0, "bounty"), (1.0, "bounty"), (1.0, "pko")))
anders += a != b
print(f"{k:4} ohne {a:5} mit Bounty 1 {b:5} PKO {c:5}")
print("anders:", anders)
P.stdin.close()