BUDGET=baum: deterministische Rechenmenge aus Baumgroesse (Iterationen, Karten, MW-Stufe), feste balancierte Kartenwahl, Notbremse zaehlt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ BEKANNTE_SCHALTER = ("FAUSTREGEL", "MDF_UNREAD", "RAISE_DRAWS", "RAISE_PRIOR", "
|
||||
"REST_STACK", "FORTSETZUNG", "POOL_PRIOR", "POSTERIOR", "GEGNER_LINIEN",
|
||||
"PREFLOP_VOLL", "PREFLOP_OHNE_ANTE", "PREFLOP_MIKRO", "PREFLOP_VOLL_TEILE",
|
||||
"WERT_BRETT", "FLUSS_WERT", "PAAR_RAISE", "BRETT_PAAR", "CALLED_JAM", "ALLIN_TIEFE", "UEBERBET", "CBET_LUFT", "POOL_STUFE", "GEGEN_GROSS", "BETTOR", "VETO_AB", "UEBERSCHUSS", "VORFLOP_BAND", "VORFLOP_POP", "DREIBET_TOPF", "CHECK_FALLE", "CHECK_FALLE_AGGR", "CHECK_FALLE_VERTRAUEN", "CHECK_FALLE_EQ",
|
||||
"TISCHWAHL", "TISCHWAHL_AB", "SITZWAHL", "GEGNER_GEDAECHTNIS", "ZEIGT_KIPP", "STATION_ZUG", "RAISE_FOLD_DECKEL", "STEAL_BREITE", "INFO_KONSISTENT", "EINSATZ_BLUFF", "WETT_KURVE", "UEBERWERT", "ENTHALTUNG", "TURN_SPIEL_FOLD", "BETTOR_GROSS", "BETTOR_GROSS_TURN", "RANGES_ECHT", "KERN_RUECKFALL")
|
||||
"TISCHWAHL", "TISCHWAHL_AB", "SITZWAHL", "GEGNER_GEDAECHTNIS", "ZEIGT_KIPP", "STATION_ZUG", "RAISE_FOLD_DECKEL", "STEAL_BREITE", "INFO_KONSISTENT", "EINSATZ_BLUFF", "WETT_KURVE", "UEBERWERT", "ENTHALTUNG", "TURN_SPIEL_FOLD", "BETTOR_GROSS", "BETTOR_GROSS_TURN", "RANGES_ECHT", "KERN_RUECKFALL", "BUDGET")
|
||||
# Schalter des LAEUFERS (betrieb/runner.py liest sie aus seiner eigenen Umgebung, nicht der Kern): aus der
|
||||
# Datei auch in os.environ, sonst schaltete ein Eintrag hier nichts. Eine ausdrueckliche Umgebung geht vor.
|
||||
# GEGNER_GEDAECHTNIS (die Uebergabe hier in `_gedaechtnis`) liest os.environ: ohne diesen Eintrag
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# BUDGET=baum: Rechenmenge aus der Baumgroesse statt aus der Uhr
|
||||
|
||||
Schalter `BUDGET=baum` (aus/unset = bitgleich zu heute; in `BEKANNTE_SCHALTER`). Code: `src/engine/baum.rs`, Einhaengepunkte in
|
||||
`solver_kern.rs` (HU River/Turn/Flop), `multi3_spieler.rs` (MW Flop/Turn, Stufe), `river3_spieler.rs` (MW River), `frist.rs`
|
||||
(Notbremse bleibt, zaehlt ihre Ausloesungen), `rueckfall.rs` (Zeit-Rueckfall), `turn_river_game.rs` (feste Kartenwahl).
|
||||
|
||||
## Was gilt
|
||||
* Iterationen, River/Turn-Karten und MW-Stufe stehen VOR dem Solve fest, aus Baumgroesse und einem Kostenmodell (CPU-ms je Iteration,
|
||||
gefittet auf fester Iterationszahl, nicht auf Uhrzeit). Die Kappen sind die heutigen Live-Kappen (HU River 1300 ms, Turn 900,
|
||||
Flop 1000, MW `SOLVER3_MS`=300 bzw. Strassen-Rest), aber gegen das Modell statt gegen die Thread-CPU-Uhr.
|
||||
* Kein Abbruch mitten im Solve nach Zeit. Keine Neuberechnung nach Zeitmessung. Notbremse (`KERN_NOTBREMSE_MS`) bleibt Sicherheitsnetz,
|
||||
`frist::NOTBREMSE_ZAEHLER` zaehlt je Entscheidung; `kern_grund` meldet ihn auf stderr (`NOTBREMSE n`). Fixture: 0.
|
||||
* "Uhr" innerhalb einer Entscheidung ist ein Konto vorhergesagter ms (`baum::konto`), z. B. fuer MW-Budget je Strasse, den
|
||||
Notfall-Schwellwert, `tgstark=breit` (zweite Rechnung ab 900 ms) und den Zeit-Rueckfall.
|
||||
|
||||
## Kostenmodell (CPU-ms je Iteration; Fit ueber 238 Fixture-Entscheidungen, `BAUM_LOG=1`, SOLVER_ITER fest)
|
||||
| Art | ms/Iteration | rel. Fehler |
|
||||
|---|---|---|
|
||||
| hu_river | 1.37e-5 x Knoten x (c0+c1) | 16 % |
|
||||
| hu_turn (k River-Karten) | k x (6.94e-7 x c0 x c1 + 1.14e-5 x Knoten x (c0+c1)) | 13 % |
|
||||
| hu_flop (k Turn-Karten) | k x 1.5e-5 x Knoten x (c0+c1) | 12 % |
|
||||
| mw_flop / mw_turn / mw_river | {1.0e-4, 1.06e-4, 2.97e-5} x Spieler x Summe(Kombos) | ~20 / 20 / 12 % |
|
||||
Setup: HU 25 ms, MW 1.6e-3 ms je Knoten. Die Constanten stammen von einem Lauf bei ~1.35x Ueberbuchung der Maschine (CPU je Iteration
|
||||
ist dort etwas hoeher), nicht von einer leeren Maschine; Eichung auf die leere Maschine steht aus (siehe unten).
|
||||
Iterationen = floor((Kappe - Setup) / ms je Iteration), auf Vielfache 5 (HU) / 50 (MW) / 200 (MW River) abgerundet, mindestens Live-Minimum.
|
||||
HU-Turn/Flop: Karten wie die Live-`eng`-Regel (zuerst min(16, 5.6e6/(c0 x c1)), dann bis zu dreimal verkleinern, wenn
|
||||
20 Iterationen x 1.3 nicht in die Kappe passen), aber aus dem Modell, vor dem Aufbau (kein verlorener Aufbau).
|
||||
MW: Stufe 1 (200 Kombos, volle Slots) wird uebersprungen, wenn 1000 Iterationen nicht passen; dann (100, Slots/2), dann (50, 2).
|
||||
|
||||
## Kartenwahl (Befund Jd8h)
|
||||
Bisher: gleichmaessiger Schritt ueber das nach Farbe sortierte Deck -> bei kleinem k Farben/Raenge zufaellig ungleich, das Ergebnis
|
||||
springt mit k (Jd8h: +0.19 / +0.23 / -0.14 bei 11 / 6 / 12 Karten). Neu unter baum (`karten_gleichmaessig`): Deck nach Rang
|
||||
sortiert, Farbreihenfolge je Rang rotiert, dann gleichmaessiger Schritt; reine Funktion von Brett und k, gleiche Karten in gleicher
|
||||
Reihenfolge; Zufallszahl pro Spot ist nicht noetig (keine Zufallswahl). Jd8h gegen 1.5 Topf (Call minus Fold in Toepfen, 38 Iterationen):
|
||||
6 Karten -0.347, 11 -0.340, 16 -0.182, 24 +0.032, 44 (alle) +0.028: monoton, kein Springen; der Wert braucht aber ~24 Karten,
|
||||
um beim Vollwert anzukommen (bei 16 bleibt es Fold).
|
||||
|
||||
Abstand gewaehlt/Vollwert (44 Karten, je 38 Iterationen), `messung/solver_kern/budget_baum/karten_ausw.txt`:
|
||||
* 16 Kipp-Turn-Spots der Angriffs-Kippliste (aus dem Raster von `werkzeuge/kippliste.py`, ungelesen/gelesen):
|
||||
gewaehlte Karten (11-16): gleiche Aktion 12/16, |Delta(Call-Fold)| Median 0.053, p90 0.380, max 0.451 Topf;
|
||||
fest 6: 9/16 (Median 0.197), 11: 11/16, 16: 12/16 (Median 0.095), 24: 12/16 (0.062).
|
||||
* 57 HU-Turn-Spots der Fixture: gewaehlte Karten (44x16, 5x7, 3x8, je 1x 4/5/9/10/12): gleiche Aktion 54/57,
|
||||
|Delta(Call-Fold)| Median 0.057, p90 0.254, max 0.937; EV-Verlust der gewaehlten Aktion nach Vollwerten im Mittel 0.034 Topf,
|
||||
p90 0.000, max 1.834 (ein 7-Karten-Fall); bei 16 Karten (44 Spots) EV-Verlust 0.000.
|
||||
=> Kipp-Spots sind knappe Entscheidungen; 16 Karten reichen fuer typische Spots, nicht fuer Knappe. Hebel, falls gewuenscht: 24 Karten
|
||||
(1.5x Rechnung dieser Baeume) oder Karten nach Knappheit nachfuellen; nicht eingebaut.
|
||||
|
||||
## Gates
|
||||
* (a) gleicher Build, `BUDGET=baum`, Fixture 2x: 238/238 gleich (ms normiert), der zweite Lauf lief neben einem weiteren
|
||||
kern_grund-Prozess (Kartenreihe): Lastunabhaengigkeit ok. Notbremse 0.
|
||||
* (b) unset gegen `pokerbench-solverkern-grund-mess.exe`, beide mit `SOLVER_ZEIT=fest` (Uhr-Laeufe sind selbst nicht bitgleich): 238/238.
|
||||
* (c) Tabelle unten. Der saubere Live-Uhr-Lauf steht aus (siehe unten).
|
||||
|
||||
## (c) SOLVER_ITER gegen baum (ms je Entscheidung, Wand; Karten/Iterationen Median)
|
||||
| kind | n | SOLVER_ITER mean/p99/max ms | baum mean/p99/max ms | SOLVER_ITER cards/iters (median) | baum cards/iters (median) |
|
||||
|---|---|---|---|---|---|
|
||||
| Flop/hu | 99 | 899/1622/2147 | 776/2046/2077 | 16/40 | 16/40 |
|
||||
| Flop/mw | 32 | 942/2102/2516 | 513/1458/1527 | -/2000.0 | -/1675.0 |
|
||||
| River/hu | 35 | 256/544/587 | 190/379/457 | -/100 | -/100 |
|
||||
| River/mw | 5 | 873/1359/1495 | 611/817/933 | -/5600 | -/3600 |
|
||||
| Turn/hu | 57 | 1632/3986/4296 | 815/1272/2284 | 16/38 | 16/35 |
|
||||
| Turn/mw | 10 | 1197/2145/2934 | 595/964/1022 | -/2700.0 | -/1425.0 |
|
||||
total SOLVER_ITER 238 s, baum 155 s
|
||||
differ SOLVER_ITER vs baum: action 15, size only 14, of 238
|
||||
line 38 Turn/hu Call vs Fold | EV(pots) {'fold': 2.43, 'call': 2.47, 'raise to 1.50': 2.21, 'raise to 9.13': 0.0} vs {'fold': 3.06, 'call': 2.71, 'raise to 1.50': 2.55, 'raise to 9.13': 0.0}
|
||||
line 54 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 1.01} vs {'check': 1.13}
|
||||
line 56 Flop/hu Raise { to: 0.06666666666666667 } vs Raise { to: 0.03333333333333333 } | EV(pots) {'check': 1.71} vs {'check': 2.24}
|
||||
line 62 Flop/hu Call vs Fold | EV(pots) {'fold': 1.9, 'call': 1.98, 'raise to 3.00': 1.96, 'raise to 12.93': 0.0} vs {'fold': 3.2, 'call': 2.43, 'raise to 3.00': 2.05, 'raise to 12.93': 0.0}
|
||||
line 63 Turn/hu Raise { to: 0.42 } vs Raise { to: 0.13999999999999999 } | EV(pots) {'check': 0.27} vs {'check': 0.39}
|
||||
line 68 Flop/hu Check vs Raise { to: 0.03 } | EV(pots) {'check': 1.26} vs {'check': 0.94}
|
||||
line 73 Flop/hu Raise { to: 0.12333333333333332 } vs Raise { to: 0.24666666666666665 } | EV(pots) {'check': 0.0} vs {'check': 0.0}
|
||||
line 84 Flop/hu Raise { to: 0.33 } vs Raise { to: 0.22 } | EV(pots) {'check': 0.31} vs {'check': 0.28}
|
||||
line 96 Flop/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 3.23} vs {'check': 3.16}
|
||||
line 97 Turn/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 2.64} vs {'check': 3.12}
|
||||
line 123 Flop/hu Raise { to: 0.11 } vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 1.34} vs {'check': 1.6}
|
||||
line 133 Turn/hu Call vs Fold | EV(pots) {'fold': 1.96, 'call': 1.99, 'raise to 1.50': 2.11, 'raise to 9.63': 0.0} vs {'fold': 2.31, 'call': 2.29, 'raise to 1.50': 2.34, 'raise to 9.63': 0.0}
|
||||
line 136 Flop/mw Raise { to: 0.15666666666666665 } vs Check | EV(pots) {} vs {}
|
||||
line 145 Flop/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.12 } | EV(pots) {'check': 2.06} vs {'check': 1.76}
|
||||
line 155 Flop/hu Raise { to: 0.03 } vs Check | EV(pots) {'check': 2.34} vs {'check': 2.21}
|
||||
line 159 Turn/hu Raise { to: 0.27999999999999997 } vs Raise { to: 0.5599999999999999 } | EV(pots) {'check': 0.0} vs {'check': 0.0}
|
||||
line 180 Turn/hu Raise { to: 0.02 } vs Check | EV(pots) {'check': 3.15} vs {'check': 2.82}
|
||||
line 183 Flop/hu Check vs Raise { to: 0.1 } | EV(pots) {'check': 0.12} vs {'check': 0.26}
|
||||
line 184 Turn/hu Check vs Raise { to: 0.05333333333333333 } | EV(pots) {'check': 0.94} vs {'check': 0.83}
|
||||
line 185 Turn/hu Raise { to: 0.1 } vs Raise { to: 3.17 } | EV(pots) {'check': 0.0} vs {'check': 0.0}
|
||||
line 190 Flop/hu Raise { to: 0.07333333333333333 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.48} vs {'check': 0.85}
|
||||
line 199 Flop/mw Raise { to: 0.04666666666666667 } vs Raise { to: 0.023333333333333334 } | EV(pots) {} vs {}
|
||||
line 200 Turn/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.07999999999999999 } | EV(pots) {'check': 0.22} vs {'check': 0.64}
|
||||
line 205 Turn/hu Raise { to: 0.11 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 3.12} vs {'check': 2.64}
|
||||
line 214 Turn/mw Raise { to: 0.1433333333333333 } vs Call | EV(pots) {} vs {}
|
||||
line 218 Turn/hu Raise { to: 0.06333333333333332 } vs Check | EV(pots) {'check': 1.17} vs {'check': 1.28}
|
||||
line 224 Turn/hu Check vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 0.14} vs {'check': 0.0}
|
||||
line 228 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.69} vs {'check': 0.69}
|
||||
line 231 Turn/hu Fold vs Call | EV(pots) {'fold': 0.01, 'call': 0.0} vs {'fold': 0.0, 'call': 0.07}
|
||||
|
||||
Unterschied zu SOLVER_ITER: 15 Aktionsart, 14 nur Groesse von 238 (ausser den Kipps der Spalte sind es fast nur gemischte Raise-Groessen
|
||||
auf Flop/Turn und MW-Zeilen). Ursache: andere Kartenwahl (balanciert statt Schritt) und kleinere MW-Iterationen (Flop 1675 statt 2000,
|
||||
Turn 1425 statt 2700, River 3600 statt 5600). Bei den Aktionsart-Kipps ist der Wertabstand klein (Call/Fold z. B. 2.43/2.47 -> 3.06/2.71 Pots).
|
||||
|
||||
## Eichung offen
|
||||
Mittel/Spitze (Gesamt 155 s baum; SOLVER_ITER 238 s) sind auf einer ueberbuchten Maschine gemessen; der Auftrag nennt 299 s Live.
|
||||
Der saubere Live-Uhr-Lauf allein auf der Maschine fehlt: `messung/solver_kern/budget_baum/live_allein.sh` (ca. 5 min, ein Prozess),
|
||||
danach `tab.py live_allein.txt baum2.txt live baum`. Stimmt das Mittel nicht, ist die Kappe je Art (BUDGET_MS etc. in
|
||||
`solver_kern.rs`/`multi3_spieler.rs`) der Stellknopf; die Modellkonstanten bleiben.
|
||||
@@ -0,0 +1,3 @@
|
||||
for k in - 6 11 16 24 44; do python vergl.py kipp_turn.jsonl kipp_k$k.txt $k; done
|
||||
for k in - 44; do python vergl.py fixture_turn_hu.jsonl fix_k$k.txt $k; done
|
||||
echo fertig > kipp_fertig.txt
|
||||
@@ -0,0 +1,52 @@
|
||||
import re,sys,statistics as st
|
||||
def lies(f):
|
||||
r=[]
|
||||
for l in open(f,encoding='utf-8'):
|
||||
p=l.rstrip('\n').split('\t')
|
||||
m=re.search(r'(\d+) river cards, (\d+) iters',p[2]);
|
||||
vals=re.search(r'\(pots\): (.*?)\] ->',p[2])
|
||||
v={}
|
||||
if vals:
|
||||
for a,x in re.findall(r'(fold|call|check|raise to [\d.]+) ([+-][\d.]+)',vals.group(1)): v[a]=float(x)
|
||||
act=re.search(r'-> (\w+)',p[2])
|
||||
r.append(dict(k=int(m.group(1)) if m else None,it=int(m.group(2)) if m else None,v=v,act=act.group(1) if act else p[-1],ms=float(p[3])))
|
||||
return r
|
||||
def gap(x):
|
||||
v=x['v']
|
||||
if 'call' in v and 'fold' in v: return v['call']-v['fold']
|
||||
return None
|
||||
def best2(x):
|
||||
s=sorted(x['v'].values(),reverse=True); return s[0]-s[1] if len(s)>1 else None
|
||||
def vgl(a,b,name):
|
||||
# a = gewaehlt, b = voll
|
||||
n=len(a); same=sum(x['act']==y['act'] for x,y in zip(a,b))
|
||||
dg=[abs(gap(x)-gap(y)) for x,y in zip(a,b) if gap(x) is not None and gap(y) is not None]
|
||||
db=[abs(x['v'].get('call',0)-y['v'].get('call',0)) for x,y in zip(a,b)]
|
||||
# EV loss: value (in b's values) of a's action vs best in b
|
||||
loss=[]
|
||||
for x,y in zip(a,b):
|
||||
if y['v']:
|
||||
best=max(y['v'].values())
|
||||
ka=[k for k in y['v'] if k.startswith(x['act'].lower().split()[0])]
|
||||
loss.append(best-(y['v'][ka[0]] if ka else min(y['v'].values())))
|
||||
q=lambda v,p: sorted(v)[min(int(len(v)*p),len(v)-1)] if v else float('nan')
|
||||
if not dg: dg=[0.0]
|
||||
print(f"{name}: n={n} same action {same}/{n}; |dcall-fold| median {st.median(dg):.3f} p90 {q(dg,.9):.3f} max {max(dg):.3f}; EV loss of chosen action vs full-card values: mean {st.mean(loss):.3f} p90 {q(loss,.9):.3f} max {max(loss):.3f} (pots)")
|
||||
if __name__=='__main__':
|
||||
full=lies('kipp/kipp_k44.txt')
|
||||
ks=[('-',None)]+[(k,k) for k in ('6','11','16','24')]
|
||||
for k,_ in ks:
|
||||
a=lies(f'kipp/kipp_k{k}.txt')
|
||||
print('k',k,'cards',sorted(set(x['k'] for x in a)),end=' '); vgl(a,full,'Kipp turn')
|
||||
ff=lies('kipp/fix_k44.txt'); fa=lies('kipp/fix_k-.txt')
|
||||
from collections import Counter
|
||||
print('fixture cards chosen',sorted(Counter(x['k'] for x in fa).items()), 'iters',sorted(Counter(x['it'] for x in fa).items()))
|
||||
vgl(fa,ff,'Fixture HU turn')
|
||||
# per k breakdown on fixture
|
||||
for k in sorted(set(x['k'] for x in fa)):
|
||||
idx=[i for i,x in enumerate(fa) if x['k']==k]
|
||||
vgl([fa[i] for i in idx],[ff[i] for i in idx],f' fixture k={k}')
|
||||
# Jd8h
|
||||
print('Jd8h (id 3rd) call-fold by k:')
|
||||
for k in ['-','6','11','16','24','44']:
|
||||
a=lies(f'kipp/kipp_k{k}.txt'); print(' ',k,a[2]['k'],round(gap(a[2]),3),a[2]['act'],'| g-version',a[11]['k'],round(gap(a[11]),3),a[11]['act'])
|
||||
@@ -0,0 +1,5 @@
|
||||
import re,sys
|
||||
def norm(f): return [re.sub(r"\d+(\.\d+)? ?ms","ms",re.sub(r"\t[0-9.]+\t","\t#\t",l.rstrip('\n'))) for l in open(f,encoding='utf-8')]
|
||||
a,b=norm(sys.argv[1]),norm(sys.argv[2])
|
||||
d=[i for i,(x,y) in enumerate(zip(a,b)) if x!=y]
|
||||
print(len(a),len(b),'gleich',sum(x==y for x,y in zip(a,b)),'abw',d[:10])
|
||||
@@ -0,0 +1,27 @@
|
||||
import sys, re, json, os
|
||||
W = r"D:\Projects\pokerfreak\.claude\worktrees\budget-baum"
|
||||
sys.path.insert(0, os.path.join(W, "lesen"))
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("kippliste", os.path.join(os.path.dirname(os.path.abspath(__file__)), "kippliste.py"))
|
||||
kl = importlib.util.module_from_spec(spec)
|
||||
kl.__file__ = os.path.join(W, "werkzeuge", "kippliste.py")
|
||||
sys.modules["kippliste"] = kl
|
||||
spec.loader.exec_module(kl)
|
||||
md = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "KIPPLISTE-allin-kurve.md"), encoding="utf-8").read()
|
||||
# Turn-Eintraege: "TURN <linie>, <hand> <klasse> (<gegner>)"
|
||||
ein = set()
|
||||
for m in re.finditer(r"^- TURN (.+?), ([2-9TJQKA][shdc][2-9TJQKA][shdc]) \w+ \((\w+)\)", md, re.M):
|
||||
ein.add((m.group(1), m.group(2), m.group(3)))
|
||||
print(len(ein), "Kipp-Turn-Eintraege", file=sys.stderr)
|
||||
out = []
|
||||
for profil in (False, True):
|
||||
for s in kl.postflop_spots(profil):
|
||||
if not s["lage"].startswith("TURN "): continue
|
||||
lin = s["lage"][5:]
|
||||
g = "gelesen" if profil else "ungelesen"
|
||||
if (lin, s["hand"], g) in ein:
|
||||
out.append(s)
|
||||
print(len(out), "Spots in der Raster", file=sys.stderr)
|
||||
with open("kipp_turn.jsonl", "w", encoding="utf-8", newline="\n") as f:
|
||||
for s in out: f.write(json.dumps({"id": s["id"], "req": s["req"]}) + "\n")
|
||||
for s in out: print(s["id"])
|
||||
@@ -0,0 +1,7 @@
|
||||
Traceback (most recent call last):
|
||||
File "C:\Users\marcm\pokerfreak-solverkern\budget\kipp\ausw.py", line 36, in <module>
|
||||
full=lies('kipp/kipp_k44.txt')
|
||||
File "C:\Users\marcm\pokerfreak-solverkern\budget\kipp\ausw.py", line 4, in lies
|
||||
for l in open(f,encoding='utf-8'):
|
||||
~~~~^^^^^^^^^^^^^^^^^^^^
|
||||
FileNotFoundError: [Errno 2] No such file or directory: 'kipp/kipp_k44.txt'
|
||||
@@ -0,0 +1,18 @@
|
||||
import os, re, subprocess, sys, time
|
||||
# lauf.py <exe> <out> [KEY=VAL ...] : fixture run with kern_schalter env + KERN_GRUND_ZEIT=1, BelowNormal
|
||||
exe, out = os.path.abspath(sys.argv[1]), os.path.abspath(sys.argv[2])
|
||||
ks = r"D:\Projects\pokerfreak\.claude\worktrees\mess-stand\betrieb\kern_schalter.txt"
|
||||
env = dict(os.environ)
|
||||
for z in open(ks, encoding="utf-8"):
|
||||
z = z.strip()
|
||||
if z and not z.startswith("#") and "=" in z:
|
||||
k, v = z.split("=", 1); env[k.strip()] = v.strip()
|
||||
env["KERN_GRUND_ZEIT"] = "1"
|
||||
env.pop("SOLVER_ITER", None); env.pop("BUDGET", None)
|
||||
for a in sys.argv[3:]:
|
||||
k, v = a.split("=", 1); env[k] = v
|
||||
korpus = r"D:\Projects\pokerfreak\.claude\worktrees\mess-stand\tests\live_fixture\abdeckung\echtgeld-2026-11-19.jsonl"
|
||||
t = time.time()
|
||||
p = subprocess.Popen([exe, korpus], env=env, stdout=open(out, "w", encoding="utf-8"), stderr=open(out + ".err", "w"), creationflags=0x4000)
|
||||
p.wait()
|
||||
print("fertig", round(time.time() - t, 1), "s", out)
|
||||
@@ -0,0 +1,4 @@
|
||||
# Clean live baseline, run ALONE (other measurements paused): ~5 min single process.
|
||||
cd /c/Users/marcm/pokerfreak-solverkern/budget
|
||||
python lauf.py pokerbench-solverkern-budget-live.exe live_allein.txt SOLVER_ITER_LOG=1
|
||||
python tab.py live_allein.txt baum2.txt live baum > live_vs_baum.md
|
||||
@@ -0,0 +1,15 @@
|
||||
import sys,collections
|
||||
def lies(f):
|
||||
r=[]
|
||||
for l in open(f,encoding='utf-8'):
|
||||
p=l.rstrip('\n').split('\t')
|
||||
if len(p)>=4: r.append((p[0],float(p[3]),p[2],p[4] if len(p)>4 else ''))
|
||||
return r
|
||||
if __name__=='__main__':
|
||||
for f in sys.argv[1:]:
|
||||
d=collections.defaultdict(list)
|
||||
for k,ms,_,_ in lies(f): d['/'.join(k.split('/')[:2])].append(ms)
|
||||
print(f); tot=0
|
||||
for k,v in sorted(d.items()):
|
||||
v.sort(); tot+=sum(v); print(' ',k,len(v),'mean %.0f p99 %.0f max %.0f'%(sum(v)/len(v),v[max(int(len(v)*.99)-1,0)],v[-1]))
|
||||
print(' total s %.0f'%(tot/1e3))
|
||||
@@ -0,0 +1,45 @@
|
||||
import re,sys,collections,statistics as st
|
||||
def rd(f):
|
||||
r=[]
|
||||
for l in open(f,encoding='utf-8'):
|
||||
p=l.rstrip('\n').split('\t'); r.append(p)
|
||||
return r
|
||||
def kind(p):
|
||||
lg=p[0].split('/'); s=lg[0]+'/'+lg[1]
|
||||
return s
|
||||
def info(p):
|
||||
m=re.search(r'(\d+) river cards, (\d+) iters',p[2]) or re.search(r'(\d+) turn cards, (\d+) iters',p[2])
|
||||
if m: return int(m.group(1)),int(m.group(2))
|
||||
m=re.search(r'(\d+) iters',p[2]);
|
||||
return (None,int(m.group(1))) if m else (None,None)
|
||||
def ch(p):
|
||||
c=p[4] if len(p)>4 else ''
|
||||
k=re.match(r'[A-Za-z]+',c); return (k.group(0) if k else c), c
|
||||
def ev(p):
|
||||
v=re.search(r'\(pots\): (.*?)\]',p[2]);
|
||||
d={}
|
||||
if v:
|
||||
for a,x in re.findall(r'(fold|call|check|raise to [\d.]+) ([+-][\d.]+)',v.group(1)): d[a]=float(x)
|
||||
return d
|
||||
A=rd(sys.argv[1]); B=rd(sys.argv[2]); na,nb=sys.argv[3],sys.argv[4]
|
||||
q=lambda v,p: sorted(v)[max(int(len(v)*p)-1,0)]
|
||||
by=collections.defaultdict(list)
|
||||
for i,(a,b) in enumerate(zip(A,B)): by[kind(a)].append(i)
|
||||
print(f"| kind | n | {na} mean/p99/max ms | {nb} mean/p99/max ms | {na} cards/iters (median) | {nb} cards/iters (median) |")
|
||||
print("|---|---|---|---|---|---|")
|
||||
for k,ix in sorted(by.items()):
|
||||
fa=[float(A[i][3]) for i in ix]; fb=[float(B[i][3]) for i in ix]
|
||||
ia=[info(A[i]) for i in ix]; ib=[info(B[i]) for i in ix]
|
||||
med=lambda L,j: st.median([x[j] for x in L if x[j] is not None]) if any(x[j] is not None for x in L) else '-'
|
||||
print(f"| {k} | {len(ix)} | {st.mean(fa):.0f}/{q(fa,.99):.0f}/{max(fa):.0f} | {st.mean(fb):.0f}/{q(fb,.99):.0f}/{max(fb):.0f} | {med(ia,0)}/{med(ia,1)} | {med(ib,0)}/{med(ib,1)} |")
|
||||
ta=sum(float(a[3]) for a in A)/1e3; tb=sum(float(b[3]) for b in B)/1e3
|
||||
print(f"total {na} {ta:.0f} s, {nb} {tb:.0f} s")
|
||||
act=sz=0; rows=[]
|
||||
for i,(a,b) in enumerate(zip(A,B)):
|
||||
(ka,ca),(kb,cb)=ch(a),ch(b)
|
||||
if ka!=kb: act+=1; rows.append((i,kind(a),ca,cb))
|
||||
elif ca!=cb: sz+=1; rows.append((i,kind(a),ca,cb))
|
||||
print(f"differ {na} vs {nb}: action {act}, size only {sz}, of {len(A)}")
|
||||
for r in rows:
|
||||
i=r[0]; ea,eb=ev(A[i]),ev(B[i])
|
||||
print(' line',i+1,r[1],r[2],'vs',r[3],'| EV(pots) ',{k:round(v,2) for k,v in ea.items()},'vs',{k:round(v,2) for k,v in eb.items()})
|
||||
@@ -0,0 +1,39 @@
|
||||
| kind | n | SOLVER_ITER mean/p99/max ms | baum mean/p99/max ms | SOLVER_ITER cards/iters (median) | baum cards/iters (median) |
|
||||
|---|---|---|---|---|---|
|
||||
| Flop/hu | 99 | 899/1622/2147 | 776/2046/2077 | 16/40 | 16/40 |
|
||||
| Flop/mw | 32 | 942/2102/2516 | 513/1458/1527 | -/2000.0 | -/1675.0 |
|
||||
| River/hu | 35 | 256/544/587 | 190/379/457 | -/100 | -/100 |
|
||||
| River/mw | 5 | 873/1359/1495 | 611/817/933 | -/5600 | -/3600 |
|
||||
| Turn/hu | 57 | 1632/3986/4296 | 815/1272/2284 | 16/38 | 16/35 |
|
||||
| Turn/mw | 10 | 1197/2145/2934 | 595/964/1022 | -/2700.0 | -/1425.0 |
|
||||
total SOLVER_ITER 238 s, baum 155 s
|
||||
differ SOLVER_ITER vs baum: action 15, size only 14, of 238
|
||||
line 38 Turn/hu Call vs Fold | EV(pots) {'fold': 2.43, 'call': 2.47, 'raise to 1.50': 2.21, 'raise to 9.13': 0.0} vs {'fold': 3.06, 'call': 2.71, 'raise to 1.50': 2.55, 'raise to 9.13': 0.0}
|
||||
line 54 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 1.01} vs {'check': 1.13}
|
||||
line 56 Flop/hu Raise { to: 0.06666666666666667 } vs Raise { to: 0.03333333333333333 } | EV(pots) {'check': 1.71} vs {'check': 2.24}
|
||||
line 62 Flop/hu Call vs Fold | EV(pots) {'fold': 1.9, 'call': 1.98, 'raise to 3.00': 1.96, 'raise to 12.93': 0.0} vs {'fold': 3.2, 'call': 2.43, 'raise to 3.00': 2.05, 'raise to 12.93': 0.0}
|
||||
line 63 Turn/hu Raise { to: 0.42 } vs Raise { to: 0.13999999999999999 } | EV(pots) {'check': 0.27} vs {'check': 0.39}
|
||||
line 68 Flop/hu Check vs Raise { to: 0.03 } | EV(pots) {'check': 1.26} vs {'check': 0.94}
|
||||
line 73 Flop/hu Raise { to: 0.12333333333333332 } vs Raise { to: 0.24666666666666665 } | EV(pots) {'check': 0.0} vs {'check': 0.0}
|
||||
line 84 Flop/hu Raise { to: 0.33 } vs Raise { to: 0.22 } | EV(pots) {'check': 0.31} vs {'check': 0.28}
|
||||
line 96 Flop/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 3.23} vs {'check': 3.16}
|
||||
line 97 Turn/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 2.64} vs {'check': 3.12}
|
||||
line 123 Flop/hu Raise { to: 0.11 } vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 1.34} vs {'check': 1.6}
|
||||
line 133 Turn/hu Call vs Fold | EV(pots) {'fold': 1.96, 'call': 1.99, 'raise to 1.50': 2.11, 'raise to 9.63': 0.0} vs {'fold': 2.31, 'call': 2.29, 'raise to 1.50': 2.34, 'raise to 9.63': 0.0}
|
||||
line 136 Flop/mw Raise { to: 0.15666666666666665 } vs Check | EV(pots) {} vs {}
|
||||
line 145 Flop/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.12 } | EV(pots) {'check': 2.06} vs {'check': 1.76}
|
||||
line 155 Flop/hu Raise { to: 0.03 } vs Check | EV(pots) {'check': 2.34} vs {'check': 2.21}
|
||||
line 159 Turn/hu Raise { to: 0.27999999999999997 } vs Raise { to: 0.5599999999999999 } | EV(pots) {'check': 0.0} vs {'check': 0.0}
|
||||
line 180 Turn/hu Raise { to: 0.02 } vs Check | EV(pots) {'check': 3.15} vs {'check': 2.82}
|
||||
line 183 Flop/hu Check vs Raise { to: 0.1 } | EV(pots) {'check': 0.12} vs {'check': 0.26}
|
||||
line 184 Turn/hu Check vs Raise { to: 0.05333333333333333 } | EV(pots) {'check': 0.94} vs {'check': 0.83}
|
||||
line 185 Turn/hu Raise { to: 0.1 } vs Raise { to: 3.17 } | EV(pots) {'check': 0.0} vs {'check': 0.0}
|
||||
line 190 Flop/hu Raise { to: 0.07333333333333333 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.48} vs {'check': 0.85}
|
||||
line 199 Flop/mw Raise { to: 0.04666666666666667 } vs Raise { to: 0.023333333333333334 } | EV(pots) {} vs {}
|
||||
line 200 Turn/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.07999999999999999 } | EV(pots) {'check': 0.22} vs {'check': 0.64}
|
||||
line 205 Turn/hu Raise { to: 0.11 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 3.12} vs {'check': 2.64}
|
||||
line 214 Turn/mw Raise { to: 0.1433333333333333 } vs Call | EV(pots) {} vs {}
|
||||
line 218 Turn/hu Raise { to: 0.06333333333333332 } vs Check | EV(pots) {'check': 1.17} vs {'check': 1.28}
|
||||
line 224 Turn/hu Check vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 0.14} vs {'check': 0.0}
|
||||
line 228 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.69} vs {'check': 0.69}
|
||||
line 231 Turn/hu Fold vs Call | EV(pots) {'fold': 0.01, 'call': 0.0} vs {'fold': 0.0, 'call': 0.07}
|
||||
@@ -0,0 +1,15 @@
|
||||
import os, re, subprocess, sys
|
||||
# vergl.py <jsonl> <out> <KARTEN|-> : kern_grund unter BUDGET=baum, SOLVER_ITER=hu_turn:38, optional BAUM_KARTEN
|
||||
exe = r"C:\Users\marcm\pokerfreak-solverkern\budget\pokerbench-solverkern-budget-baum.exe"
|
||||
ks = r"D:\Projects\pokerfreak\.claude\worktrees\mess-stand\betrieb\kern_schalter.txt"
|
||||
env = dict(os.environ)
|
||||
for z in open(ks, encoding="utf-8"):
|
||||
z = z.strip()
|
||||
if z and not z.startswith("#") and "=" in z:
|
||||
k, v = z.split("=", 1); env[k.strip()] = v.strip()
|
||||
env.pop("SOLVER_ITER", None)
|
||||
env.update(BUDGET="baum", KERN_GRUND_ZEIT="1", SOLVER_ITER="hu_turn:38")
|
||||
if sys.argv[3] != "-": env["BAUM_KARTEN"] = sys.argv[3]
|
||||
src, out = os.path.abspath(sys.argv[1]), os.path.abspath(sys.argv[2])
|
||||
p = subprocess.Popen([exe, src], env=env, stdout=open(out, "w", encoding="utf-8"), stderr=subprocess.DEVNULL, creationflags=0x4000)
|
||||
p.wait()
|
||||
@@ -61,4 +61,7 @@ fn main() {
|
||||
};
|
||||
println!("{lage}\t{grund}\t{}{ms}", d.reason.replace('\t', " "));
|
||||
}
|
||||
if rechner::engine::baum::aktiv() {
|
||||
eprintln!("NOTBREMSE {}", rechner::engine::frist::NOTBREMSE_ZAEHLER.load(std::sync::atomic::Ordering::Relaxed));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,6 +377,20 @@ fn matched_any(regret: &[f64], a: usize, out: &mut [f64]) {
|
||||
}
|
||||
}
|
||||
|
||||
/// `k` of the undealt cards as single-bit masks, balanced over ranks and suits: the deck sorted by rank (the suit order rotating
|
||||
/// with the rank, so no suit leads), then evenly strided. Same board and `k` give the same cards in the same order.
|
||||
pub fn karten_gleichmaessig(board: u64, k: usize) -> Vec<u64> {
|
||||
let mut all: Vec<u64> = (0..4u32).flat_map(|s| (0..13u32).map(move |r| 1u64 << (16 * s + r))).filter(|b| b & board == 0).collect();
|
||||
all.sort_by_key(|b| {
|
||||
let t = b.trailing_zeros();
|
||||
let (s, r) = (t / 16, t % 16);
|
||||
(r, (s + r) % 4)
|
||||
});
|
||||
let n = all.len();
|
||||
let k = k.clamp(1, n);
|
||||
(0..k).map(|i| all[(((i as f64 + 0.5) * n as f64 / k as f64) as usize).min(n - 1)]).collect()
|
||||
}
|
||||
|
||||
impl TrSolver {
|
||||
/// `board`: the four turn cards as a mask; `river`: the river cards to enumerate (`None` = all 48 not
|
||||
/// on the board, `Some(k)` = `k` of them, evenly strided). Combos must not touch the board.
|
||||
@@ -395,6 +409,15 @@ impl TrSolver {
|
||||
TrSolver::with_cards(game, hands, board, all, wr)
|
||||
}
|
||||
|
||||
/// As `new` with `Some(k)`, but the `k` cards are chosen by `karten_gleichmaessig` (rank- and suit-balanced, a fixed function of
|
||||
/// the board and `k`): `BUDGET=baum` uses it so a smaller card count is a coarser but unbiased sample of the same deck.
|
||||
pub fn new_gleichmaessig(game: TrGame, hands: [Hands; 2], board: u64, k: usize) -> TrSolver {
|
||||
let candidates = (0..52u32).filter(|i| board & (1u64 << (16 * (i / 13) + i % 13)) == 0).count();
|
||||
let all = karten_gleichmaessig(board, k);
|
||||
let wr = candidates as f64 / (all.len() as f64 * (candidates as f64 - 4.0));
|
||||
TrSolver::with_cards(game, hands, board, all, wr)
|
||||
}
|
||||
|
||||
/// As `new`, with explicit river cards (single-bit masks) and the deal weight of each.
|
||||
pub fn with_cards(game: TrGame, hands: [Hands; 2], board: u64, all: Vec<u64>, wr: f64) -> TrSolver {
|
||||
let n = [hands[0].masks.len(), hands[1].masks.len()];
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
//! `BUDGET=baum`: the work of every postflop solve is a deterministic function of its tree size, not of the clock.
|
||||
//! (Calibration helpers: `BAUM_LOG=1` prints one stderr line per finished solve loop.)
|
||||
|
||||
/// `BUDGET=baum` is set (read once). Off: nothing in this module is consulted and every path is the clock's.
|
||||
pub fn aktiv() -> bool {
|
||||
static AN: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
*AN.get_or_init(|| std::env::var("BUDGET").as_deref() == Ok("baum"))
|
||||
}
|
||||
|
||||
/// Calibration log `BAUM_LOG=1`: `BAUM_LOG <kind> <size features> setup_ms loop_ms iters` on stderr.
|
||||
pub fn log(art: &str, feats: &str, setup_ms: f64, loop_ms: f64, done: u64) {
|
||||
static LOG: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
if *LOG.get_or_init(|| std::env::var("BAUM_LOG").is_ok_and(|v| !v.is_empty() && v != "0")) {
|
||||
eprintln!("BAUM_LOG\t{art}\t{feats}\t{setup_ms:.1}\t{loop_ms:.1}\t{done}");
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
// The work of a solve as a function of its tree size. Constants: least-squares fits of CPU ms per iteration over the 238
|
||||
// fixture decisions, measured with fixed iterations (`SOLVER_ITER`, `BAUM_LOG=1`; messung/solver_kern/BUDGET_BAUM.md), relative
|
||||
// error 12 to 16 % (HU) and 4 to 12 % (MW). A solve gets what the live clock would give it on an idle core
|
||||
// (`TURN_BUDGET_MS` etc.), but the iterations, the river/turn cards and the multiway stage are computed from these predictions
|
||||
// BEFORE the solve, so the same spot gets the same work whatever the machine load.
|
||||
// ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
use crate::engine::frist::Art;
|
||||
use std::cell::Cell;
|
||||
|
||||
thread_local! {
|
||||
/// Predicted CPU ms the solves of this decision have used so far (the deterministic stand-in of `frist::elapsed_ms`).
|
||||
static KONTO: Cell<f64> = const { Cell::new(0.0) };
|
||||
}
|
||||
|
||||
/// New decision (called by `frist::begin`).
|
||||
pub fn neu() {
|
||||
KONTO.with(|k| k.set(0.0));
|
||||
}
|
||||
|
||||
/// Predicted CPU ms spent on solves in this decision so far.
|
||||
pub fn konto() -> f64 {
|
||||
KONTO.with(Cell::get)
|
||||
}
|
||||
|
||||
/// Book predicted CPU ms.
|
||||
pub fn buche(ms: f64) {
|
||||
KONTO.with(|k| k.set(k.get() + ms));
|
||||
}
|
||||
|
||||
/// Setup (ranges, tree, equity tables) of a heads-up flop/turn/river solve, CPU ms (the measured ticks are 0 to 60).
|
||||
pub const HU_SETUP_MS: f64 = 25.0;
|
||||
|
||||
/// CPU ms of one heads-up river iteration.
|
||||
pub fn hu_river_iter_ms(c0: usize, c1: usize, nodes: usize) -> f64 {
|
||||
1.37e-5 * nodes as f64 * (c0 + c1) as f64
|
||||
}
|
||||
|
||||
/// CPU ms of one heads-up turn iteration with `k` river cards.
|
||||
pub fn hu_turn_iter_ms(c0: usize, c1: usize, nodes: usize, k: usize) -> f64 {
|
||||
k as f64 * (6.94e-7 * (c0 * c1) as f64 + 1.14e-5 * nodes as f64 * (c0 + c1) as f64)
|
||||
}
|
||||
|
||||
/// CPU ms of one heads-up flop iteration with `k` turn cards.
|
||||
pub fn hu_flop_iter_ms(c0: usize, c1: usize, nodes: usize, k: usize) -> f64 {
|
||||
k as f64 * 1.5e-5 * nodes as f64 * (c0 + c1) as f64
|
||||
}
|
||||
|
||||
/// CPU ms of one multiway iteration (MCCFR samples one path: the cost follows players x combos, not the node count;
|
||||
/// fit `ms = k x players x sum(combos)`, relative error ~20 %, the small solves are limited by the 15.6 ms clock tick).
|
||||
pub fn mw_iter_ms(art: Art, players: usize, combos: &[usize]) -> f64 {
|
||||
let k = match art {
|
||||
Art::MwFlop => 1.0e-4,
|
||||
Art::MwTurn => 1.06e-4,
|
||||
_ => 2.97e-5,
|
||||
};
|
||||
k * players as f64 * combos.iter().sum::<usize>() as f64
|
||||
}
|
||||
|
||||
/// CPU ms to set up a multiway solve of `nodes` tree nodes (locks and rows).
|
||||
pub fn mw_setup_ms(nodes: usize) -> f64 {
|
||||
1.6e-3 * nodes as f64
|
||||
}
|
||||
|
||||
/// `x` rounded down to a multiple of `step`, between `lo` and `hi` (the live clock checks every `step` iterations too).
|
||||
pub fn iters_aus(x: f64, step: u32, lo: u32, hi: u32) -> u32 {
|
||||
let n = if x.is_finite() && x > 0.0 { (x as u32) / step * step } else { 0 };
|
||||
n.clamp(lo, hi.max(lo))
|
||||
}
|
||||
|
||||
/// Iterations of a solve that must fit `kappe` CPU ms with `setup` ms already gone and `p` ms per iteration.
|
||||
pub fn iters_fuer(kappe: f64, setup: f64, p: f64, step: u32, lo: u32, hi: u32) -> u32 {
|
||||
iters_aus((kappe - setup) / p.max(1e-9), step, lo, hi)
|
||||
}
|
||||
|
||||
/// Cards of a heads-up turn/flop solve so that `min_iters` iterations (x 1.3 slack, as the live check) fit `kappe`:
|
||||
/// the live `eng` rule (scale by `(kappe - setup) / (p x min_iters x 1.5)`, at most three times), with the predicted cost in
|
||||
/// place of two measured iterations. `iter_ms(k)` = predicted ms per iteration with `k` cards.
|
||||
pub fn karten_fuer(k0: usize, kmin: usize, kappe: f64, min_iters: u32, iter_ms: &dyn Fn(usize) -> f64) -> usize {
|
||||
let mut k = k0;
|
||||
for _ in 0..3 {
|
||||
let p = iter_ms(k);
|
||||
if p * min_iters as f64 * 1.3 <= kappe - HU_SETUP_MS || k <= kmin {
|
||||
break;
|
||||
}
|
||||
let skala = ((kappe - HU_SETUP_MS) / (p * min_iters as f64 * 1.5)).clamp(0.05, 0.9);
|
||||
k = ((k as f64 * skala) as usize).max(kmin);
|
||||
}
|
||||
k
|
||||
}
|
||||
|
||||
/// Measurement only (`BAUM_KARTEN=<n>`, under `BUDGET=baum`): force the river/turn card count of every heads-up turn/flop solve
|
||||
/// (48 = all), to compare the chosen count with the full one.
|
||||
pub fn karten_vorgabe() -> Option<usize> {
|
||||
static K: std::sync::OnceLock<Option<usize>> = std::sync::OnceLock::new();
|
||||
*K.get_or_init(|| std::env::var("BAUM_KARTEN").ok().and_then(|v| v.trim().parse().ok()).filter(|n: &usize| *n > 0))
|
||||
}
|
||||
+17
-1
@@ -15,8 +15,13 @@ thread_local! {
|
||||
static WAND: Cell<Option<Instant>> = const { Cell::new(None) };
|
||||
/// `fest_hier`: this thread ignores wall time like `SOLVER_ZEIT=fest` (tests, tools).
|
||||
static FEST_HIER: Cell<bool> = const { Cell::new(false) };
|
||||
/// `BUDGET=baum`: the emergency brake already fired in this decision (counted once per decision).
|
||||
static GEFEUERT: Cell<bool> = const { Cell::new(false) };
|
||||
}
|
||||
|
||||
/// How many decisions the emergency brake cut under `BUDGET=baum` (a safety net there: should stay 0).
|
||||
pub static NOTBREMSE_ZAEHLER: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
|
||||
|
||||
/// Total wall time of one decision per street, in ms.
|
||||
pub const RIVER_MS: f64 = 2000.0;
|
||||
pub const TURN_MS: f64 = 1250.0;
|
||||
@@ -28,6 +33,8 @@ pub const MARGIN_MS: f64 = 150.0;
|
||||
pub fn begin() {
|
||||
START.with(|s| s.set(Some(thread_cpu_ms())));
|
||||
WAND.with(|s| s.set(Some(Instant::now())));
|
||||
GEFEUERT.with(|g| g.set(false));
|
||||
super::baum::neu();
|
||||
}
|
||||
|
||||
/// Live emergency brake in wall time (`KERN_NOTBREMSE_MS`, set only by the live bridge
|
||||
@@ -39,7 +46,11 @@ pub fn notbremse() -> bool {
|
||||
let Some(ms) = *MS.get_or_init(|| std::env::var("KERN_NOTBREMSE_MS").ok().and_then(|v| v.trim().parse().ok()).filter(|x: &f64| *x > 0.0)) else {
|
||||
return false;
|
||||
};
|
||||
!fixed() && wand_ueber(ms)
|
||||
let an = !fest_streng() && wand_ueber(ms);
|
||||
if an && super::baum::aktiv() && !GEFEUERT.with(|g| g.replace(true)) {
|
||||
NOTBREMSE_ZAEHLER.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
}
|
||||
an
|
||||
}
|
||||
|
||||
/// Wall time since `begin` exceeds `ms`.
|
||||
@@ -64,6 +75,11 @@ pub fn left_ms(total_ms: f64) -> f64 {
|
||||
/// Measurement switch `SOLVER_ZEIT=fest`: solvers ignore wall time and always run their full iteration
|
||||
/// count, so ladder and LBR results do not depend on machine load (read once).
|
||||
pub fn fixed() -> bool {
|
||||
fest_streng() || super::baum::aktiv()
|
||||
}
|
||||
|
||||
/// `fixed` without `BUDGET=baum`: the modes that also switch the emergency brake off.
|
||||
fn fest_streng() -> bool {
|
||||
static FIXED: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
FEST_HIER.with(Cell::get) || *FIXED.get_or_init(|| std::env::var("SOLVER_ZEIT").as_deref() == Ok("fest")) || iter_aktiv()
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ pub mod double_board;
|
||||
pub mod effective;
|
||||
pub mod flop_spieler;
|
||||
pub mod fortsetzung;
|
||||
pub mod baum;
|
||||
pub mod frist;
|
||||
pub mod glaube;
|
||||
pub mod glaube_linie;
|
||||
|
||||
@@ -599,7 +599,12 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
|
||||
if spot.board.len() != cards || spot.hero_cards.len() != 2 || villains < 2 {
|
||||
return weg("mw lage");
|
||||
}
|
||||
let budget = crate::engine::frist::budget_ms(self::cap_ms(cap_ms), total);
|
||||
let baum = crate::engine::baum::aktiv();
|
||||
let budget = if baum {
|
||||
self::cap_ms(cap_ms).min(total - crate::engine::frist::MARGIN_MS - crate::engine::baum::konto())
|
||||
} else {
|
||||
crate::engine::frist::budget_ms(self::cap_ms(cap_ms), total)
|
||||
};
|
||||
if budget <= 0.0 {
|
||||
return weg("mw keine zeit");
|
||||
}
|
||||
@@ -630,6 +635,8 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
|
||||
// Under SOLVER3_ALLE a game too big for the budget (fewer than MIN_ITERS iterations projected) is solved again
|
||||
// smaller: fewer combos per player, fewer slots (a coarser abstraction beats the heuristic).
|
||||
let stufen: Vec<(usize, usize)> = if alle() { vec![(MAX_COMBOS, slots), (100, (slots / 2).max(2)), (50, 2)] } else { vec![(MAX_COMBOS, slots)] };
|
||||
// `BUDGET=baum`: predicted CPU ms already used by earlier stages of this solve (the stand-in of `jetzt - cpu0`).
|
||||
let mut baum_vorher = 0.0;
|
||||
for (lvl, (maxc, sl)) in stufen.iter().copied().enumerate() {
|
||||
let letzte = lvl + 1 == stufen.len();
|
||||
let erzwungen: Option<usize> = std::env::var("KERN_STUFE").ok().and_then(|v| v.trim().parse().ok());
|
||||
@@ -657,6 +664,20 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
|
||||
let nodes = game.nodes.len();
|
||||
let combos: Vec<usize> = hands.iter().map(|h| h.masks.len()).collect();
|
||||
let hero_index = hands[me].masks.iter().position(|m| *m == hero_mask)?;
|
||||
// `BUDGET=baum`: the stage and its iterations come from the tree size, before anything is built on it.
|
||||
let art = if spot.street == Street::Turn { crate::engine::frist::Art::MwTurn } else { crate::engine::frist::Art::MwFlop };
|
||||
let min_iter = crate::engine::frist::iter_min(art, if alle() && letzte { MIN_ITERS_KLEIN } else { MIN_ITERS });
|
||||
let p_baum = crate::engine::baum::mw_iter_ms(art, order.len(), &combos);
|
||||
let setup_baum = crate::engine::baum::mw_setup_ms(nodes);
|
||||
let mut iters_eff = ITERS;
|
||||
if baum {
|
||||
let frei = budget - baum_vorher - setup_baum;
|
||||
if !letzte && erzwungen.is_none() && p_baum * MIN_ITERS as f64 > frei - 30.0 * p_baum && !crate::engine::frist::iter_aktiv() {
|
||||
baum_vorher += setup_baum + 30.0 * p_baum;
|
||||
continue;
|
||||
}
|
||||
iters_eff = crate::engine::baum::iters_fuer(frei, 0.0, p_baum, 50, min_iter, ITERS);
|
||||
}
|
||||
let mut solver = SolverM::new(game, hands, board, spot.seed ^ 0x9e37_79b9_7f4a_7c15);
|
||||
if pool_w() > 0.0 || offen_w() > 0.0 {
|
||||
let masks: Vec<&[u64]> = (0..order.len()).map(|p| solver.masks(p)).collect();
|
||||
@@ -693,19 +714,21 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
|
||||
}
|
||||
}
|
||||
let cpu_stufe = crate::engine::frist::thread_cpu_ms();
|
||||
let cpu_s0 = cpu_stufe;
|
||||
let mut done = 0u32;
|
||||
let mut zu_gross = false;
|
||||
let art = if spot.street == Street::Turn { crate::engine::frist::Art::MwTurn } else { crate::engine::frist::Art::MwFlop };
|
||||
let min_iter = crate::engine::frist::iter_min(art, if alle() && letzte { MIN_ITERS_KLEIN } else { MIN_ITERS });
|
||||
while done < crate::engine::frist::iter_cap(art, ITERS) {
|
||||
while done < crate::engine::frist::iter_cap(art, iters_eff) {
|
||||
solver.iterate();
|
||||
done += 1;
|
||||
if baum && crate::engine::frist::notbremse() {
|
||||
break;
|
||||
}
|
||||
let jetzt = crate::engine::frist::thread_cpu_ms();
|
||||
if done == 30 && !letzte && erzwungen.is_none() && (jetzt - cpu_stufe) / 30.0 * MIN_ITERS as f64 > budget - (jetzt - cpu0) {
|
||||
if !baum && done == 30 && !letzte && erzwungen.is_none() && (jetzt - cpu_stufe) / 30.0 * MIN_ITERS as f64 > budget - (jetzt - cpu0) {
|
||||
zu_gross = true;
|
||||
break;
|
||||
}
|
||||
if done % 50 == 0 && jetzt - cpu0 > budget {
|
||||
if !baum && done % 50 == 0 && jetzt - cpu0 > budget {
|
||||
// Over the budget: enough iterations end the solve; too few hand the spot to a smaller game, the
|
||||
// smallest one runs on to its minimum.
|
||||
if done >= min_iter {
|
||||
@@ -727,6 +750,10 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
|
||||
continue;
|
||||
}
|
||||
crate::engine::frist::iter_log(art, done as u64);
|
||||
if baum {
|
||||
crate::engine::baum::buche(setup_baum + done as f64 * p_baum);
|
||||
}
|
||||
crate::engine::baum::log(art.name(), &format!("{} {:?} {} {}", order.len(), combos, nodes, sl), cpu_s0 - cpu0, crate::engine::frist::thread_cpu_ms() - cpu_s0, done as u64);
|
||||
// The smallest game under ALLE may rest on fewer iterations: a coarse solve still beats the heuristic.
|
||||
if done < min_iter {
|
||||
return weg("mw zu wenig iterationen");
|
||||
|
||||
@@ -141,7 +141,12 @@ pub fn solve_river3(spot: &Spot) -> Option<Solved3> {
|
||||
if spot.street != Street::River || spot.board.len() != 5 || spot.hero_cards.len() != 2 || villains < 2 {
|
||||
return weg("mw lage");
|
||||
}
|
||||
let budget = crate::engine::frist::budget_ms(crate::engine::multi3_spieler::cap_ms(BUDGET_MS), crate::engine::frist::RIVER_MS);
|
||||
let baum = crate::engine::baum::aktiv();
|
||||
let budget = if baum {
|
||||
crate::engine::multi3_spieler::cap_ms(BUDGET_MS).min(crate::engine::frist::RIVER_MS - crate::engine::frist::MARGIN_MS - crate::engine::baum::konto())
|
||||
} else {
|
||||
crate::engine::frist::budget_ms(crate::engine::multi3_spieler::cap_ms(BUDGET_MS), crate::engine::frist::RIVER_MS)
|
||||
};
|
||||
if budget <= 0.0 {
|
||||
return weg("mw keine zeit");
|
||||
}
|
||||
@@ -220,14 +225,26 @@ pub fn solve_river3(spot: &Spot) -> Option<Solved3> {
|
||||
}
|
||||
}
|
||||
let mut done = 0u32;
|
||||
while done < crate::engine::frist::iter_cap(crate::engine::frist::Art::MwRiver, ITERS) {
|
||||
let cpu_l0 = crate::engine::frist::thread_cpu_ms();
|
||||
// `BUDGET=baum`: the iterations the cap allows on an idle core, from the tree size (never fewer than `MIN_ITERS`: no drop to the fallback for time).
|
||||
let p_baum = crate::engine::baum::mw_iter_ms(crate::engine::frist::Art::MwRiver, order.len(), &combos);
|
||||
let setup_baum = crate::engine::baum::mw_setup_ms(nodes);
|
||||
let iters_eff = if baum { crate::engine::baum::iters_fuer(budget, setup_baum, p_baum, 200, MIN_ITERS, ITERS) } else { ITERS };
|
||||
while done < crate::engine::frist::iter_cap(crate::engine::frist::Art::MwRiver, iters_eff) {
|
||||
solver.iterate();
|
||||
done += 1;
|
||||
if done % 200 == 0 && crate::engine::frist::thread_cpu_ms() - cpu0 > budget || crate::engine::frist::notbremse() {
|
||||
if baum && crate::engine::frist::notbremse() {
|
||||
break;
|
||||
}
|
||||
if !baum && done % 200 == 0 && crate::engine::frist::thread_cpu_ms() - cpu0 > budget || crate::engine::frist::notbremse() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
crate::engine::frist::iter_log(crate::engine::frist::Art::MwRiver, done as u64);
|
||||
if baum {
|
||||
crate::engine::baum::buche(setup_baum + done as f64 * p_baum);
|
||||
}
|
||||
crate::engine::baum::log("mw_river", &format!("{} {:?} {} 0", order.len(), combos, nodes), cpu_l0 - cpu0, crate::engine::frist::thread_cpu_ms() - cpu_l0, done as u64);
|
||||
if done < crate::engine::frist::iter_min(crate::engine::frist::Art::MwRiver, MIN_ITERS) {
|
||||
return crate::engine::multi3_spieler::weg("mw zu wenig iterationen");
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ fn setzer_index(spot: &Spot) -> usize {
|
||||
/// Rückfall-Antwort für diesen Spot; `None` bei ausgeschaltetem Schalter oder ausserhalb der Scheibe (Omaha, keine Gegner-Range).
|
||||
pub fn entscheide(spot: &Spot, lists: &[Option<List>], lage: Option<&Turnierlage>) -> Option<Decision> {
|
||||
let c = cfg()?;
|
||||
if c.nur_zeit && !(crate::engine::frist::notbremse() || (crate::engine::frist::elapsed_ms() >= ZEIT_AB_MS && !crate::engine::frist::iter_aktiv())) {
|
||||
if c.nur_zeit && !(crate::engine::frist::notbremse() || (crate::engine::frist::elapsed_ms() >= ZEIT_AB_MS && !crate::engine::frist::iter_aktiv() && !crate::engine::baum::aktiv()) || (crate::engine::baum::aktiv() && !crate::engine::frist::iter_aktiv() && crate::engine::baum::konto() >= ZEIT_AB_MS)) {
|
||||
return None;
|
||||
}
|
||||
entscheide_mit(spot, lists, c, lage)
|
||||
|
||||
@@ -1136,6 +1136,10 @@ pub fn solve(spot: &Spot, c: &Cfg) -> Option<Geloest> {
|
||||
if !ohne_uhr && (crate::engine::frist::elapsed_ms() > NOTFALL_MS || crate::engine::frist::notbremse()) {
|
||||
return None;
|
||||
}
|
||||
let baum = crate::engine::baum::aktiv();
|
||||
if baum && (crate::engine::baum::konto() > NOTFALL_MS || crate::engine::frist::notbremse()) {
|
||||
return None;
|
||||
}
|
||||
let started = std::time::Instant::now();
|
||||
let cpu0 = crate::engine::frist::thread_cpu_ms();
|
||||
// Ranges zum River-Beginn: die River-Aktionen kommen nur über den Baum.
|
||||
@@ -1240,14 +1244,25 @@ pub fn solve(spot: &Spot, c: &Cfg) -> Option<Geloest> {
|
||||
}
|
||||
}
|
||||
let mut done = 0;
|
||||
while done < crate::engine::frist::iter_cap(crate::engine::frist::Art::HuRiver, c.iters) {
|
||||
let cpu_l0 = crate::engine::frist::thread_cpu_ms();
|
||||
// `BUDGET=baum`: the iterations the live cap would allow on an idle core, computed from the tree size up front.
|
||||
let p_baum = crate::engine::baum::hu_river_iter_ms(combos[0], combos[1], nodes);
|
||||
let iters_eff = if baum { crate::engine::baum::iters_fuer(BUDGET_MS, crate::engine::baum::HU_SETUP_MS, p_baum, 5, MIN_ITERS, c.iters) } else { c.iters };
|
||||
while done < crate::engine::frist::iter_cap(crate::engine::frist::Art::HuRiver, iters_eff) {
|
||||
solver.iterate();
|
||||
done += 1;
|
||||
if baum && crate::engine::frist::notbremse() {
|
||||
break;
|
||||
}
|
||||
if !ohne_uhr && done % 5 == 0 && (crate::engine::frist::thread_cpu_ms() - cpu0 > BUDGET_MS || crate::engine::frist::elapsed_ms() > NOTFALL_MS || crate::engine::frist::notbremse()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
crate::engine::frist::iter_log(crate::engine::frist::Art::HuRiver, done as u64);
|
||||
if baum {
|
||||
crate::engine::baum::buche(crate::engine::baum::HU_SETUP_MS + done as f64 * p_baum);
|
||||
}
|
||||
crate::engine::baum::log("hu_river", &format!("{} {} {}", combos[0], combos[1], nodes), cpu_l0 - cpu0, crate::engine::frist::thread_cpu_ms() - cpu_l0, done as u64);
|
||||
if done < crate::engine::frist::iter_min(crate::engine::frist::Art::HuRiver, MIN_ITERS) {
|
||||
return None;
|
||||
}
|
||||
@@ -1677,6 +1692,10 @@ fn solve_frueh_roh(spot: &Spot, c: &Cfg, strasse: Street) -> Option<TurnGeloest>
|
||||
if !ohne_uhr && (crate::engine::frist::elapsed_ms() > NOTFALL_MS || crate::engine::frist::notbremse()) {
|
||||
return weg("frist");
|
||||
}
|
||||
let baum = crate::engine::baum::aktiv();
|
||||
if baum && (crate::engine::baum::konto() > NOTFALL_MS || crate::engine::frist::notbremse()) {
|
||||
return weg("frist");
|
||||
}
|
||||
let started = std::time::Instant::now();
|
||||
let cpu0 = crate::engine::frist::thread_cpu_ms();
|
||||
let mut start = spot.clone();
|
||||
@@ -1713,8 +1732,20 @@ fn solve_frueh_roh(spot: &Spot, c: &Cfg, strasse: Street) -> Option<TurnGeloest>
|
||||
let villain_weights = hands[1].weights.clone();
|
||||
let pct = brett_perzentil(&hands[1].masks, board);
|
||||
let root = game.root;
|
||||
let mut solver = if flop {
|
||||
let (iters, kappe) = if flop { (c.flop_iters, FLOP_BUDGET_MS) } else { (c.turn_iters, TURN_BUDGET_MS) };
|
||||
// `BUDGET=baum`: river cards of the turn solve and iterations from the tree size (see `baum.rs`), never from the clock.
|
||||
// A flop solve that is too big for its cap at the minimum iterations goes the `eng` way (`SKALA`, solved again smaller).
|
||||
let mut turn_karten_baum = c.karten;
|
||||
if baum && !flop {
|
||||
let k0 = if c.eng { ((ENG_GRENZE / (combos[0] * combos[1]).max(1) as f64) as usize).clamp(2, c.karten) } else { c.karten };
|
||||
turn_karten_baum = if let Some(n) = crate::engine::baum::karten_vorgabe() { n } else if c.eng { crate::engine::baum::karten_fuer(k0, 2, kappe, MIN_TURN_ITERS, &|k| crate::engine::baum::hu_turn_iter_ms(combos[0], combos[1], nodes, k)) } else { k0 };
|
||||
}
|
||||
let mut solver = if flop && baum {
|
||||
TrSolver::new_gleichmaessig(game, hands, board, crate::engine::baum::karten_vorgabe().unwrap_or(c.flop_karten)).with_river_equity(board)
|
||||
} else if flop {
|
||||
TrSolver::new(game, hands, board, Some(c.flop_karten)).with_river_equity(board)
|
||||
} else if baum {
|
||||
TrSolver::new_gleichmaessig(game, hands, board, turn_karten_baum)
|
||||
} else {
|
||||
// `eng`: die Kosten (Aufbau und jede Iteration) wachsen mit Kombos x Kombos x River-Karten; breite Ranges bekommen
|
||||
// von vornherein weniger Karten, statt erst nach einem verlorenen Aufbau.
|
||||
@@ -1756,13 +1787,25 @@ fn solve_frueh_roh(spot: &Spot, c: &Cfg, strasse: Street) -> Option<TurnGeloest>
|
||||
let m = Modell { spot, strasse, pot, stack, board, pfa, before, pct, profile: villain.profile.as_ref(), at, reach_at: Default::default(), auf_linie, w_linie: c.w_linie.unwrap_or(c.w), w_raise: c.w_raise.unwrap_or(c.w), mitglied, echt: ft_echt, ft: ft_min };
|
||||
let mut locks = Locks::default();
|
||||
lege_fest(&mut solver, &m, root, [0.0, 0.0], None, &villain_weights, c.w, &mut locks, "");
|
||||
let (iters, kappe) = if flop { (c.flop_iters, FLOP_BUDGET_MS) } else { (c.turn_iters, TURN_BUDGET_MS) };
|
||||
let art = if flop { crate::engine::frist::Art::HuFlop } else if crate::engine::frist::breit_hier() { crate::engine::frist::Art::HuTurnBreit } else { crate::engine::frist::Art::HuTurn };
|
||||
let mut done = 0;
|
||||
let cpu_iter0 = crate::engine::frist::thread_cpu_ms();
|
||||
while done < crate::engine::frist::iter_cap(art, iters) {
|
||||
let p_baum = if flop { crate::engine::baum::hu_flop_iter_ms(combos[0], combos[1], nodes, karten) } else { crate::engine::baum::hu_turn_iter_ms(combos[0], combos[1], nodes, karten) };
|
||||
let iters_eff = if baum {
|
||||
if flop && c.eng && p_baum * MIN_TURN_ITERS as f64 * 1.3 > kappe - crate::engine::baum::HU_SETUP_MS {
|
||||
SKALA.with(|x| x.set(Some(((kappe - crate::engine::baum::HU_SETUP_MS) / (p_baum * MIN_TURN_ITERS as f64 * 1.5)).clamp(0.05, 0.9))));
|
||||
return weg("zu gross (eng)");
|
||||
}
|
||||
crate::engine::baum::iters_fuer(kappe, crate::engine::baum::HU_SETUP_MS, p_baum, 5, MIN_TURN_ITERS, iters)
|
||||
} else {
|
||||
iters
|
||||
};
|
||||
while done < crate::engine::frist::iter_cap(art, iters_eff) {
|
||||
solver.iterate();
|
||||
done += 1;
|
||||
if baum && crate::engine::frist::notbremse() {
|
||||
break;
|
||||
}
|
||||
if c.eng && !ohne_uhr && done == 2 {
|
||||
let je = (crate::engine::frist::thread_cpu_ms() - cpu_iter0) / 2.0;
|
||||
if je * MIN_TURN_ITERS as f64 * 1.3 > kappe - (cpu_iter0 - cpu0) {
|
||||
@@ -1775,6 +1818,10 @@ fn solve_frueh_roh(spot: &Spot, c: &Cfg, strasse: Street) -> Option<TurnGeloest>
|
||||
}
|
||||
}
|
||||
crate::engine::frist::iter_log(art, done as u64);
|
||||
if baum {
|
||||
crate::engine::baum::buche(crate::engine::baum::HU_SETUP_MS + done as f64 * p_baum);
|
||||
}
|
||||
crate::engine::baum::log(art.name(), &format!("{} {} {} {}", combos[0], combos[1], nodes, karten), cpu_iter0 - cpu0, crate::engine::frist::thread_cpu_ms() - cpu_iter0, done as u64);
|
||||
if done < crate::engine::frist::iter_min(art, MIN_TURN_ITERS) {
|
||||
return weg("zu wenig iterationen");
|
||||
}
|
||||
@@ -1913,7 +1960,7 @@ fn turn_decision_neu(raw: &Spot, c: &'static Cfg) -> Option<Decision> {
|
||||
}
|
||||
}
|
||||
let mut breit = false;
|
||||
if c.turn_gegen_stark_breit && stark_fold && !crate::engine::frist::fixed() && crate::engine::frist::elapsed_ms() > TGSTARK_SPAET_MS {
|
||||
if c.turn_gegen_stark_breit && stark_fold && (!crate::engine::frist::fixed() && crate::engine::frist::elapsed_ms() > TGSTARK_SPAET_MS || crate::engine::baum::aktiv() && crate::engine::baum::konto() > TGSTARK_SPAET_MS) {
|
||||
// Keine Zeit fuer die zweite Rechnung: die beste Nicht-Fold-Antwort dieser Rechnung statt des Folds.
|
||||
if let Some(k2) = (0..g.acts.len()).filter(|&k| !matches!(g.acts[k], Act::Fold)).max_by(|&x, &y| g.werte[x].total_cmp(&g.werte[y])) {
|
||||
(act, pick, breit) = (g.acts[k2], k2, true);
|
||||
|
||||
Reference in New Issue
Block a user