Changeset 174 for 06/devel/algosPY.py

Show
Ignore:
Timestamp:
08/16/06 22:26:22 (2 years ago)
Author:
ug
Message:

Worked some more on pattern.cc ... not done yet, though.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 06/devel/algosPY.py

    r171 r174  
    11# File: algosPY.py 
    22 
    3 ##   Copyright (C) 2001-5 Ulrich Goertz (u@g0ertz.de) 
     3##   Copyright (C) 2001-6 Ulrich Goertz (u@g0ertz.de) 
    44 
    55##   This file is part of Kombilo 0.6, a go database program. 
     
    2525from string import lower, join 
    2626from copy import copy, deepcopy 
     27 
     28class AlgoError(Exception): pass 
    2729 
    2830def BW2XO(c): 
     
    269271                                     
    270272                        pIndex = 2*(a1%2) + (a0%2) 
    271                         patternBits = pattern.bits[pIndex] 
    272273 
    273274                        pbIndex = 0 
    274275                        fpIndex = index*100 + a1/2 + (a0/2)*10 
    275276 
    276                         # print 'p', patternBits[0] 
    277  
    278                         for x in range(patternBits[0]): 
    279                             start = patternBits[pbIndex+1] 
    280                             length = patternBits[pbIndex+2] 
     277                        for x in range(pattern.getBits(pIndex,0)): 
     278                            start = pattern.getBits(pIndex, pbIndex+1) 
     279                            length = pattern.getBits(pIndex, pbIndex+2) 
    281280                            # print 's', pbIndex, start, length 
    282281                            fpIndex += start 
     
    284283                            for y in range(length): 
    285284                                pbIndex += 1 
    286                                 # print 'pbIndex', pbIndex 
    287                                 # for i in range(2): 
    288                                 #     for j in range(2): 
    289                                 #         if patternBits[pbIndex] & (1 << (2*(j + 2*i))): print 'X', 
    290                                 #         elif patternBits[pbIndex] & (1 << (2*(j + 2*i)+1)): print 'O', 
    291                                 #         else: print '.', 
    292                                 #     print 
    293                                 # print 'compare with', fpIndex 
    294                                 # for i in range(2): 
    295                                 #     for j in range(2): 
    296                                 #         if not (self.finalpos[fpIndex] & (1 << (2*(j%2 + 2*(i%2))))): 
    297                                 #             print 'X', 
    298                                 #         elif not (self.finalpos[fpIndex] & (1 << (2*(j%2 + 2*(i%2))+1))): 
    299                                 #             print 'O', 
    300                                 #         else: print '.',  
    301                                 #     print 
    302                                 # qprint fpIndex, a0, a1, x, y 
    303                                 if (patternBits[pbIndex] & self.finalpos[fpIndex]): 
     285                                if (pattern.getBits(pIndex, pbIndex) & self.finalpos[fpIndex]): 
    304286                                    matches = 0 
    305287                                    break 
     
    666648                                hit, label, contLabelsIndex, switched =\ 
    667649                                     patternList.updateContinuations(m[0], x, y, invco, 
    668                                                                      Xinterv[m], Yinterv[m], 
     650                                                                     Xinterv[m][0], Xinterv[m][1],  
     651                                                                     Yinterv[m][0], Yinterv[m][1], 
    669652                                                                     dicts[m]['found'], counter, 
    670                                                                      continuations, contLabels, 
     653                                                                     continuations, ''.join(contLabels), 
    671654                                                                     contLabelsIndex, 
    672655                                                                     db.getCurrentWinner()) 
     
    15501533                         
    15511534                        hit, label, contLabelsIndex, switched =\ 
    1552                              patternList.updateContinuations(m[0], x+a0, y+a1, co, Xint, Yint, 
     1535                             patternList.updateContinuations(m[0], x+a0, y+a1, co, Xint[0], Xint[1], Yint[0], Yint[1], 
    15531536                                                             currentUInterv.first(), counter-1, 
    1554                                                              continuations, contLabels, contLabelsIndex, 
     1537                                                             continuations, str(contLabels), contLabelsIndex, 
    15551538                                                             db.getCurrentWinner()) 
    15561539                    if hit: