"""Bounded Friday Will v4 plan for the 115+ postgame party from installed roster and public battle UI.""" from play import * import difflib,re began=json.loads((ROOT/'work/active-trainer-music.json').read_text())['start_epoch'] actor=sys.argv[1] if len(sys.argv)>1 else 'Amoonguss' names=['Swampert','Sceptile','Charizard','Gardevoir'] matchups={'Swampert':('Amoonguss',2),'Sceptile':('Zapdos',0),'Charizard':('Zapdos',1),'Gardevoir':('Mawile',1)} if os.environ.get('REBORN_WILL_GARDEVOIR_ZAPDOS')=='1': # Installed Will v4 Gardevoir85: Hyper Voice/Psyshock/Focus Blast/Calm Mind. # Reviewed Zapdos120 has Discharge1 and Roost2; avoids a PC trip for Mawile. matchups['Gardevoir']=('Zapdos',1) mega=False def run(s,*args): before=(ROOT/'recordings/actions.jsonl').stat().st_mtime_ns subprocess.run([sys.executable,str(ROOT/'scripts'/(s+'.py')),*map(str,args)],check=True) if s=='battle_batch' and (ROOT/'recordings/actions.jsonl').stat().st_mtime_ns==before: raise SystemExit('Battle helper requested review without choosing an action; do not repeat unchanged state') def named(t): hits=[n for n in names if any(difflib.SequenceMatcher(None,n.lower(),w.lower()).ratio()>=.8 for w in re.findall('[A-Za-z]+',t))] assert len(hits)==1,('Opponent ambiguity',t,hits) return hits[0] for phase in range(16): rows=snap();t=' '.join(v['text'] for v in rows);low=t.lower();print('WILL PHASE',phase,actor,t,flush=True) if re.search(r'de.?feated|for winning',low):print('WILL VICTORY',flush=True);break if 'change pok' in low or 'switch your' in low: from recent_incoming import recent_incoming foe=None for line in (ROOT/'recordings/screens.jsonl').read_text().splitlines()[::-1]: v=json.loads(line) if v['epoch']