38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
# Postflop-Laeufe: die 21 600 gelesenen hhDealer-Spots (neu_lesen_mit, 19 Leckkarten-Saetze) je Arm.
|
|
# python -B -X utf8 post.py <prozesse> <arm> [<arm> ...] -> nach/basis_<arm>/<satz>/antw.jsonl (wiederaufnehmbar)
|
|
import json, os, sys
|
|
sys.dont_write_bytecode = True
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
import arme as AR # noqa: E402
|
|
KN = AR.KN
|
|
QUELLE = os.path.join(AR.GS, "neu_lesen_mit")
|
|
|
|
|
|
def main():
|
|
pr, arme = int(sys.argv[1]), sys.argv[2:]
|
|
saetze = sorted(os.listdir(QUELLE))
|
|
for arm in arme:
|
|
env = AR.umgebung(arm)
|
|
for satz in saetze:
|
|
d = os.path.join(AR.GS, "nach", "basis_" + arm, satz)
|
|
aus = os.path.join(d, "antw.jsonl")
|
|
if os.path.exists(aus):
|
|
continue
|
|
os.makedirs(d, exist_ok=True)
|
|
ein = os.path.join(d, "spots.jsonl")
|
|
with open(ein, "w", encoding="utf-8", newline="\n") as f:
|
|
for z in open(os.path.join(QUELLE, satz, "spots.jsonl"), encoding="utf-8"):
|
|
if AR.ohne_profile(arm):
|
|
sp = json.loads(z)
|
|
for v in sp["req"]["villains"]:
|
|
v.pop("profile", None)
|
|
z = json.dumps(sp, separators=(",", ":")) + "\n"
|
|
f.write(z)
|
|
print("==", arm, satz, flush=True)
|
|
KN.lf.lauf_entscheiden(ein, aus, KN.BIN, env, prozesse=pr, block=30)
|
|
print("alle fertig", flush=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|