comparison nono.py @ 17:6c9e371b0325

doesn't break, what's there is good, but stuck part-way in 10a
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 25 Mar 2020 19:21:38 +0000
parents a7a10e40b344
children 6543fcbb8abd 68004ce55703
comparison
equal deleted inserted replaced
16:a7a10e40b344 17:6c9e371b0325
76 return 0 76 return 0
77 scratch=[0 if c.val is None else c.val for c in self] 77 scratch=[0 if c.val is None else c.val for c in self]
78 wins=0 78 wins=0
79 changed=0 79 changed=0
80 for k,runs in enumerate(self.allRuns): 80 for k,runs in enumerate(self.allRuns):
81 if (self.m.loop,self.cLet,pos,k)==(1,'R',7,5):
82 print(self.m)
81 dprint('=====pass %s.%s.%s.%s======'%(self.m.loop,self.cLet,pos,k)) 83 dprint('=====pass %s.%s.%s.%s======'%(self.m.loop,self.cLet,pos,k))
82 if self.onepass(self.margin0,self.marginN+1,scratch,runs.copy()): 84 if self.onepass(self.margin0,self.marginN+1,scratch,runs.copy()):
83 wins+=1 85 wins+=1
84 dprint(wins, scratch) 86 dprint(wins, scratch)
85 maybeSeq=None 87 maybeSeq=None
291 # run could fit here, so no go 293 # run could fit here, so no go
292 dprint('mx1') 294 dprint('mx1')
293 return False 295 return False
294 if g>0: 296 if g>0:
295 # Block a too-small gap 297 # Block a too-small gap
296 dprint('m2',i-g,i) 298 if rng.step==1:
297 for j in range(i+1-g,i+1): 299 # forward
298 self.newX(j,True) 300 dprint('m2f',i-g,i)
301 for j in range(i+1-g,i+1):
302 self.newX(j,True)
303 else:
304 # backward
305 dprint('m2b',i+g,i)
306 for j in range(i+g-1,i-1,-1):
307 self.newX(j,True)
299 return True 308 return True
300 309
301 def found0(self,i): 310 def found0(self,i):
302 dprint('found0 called on %s at %s'%(self,i)) 311 dprint('found0 called on %s at %s'%(self,i))
303 i=self.margin0 312 i=self.margin0