Esempio n. 1
0
    def testEngine(self, nMultiPV=0):
        if self.motor:
            return
        if self.nMultiPV:
            self.nMultiPV = min(self.nMultiPV, self.confMotor.maxMultiPV)

        exe = self.confMotor.ejecutable()
        args = self.confMotor.argumentos()
        liUCI = self.confMotor.liUCI
        if self.direct:
            self.motor = XMotor.FastEngine(self.nombre,
                                           exe,
                                           liUCI,
                                           self.nMultiPV,
                                           priority=self.priority,
                                           args=args)
        else:
            self.motor = XMotor.XMotor(self.nombre,
                                       exe,
                                       liUCI,
                                       self.nMultiPV,
                                       priority=self.priority,
                                       args=args)
        if self.confMotor.siDebug:
            self.motor.siDebug = True
            self.motor.nomDebug = self.confMotor.nomDebug
        if self.dispatching:
            rutina, whoDispatch = self.dispatching
            self.motor.ponGuiDispatch(rutina, whoDispatch)
        if self.ficheroLog:
            self.motor.log_open(self.ficheroLog)
Esempio n. 2
0
    def leerUCI(self, exe):
        self.exe = Util.dirRelativo(exe)
        self.liOpciones = []

        motor = XMotor.XMotor("-", exe)

        uci = motor.uci
        self.idName = "-"
        self.idAuthor = "-"
        for linea in uci.split("\n"):
            linea = linea.strip()
            if linea.startswith("id name"):
                self.idName = linea[8:]
            elif linea.startswith("id author"):
                self.idAuthor = linea[10:]
            elif linea.startswith("option name "):
                op = OpcionUCI()
                if op.lee(linea):
                    self.liOpciones.append(op)
        self.alias = self.idName
        self.clave = self.idName
        motor.apagar()
        return len(uci) > 0
    def leerUCI(self, exe, args=[]):
        self.exe = Util.dirRelativo(exe)
        self.args = args
        self.liOpciones = []

        motor = XMotor.XMotor("-", exe, args=args)
        if motor.uci_ok:
            self.idName = "-"
            self.idAuthor = "-"
            for linea in motor.uci_lines:
                linea = linea.strip()
                if linea.startswith("id name"):
                    self.idName = linea[8:]
                elif linea.startswith("id author"):
                    self.idAuthor = linea[10:]
                elif linea.startswith("option name "):
                    op = OpcionUCI()
                    if op.lee(linea):
                        self.liOpciones.append(op)
            self.alias = self.idName
            self.clave = self.idName
        motor.close()
        return motor.uci_ok
Esempio n. 4
0
    def iniciarMotor(self, nMultiPV=0):
        self.siIniMotor = True

        if self.siMultiPV:
            if self.siMaximizaMultiPV and self.confMotor.maxMultiPV:
                nMultiPV = self.confMotor.maxMultiPV
            else:
                if nMultiPV == 0:
                    nMultiPV = self.confMotor.multiPV
                else:
                    if self.confMotor.multiPV < nMultiPV:
                        nMultiPV = self.confMotor.multiPV

        exe = self.confMotor.ejecutable()
        liUCI = self.confMotor.liUCI
        self.motor = XMotor.XMotor(self.nombre,
                                   exe,
                                   liUCI,
                                   nMultiPV,
                                   priority=self.priority)
        if self.confMotor.siDebug:
            self.motor.siDebug = True
            self.motor.nomDebug = self.confMotor.nomDebug