Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
098865eeed |
@@ -1,30 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regelbuch, Abfrage: die Vorflop-Mischung des LIVE-Motors je Lage x 169 Klassen.
|
||||
"""Regelbuch, Abfrage: die Vorflop-Mischung der LIVE-Strategie je Lage x 169 Klassen.
|
||||
|
||||
Motor wie entscheiden/schatten.py (dienst sechs100, sechs100-v2.bin, genau, hu-Baeume), als Kopie
|
||||
pokerbench-regelbuch-motor.exe. Gezaehlt wird die genannte Mischung ("motor PREFLOP (...): fold x%, call y%, 0.60x z%");
|
||||
wo der Motor nicht greift (Baum passt nicht, Live-Regel davor), zaehlt die gegebene Aktion - so spielt es live.
|
||||
Live heisst: dieselbe Motor-Exe und dieselben Schalter wie der Laeufer (betrieb/kern_schalter.txt im Live-Baum, letzte
|
||||
Zeile gewinnt; Exe aus MOTOR_SCHATTEN, Blueprint je MOTOR_BRETTQ wie entscheiden/schatten.py). Mit
|
||||
MOTOR_VORFLOP_FLOP_QUELLE=sharingan spielt vor dem Flop SHARINGAN (Hybrid), ausser an den Knoten, die der Motor behaelt
|
||||
(Rake-Tafel, Baum passt nicht): welche Seite spielt, sagt der Grund der Antwort. Gezaehlt wird die ganze Verteilung:
|
||||
Motor: die genannte Mischung ("motor PREFLOP (...): fold x%, call y%, 0.60x z%")
|
||||
SHARINGAN: seine ganze Verteilung ueber op probs des Hybrid-Dienstes (eigene Instanz, eigener Port)
|
||||
sonst: die gegebene Aktion (Live-Regel davor) - so spielt es live.
|
||||
|
||||
erste: die gekauften hhDealer-Lagen (lagen.json: 30 Erstentscheidungs-Knoten x 60 Lagen, echte Historie und Stacks)
|
||||
zweite: gestellte Lagen der zweiten Entscheidung (gegen 3-Bet, gegen 4-Bet, gegen All-in), 100/50/25 bb
|
||||
|
||||
python -I -X utf8 messung/regelbuch/motor_tabelle.py erste|zweite [--prozesse 8] [--neu]
|
||||
Ausgabe: C:/Users/marcm/pokerfreak-vorflop/regelbuch/motor-<art>.jsonl, je Zeile
|
||||
[lage-index, knoten, [{"mix": {option: anteil}, "bb": raise-auf in bb oder null}, ... 169]]
|
||||
fortsetzbar (fertige Lagen bleiben; --neu faengt neu an). BelowNormal.
|
||||
[lage-index, knoten, [{"mix": {option: anteil}, "bb": raise-auf in bb oder null, "q": motor|sharingan|fest}, ... 169]]
|
||||
und motor-<art>.stand.json (Exe, Schalter, Zeit). Fortsetzbar (fertige Lagen bleiben; --neu legt die alte Datei beiseite).
|
||||
"""
|
||||
import json, os, shutil, subprocess, sys, threading
|
||||
import datetime, hashlib, json, os, shutil, socket, subprocess, sys, threading, time
|
||||
sys.dont_write_bytecode = True
|
||||
R0 = "D:/Projects/pokerfreak"
|
||||
sys.path.insert(0, R0 + "/messung/vorflop/eintritt")
|
||||
import kern_lauf as K # noqa: E402
|
||||
|
||||
LIVE = R0 + "/.claude/worktrees/engine-lecks-angreifen-de7b88"
|
||||
AUSW = "C:/Users/marcm/pokerfreak-vorflop/regelbuch"
|
||||
EXE = os.path.join(AUSW, "pokerbench-regelbuch-motor.exe")
|
||||
QUELLE = R0 + "/entscheiden/motor/target/pokerbench-motor-schatten.exe"
|
||||
D = R0 + "/daten/grundstrategie/motor"
|
||||
ARGS = ["dienst", "sechs100", D, "2000-600-400", "200", D + "/sechs100-v2.bin", "genau",
|
||||
f"hu={D}/hu100-v1.bin,{D}/hu200-v2.bin"]
|
||||
HYB_PORT = 47139 # eigene SHARINGAN-Instanz, nie die des Laeufers (47125)
|
||||
OHNE_FENSTER = 0x08000000 | 0x4000 # CREATE_NO_WINDOW | BELOW_NORMAL
|
||||
N = ["SB", "BB", "UTG", "HJ", "CO", "BTN"]
|
||||
REIHE = [2, 3, 4, 5, 0, 1]
|
||||
|
||||
@@ -33,6 +36,27 @@ def aus_pfad(art):
|
||||
return os.path.join(AUSW, f"motor-{art}.jsonl")
|
||||
|
||||
|
||||
def live_schalter():
|
||||
"""Die wirksamen Schalter des Laeufers: kern_schalter.txt des Live-Baums, letzte Zeile gewinnt."""
|
||||
d = {}
|
||||
for z in open(os.path.join(LIVE, "betrieb", "kern_schalter.txt"), encoding="utf-8"):
|
||||
z = z.strip()
|
||||
if z and not z.startswith("#") and "=" in z:
|
||||
k, v = z.split("=", 1)
|
||||
d[k.strip()] = v.strip()
|
||||
return d
|
||||
|
||||
|
||||
def motor_aufruf(s):
|
||||
"""Exe und Argumente wie entscheiden/schatten.py starte()."""
|
||||
w = s.get("MOTOR_SCHATTEN", R0)
|
||||
d = os.path.join(w, "daten", "grundstrategie", "motor")
|
||||
q = s.get("MOTOR_BRETTQ") == "1"
|
||||
g = [os.path.join(d, x) for x in ("sechs100-q.bin" if q else "sechs100-v2.bin", "hu100-v1.bin", "hu200-v2.bin")]
|
||||
return (os.path.join(w, "entscheiden", "motor", "target", "pokerbench-motor-schatten.exe"),
|
||||
["dienst", "sechs100", d, "2000-600-400", "200q400" if q else "200", g[0], "genau", f"hu={g[1]},{g[2]}"])
|
||||
|
||||
|
||||
def mischung(reason):
|
||||
if not reason.startswith("motor PREFLOP ("):
|
||||
return None
|
||||
@@ -43,6 +67,101 @@ def mischung(reason):
|
||||
return m if sum(m.values()) > .9 else None
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- SHARINGAN (Hybrid-Dienst)
|
||||
|
||||
def _karte(k):
|
||||
r = ["TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN", "JACK", "QUEEN", "KING", "ACE"]
|
||||
return "23456789TJQKA"[r.index(k["rank"])] + "cdhs"[["CLUBS", "DIAMONDS", "HEARTS", "SPADES"].index(k["suit"])]
|
||||
|
||||
|
||||
def sein_req(q, phm):
|
||||
"""Vertrag -> seine ActRequest wie entscheiden/motor/src/sharingan.rs Kontext::aus (nur vor dem Flop, 6 Plaetze,
|
||||
Sitz 1 = SB, BB = 100 Chips)."""
|
||||
bb = q["bigBlind"]
|
||||
c = lambda x: int(round(x / bb * 100))
|
||||
drin, hist = [0] * 6, []
|
||||
for h in q["history"]:
|
||||
s, x = h["seat"] - 1, h["action"]
|
||||
e = {"seat": s, "type": {"POST_SB": "post_sb", "POST_BB": "post_bb"}.get(x, x.lower())}
|
||||
if x in ("POST_SB", "POST_BB", "RAISE", "BET", "ALL_IN", "CALL") and h.get("amount") is not None:
|
||||
drin[s] = c(h["amount"])
|
||||
if x != "CALL":
|
||||
e["to"] = drin[s]
|
||||
hist.append(e)
|
||||
held = q["heroSeat"] - 1
|
||||
stand = {held: c(q["heroStack"])} | {v["seat"] - 1: c(v["stack"]) for v in q["villains"]}
|
||||
start = [stand[s] + drin[s] for s in range(6)]
|
||||
loch = [_karte(k) for k in q["heroCards"]]
|
||||
r = {"small_blind": 50, "big_blind": 100, "button_seat": 5, "hero_seat": held, "hole_cards": loch, "board": [],
|
||||
"players": [{"seat": s, "stack_start": start[s]} for s in range(6)], "history": hist,
|
||||
"options": {"seed": q.get("seed", 1), "include_probs": False}}
|
||||
if phm: # je Hand feste Uebersetzung wie live (FNV-1a ueber Rusts Debug-Text)
|
||||
f = 0xcbf29ce484222325
|
||||
for b in ("[%s]%s0" % (", ".join('"%s"' % x for x in loch), "[" + ", ".join(map(str, start)) + "]")).encode():
|
||||
f = ((f ^ b) * 0x100000001b3) & 0xFFFFFFFFFFFFFFFF
|
||||
r["options"]["track_seed"] = f >> 1
|
||||
return r
|
||||
|
||||
|
||||
def hyb_frage(leitung, msg):
|
||||
lesen, schreiben = leitung
|
||||
schreiben.sendall((json.dumps(msg) + "\n").encode())
|
||||
return json.loads(lesen.readline())
|
||||
|
||||
|
||||
def hyb_verbinden():
|
||||
s = socket.create_connection(("127.0.0.1", HYB_PORT), timeout=300)
|
||||
return s.makefile("r", encoding="utf-8"), s
|
||||
|
||||
|
||||
def hyb_starten(s):
|
||||
"""Eigene Instanz des Hybrid-Dienstes unter erkennbarem Namen; wartet, bis sie antwortet."""
|
||||
quelle = s["MOTOR_SHARINGAN_EXE"]
|
||||
exe = os.path.join(os.path.dirname(quelle), "pokerbench-regelbuch-sharingan.exe")
|
||||
if not os.path.exists(exe) or os.path.getmtime(exe) < os.path.getmtime(quelle):
|
||||
shutil.copy2(quelle, exe)
|
||||
F = "D:/pokerfreak-fremd/sharingan"
|
||||
args = s.get("MOTOR_SHARINGAN_ARGS", f"--blueprint {F}/weights/B-local-2e10.plcp --buckets {F}/data/buckets-200 --sizing local")
|
||||
env = dict(os.environ, HYBRID_FAEDEN="8", HYBRID_LEERLAUF_S="120")
|
||||
if s.get("MOTOR_HYB_UEBERSETZUNG") == "phm":
|
||||
env["HYBRID_UEBERSETZUNG"] = "phm"
|
||||
p = subprocess.Popen([exe] + args.split() + ["--port", str(HYB_PORT)], env=env, stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, creationflags=OHNE_FENSTER)
|
||||
t0 = time.time()
|
||||
while time.time() - t0 < 900:
|
||||
try:
|
||||
l = hyb_verbinden()
|
||||
if hyb_frage(l, {"op": "ping"}).get("ok"):
|
||||
l[1].close()
|
||||
return p
|
||||
except OSError:
|
||||
time.sleep(2)
|
||||
p.kill()
|
||||
raise SystemExit("SHARINGAN-Dienst antwortet nicht")
|
||||
|
||||
|
||||
def sharingan_mix(leitung, q, phm):
|
||||
r = hyb_frage(leitung, {"op": "probs", "req": sein_req(q, phm)})
|
||||
if not r.get("ok") or r.get("source") == "fallback" or not r.get("probs"):
|
||||
return None, None
|
||||
m, bb, w = {}, [], 0.0
|
||||
for x in r["probs"]:
|
||||
t, p = x["type"], float(x["p"])
|
||||
if p <= 0:
|
||||
continue
|
||||
name = "fold" if t == "fold" else "call" if t in ("call", "check") else "raise"
|
||||
m[name] = m.get(name, 0.0) + p
|
||||
if name == "raise" and x.get("to") is not None:
|
||||
bb.append((x["to"] / 100.0, p))
|
||||
ges = sum(m.values())
|
||||
if ges < .9:
|
||||
return None, None
|
||||
hoch = max(bb, key=lambda y: y[1])[0] if bb else None # haeufigste Groesse
|
||||
return {k: v / ges for k, v in m.items()}, hoch
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- Lagen
|
||||
|
||||
def _lage(akt, pos, st=100):
|
||||
return {"akt": akt, "pos": pos, "stack": [st] * 6}
|
||||
|
||||
@@ -73,13 +192,31 @@ def lagen(art):
|
||||
return zweite_lagen()
|
||||
|
||||
|
||||
def _md5(p):
|
||||
h = hashlib.md5()
|
||||
with open(p, "rb") as f:
|
||||
for b in iter(lambda: f.read(1 << 20), b""):
|
||||
h.update(b)
|
||||
return h.hexdigest()
|
||||
|
||||
|
||||
def lauf(art, prozesse, neu=False):
|
||||
if not os.path.exists(EXE) or os.path.getmtime(EXE) < os.path.getmtime(QUELLE):
|
||||
shutil.copy2(QUELLE, EXE) # der Live-Motor, unter erkennbarem Namen (CLAUDE.md)
|
||||
s = live_schalter()
|
||||
quelle, args = motor_aufruf(s)
|
||||
if not os.path.exists(EXE) or _md5(EXE) != _md5(quelle):
|
||||
shutil.copy2(quelle, EXE) # die Live-Exe, unter erkennbarem Namen (CLAUDE.md)
|
||||
hybrid = s.get("MOTOR_VORFLOP_FLOP_QUELLE") == "sharingan"
|
||||
phm = s.get("MOTOR_HYB_UEBERSETZUNG") == "phm"
|
||||
env = dict(os.environ, **s)
|
||||
env.update(MOTOR_SHARINGAN_ADRESSE=f"127.0.0.1:{HYB_PORT}", MOTOR_SHARINGAN_FRIST_MS="60000")
|
||||
dienst = hyb_starten(s) if hybrid else None
|
||||
L = lagen(art)
|
||||
aus = aus_pfad(art)
|
||||
if neu and os.path.exists(aus):
|
||||
os.remove(aus)
|
||||
if neu and os.path.exists(aus): # nie leeren: beiseite legen (CLAUDE.md, Daten nie ueberschreiben)
|
||||
os.replace(aus, aus + ".vor-" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
|
||||
json.dump({"zeit": datetime.datetime.now().isoformat(timespec="seconds"), "exe_md5": _md5(EXE), "args": args,
|
||||
"schalter": {k: v for k, v in s.items() if k.startswith("MOTOR_")}, "hybrid": hybrid},
|
||||
open(aus_pfad(art).replace(".jsonl", ".stand.json"), "w", encoding="utf-8"), ensure_ascii=False, indent=1)
|
||||
fertig = set()
|
||||
if os.path.exists(aus):
|
||||
for z in open(aus, encoding="utf-8"):
|
||||
@@ -90,10 +227,12 @@ def lauf(art, prozesse, neu=False):
|
||||
it = iter([(i, x) for i, x in enumerate(L) if i not in fertig])
|
||||
sp = threading.Lock()
|
||||
f = open(aus, "a", encoding="utf-8")
|
||||
zaehl = {"motor": 0, "sharingan": 0, "fest": 0}
|
||||
|
||||
def arb():
|
||||
p = subprocess.Popen([EXE] + ARGS, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
|
||||
text=True, encoding="utf-8", creationflags=0x4000)
|
||||
p = subprocess.Popen([EXE] + args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
|
||||
text=True, encoding="utf-8", env=env, creationflags=OHNE_FENSTER)
|
||||
leitung = hyb_verbinden() if hybrid else None
|
||||
while True:
|
||||
with sp:
|
||||
x = next(it, None)
|
||||
@@ -107,17 +246,32 @@ def lauf(art, prozesse, neu=False):
|
||||
p.stdin.write(json.dumps(q) + "\n")
|
||||
p.stdin.flush()
|
||||
a = json.loads(p.stdout.readline())
|
||||
mix = mischung(a.get("reason", "")) or {"?" + str(a.get("action")): 1.0}
|
||||
grund = a.get("reason", "")
|
||||
agg = str(a.get("action")).upper() in ("RAISE", "BET", "ALL_IN") and a.get("size")
|
||||
o.append({"mix": mix, "bb": round(float(a["size"]) / K.BB, 2) if agg else None})
|
||||
bb = round(float(a["size"]) / K.BB, 2) if agg else None
|
||||
mix, wer = mischung(grund), "motor"
|
||||
if mix is None and grund.startswith("sharingan") and leitung:
|
||||
mix, hoch = sharingan_mix(leitung, q, phm)
|
||||
wer = "sharingan"
|
||||
if hoch and mix and mix.get("raise", 0) > 0:
|
||||
bb = round(hoch, 2)
|
||||
if mix is None:
|
||||
mix, wer = {"?" + str(a.get("action")): 1.0}, "fest"
|
||||
o.append({"mix": mix, "bb": bb, "q": wer})
|
||||
with sp:
|
||||
for e in o:
|
||||
zaehl[e["q"]] += 1
|
||||
f.write(json.dumps([i, name, o]) + "\n")
|
||||
f.flush()
|
||||
ts = [threading.Thread(target=arb) for _ in range(prozesse)]
|
||||
[t.start() for t in ts]
|
||||
[t.join() for t in ts]
|
||||
f.close()
|
||||
print(art, "fertig:", sum(1 for _ in open(aus, encoding="utf-8")), "von", len(L), "Lagen", flush=True)
|
||||
try:
|
||||
ts = [threading.Thread(target=arb) for _ in range(prozesse)]
|
||||
[t.start() for t in ts]
|
||||
[t.join() for t in ts]
|
||||
finally:
|
||||
f.close()
|
||||
if dienst:
|
||||
dienst.kill()
|
||||
print(art, "fertig:", sum(1 for _ in open(aus, encoding="utf-8")), "von", len(L), "Lagen; Antworten", zaehl, flush=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -51,12 +51,13 @@ def motor(art):
|
||||
for z in open(MT.aus_pfad(art), encoding="utf-8"):
|
||||
i, name, o = json.loads(z)
|
||||
m = np.zeros((NK, 3))
|
||||
e = aus.setdefault(name, {"m": 0, "n": 0, "bb": []})
|
||||
e = aus.setdefault(name, {"m": 0, "n": 0, "bb": [], "wer": {}})
|
||||
for j, x in enumerate(o):
|
||||
for k, q in x["mix"].items():
|
||||
m[j, spalte(k)] += q
|
||||
if x["bb"]:
|
||||
e["bb"].append((x["bb"], PC[j]))
|
||||
e["wer"][x.get("q", "motor")] = e["wer"].get(x.get("q", "motor"), 0.0) + PC[j]
|
||||
m /= np.maximum(m.sum(1, keepdims=True), 1e-12)
|
||||
e["m"] = e["m"] + m
|
||||
e["n"] += 1
|
||||
@@ -127,8 +128,10 @@ def groesse(bb, stack=100):
|
||||
def zelle(e, ordnung, kanten, mit_fold=True, w=None):
|
||||
ab, a, b = schwellen(e["m"], ordnung, kanten[1:-1], mit_fold, w)
|
||||
ra, pb = kanten.index(a), kanten.index(b)
|
||||
wer = e.get("wer") or {}
|
||||
return {"raise_bis": ra or None, "passiv_bis": pb if pb > ra and mit_fold else None,
|
||||
"check_rest": not mit_fold, "groesse": groesse(e["bb"]) if ra else None, "anders": round(ab, 4)}
|
||||
"check_rest": not mit_fold, "groesse": groesse(e["bb"]) if ra else None, "anders": round(ab, 4),
|
||||
"wer": max(wer, key=wer.get) if wer else "motor"}
|
||||
|
||||
|
||||
def reichweite(erste, name):
|
||||
@@ -192,7 +195,11 @@ def tafeln(erste, zweite, ordnung, kanten, besuche):
|
||||
continue
|
||||
w = sum((reichweite(erste, f"RFI {held}") if tiefe != "4B"
|
||||
else reichweite(erste, f"vs Open {held} v {n.split(' v ')[1].split()[0]}")) for n in ns) / len(ns)
|
||||
z[f"{tiefe}|{held}"] = zelle({"m": sum(zweite[n]["m"] for n in ns) / len(ns), "bb": []}, ordnung, kanten, w=w)
|
||||
wer = {}
|
||||
for n in ns:
|
||||
for k, v in zweite[n].get("wer", {}).items():
|
||||
wer[k] = wer.get(k, 0.0) + v
|
||||
z[f"{tiefe}|{held}"] = zelle({"m": sum(zweite[n]["m"] for n in ns) / len(ns), "bb": [], "wer": wer}, ordnung, kanten, w=w)
|
||||
tafel("Gegen ein All-in", "C = Call · über alle Positionen des Gegners gemittelt", ["100", "50", "25", "4B"],
|
||||
[p for p in POS if any(k.endswith("|" + p) for k in z)], z,
|
||||
{"100": "nach deinem Open, 100 bb", "50": "nach deinem Open, 50 bb", "25": "nach deinem Open, 25 bb",
|
||||
@@ -262,11 +269,27 @@ def bauen(a):
|
||||
gesamt = sum(besuche.get(n, 0) for n in erste)
|
||||
anders = sum(besuche.get(n, 0) * schwellen(e["m"], ordnung, kanten[1:-1], n not in OHNE_FOLD)[0]
|
||||
for n, e in erste.items()) / max(gesamt, 1e-9)
|
||||
st = {}
|
||||
try:
|
||||
st = json.load(open(MT.aus_pfad("erste").replace(".jsonl", ".stand.json"), encoding="utf-8"))
|
||||
except (OSError, ValueError):
|
||||
pass
|
||||
anteil = {}
|
||||
for M in (erste, zweite):
|
||||
for n, e in M.items():
|
||||
for k, v in e.get("wer", {}).items():
|
||||
anteil[k] = anteil.get(k, 0.0) + v * besuche.get(n, 0.05)
|
||||
ges_a = sum(anteil.values()) or 1.0
|
||||
wer_text = ", ".join("%s %.0f %%" % ({"motor": "eigener Motor", "sharingan": "SHARINGAN", "fest": "feste Regel"}[k],
|
||||
100 * v / ges_a) for k, v in sorted(anteil.items(), key=lambda x: -x[1]))
|
||||
buch = {"stand": datetime.datetime.now().strftime("%d.%m.%Y %H:%M"),
|
||||
"quelle": "Live-Motor (sechs100-v2, genau): Erstentscheidungen auf %d gekauften hhDealer-Lagen, zweite "
|
||||
"Entscheidungen auf %d gestellten Lagen" % (
|
||||
"quelle": "Live-Strategie wie der Läufer (Exe %s, %s, Schalter aus kern_schalter.txt, abgefragt %s): %s. "
|
||||
"Erstentscheidungen auf %d gekauften hhDealer-Lagen, zweite Entscheidungen auf %d gestellten Lagen" % (
|
||||
st.get("exe_md5", "?")[:8], os.path.basename(st.get("args", ["", "", "", "", "", "?"])[5]),
|
||||
st.get("zeit", "?").replace("T", " "), wer_text,
|
||||
sum(1 for _ in open(MT.aus_pfad("erste"), encoding="utf-8")),
|
||||
sum(1 for _ in open(MT.aus_pfad("zweite"), encoding="utf-8")) if zweite else 0),
|
||||
"wer": {k: v / ges_a for k, v in anteil.items()},
|
||||
"gruppen": liste, "gruppe_von": {k: i + 1 for i, g in enumerate(liste) for k in g},
|
||||
"anders_erste": anders, "kosten": kosten, "tafeln": tafeln(erste, zweite, ordnung, kanten, besuche)}
|
||||
json.dump(buch, open(os.path.join(HIER, "vorflop-regelbuch.json"), "w", encoding="utf-8"), ensure_ascii=False,
|
||||
|
||||
@@ -77,7 +77,8 @@ def tafel(t):
|
||||
if not any(zellen):
|
||||
continue
|
||||
o.append("<tr><th>%s</th>" % html.escape(t["zeilen_namen"].get(zl, zl or "du")))
|
||||
o += ["<td>%s</td>" % _zelltext(z) if z else '<td class="leer">–</td>' for z in zellen]
|
||||
o += [('<td class="sh">%s</td>' if z.get("wer") == "sharingan" else "<td>%s</td>") % _zelltext(z) if z
|
||||
else '<td class="leer">–</td>' for z in zellen]
|
||||
o.append("</tr>")
|
||||
o.append("</table></section>")
|
||||
return "".join(o)
|
||||
@@ -106,6 +107,7 @@ h3 { font-size: 10.5pt; margin: 0 0 .5mm; } p { margin: 0 0 2mm; }
|
||||
.regeln small { display: block; font-size: 7pt; color: #666; }
|
||||
.r { color: #9c1f1f; font-weight: 700; } .c { color: #1d5e2e; font-weight: 700; } .f { color: #777; }
|
||||
.leer { color: #bbb; }
|
||||
.regeln td.sh { background: #fbf6ea; } .zeichen { display: inline-block; width: 9mm; height: 3.5mm; background: #fbf6ea; border: 1px solid #c9d3e0; vertical-align: middle; }
|
||||
.fuss { font-size: 7.5pt; color: #666; border-top: 1px solid #ddd; padding-top: 1.5mm; margin-top: 2mm; }
|
||||
@media screen { body { padding: 8mm 0; } .seite { border-bottom: 1px dashed #bbb; padding-bottom: 6mm; margin-bottom: 6mm; } }
|
||||
"""
|
||||
@@ -125,7 +127,8 @@ def schreiben(buch, pfad):
|
||||
% len(buch["gruppen"]),
|
||||
"<h2>Die Gruppen</h2><p class='hilfe'>oben rechts suited (s), unten links offsuit (o), Diagonale Paare</p>",
|
||||
raster(buch), legende(buch), "</div>",
|
||||
'<div class="kopf"><h1>Lagen</h1><span class="stand">Größe = Raise auf (bb), wie der Motor</span></div>']
|
||||
'<div class="kopf"><h1>Lagen</h1><span class="stand">Größe = Raise auf (bb) · <span class="zeichen"></span> '
|
||||
'spielt live SHARINGAN, weiß der eigene Motor</span></div>']
|
||||
o += [tafel(t) for t in buch["tafeln"]]
|
||||
o.append('<p class="fuss">%s · %.1f %% der Erstentscheidungen anders als der Motor · %s</p></body></html>' % (
|
||||
html.escape(buch["quelle"]), 100 * buch["anders_erste"], preis))
|
||||
|
||||
Reference in New Issue
Block a user