Regeln fuer River, Flop/Turn, Einsaetze und Iso gegen Limper (nl2.rs), Tafeln ohne Spielerkennungen. Gemeinsam gegen den Trainer-Pool: +8,0 +-3,9 bb/100 mit bekanntem Typ, +0,9 +-6,6 ohne. Gewinn live nicht belegt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
2.4 KiB
Python
45 lines
2.4 KiB
Python
# Eingebaute Typ-Regel (Marge 20 %) gegen den Motor: Tafel Spieler-Haelfte A, Wert Haelfte B; Typen gewichtet nach Haeufigkeit je Einsatzgroesse.
|
|
import sys,io,contextlib,numpy as np,math
|
|
sys.path[:0]=["entscheiden","messung/motor/sinn"]; S=sys.argv[2]
|
|
with contextlib.redirect_stdout(io.StringIO()):
|
|
src=open("messung/motor/sinn/river_kreuz.py",encoding="utf-8").read(); exec(src[:src.index("NH=9362")])
|
|
RR=list(R); src2=open("messung/motor/sinn/typ_wert.py",encoding="utf-8").read(); exec(src2[src2.index('D="C:'):src2.index("def tafel(h)")])
|
|
def lies(h):
|
|
P=np.zeros((4,2,2,10)); T=np.zeros((31,4,10))
|
|
for z_ in open(S+"/ty%d/nl2-typ.txt"%h):
|
|
w=z_.split(); v=np.array([float(x) for x in w[4:]]); a,b,c=map(int,w[1:4])
|
|
if w[0]=="P": P[a,b,c]=v
|
|
else: T[a,b]=v
|
|
return P,T
|
|
# Wahrheit der Haelfte: Verteilung je Typ und Groesse (ungeglaettet) und Haeufigkeit
|
|
def wahr(h):
|
|
q=gut&(halb==h); X=np.zeros((31,4,10)); np.add.at(X,(typ[q],gk[q],dz[q]),1); return X
|
|
NH=9362; ab=lambda v:v/v.sum(-1,keepdims=True)
|
|
def lauf(art):
|
|
ges=np.zeros(len(RR))
|
|
for h in (0,1):
|
|
P,T=lies(h); W=wahr(1-h); Pw,Tw=lies(1-h); pgw=ab(W.sum(0))
|
|
for j,x in enumerate(RR):
|
|
if x[1]!="B": continue
|
|
hand,ar,s_,fo,ca,ev,tc,pot_,ist,ty=x[:10]; vor=pot_-tc; g="kmgu".index(fach(tc/vor)); pk_=int(vor>=20)
|
|
ip_=1 if x[12]=="ip" else 0
|
|
ant=np.clip(s_*10-np.arange(10),0,1); top=pot_+tc; ne=top-min(.05*top,10)
|
|
hw=W[:,g].sum(1); hw=hw/hw.sum()
|
|
for t in range(31):
|
|
if hw[t]<1e-4: continue
|
|
d=ab(P[g,ip_,pk_]*(T[t,g] if art=="typ" else T[30,g] if art=="neu" else 1)); e=(d*ant).sum()*ne-tc
|
|
dw=ab(Pw[g,ip_,pk_]*ab(W[t,g]+1e-9)/pgw[g]); ew=(dw*ant).sum()*ne-tc
|
|
if e>.2*tc: ges[j]+=.5*hw[t]*fo*ew
|
|
if e<-.2*tc: ges[j]-=.5*hw[t]*ca*ew
|
|
return ges
|
|
# Position des Setzers mitfuehren
|
|
import json
|
|
pos={}
|
|
for z_ in open(sys.argv[1],encoding="utf-8"):
|
|
r=json.loads(z_); q=r["q"]
|
|
if q["street"]=="RIVER":
|
|
riv=[h for h in q["history"] if h["street"]=="RIVER"]; pos[r["hand"]]="ip" if riv and riv[0]["seat"]==q["heroSeat"] else "oop"
|
|
RR=[x+(pos.get(x[0],"oop"),) for x in RR]
|
|
for art in ("pool","typ"):
|
|
g=lauf(art); m=g.mean(); print("%-5s Gewinn gegen Motor ohne Regel %+.2f +-%.2f bb/100, ohne beste 2 %+.2f"%(art,100*g.sum()/NH,100*g.std()*math.sqrt(len(g))/NH,100*np.sort(g)[:-2].sum()/NH))
|