"""Construct and validate strip choices for the finite part of the Hanoi lemma.""" import sys import json from pathlib import Path def make(): width=500 choices=[[0]*(width+1) for _ in range(100)] choices[1]=[0]+[1]*width for w in range(2,width+1,2): choices[2][w]=2 for h in range(3,100): sides=[s for s in range(1,h+1) if h-s=3: lo=(5*h+1)//2 assert all(row[lo:lo+h]) print('Certified strip decompositions for all 97 cap base heights.') if __name__=='__main__': path=Path(__file__).with_name('hanoi-caps.json') if '--generate' in sys.argv: path.write_text(json.dumps(make(),separators=(',',':')),encoding='utf8') verify(json.loads(path.read_text(encoding='utf8')))