pokerbench-duplikat.ps1: Fassung minus Anker - gepaartes Duplikat zweier SHARINGAN-Fassungen (je Schalterdatei) mit Rake, eigene Dienst-Ports je Seite, Abbruch je Aufstellung bei entschiedenem Intervall oder Halbbreite <= Ziel, Suchprotokoll je Seite

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 17:47:46 +01:00
co-authored by Claude Opus 5.5
parent 19fdd0092f
commit 2efc27d981
2 changed files with 92 additions and 0 deletions
@@ -26,6 +26,8 @@ def main():
m = re.match(r"m(\d)-s\d+\.suche$", os.path.basename(p))
if m:
je["%sv%s" % (m.group(1), 6 - int(m.group(1)))].update(zaehle(open(p, encoding="utf-8", errors="replace")))
for p in sorted(glob.glob(os.path.join(o, "seite-*.suche"))): # pokerbench-duplikat: je Seite (X/Y) ein Protokoll ueber alle Tische
je["Seite " + os.path.basename(p)[6:-6]].update(zaehle(open(p, encoding="utf-8", errors="replace")))
aus = {}
for k, z in sorted(je.items()):
such = z["suche_fertig"] + z["suche_rueckfall"]
+90
View File
@@ -0,0 +1,90 @@
# "Fassung minus Anker" (03.12., Owner: Benchmarks nur als Abnahme einer fertigen Fassung gegen ihren Vorgaenger / den Anker).
# Gepaartes Duplikat zweier SHARINGAN-Fassungen am NL2-Tisch MIT Rake (tisch6, pruef6-Fassung: Rake je Einsatz, TISCH_MUSTER, Fortsetzen).
# Jede Seite ist eine Schalterdatei wie live: ihre AB_SPOT_B-Zeile (Umgebung des Motors, darin die Dienst-Exes) und ihre AB_SPOT_EXE.
# pokerbench-duplikat.ps1 -Name rake-stufe0 -X <schalter X> -Y <schalter Y = Anker> [-XExe ..] [-YExe ..] [-Blaetter 2000] [-Tische 32]
# [-Muster '3,1,5'] [-Saat 2026120400] [-Ziel 10]
# - Jede Seite bekommt eigene Dienst-Ports (X 4718x, Y 4719x), damit sich die Fassungen nie einen Dienst teilen; die Dienste bleiben warm.
# - MOTOR_FLACH=1 (geteilte Tafeln, 0,3 GB je Motor): Exes ohne MOTOR_FLACH laden normal (~9,5 GB) - dann -Tische kleiner waehlen oder
# -XExe/-YExe auf eine Flach-Exe derselben Quelle setzen (Anker: pokerbench-bench-anker-<sha>.exe aus claude/bench-anker).
# - Ohne Python-Schichten des Laeufers (wie Arm B live: REIN_GEGEN/SCHWACHJAM/VERTRAUEN sind aus), Fristen wie in der Schalterdatei.
# - Gleiche Saat je Tisch fuer alle Laeufe: jede Fassung tritt auf denselben Blaettern an.
# Ausgabe D:\Projects\pf-batterie\messung\farm\duplikat\<Name>\: m<k>-s<i>.jsonl, ZWISCHENSTAND.txt (alle 10 min, angehaengt), ERGEBNIS.txt.
# Abbruch je Aufstellung, sobald das 95-%-Intervall von X - Y die 0 ausschliesst oder die Halbbreite <= Ziel ist.
# Laeuft nur ohne laeufer.pid; prueft die Sperre vor jedem Tischstart selbst (der Farm-Waechter haelt im Spiel alles an).
param([Parameter(Mandatory)][string]$Name, [Parameter(Mandatory)][string]$X, [Parameter(Mandatory)][string]$Y, [string]$XExe = '', [string]$YExe = '',
[int]$Blaetter = 2000, [int]$Tische = 32, [string]$Muster = '3,1,5', [int]$Saat = 2026120400, [double]$Ziel = 10)
$f = 'D:\Projects\pf-batterie\messung\farm'; $o = "$f\duplikat\$Name"; New-Item -ItemType Directory -Force $o | Out-Null; $log = "$o\kette.log"
Set-Content "$o\STARTER.pid" $PID
function Log($t) { Add-Content -Path $log -Value ((Get-Date -Format 'HH:mm:ss') + ' ' + $t) -Encoding UTF8 }
function Spielt { (Test-Path 'D:\Projects\pokerfreak\.claude\worktrees\engine-lecks-angreifen-de7b88\betrieb\scratch\laeufer.pid') -or (Test-Path 'D:\Projects\pokerfreak\scratch\laeufer.pid') }
function WarteFrei { $r = 0; while ($r -lt 2) { if (Spielt) { $r = 0 } else { $r++ }; Start-Sleep 15 } }
Add-Type -Namespace FarmD -Name Sp -MemberDefinition @'
[StructLayout(LayoutKind.Sequential)] public struct MS { public uint l; public uint last; public ulong phys, physfrei, zusage, zusagefrei, virt, virtfrei, x; }
[DllImport("kernel32.dll")] public static extern bool GlobalMemoryStatusEx(ref MS m);
public static double FreiGB() { MS m = new MS(); m.l = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(MS)); GlobalMemoryStatusEx(ref m); return m.zusagefrei / 1073741824.0; }
'@
# Seite aus der Schalterdatei: (Exe, Umgebung als "K=V K=V")
function Seite([string]$datei, [string]$exe, [int]$port0, [string]$seite) {
$z = Get-Content $datei -Encoding UTF8
$b = ($z | ? { $_ -match '^AB_SPOT_B=' } | Select-Object -First 1) -replace '^AB_SPOT_B=', ''
$e = ($z | ? { $_ -match '^AB_SPOT_EXE=' } | Select-Object -First 1) -replace '^AB_SPOT_EXE=', ''
if (-not $b -or -not $e) { throw "Schalterdatei ohne AB_SPOT_B/AB_SPOT_EXE: $datei" }
if ($exe) { $e = $exe }
$kv = [ordered]@{}; foreach ($p in $b.Split(';')) { if ($p -match '^([^=]+)=(.*)$') { $kv[$Matches[1]] = $Matches[2] } }
$kv['MOTOR_SHARINGAN_ADRESSE'] = "127.0.0.1:$port0"; $kv['MOTOR_SUCHE_ADRESSE'] = "127.0.0.1:$($port0 + 2)"
$kv['MOTOR_SHARINGAN_PROTOKOLL'] = "$o\seite-$seite.suche"
$kv['MOTOR_SHARINGAN_WARTEN'] = '900'; $kv['MOTOR_FLACH'] = '1'; $kv['HYBRID_LEERLAUF_S'] = '7200'; $kv['RAYON_NUM_THREADS'] = '1'
foreach ($k in @($kv.Keys)) { if ("$($kv[$k])" -match '\s') { throw "Leerzeichen im Wert $k (tisch6 trennt an Leerzeichen)" } }
return @($e, (($kv.GetEnumerator() | % { "$($_.Key)=$($_.Value)" }) -join ' '), (Get-FileHash $datei).Hash, (Get-FileHash $e).Hash)
}
$py = (Get-Command python).Source; $pruef = 'D:\Projects\pokerfreak\.claude\worktrees\motor-pruef6-3b22d4\messung\pruef'
$D = 'D:/Projects/pokerfreak-daten/grundstrategie-flach'
$motorArgs = "dienst sechs100 $D 2000-600-400 200 $D/sechs100-v2.bin genau hu=$D/hu100-v1.bin,$D/hu200-v2.bin"
$sx = Seite $X $XExe 47181 'X'; $sy = Seite $Y $YExe 47191 'Y'
$xs = "cmd:$($sx[0]) $motorArgs|$($sx[1])"; $ys = "cmd:$($sy[0]) $motorArgs|$($sy[1])"
Log "Start ${Name}: X = $X (Schalter $($sx[2].Substring(0,16)), Exe $($sx[3].Substring(0,16))), Y = $Y (Schalter $($sy[2].Substring(0,16)), Exe $($sy[3].Substring(0,16)))"
Log "X: $xs"; Log "Y: $ys"
$nur = @($Muster -split ',' | % { [int]$_ }); $anteil = @{ 1 = 0.5; 3 = 0.25; 5 = 0.25 }
$summe = ($nur | % { $anteil[$_] } | Measure-Object -Sum).Sum
$tische = [ordered]@{}; foreach ($m in $nur) { $k = [Math]::Max(1, [int][Math]::Round($Tische * $anteil[$m] / $summe)); for ($i = 0; $i -lt $k; $i++) { $tische["m$m-s$i"] = @($m, $i) } }
$aus_w = "$f\nacht-0112\werkzeuge\farm_sharingan_auswertung.py"
$laeufe = @{}; $entschieden = @{}; $letzte = Get-Date
while ($true) {
WarteFrei; $offen = 0
foreach ($t in $tische.Keys) {
$n = @($tische[$t])[0]
if ($entschieden.ContainsKey("$n")) { $p = $laeufe[$t]; if ($p -and -not $p.HasExited) { Stop-Process -Id $p.Id -Force -EA 0; Log "Tisch $t beendet (Aufstellung $n entschieden)" }; continue }
$p = $laeufe[$t]; if ($p -and -not $p.HasExited) { $offen++; continue }
$aus = "$o\$t.jsonl"; $fertig = 0
if (Test-Path $aus) { $fertig = @(Get-Content $aus | % { try { ($_ | ConvertFrom-Json).blatt } catch {} } | Sort-Object -Unique).Count }
if ($fertig -ge $Blaetter) { continue }
if (Spielt) { $offen++; break }
if ([FarmD.Sp]::FreiGB() -lt 25) { $offen++; continue }
if ($p) { Log "Tisch $t beendet (Rueckgabe $($p.ExitCode)), ~$fertig Blaetter; Neustart mit Fortsetzen" }
$env:TISCH_MUSTER = "$n"; $env:TISCH_FORTSETZEN = '1'; $env:TISCH_DATEN = $D
$laeufe[$t] = Start-Process $py -ArgumentList '-X', 'utf8', "$pruef\tisch6.py", $Blaetter, ($Saat + 100 * $n + @($tische[$t])[1]), $aus, "`"$xs`"", "`"$ys`"" `
-WorkingDirectory $pruef -PassThru -WindowStyle Hidden -RedirectStandardError "$o\$t.err"
$null = $laeufe[$t].Handle; $laeufe[$t].PriorityClass = 'BelowNormal'; Log "Tisch $t (Muster $n) gestartet PID $($laeufe[$t].Id), fertig bisher $fertig"; $offen++; Start-Sleep 8
}
# Zwischenstand alle 10 min (angehaengt); Abbruch je Aufstellung bei entschiedenem Intervall oder erreichter Halbbreite
if (((Get-Date) - $letzte).TotalMinutes -ge 10) {
$letzte = Get-Date
$j = & $py -X utf8 $aus_w $o 2>$null | Out-String
Add-Content -Path "$o\ZWISCHENSTAND.txt" -Value ((Get-Date -Format 'HH:mm') + ' ' + $j.Trim()) -Encoding UTF8
try {
$e = $j | ConvertFrom-Json
foreach ($k in $e.PSObject.Properties) {
$m = [int]$k.Name.Substring(0, 1); $v = $k.Value; $d = $v.motor_minus_sharingan_bb100; $h = $v.halbbreite_diff
if ($null -ne $d -and $null -ne $h -and $v.blaetter -ge 100 -and (([Math]::Abs($d) -gt $h) -or ($h -le $Ziel)) -and -not $entschieden.ContainsKey("$m")) {
$entschieden["$m"] = $true; Log "Aufstellung $($k.Name) entschieden: X - Y = $d +- $h bb/100 bei $($v.blaetter) Blaettern"
}
}
} catch { Log "Zwischenstand nicht lesbar: $_" }
}
if (-not $offen) { break }
Start-Sleep 30
}
Log "=== FERTIG duplikat $Name"
& $py -X utf8 $aus_w $o 2>&1 | % { "$_" } | Tee-Object "$o\ERGEBNIS.txt" | % { Log $_ }
& $py -X utf8 "$f\nacht-0112\werkzeuge\farm_benchmark_suche.py" $o 2>&1 | % { "$_" } | Tee-Object "$o\SUCHE.txt" | % { Log $_ }
Remove-Item "$o\STARTER.pid" -EA 0