Esempio n. 1
0
    def __init__(self, moveOwner, fen, dbCache):
        self.moveOwner = moveOwner
        self.dbCache = dbCache

        if not moveOwner:
            self.nivel = 0
            cp = ControlPosicion.ControlPosicion()
            cp.leeFen(fen)
            self.partidaBase = Partida.Partida(cp)
        else:
            self.nivel = self.moveOwner.listaMovesPadre.nivel + 1
            self.partidaBase = self.moveOwner.partida.copia()

        self.fenM2 = self.partidaBase.ultPosicion.fenM2()

        dicCache = self.dbCache[self.fenM2]

        LCEngine.setFen(self.fenM2 + " 0 1")
        liMov = [xpv[1:] for xpv in LCEngine.getMoves()]

        liMov.sort()
        liMoves = []
        for pv in liMov:
            um = UnMove(self, pv, dicCache)
            liMoves.append(um)

        self.liMoves = liMoves
        self.liMovesInicial = liMoves[:]
        self.liAnalisis = dicCache.get("ANALISIS", []) if dicCache else []

        # self.analisisActivo
        # self.dicAnalisis
        self.ponAnalisisActivo(
            dicCache.get("ANALISIS_ACTIVO", None) if dicCache else None)
Esempio n. 2
0
    def wd_move(self, fen, move):
        LCEngine.setFen(fen)
        liMoves = LCEngine.getMoves()
        liMoves = map(lambda x: x[1:], liMoves)

        if move in liMoves:
            LCEngine.movePV(move[:2], move[2:4], move[4:])
            xfen = LCEngine.getFen()
            wdl, dtz = self.wdl_dtz(xfen)
        else:
            wdl, dtz = 2, 0

        return -wdl, -dtz
Esempio n. 3
0
 def checkFen(self, fen):
     LCEngine.setFen(fen)
     liMoves = LCEngine.getMoves()
     dic = {}
     for xpv in liMoves:
         pv = xpv[1:]
         LCEngine.setFen(fen)
         LCEngine.movePV(pv[:2], pv[2:4], pv[4:])
         xfen = LCEngine.getFen()
         wdl, dtz = self.wdl_dtz(xfen)
         if wdl is not None and dtz is not None:
             dic[pv] = -wdl, -dtz
     return dic