app
AI Flow
Public Made by Adomby adom
Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board.
main
John Lauer
Publish 0.1.26
0b71841
import importlib.util,pathlib,tempfile,json
p=pathlib.Path(__file__).with_name('silkscreen-layout.py');s=importlib.util.spec_from_file_location('layout',p);m=importlib.util.module_from_spec(s);s.loader.exec_module(m)
spec=dict(bounds=[0,0,10,10],obstacles=[dict(box=[0,0,2,2])],labels=[dict(id='C1',anchor=[4,4],candidates=[dict(font=.5,position=[1,1],box=[.5,.5,1.5,1.5]),dict(font=.5,position=[4,4],box=[3,3,5,5])]),dict(id='C2',anchor=[1,1],candidates=[])],solver='milp')
with tempfile.TemporaryDirectory() as td:
m.EVENT_FILE=str(pathlib.Path(td)/'events.jsonl');m.EVENT_ID='test';r=m.solve(spec);assert r['unresolved']==['C2'];events=[json.loads(l) for l in pathlib.Path(m.EVENT_FILE).read_text().splitlines()];assert any(e.get('reason')=='intersects a reserved obstacle' for e in events);assert any(e.get('reason','').startswith('clears') for e in events);assert all(e['solveId']=='test' for e in events);assert r['nativeVerified'] is False
print('PASS: real rejection/feasible events, solve identity, unresolved MILP result and native-review boundary')