Files
pokerfreak/messung/motor/splash/pruef.py
T
mmintelandClaude Opus 5.5 fd2437dfa6 Motor: Jam-Probe, gleichverteilte Knoten als ungelernt, Splash, Gedaechtnis, Ranges
- dienst.rs: Riesen-All-in aus der Tafel (>= 2,5x Topf nach dem Flop) wird gegen
  die NL2-Fold-Rate und die staerkste Caller-Range nachgerechnet und gestrichen,
  wenn es gegen Folden Geld verliert (MOTOR_JAMPROBE=0 schaltet ab)
- Strategie:🕳️ exakt gleichverteilte Zeilen zaehlen als nie gelernt
  (Preisfrage statt Wuerfeln)
- gedaechtnis.rs, range.rs, nl2/spiel/nachrechnen: Gegnergedaechtnis, Ranges,
  Splash-Toepfe; schatten.py nimmt Splash, wenn splash<bb>.bin gelernt ist
- Messungen unter messung/motor/ (ohne .bin und Dateien > 5 MB)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 12:26:56 +01:00

50 lines
4.3 KiB
Python

# Splash-Motor: je Groesse und Platz alle 169 Haende, erster im Topf (alle davor folden) und BB gegen All-in/Limp; Anteile, Beispiele, Zulaessigkeit
import sys,json,subprocess,collections,ctypes,os,time
EX=sys.argv[1]; DS=[float(x) for x in sys.argv[2].split(",")]; sys.argv=["x","C:/nicht/da"]; R0="D:/Projects/pokerfreak"; sys.path.insert(0,R0+"/.claude/worktrees/leckkarte-963a08/messung/vorflop/eintritt")
import kern_lauf as K
D=R0+"/daten/grundstrategie/motor"; R_=[2,3,4,5,0,1]
ko=[6 if k[0]==k[1] else 4 if k[2]=="s" else 12 for k in K.KL]
p=subprocess.Popen([R0+"/entscheiden/motor/target/"+EX,"dienst","sechs100",D,"2000-600-400","200",D+"/sechs100-v2.bin","genau"],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=open(R0+"/messung/motor/splash/pruef.err","w"),text=True,encoding="utf-8",creationflags=0x4000)
s=type("S",(ctypes.Structure,),{"_fields_":[(x,ctypes.c_ulong) for x in "VCM"]})(1,1,0); ctypes.windll.kernel32.SetProcessInformation(ctypes.c_void_p(int(p._handle)),4,ctypes.byref(s),12)
def frag(q): p.stdin.write(json.dumps(q)+"\n"); p.stdin.flush(); return json.loads(p.stdout.readline())
def lage(akt,pos,kl,D_,seed):
q=K.anfrage({"akt":akt,"pos":pos,"stack":[100]*6},kl,seed); s=D_*q["bigBlind"]
q["pot"]+=s; q["_splash"]=s; q["history"]=[{"street":"PREFLOP","seat":q["heroSeat"],"action":"POST_ANTE","amount":s,"splash":True}]+q["history"]; return q
NM={2:"UTG",3:"HJ",4:"CO",5:"BTN",0:"SB",1:"BB"}; t0=time.time()
while "keine Splash" in frag(lage([],2,"AA",100 if 100 in DS else DS[0],1))["reason"] and time.time()-t0<120: time.sleep(1)
time.sleep(20)
for d in DS:
faelle=[("als Erster",[(x,0,0) for x in R_[:R_.index(h)]],h) for h in(2,3,4,5,0)]
faelle+=[("BTN gegen UTG 3bb",[(2,3,3.),(3,0,0),(4,0,0)],5),("BB gegen UTG 3bb",[(2,3,3.),(3,0,0),(4,0,0),(5,0,0),(0,0,0)],1),("BB gegen BTN all-in",[(2,0,0),(3,0,0),(4,0,0),(5,3,100.),(0,0,0)],1),("BTN gegen Limp",[(2,2,1.),(3,0,0),(4,0,0)],5)]
for nm,akt,h in faelle:
c=collections.Counter(); g=collections.Counter(); bad=0; f=[];gr=collections.Counter()
for j,kl in enumerate(K.KL):
q=lage(akt,h,kl,d,j+1); a=frag(q); x=a["action"]
if "notfall" in a["reason"] or (x not in q["legalActions"]): bad+=1; gr[a["reason"][:90]]+=1
if x=="RAISE": x="JAM" if a["size"]>.95*q["maxRaiseTo"] else "RAISE"
c[x]+=ko[j]/1326
if x=="FOLD": f.append(kl)
print("D%g"%d,nm,NM[h],{k:round(v,2) for k,v in c.items()},"schlecht",bad,gr.most_common(1),"Folds:",f[:6],flush=True)
# Nach dem Flop: BTN raist auf 3 bb, BB zahlt; Flop/Turn/River mit zufaelligen Haenden, BB checkt bzw. setzt halben Topf
import random
rng=random.Random(3); Rn=K.RANG; Fa=K.FARBE
for d in DS:
c=collections.Counter(); bad=0; nf=collections.Counter(); tm=[]
for i in range(60):
k=rng.sample([(r,f) for r in Rn for f in Fa],7); C=[{"rank":r,"suit":f} for r,f in k]
q=lage([(2,0,0),(3,0,0),(4,0,0)],5,"AA",d,i); B=.02; st=["FLOP","TURN","RIVER"][i%3]
hi=q["history"]+[{"action":"RAISE","amount":.06,"seat":6,"street":"PREFLOP"},{"action":"FOLD","seat":1,"street":"PREFLOP"},{"action":"CALL","amount":.06,"seat":2,"street":"PREFLOP"}]
for s_ in ["FLOP","TURN","RIVER"][:i%3]: hi+=[{"action":"CHECK","seat":2,"street":s_},{"action":"CHECK","seat":6,"street":s_}]
bo={"FLOP":C[2:5]}
if i%3>0: bo["TURN"]=C[5:6]
if i%3>1: bo["RIVER"]=C[6:7]
pot=.13+d*B; setzt=i%2; e=round(min(pot/2,1.94),2)
hi=hi+([{"action":"BET","amount":e,"seat":2,"street":st}] if setzt else [{"action":"CHECK","seat":2,"street":st}])
q.update(history=hi,street=st,board=bo,heroCards=C[:2],pot=pot+(e if setzt else 0),toCall=e if setzt else 0.,heroStack=1.94,legalActions=["FOLD","CALL","RAISE"] if setzt else ["CHECK","RAISE"],minRaiseTo=min(2*e,1.94) if setzt else .02,maxRaiseTo=1.94)
for v in q["villains"]: v["folded"]=v["seat"]!=2; v["stack"]=1.94-(e if setzt else 0) if v["seat"]==2 else v["stack"]
t=time.time(); a=frag(q); tm.append(time.time()-t); c[st,setzt,a["action"]]+=1
if "notfall" in a["reason"] or a["action"] not in q["legalActions"]: bad+=1; nf[a["reason"][:100]]+=1
if "preis" in a["reason"]: nf["preis"]+=1
print("D%g nach dem Flop"%d,dict(c),"schlecht",bad,nf.most_common(2),"laengste %.1f s"%max(tm),flush=True)