Micro-Start/-Stop-Skripte fuer den Echtgeldlauf am Windows-Client

micro_start.ps1: Sperre weg, Cockpit --live, Spielplan Cash + Micro only
(12 Tische, Einsatz nach echtem Guthaben), CoinPoker mit Debug-Port, Laeufer.
micro_stop.ps1: Laeufer sanft stoppen, Spielgeld-Sperre zuruecklegen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 11:39:12 +01:00
co-authored by Claude Opus 5.5
parent 4b74680c2e
commit 84599f3f95
2 changed files with 68 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
# Micro Stakes (Echtgeld, hoechstens BB 0.10) in einem Schritt starten.
# powershell -ExecutionPolicy Bypass -File betrieb\micro_start.ps1
# Vorgabe: 12 Tische (das Maximum), kein eigener Budget-Deckel - es gilt das echte Guthaben, die
# Geldregel (Fuenftel-Regel, Stakes-Leiter) und Micro only (BB <= 0.10). -Tische / -Budget optional.
# Ablauf: Spielgeld-Sperre weg -> Cockpit (--live, startet den Server am Client) -> Spielplan
# Cash + Micro only -> CoinPoker mit Debug-Port -> Laeufer. Stoppen: micro_stop.ps1 / Cockpit.
param([int]$Tische = 12, [double]$Budget = 1000000)
$ErrorActionPreference = 'Stop'
$wurzel = Split-Path -Parent $PSScriptRoot
if ($Budget -le 0) { throw "Budget muss positiv sein" }
if ($Tische -lt 1 -or $Tische -gt 12) { throw "Tische 1..12" }
if ($env:COINPOKER_NUR_UEBUNG -eq '1') { throw "COINPOKER_NUR_UEBUNG=1 ist gesetzt - erst entfernen" }
$sperre = Join-Path $wurzel 'betrieb\nur_uebung'
if (Test-Path $sperre) { Remove-Item $sperre; Write-Host "Spielgeld-Sperre entfernt" }
function Offen([int]$port) {
$c = New-Object Net.Sockets.TcpClient
try { $c.Connect('127.0.0.1', $port); return $true } catch { return $false } finally { $c.Close() }
}
function Warten([int]$port, [int]$sek, [string]$was) {
$ende = (Get-Date).AddSeconds($sek)
while (-not (Offen $port)) {
if ((Get-Date) -gt $ende) { throw "$was antwortet nicht (Port $port)" }
Start-Sleep -Seconds 1
}
}
function Knopf([string]$aktion, $daten = $null) {
$body = @{ aktion = $aktion }
if ($daten) { $body.daten = $daten }
$json = $body | ConvertTo-Json -Depth 5 -Compress
$r = Invoke-RestMethod -Uri 'http://127.0.0.1:8787/api/steuern' -Method Post `
-ContentType 'application/json; charset=utf-8' -Body ([Text.Encoding]::UTF8.GetBytes($json))
Write-Host ("{0}: {1} - {2}" -f $aktion, $(if ($r.ok) { 'ok' } else { 'NEIN' }), $r.text)
return $r
}
# 1. Cockpit (startet den Server mit --client und Tisch-Desktop), falls noch keiner laeuft
if (-not (Offen 8787)) {
Start-Process -FilePath (Join-Path $wurzel 'cockpit\target\release\cockpit.exe') -ArgumentList '--live' -WorkingDirectory $wurzel
Warten 8787 60 "Cockpit-Server"
}
# 2. Spielplan: Cash, Micro only, Tischzahl, Budget
$plan = Knopf 'spielplan_setzen' @{ modus = 'cash'; tische = $Tische; budget = $Budget; micro_only = $true }
if (-not $plan.ok -or $plan.text -notmatch 'Cash') { throw "Spielplan nicht Cash: $($plan.text)" }
# 3. CoinPoker mit Debug-Port (laeuft er schon, ist das auch recht)
$null = Knopf 'client_starten'
Warten 9333 120 "CoinPoker (Debug-Port)"
# 4. Laeufer
$l = Knopf 'laeufer_starten'
if (-not $l.ok) { throw "Laeufer nicht gestartet: $($l.text)" }
Write-Host "Laeuft: Cash Micro (BB <= 0.10), bis $Tische Tische, Einsatz nach echtem Guthaben. Log: sicht\scratch\laeufer.txt"
+12
View File
@@ -0,0 +1,12 @@
# Micro-Lauf beenden: Laeufer sanft stoppen (steht nach der Hand auf) und die Spielgeld-Sperre zuruecklegen.
# powershell -ExecutionPolicy Bypass -File betrieb\micro_stop.ps1
$ErrorActionPreference = 'Continue'
$wurzel = Split-Path -Parent $PSScriptRoot
try {
$json = '{"aktion":"laeufer_stoppen"}'
$r = Invoke-RestMethod -Uri 'http://127.0.0.1:8787/api/steuern' -Method Post `
-ContentType 'application/json; charset=utf-8' -Body ([Text.Encoding]::UTF8.GetBytes($json))
Write-Host ("laeufer_stoppen: {0}" -f $r.text)
} catch { Write-Host "Cockpit-Server nicht erreichbar - Laeufer ggf. im Cockpit stoppen" }
git -C $wurzel checkout -- betrieb/nur_uebung
if (Test-Path (Join-Path $wurzel 'betrieb\nur_uebung')) { Write-Host "Spielgeld-Sperre liegt wieder" }