Spec schatten_frist: frist_rest_s nur mit MOTOR_NACH_BREIT=1 + MOTOR_NACH_BREIT_FRIST, nur Turn/River (Ersatzmotor, keine Tische)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""MOTOR_NACH_BREIT_FRIST (29.11.): Turn/River-Anfragen an den Motor tragen frist_rest_s (Frist des Laeufers minus Wartezeit
|
||||
minus FRIST_PUFFER), nur mit MOTOR_NACH_BREIT=1 und MOTOR_NACH_BREIT_FRIST; sonst geht die Anfrage unveraendert hinaus.
|
||||
Ersatz-Motor (kein echter Motor, keine Tische): er meldet im Grund, was an frist_rest_s ankam."""
|
||||
import json, os, sys, tempfile
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "entscheiden"))
|
||||
import schatten as S
|
||||
|
||||
d = tempfile.mkdtemp(prefix="schatten-frist-")
|
||||
ersatz = os.path.join(d, "motor.py")
|
||||
open(ersatz, "w").write(
|
||||
"import sys, json\n"
|
||||
"for z in sys.stdin:\n"
|
||||
" q = json.loads(z)\n"
|
||||
" print(json.dumps({'action': 'FOLD', 'size': None, 'confidence': 1.0, 'reason': json.dumps(q.get('frist_rest_s'))}), flush=True)\n")
|
||||
|
||||
|
||||
def frage(strasse):
|
||||
return json.dumps({"variant": "NLHE", "street": strasse, "legalActions": ["FOLD", "CALL"], "history": []})
|
||||
|
||||
|
||||
def rest(m, strasse, frist):
|
||||
r = m.zug(frage(strasse), frist=frist)
|
||||
assert r and r["action"] == "FOLD", r
|
||||
return json.loads(r["reason"])
|
||||
|
||||
|
||||
for k in ("MOTOR_NACH_BREIT", "MOTOR_NACH_BREIT_FRIST"):
|
||||
os.environ.pop(k, None)
|
||||
m = S.Schatten([sys.executable, ersatz], ziel=os.path.join(d, "log.jsonl"), spielt=True)
|
||||
assert rest(m, "TURN", 5) is None # Schalter aus: Anfrage unveraendert
|
||||
os.environ["MOTOR_NACH_BREIT_FRIST"] = "9"
|
||||
assert rest(m, "TURN", 5) is None # nur mit MOTOR_NACH_BREIT=1
|
||||
os.environ["MOTOR_NACH_BREIT"] = "1"
|
||||
x = rest(m, "TURN", 5)
|
||||
assert 4.0 <= x <= 5 - S.FRIST_PUFFER, x # Frist des Laeufers minus Warten minus Puffer
|
||||
x = rest(m, "RIVER", 3)
|
||||
assert 2.0 <= x <= 3 - S.FRIST_PUFFER, x
|
||||
assert rest(m, "FLOP", 5) is None # Flop/Preflop nie
|
||||
print("schatten_frist_spec: gruen")
|
||||
Reference in New Issue
Block a user