Changeset 166

Show
Ignore:
Timestamp:
09/30/04 19:47:51 (4 years ago)
Author:
ug
Message:

Subversion trouble ...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 06/devel/abstractBoardPY.py

    r165 r166  
    6969        """ Return number of captured stones in last move. """ 
    7070 
    71         if not self.undostack:  
    72             print 'no undostack' 
    73             return 0 
    74         elif len(self.undostack[-1]) < 3: print self.undostack[-1] 
    7571        return len(self.undostack[-1][2]) 
    7672 
  • 06/devel/algosPY.py

    r160 r166  
    222222    def search(self, patternList, options, db, progBar, progStart, progEnd): 
    223223 
     224        print 'algo-finalpos start' 
    224225        ctr = 0 
    225226 
     
    319320            index = db.next() 
    320321 
    321         print numOfMatches, numOfOccurrences 
     322        print 'algo-finalpos:', numOfMatches, numOfOccurrences 
    322323 
    323324# in x-coord: 
     
    548549        index = db.start() 
    549550        gameCounter = 0 
    550          
     551 
    551552        while not index is None: 
    552553 
     
    579580                dNO = 0 
    580581                p = patternList.get(m[0]) 
     582                p.printPattern() 
    581583                for i in range(p.sizeX): 
    582584                    for j in range(p.sizeY): 
     
    607609                             # then going forward n2 times, then choosing the m2-th variation, 
    608610                             # etc. 
    609                              # we have counter == sum_j nj 
     611                             # we have counter == sum_j nj // FIXME this cannot be correct (maybe i + sum_j nj) 
    610612             
    611613            while movelistIndex < endMovelist and (counter <= self.movelimit or self.branchpoints): 
     
    691693 
    692694                            elif dicts[m].has_key('foundInitial'): 
    693  
     695                                print contList[m], contListIndex[m] 
    694696                                if (x, y, co) == contList[m][contListIndex[m]]: 
    695697                                    contListIndex[m] += 1 
     
    751753 
    752754                                    # look for captures in the contList 
    753                                     # (which may be in the wrong order) 
     755                                    # (which may be in the wrong order) FIXME: probably would make sense to sort them ... 
    754756                                     
    755757                                    ii = contListIndex[m] 
     
    761763                                        help = contList[m][ii] 
    762764                                        contList[m][ii] = contList[m][contListIndex[m]] 
    763                                         contlist[contListIndex[m]] = help 
     765                                        contList[contListIndex[m]] = help 
    764766                                         
    765767                                        contListIndex[m] += 1 
     768                                        print 'X', contListIndex[m] 
    766769 
    767770                                    else: 
     
    783786                if endOfNode: 
    784787                    for m in dicts.keys(): 
    785                         if dictsNO[m] == 0 and not dicts[m].has_key('found') \ 
    786                            and not dicts[m].has_key('foundInitial'): 
    787                             if contListIndex[m] == len(contList[m]): 
    788                                 dicts[m]['found'] = counter 
    789                                 dicts[m]['whereAreWe'] = copy(whereAreWe) 
    790                                 # print 'found1', counter, whereAreWe 
    791                             else: dicts[m]['foundInitial'] = counter 
     788                        if dicts[m].has_key('found'): continue 
     789                        if (dictsNO[m] == 0 and not contList[m]) \ 
     790                            or (dicts[m].has_key('foundInitial') and contListIndex[m] == len(contList[m])): 
     791                            dicts[m]['found'] = counter 
     792                            dicts[m]['whereAreWe'] = copy(whereAreWe) 
     793                            print 'found1', counter, whereAreWe 
     794                        elif dictsNO[m] == 0 and not dicts[m].has_key('foundInitial'):  
     795                            dicts[m]['foundInitial'] = counter 
     796                            print 'foundInitial', counter 
    792797 
    793798                    counter += 1 
     
    840845 
    841846    def __init__(self, boardsize, poslist, filename): 
    842         self.poslist = [[0,0] + p for p in poslist] # store num of stones and current 
     847        self.poslist = [[0,0]+p for p in poslist] # store num of stones and current 
    843848                                                    # hashcode in first two entries  
    844849        self.filename = filename 
     
    981986        """ 
    982987 
     988        print 'algo.hash.search start' 
    983989        for i in range(patternList.size()): 
    984990            pattern = patternList.get(i) 
     
    10691075                            l[2] += 2 
    10701076                            matchList.append((N, (a0, a1))) 
     1077                        # print [ll[0] for ll in pattern.hashkeys[(a0,a1)]], matchPossible  
    10711078                     
    10721079            if matchList: db.makeCurrentCandidate(matchList) 
  • 06/devel/kombilo.py

    r165 r166  
    23602360        if self.moveSequenceVar.get(): 
    23612361            self.currentContList.append((pos[0], pos[1], color)) 
     2362            for c in self.board.undostack[-1][2]: 
     2363                self.currentContList.append((c[0], c[1], '-')) 
    23622364            self.board.placeMSLabel(pos, 'LB', `len(self.currentContList)`) 
    2363  
    2364         # FIXME: put captures into currentContList! 
    2365  
     2365             
    23662366        if self.oneClick.get() and (self.board.selection[1] == (-1,-1) or \ 
    23672367                                    (self.board.selection[0][0] <= pos[0] <= self.board.selection[1][0] \ 
  • 06/devel/patternPY.py

    r164 r166  
    7171            d.append('\n') 
    7272        print join(d, '') 
    73         print 'anchors', self.anchors 
     73        print 
     74        d = [] 
     75        for j in range(self.sizeY): 
     76            for i in range(self.sizeX): 
     77                d.append(self.finalPos[i+j*self.sizeX]) 
     78            d.append('\n') 
     79        print join(d, '') 
     80        print self.contList 
    7481 
    7582         
     
    101108 
    102109        for t in contList.split('/'): 
    103             if t and t[2] in ['B', 'W']: 
    104                 # print ord(t[0]), ord(t[1]), t[2] 
    105                 helpFinalPos[ord(t[0]) + sizeX*ord(t[1])] = self.BW2XO(t[2]) # FIXME: deal with captures 
    106  
     110            if t: 
     111                if t[2] in ['B', 'W']: 
     112                    # print ord(t[0]), ord(t[1]), t[2] 
     113                    helpFinalPos[ord(t[0]) + sizeX*ord(t[1])] = self.BW2XO(t[2]) 
     114                else: 
     115                    helpFinalPos[ord(t[0]) + sizeX*ord(t[1])] = '.' 
    107116        self.finalPos = join(helpFinalPos, '') 
    108117 
     
    174183    def invertColor(self,co): 
    175184        try: 
    176             return {'X': 'O', 'x': 'o', 'O': 'X', 'o': 'x', '.': '.', '*': '*', 'B':'W', 'W':'B'}[co] 
     185            return {'X': 'O', 'x': 'o', 'O': 'X', 'o': 'x', '.': '.', '*': '*', 'B':'W', 'W':'B', '-':'-'}[co] 
    177186        except: 
    178187            print 'oops invertColor', co # FIXME