"""Plan the installed rotating Devon pads, then execute verified native inputs. Reads public map events. Only navigation notes are written; never game data. """ from nav import ROOT,route,act,read,snap from locate import locate import argparse,json,subprocess,heapq,copy,re from devon_terrain import terrain_conveyors p=argparse.ArgumentParser();p.add_argument('--go',action='store_true');p.add_argument('--from',dest='origin',nargs=2,type=int,default=[4,4]);p.add_argument('--goal',nargs=2,type=int,default=[15,3]);p.add_argument('--map',dest='mid',type=int,choices=[630,629,631],default=630);p.add_argument('--planning-overrides',type=json.loads);p.add_argument('--monitor',type=int,help='Route to an accessible side of a source-inspected monitor');p.add_argument('--activate',action='store_true');p.add_argument('--allow-damage',action='store_true',help='Reviewed native electrical damage, with a large routing penalty; heal normally before battles');p.add_argument('--forced-per-check',type=int,choices=[1,2,3],default=3,help='Queue up to three inspected forced steps, retaining their waits, before one coordinate proof');a=p.parse_args() assert not(a.go and a.planning_overrides) assert not a.activate or(a.go and a.monitor) switch_ids={630:[750,751,752],629:[757,758,759,760],631:list(range(769,776))}[a.mid] switch_base=switch_ids[0] path=ROOT/'notes/navigation-state.json';state=json.loads(path.read_text()) initial_switches=state.get('switches',{})|((a.planning_overrides or {}).get('switches',{})) color=(a.planning_overrides or {}).get('variables',{}).get('342',state['variables']['342']);mask=sum(1<=a.forced_per_check:break seq=[] for z in chunk: seq.append(z['key']+':.12') if z['key']=='a':seq.append('wait:.3') if z['forced']:seq.append('wait:'+str(min(6,max(2,z['forced']*.22)))) act(*seq,'wait:.5');t=read();print(t,flush=True) assert not re.search(r'\bhp\b|\bfight\b',t,re.I) expected=chunk[-1]['to'];actual=locate(a.mid) assert actual==(a.mid,*expected[:2]),f'Spinner mismatch {actual}, expected{expected}' v=json.loads(path.read_text());v['variables']['342']=expected[2] v.setdefault('switches',{}).update({str(sw):bool(expected[3]&(1<