def testEngine(self, nMultiPV=0): if self.engine is not None: 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.engine = EngineRunDirect.DirectEngine( self.name, exe, liUCI, self.nMultiPV, priority=self.priority, args=args ) elif self.name.lower().startswith("maia"): self.engine = EngineRun.MaiaEngine(self.name, exe, liUCI, self.nMultiPV, priority=self.priority, args=args) else: self.engine = EngineRun.RunEngine(self.name, exe, liUCI, self.nMultiPV, priority=self.priority, args=args) if self.confMotor.siDebug: self.engine.siDebug = True self.engine.nomDebug = self.confMotor.nomDebug if self.dispatching: rutina, whoDispatch = self.dispatching self.engine.ponGuiDispatch(rutina, whoDispatch) if self.ficheroLog: self.engine.log_open(self.ficheroLog)
def read_uci_options(self): self.__li_uci_options = [] dc_op = {} engine = EngineRunDirect.DirectEngine("-", self.path_exe, args=self.args) if engine.uci_ok: for linea in engine.uci_lines: linea = linea.strip() if linea.startswith("id name"): self.id_name = linea[8:] elif linea.startswith("id author"): self.id_author = linea[10:] elif linea.startswith("option name "): op = OpcionUCI() if op.lee(linea): self.__li_uci_options.append(op) dc_op[op.name] = op engine.close() for comando, valor in self.liUCI: if comando in dc_op: dc_op[comando].valor = valor return self.__li_uci_options
def check_engine(self, num_multipv=0): if self.engine is not None: return False if self.num_multipv: self.num_multipv = min(self.num_multipv, self.confMotor.maxMultiPV) exe = self.confMotor.ejecutable() args = self.confMotor.argumentos() liUCI = self.confMotor.liUCI if self.direct: self.engine = EngineRunDirect.DirectEngine(self.name, exe, liUCI, self.num_multipv, priority=self.priority, args=args, log=self.ficheroLog) elif self.name.lower().startswith("maia"): self.engine = EngineRun.MaiaEngine(self.name, exe, liUCI, self.num_multipv, priority=self.priority, args=args, log=self.ficheroLog) else: self.engine = EngineRun.RunEngine(self.name, exe, liUCI, self.num_multipv, priority=self.priority, args=args, log=self.ficheroLog) if self.confMotor.siDebug: self.engine.siDebug = True self.engine.nomDebug = self.confMotor.nomDebug if self.dispatching: rutina, who_dispatch = self.dispatching self.engine.set_gui_dispatch(rutina, who_dispatch) return True
def read_engine_uci(exe, args=None): path_exe = Util.relative_path(exe) if args is None: args = [] engine = EngineRunDirect.DirectEngine("-", exe, args=args) if engine.uci_ok: id_name = "-" id_author = "-" for linea in engine.uci_lines: linea = linea.strip() if linea.startswith("id name"): id_name = linea[8:] elif linea.startswith("id author"): id_author = linea[10:] me = Engine(id_name, id_author, id_name, "", path_exe) me._nombre = id_name else: me = None engine.close() return me