"""Execute the reviewed three-turn opening, stopping on any unexpected prompt.""" from play import * def run(s,*a):subprocess.run([sys.executable,str(ROOT/'scripts'/(s+'.py')),*map(str,a)],check=True) def need(*words): t=read().lower() if not all(w.lower() in t for w in words):raise SystemExit('Opening checkpoint mismatch: '+t) need('fight','drapion','reuniclus','malamar') run('battle_batch','Drapion',0,'--foes','reuniclus,malamar','--watch','--turns',2,'--policy',str(ROOT/'work/g8-opening-policy.json')) run('battle_batch','Drapion',0,'--foes','gallade,malamar','--watch','--turns',0) need('fight','drapion','gallade','malamar') run('battle_move',3,3,'--watch') need('fight','cofagrigus') run('battle_switch','Klinklang') run('battle_batch','Drapion',0,'--foes','gallade,malamar','--watch','--turns',0) t=read().lower() if not ('cancel' in t and t.count('hp')>=5):raise SystemExit('Expected free replacement') run('party_pick','Ampharos') run('battle_batch','Ampharos',3,'--foes','gallade,malamar','--watch','--turns',0) need('fight','ampharos','gallade','malamar') run('battle_move',3,3,'--watch') need('fight','klinklang') run('battle_move',0,1,'--watch') run('battle_batch','Ampharos',2,'--foes','metagross,slowking','--watch','--turns',0) print('OPENING COMPLETE — REVIEW FOURTH TURN',flush=True)