# HG changeset patch # User Henry S. Thompson # Date 1583956342 0 # Node ID 3276cf6ee6df418689ed940ccd7cdcddb7650df7 # Parent 13f600be3a1bec79b8a6acda84fa09baf984a54c vastly simplified onePass, printing rows working diff -r 13f600be3a1b -r 3276cf6ee6df nono.py --- a/nono.py Wed Mar 11 17:13:05 2020 +0000 +++ b/nono.py Wed Mar 11 19:52:22 2020 +0000 @@ -14,7 +14,7 @@ Red='' eRed='' -RedFmt=Red+'%s'+eRed +RedFmt=Red+'%s '+eRed def interleave(*args): for vals in zip(*args): @@ -28,8 +28,8 @@ self.margin0=0 # a run can start here, so if >0 then self[m0-1].val must be False self.marginN=n-1 # a run can end here, so if 0 iff n-1 is None or False - if i>0 and i0 and self[i-1].val is True: + # dprint('x1',i) + # return if (iBound-i)0: + # guaranteed by check above that we won't run over the far end c=self[i].val - dprint('top',i,c,inOne,rr) + if c is False: + dprint('x3',i) + return False if c is None: # we could add a blob here - dprint('c1') gapsFilled+=1 - rr-=1 - if inOne<0: - dprint('c1a',i) - # starts here - inOne=i - # fall through to check for completion - else: - dprint('c2') - # c is a bool - if inOne<0: - dprint('c2a') - if c: - dprint('c2a1') - # a *, we can possible start something here - inOne=i - rr-=1 - # fall through to check for completion - else: - dprint('c2a2') - # an x, can't start here, just move along - i+=1 - continue - else: - dprint('c2b') - if c: - dprint('c2b1') - # a blob, extend or complete a partial - rr-=1 - # fall through to check for completion - else: - # abandon a partial - dprint('c2b2') - inOne=-1 - rr=r - i+=1 - continue - if rr>0: - dprint('c3') - # we're not done, carry on - i+=1 - continue - # Maybe a win? - # look ahead, can we stop here? - # NB _self_.n - if i+11: