Exemple #1
0
    def __init__(self, gestor, cromo):

        self.cromo = cromo

        self.gestor = gestor

        self.partida = gestor.partida

        self.nombre = cromo.nombre

        self.xirina = None
        self.xsimilar = None

        conf_motor = self.gestor.configuracion.buscaRival("irina")
        self.xirina = XGestorMotor.GestorMotor(self.gestor.procesador, conf_motor)
        self.xirina.opciones(None, 1, False)

        self.apertura = self.cromo.apertura
        if self.apertura:
            bookdef = VarGen.tbookPTZ
            self.book = Books.Libro("P", bookdef.split("/")[1], bookdef, True)
            self.book.polyglot()

        # De compatibilidad
        self.motorTiempoJugada = 0
        self.motorProfundidad = 0

        atexit.register(self.cerrar)
Exemple #2
0
 def juega_similar(self, fen):
     if self.xsimilar is None:
         conf_engine = self.gestor.configuracion.buscaRival(self.cromo.engine)
         self.xsimilar = XGestorMotor.GestorMotor(self.gestor.procesador, conf_engine)
         self.xsimilar.opciones(None, 5, True)
     mrm = self.xsimilar.control(fen, 5)
     mrm.partida = self.partida
     return mrm.mejorMovAjustadoSimilar(self.cromo.dif_puntos, self.cromo.mate, self.cromo.aterrizaje)
Exemple #3
0
 def creaGestorMotor(self,
                     confMotor,
                     tiempo,
                     nivel,
                     siMultiPV=False,
                     priority=None):
     xgestor = XGestorMotor.GestorMotor(self, confMotor)
     xgestor.opciones(tiempo, nivel, siMultiPV)
     xgestor.setPriority(priority)
     return xgestor
Exemple #4
0
    def juega_gaia(self, fen):
        if self.xgaia is None:
            conf_motor = self.gestor.configuracion.buscaRival("gaia")
            self.xgaia = XGestorMotor.GestorMotor(self.gestor.procesador,
                                                  conf_motor)
            self.xgaia.opciones(None, 1, False)

        mrm = self.xgaia.control(fen, 1)
        mrm.partida = self.partida
        return mrm.mejorMov()
Exemple #5
0
 def creaGestorMotor(self,
                     confMotor,
                     tiempo,
                     nivel,
                     siMultiPV=False,
                     priority=EngineThread.PRIORITY_NORMAL):
     xgestor = XGestorMotor.GestorMotor(self, confMotor)
     xgestor.opciones(tiempo, nivel, siMultiPV)
     xgestor.setPriority(priority)
     self.liEngines.append(xgestor)
     return xgestor
Exemple #6
0
    def creaXAnalyzer(self):
        xanalyzer = XGestorMotor.GestorMotor(self, self.configuracion.tutor)
        xanalyzer.nombre += ("(%s)" % _("analyzer"))
        xanalyzer.opciones(self.configuracion.tiempoTutor, self.configuracion.depthTutor, True)
        if self.configuracion.tutorMultiPV == 0:
            xanalyzer.maximizaMultiPV()
        else:
            xanalyzer.setMultiPV(self.configuracion.tutorMultiPV)

        self.xanalyzer = xanalyzer
        VarGen.xanalyzer = xanalyzer
Exemple #7
0
    def creaXAnalyzer(self):
        xanalyzer = XGestorMotor.GestorMotor(self, self.configuracion.tutor)
        xanalyzer.opciones(self.configuracion.tiempoTutor, None, True)
        if self.configuracion.tutorMultiPV == 0:
            xanalyzer.maximizaMultiPV()
        else:
            xanalyzer.setMultiPV(self.configuracion.tutorMultiPV)

        self.xanalyzer = xanalyzer
        VarGen.xanalyzer = xanalyzer

        self.liEngines.append(xanalyzer)
Exemple #8
0
    def creaXTutor(self):
        xtutor = XGestorMotor.GestorMotor(self, self.configuracion.tutor)
        xtutor.opciones(self.configuracion.tiempoTutor, None, True)
        if self.configuracion.tutorMultiPV == 0:
            xtutor.maximizaMultiPV()
        else:
            xtutor.actMultiPV(self.configuracion.tutorMultiPV)

        self.xtutor = xtutor
        VarGen.xtutor = xtutor

        self.liEngines.append(xtutor)
Exemple #9
0
    def siguienteJuego(self, gm, ngame, numGames):

        self.estado = kJugando

        self.gm = gm
        self.maxSegundos = self.gm.minutos() * 60.0
        self.segundosJugada = self.gm.segundosJugada()

        rival = {
            True: self.torneo.buscaHEngine(self.gm.hwhite()),
            False: self.torneo.buscaHEngine(self.gm.hblack()),
        }

        self.tiempo = {}

        self.book = {}
        self.bookRR = {}

        self.xmotor = {}

        for color in (True, False):

            rv = rival[color]
            self.xmotor[color] = XGestorMotor.GestorMotor(
                self.procesador, rv.configMotor())
            self.xmotor[color].opciones(rv.time() * 1000, rv.depth(), False)
            self.xmotor[color].ponGuiDispatch(self.guiDispatch)

            self.tiempo[color] = Util.Timer(self.maxSegundos)

            bk = rv.book()
            if bk == "*":
                bk = VarGen.tbook
            elif bk == "-":
                bk = None
            if bk:
                self.book[color] = Books.Libro("P", bk, bk, True)
                self.book[color].polyglot()
            else:
                self.book[color] = None
            self.bookRR[color] = rv.bookRR()

        self.partida = Partida.Partida(fen=self.fenInicial)
        self.pgn.partida = self.partida

        self.alturaRotulo3(32)

        self.desactivaTodas()
        self.ponPosicion(self.partida.ultPosicion)
        self.pgnRefresh(True)

        # self.siPrimeraJugadaHecha = False
        tpBL = self.tiempo[True].etiqueta()
        tpNG = self.tiempo[False].etiqueta()
        bl = self.xmotor[True].nombre
        ng = self.xmotor[False].nombre
        self.pantalla.activaJuego(True, True, siAyudas=False)
        self.ponRotulo1("<center><b>%s %d/%d</b></center>" %
                        (_("Game"), ngame, numGames))
        self.ponRotulo2(None)
        self.quitaAyudas()
        self.pantalla.ponDatosReloj(bl, tpBL, ng, tpNG)
        self.refresh()

        self.finPorTiempo = None
        while self.siguienteJugada():
            pass

        self.xmotor[True].terminar()
        self.xmotor[False].terminar()
        self.pantalla.paraReloj()
Exemple #10
0
 def __init__(self):
     if VarGen.listaGestoresMotor is None:
         VarGen.listaGestoresMotor = XGestorMotor.ListaGestoresMotor()