From 84599f3f95f1a96ccd7b98ade6bf4a1a53c3f6d3 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sat, 14 Nov 2026 11:39:12 +0100 Subject: [PATCH] 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 --- betrieb/micro_start.ps1 | 56 +++++++++++++++++++++++++++++++++++++++++ betrieb/micro_stop.ps1 | 12 +++++++++ 2 files changed, 68 insertions(+) create mode 100644 betrieb/micro_start.ps1 create mode 100644 betrieb/micro_stop.ps1 diff --git a/betrieb/micro_start.ps1 b/betrieb/micro_start.ps1 new file mode 100644 index 00000000..8e067b2f --- /dev/null +++ b/betrieb/micro_start.ps1 @@ -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" diff --git a/betrieb/micro_stop.ps1 b/betrieb/micro_stop.ps1 new file mode 100644 index 00000000..e5bfc209 --- /dev/null +++ b/betrieb/micro_stop.ps1 @@ -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" }