Files
pokerfreak/messung/basis/teile.py
T

56 lines
2.6 KiB
Python

# Profil-Zerlegung: jeder Teil des Gegnerprofils allein aus gegen Live, auf den Live-Spots (teile_spots.py).
# Kern = pokerbench-basis-profilteile.exe (Live 19d8cfeb + Schalter PROFIL_OHNE, aus = bitgleich; Identitaet: Arm ident
# mit dem Live-Kern auf 100 Spots je Satz). Schalter wie live (eingefroren), dazu der Teil.
# python -B -X utf8 teile.py <prozesse> <arm> [...] -> nach/teile_<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
BIN_T = os.path.join(AR.GS, "bin", "pokerbench-basis-profilteile.exe")
BIN_L = os.path.join(AR.GS, "bin", "pokerbench-basis-live.exe")
# Arm -> (Spot-Quelle, Zusatz-Umgebung, Schalter heraus, Kern, Stichprobe je Satz)
ARME = {
"live": ("teile_live", {}, [], BIN_T, 0),
"ident": ("teile_live", {}, [], BIN_L, 100),
"vw": ("teile_ohne_vw", {}, [], BIN_T, 0), # VORWISSEN aus
"fold": ("teile_live", {"PROFIL_OHNE": "foldToBet,foldToCbet"}, [], BIN_T, 0),
"aggr": ("teile_live", {"PROFIL_OHNE": "aggression,aggressionActions"}, [], BIN_T, 0),
"vpip": ("teile_live", {"PROFIL_OHNE": "vpip,pfr"}, [], BIN_T, 0),
"rest": ("teile_live", {"PROFIL_OHNE": "threeBet,foldToThreeBet,steal,checkRaise,cbet"}, [], BIN_T, 0),
"schalter": ("teile_live", {}, ["STATION_POSTFLOP", "PAAR_RAISE"], BIN_T, 0),
}
RIVER = ["river_vsbet", "reakt_river", "reakt_river_3b", "river_barrel", "river_barrel3", "river_erst", "river_lead"]
SAETZE = RIVER
def main():
global SAETZE
pr, arme = int(sys.argv[1]), sys.argv[2:]
if arme[0] == "--rest": # Flop/Turn-Saetze nach den River-Saetzen
arme = arme[1:]
SAETZE = [s for s in sorted(os.listdir(os.path.join(AR.GS, "teile_live"))) if s not in RIVER]
for arm in arme:
quelle, zusatz, heraus, binr, n = ARME[arm]
env = AR.umgebung("live")
for k in heraus:
env.pop(k)
env.update(zusatz)
for satz in SAETZE:
d = os.path.join(AR.GS, "nach", "teile_" + 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")
open(ein, "w", encoding="utf-8", newline="\n").writelines(KN.stichprobe(quelle + "/" + satz, n))
print("==", arm, satz, flush=True)
KN.lf.lauf_entscheiden(ein, aus, binr, env, prozesse=pr, block=30)
print("alle fertig", flush=True)
if __name__ == "__main__":
main()