Changeset 102
- Timestamp:
- 03/20/04 23:55:39 (5 years ago)
- Location:
- 06/devel
- Files:
-
- 3 modified
-
algosPY.py (modified) (4 diffs)
-
kombilo.py (modified) (5 diffs)
-
patternPY.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
06/devel/algosPY.py
r101 r102 193 193 return 194 194 195 numOfMatches = 0 196 numOfOccurrences = 0 197 195 198 while not index is None: 196 199 … … 204 207 205 208 pattern = patternList.get(N) 206 for a0 in range(pattern.anchors[0][ 0], pattern.anchors[1][0]+1):207 for a1 in range(pattern.anchors[0][ 1], pattern.anchors[1][1]+1):209 for a0 in range(pattern.anchors[0][1], pattern.anchors[1][1]+1): 210 for a1 in range(pattern.anchors[0][0], pattern.anchors[1][0]+1): 208 211 matches = 1 209 212 … … 220 223 for y in range(length): 221 224 pbIndex += 1 222 if (patternBits[pbIndex] & 223 self.finalpos[fpIndex]): 225 if (patternBits[pbIndex] & self.finalpos[fpIndex]): 224 226 matches = 0 225 227 break … … 232 234 233 235 234 if matchList: db.makeCurrentCandidate(matchList) 236 if matchList: 237 db.makeCurrentCandidate(matchList) 238 numOfMatches += 1 239 numOfOccurrences += len(matchList) 235 240 else: db.discardCurrent() 236 241 237 242 index = db.next() 238 243 244 print numOfMatches, numOfOccurrences 239 245 240 246 # in x-coord: -
06/devel/kombilo.py
r101 r102 1861 1861 if self.currentInitialPattern: 1862 1862 d = [] 1863 for i in range(self.sel[0][0], self.sel[1][0]+1):1864 for j in range(self.sel[0][1], self.sel[1][1]+1):1863 for j in range(self.sel[0][1], self.sel[1][1]+1): 1864 for i in range(self.sel[0][0], self.sel[1][0]+1): 1865 1865 d.append(self.currentInitialPattern[i+self.boardsize*j]) 1866 1866 else: … … 1870 1870 cls.append(chr(c[0]-self.sel[0][0]) + chr(c[1]-self.sel[0][1]) + c[2] + '/') 1871 1871 contListString = join(cls, '') 1872 self.currentSearchPattern = Pattern(anchors[0][0], anchors[0][1], anchors[1][0], anchors[1][1], 1872 print 'SEARCH', join(d, '') 1873 self.currentSearchPattern = Pattern(anchors[0][0], anchors[1][0], anchors[0][1], anchors[1][1], 1873 1874 self.sel[1][0]-self.sel[0][0]+1, self.sel[1][1]-self.sel[0][1]+1, 1874 1875 join(d, ''), contListString, len(self.currentContList), self.moveOne) … … 2479 2480 d = [] 2480 2481 2481 for i in range(region[0][0], region[1][0]+1):2482 for j in range(region[0][1], region[1][1]+1):2482 for j in range(region[0][1], region[1][1]+1): 2483 for i in range(region[0][0], region[1][0]+1): 2483 2484 if self.board.wildcards.has_key((i,j)): 2484 2485 d.append(wildcolor_to_char(self.board.wildcards[(i,j)])) … … 2492 2493 2493 2494 def getAnchors(self): 2495 print 'ANCHORS' 2496 print self.sel 2494 2497 if self.sel[0] == (0,0) or \ 2495 2498 (self.sel[0][0], self.sel[1][1]) == (0,self.boardsize-1) or \ … … 2516 2519 self.boardsize-2 -self.sel[1][1]+self.sel[0][1])] 2517 2520 anchors.sort() # FIXME: is this necessary? 2521 print anchors 2518 2522 return anchors 2519 2523 -
06/devel/patternPY.py
r101 r102 64 64 65 65 66 def printPattern(self): 67 d = [] 68 for j in range(self.sizeY): 69 for i in range(self.sizeX): 70 d.append(self.initialPos[i+j*self.sizeX]) 71 d.append('\n') 72 print join(d, '') 73 print 'anchors', self.anchors 74 75 66 76 def getBits(self, b, i): 67 77 return self.bits[b][i] … … 88 98 89 99 self.initialPos = initialPos 90 91 100 helpFinalPos = list(initialPos) 92 101 … … 135 144 self.bits.append(nextBlock) 136 145 146 self.printPattern() 137 147 138 148 flips = [] … … 206 216 newPd[f(i,j, self.pattern.sizeX-1, self.pattern.sizeY-1)] = self.pattern.getInitial(i, j) 207 217 208 print newPd209 218 cl = self.pattern.contList.split('/') 210 219 for c in cl: … … 229 238 230 239 npdl = [] 231 for i in range(newSizeX): 232 for j in range(newSizeY): 240 241 for j in range(newSizeY): 242 for i in range(newSizeX): 233 243 npdl.append(newPd[(i,j)]) 234 244 newPdString = join(npdl, '') 235 245 236 pNew = Pattern(newAnchors[0][0], newAnchors[ 0][1], newAnchors[1][0], newAnchors[1][1],246 pNew = Pattern(newAnchors[0][0], newAnchors[1][0], newAnchors[0][1], newAnchors[1][1], 237 247 newSizeX, newSizeY, 238 248 newPdString, newContList, self.pattern.lenContList, self.pattern.moveOne) … … 249 259 = self.invertColor(self.pattern.getInitial(i, j)) 250 260 npdl = [] 251 for i in range(newSizeX): 252 for j in range(newSizeY): 253 npdl.append(newPd[(i,j)]) 261 262 for j in range(newSizeY): 263 for i in range(newSizeX): 264 npdl.append(newPd1[(i,j)]) 254 265 newPd1String = join(npdl, '') 255 266 256 267 newContList1 = join([t[0]+t[1]+self.invertColor(t[2])+'/' for t in ncl], '') 257 268 258 pNew1 = Pattern(newAnchors[0][0], newAnchors[ 0][1], newAnchors[1][0], newAnchors[1][1],269 pNew1 = Pattern(newAnchors[0][0], newAnchors[1][0], newAnchors[0][1], newAnchors[1][1], 259 270 newSizeX, newSizeY, 260 271 newPd1String, newContList1, self.pattern.lenContList, self.pattern.moveTwo)
