def start(self, dbwashing, washing, engine): self.dbwashing = dbwashing self.washing = washing self.engine = engine self.dbwashing.add_game() self.game_type = GT_WASHING_REPLAY self.human_is_playing = False self.is_tutor_enabled = False self.main_window.set_activate_tutor(False) self.ayudas_iniciales = 0 self.main_window.activaJuego(True, False, siAyudas=False) self.main_window.remove_hints(True, True) self.set_dispatcher(self.player_has_moved) self.show_side_indicator(True) self.gameObj = self.dbwashing.restoreGame(self.engine) self.numJugadasObj = self.gameObj.num_moves() self.posJugadaObj = 0 li_options = [TB_CLOSE] self.main_window.pon_toolbar(li_options) self.errores = 0 self.book = Opening.OpeningPol(999, elo=engine.elo) is_white = self.engine.color self.human_side = is_white self.is_engine_side_white = not is_white self.set_position(self.game.last_position) self.put_pieces_bottom(is_white) self.set_label1( "%s: %s\n%s: %s" % (_("Rival"), self.engine.name, _("Task"), self.engine.lbState())) self.pgnRefresh(True) self.game.pending_opening = True self.game.set_tag("Event", _("The Washing Machine")) player = self.configuration.nom_player() other = self.engine.name w, b = (player, other) if self.human_side else (other, player) self.game.set_tag("White", w) self.game.set_tag("Black", b) QTUtil.refresh_gui() self.check_boards_setposition() self.state = ST_PLAYING self.play_next_move()
def start(self, recno, is_white): db = WindowPlayGame.DBPlayGame(self.configuration.file_play_game()) reg = db.leeRegistro(recno) gameObj = Game.Game() gameObj.restore(reg["GAME"]) nombreObj = gameObj.get_tag("WHITE" if is_white else "BLACK") label = db.label(recno) db.close() self.recno = recno self.resultado = None self.human_is_playing = False self.analysis = None self.comment = None self.siAnalizando = False self.human_side = is_white self.is_engine_side_white = not is_white self.numJugadasObj = gameObj.num_moves() self.gameObj = gameObj self.posJugadaObj = 0 self.nombreObj = nombreObj self.siSave = False self.minTiempo = 5000 self.xanalyzer.maximizaMultiPV() self.puntosMax = 0 self.puntos = 0 self.vtime = 0.0 self.book = Opening.OpeningPol(999) self.main_window.pon_toolbar( (TB_CANCEL, TB_REINIT, TB_CONFIG, TB_UTILITIES)) self.main_window.activaJuego(True, False, siAyudas=False) self.remove_hints(True, True) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.put_pieces_bottom(self.human_side) self.show_side_indicator(True) self.set_label1(label) self.set_label2("") self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.check_boards_setposition() self.state = ST_PLAYING self.play_next_move()
def takeback(self): if len(self.game): self.analizaTerminar() self.game.anulaUltimoMovimiento(self.human_side) self.game.assign_opening() self.goto_end() self.opening = Opening.OpeningPol(30, self.engine.elo) self.is_analyzed_by_tutor = False self.add_hint() self.add_time() self.refresh() self.play_next_move()
def base_inicio(self, id_game): self.resultado = None self.human_is_playing = False self.state = ST_PLAYING self.analysis = None self.comment = None self.siAnalizando = False self.is_competitive = True self.read_id(id_game) self.id_game = id_game self.eloObj = int( self.game.get_tag("WhiteElo" if self.human_side else "BlackElo")) self.eloUsu = self._activo() self.pwin = Util.fideELO(self.eloUsu, self.eloObj, +1) self.pdraw = Util.fideELO(self.eloUsu, self.eloObj, 0) self.plost = Util.fideELO(self.eloUsu, self.eloObj, -1) self.puntos = 0 self.is_tutor_enabled = False self.main_window.set_activate_tutor(self.is_tutor_enabled) self.hints = 0 self.ayudas_iniciales = 0 self.xtutor.maximizaMultiPV() self.book = Opening.OpeningPol(999) self.pon_toolbar() self.main_window.activaJuego(True, False, siAyudas=False) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.put_pieces_bottom(self.human_side) self.remove_hints(True, siQuitarAtras=True) self.show_side_indicator(True) label = "%s: <b>%d</b> | %s: <b>%d</b>" % (self._titulo, self.eloUsu, _("Elo rival"), self.eloObj) label += " | %+d %+d %+d" % (self.pwin, self.pdraw, self.plost) self.set_label1(label) self.set_label2("") self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.check_boards_setposition()
def start(self, recno): self.expedition = Everest.Expedition(self.configuration, recno) self.expedition.run() self.dic_analysis = {} self.is_competitive = True self.resultado = None self.human_is_playing = False self.analysis = None self.comment = None self.siAnalizando = False self.human_side = self.expedition.is_white self.is_engine_side_white = not self.expedition.is_white self.gameObj = self.expedition.game self.game.set_tags(self.gameObj.li_tags) self.numJugadasObj = self.gameObj.num_moves() self.posJugadaObj = 0 self.nombreObj = self.expedition.name self.xanalyzer.maximize_multipv() self.puntos = 0 self.vtime = 0.0 self.book = Opening.OpeningPol(999) self.main_window.pon_toolbar((TB_CANCEL, TB_REINIT, TB_CONFIG)) self.main_window.activaJuego(True, False, siAyudas=False) self.remove_hints(True, True) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.put_pieces_bottom(self.human_side) self.show_side_indicator(True) self.set_label1(self.expedition.label()) self.set_label2("") self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.check_boards_setposition() self.state = ST_PLAYING self.play_next_move()
def reiniciar(self): self.game.set_position() self.posJugadaObj = 0 self.puntos = 0 self.ponPuntos() self.vtime = 0.0 self.book = Opening.OpeningPol(999) self.state = ST_PLAYING self.board.set_position(self.game.first_position) self.pgnRefresh(True) self.check_boards_setposition() self.analizaFinal() self.terminaNoContinuo() self.set_label1(self.expedition.label()) self.ponPuntos() self.play_next_move()
def reiniciar(self, siPregunta): if siPregunta: if not QTUtil2.pregunta(self.main_window, _("Restart the game?")): return self.game.set_position() self.posJugadaObj = 0 self.puntos = 0 self.puntosMax = 0 self.ponPuntos() self.vtime = 0.0 self.book = Opening.OpeningPol(999) self.state = ST_PLAYING self.board.set_position(self.game.first_position) self.pgnRefresh(True) self.check_boards_setposition() self.analizaFinal() self.play_next_move()
def calc_elosFORM(self, configuration): for move in self.li_moves: move.is_book = False if self.siFenInicial(): ap = Opening.OpeningPol(999) for move in self.li_moves: move.is_book = ap.check_human(move.position_before.fen(), move.from_sq, move.to_sq) if not move.is_book: break elos = {} for is_white in (True, False): elos[is_white] = self.calc_elo_colorFORM(configuration.perfomance, is_white) elos[None] = {} for std in (OPENING, MIDDLEGAME, ENDGAME, ALLGAME): elos[None][std] = int((elos[True][std] + elos[False][std]) / 2.0) return elos
def base_inicio(self, dic_var): self.reinicio = dic_var self.cache = dic_var.get("cache", {}) self.game_type = GT_AGAINST_ENGINE self.human_is_playing = False self.plays_instead_of_me_option = True self.state = ST_PLAYING self.is_analyzing = False self.summary = { } # numJugada : "a"ccepted, "s"ame, "r"ejected, dif points, time used self.with_summary = dic_var.get("SUMMARY", False) is_white = dic_var["ISWHITE"] self.human_side = is_white self.is_engine_side_white = not is_white self.conf_engine = dic_var["RIVAL"].get("CM", None) self.lirm_engine = [] self.next_test_resign = 0 self.resign_limit = -99999 # never self.aperturaObl = self.aperturaStd = None self.fen = dic_var["FEN"] if self.fen: cp = Position.Position() cp.read_fen(self.fen) self.game.set_position(cp) self.game.pending_opening = False else: if dic_var["OPENING"]: self.aperturaObl = Opening.JuegaOpening( dic_var["OPENING"].a1h8) self.primeroBook = False # la opening es obligatoria self.bookR = dic_var.get("BOOKR", None) if self.bookR: self.bookRdepth = dic_var.get("BOOKRDEPTH", 0) self.bookR.polyglot() self.bookRR = dic_var.get("BOOKRR", "mp") elif dic_var["RIVAL"].get("TYPE", None) in (SelectEngines.MICGM, SelectEngines.MICPER): if self.conf_engine.book: self.bookR = Books.Book("P", self.conf_engine.book, self.conf_engine.book, True) self.bookR.polyglot() self.bookRR = "mp" self.bookRdepth = 0 self.bookP = dic_var.get("BOOKP", None) if self.bookP: self.bookPdepth = dic_var.get("BOOKPDEPTH", 0) self.bookP.polyglot() self.is_tutor_enabled = ( Code.dgtDispatch is None) and self.configuration.x_default_tutor_active self.main_window.set_activate_tutor(self.is_tutor_enabled) self.hints = dic_var["HINTS"] self.ayudas_iniciales = self.hints # Se guarda para guardar el PGN self.nArrows = dic_var.get("ARROWS", 0) n_box_height = dic_var.get("BOXHEIGHT", 24) self.thoughtOp = dic_var.get("THOUGHTOP", -1) self.thoughtTt = dic_var.get("THOUGHTTT", -1) self.continueTt = not Code.configuration.x_engine_notbackground self.nArrowsTt = dic_var.get("ARROWSTT", 0) self.chance = dic_var.get("2CHANCE", True) if self.nArrowsTt != 0 and self.hints == 0: self.nArrowsTt = 0 self.with_takeback = dic_var.get("TAKEBACK", True) self.tutor_con_flechas = self.nArrowsTt > 0 and self.hints > 0 self.tutor_book = Books.BookGame(Code.tbook) mx = max(self.thoughtOp, self.thoughtTt) if mx > -1: self.set_hight_label3(n_box_height) dr = dic_var["RIVAL"] rival = dr["CM"] if dr["TYPE"] == SelectEngines.ELO: r_t = 0 r_p = rival.fixed_depth self.nAjustarFuerza = ADJUST_BETTER else: r_t = dr["ENGINE_TIME"] * 100 # Se guarda en decimas -> milesimas r_p = dr["ENGINE_DEPTH"] self.nAjustarFuerza = dic_var.get("ADJUST", ADJUST_BETTER) if not self.xrival: # reiniciando is not None if r_t <= 0: r_t = None if r_p <= 0: r_p = None if r_t is None and r_p is None and not dic_var["WITHTIME"]: r_t = 1000 self.xrival = self.procesador.creaManagerMotor( rival, r_t, r_p, self.nAjustarFuerza != ADJUST_BETTER) if self.nAjustarFuerza != ADJUST_BETTER: self.xrival.maximizaMultiPV() self.resign_limit = dic_var["RESIGN"] self.game.set_tag("Event", _("Play against an engine")) player = self.configuration.nom_player() other = self.xrival.name w, b = (player, other) if self.human_side else (other, player) self.game.set_tag("White", w) self.game.set_tag("Black", b) self.siBookAjustarFuerza = self.nAjustarFuerza != ADJUST_BETTER self.xrival.is_white = self.is_engine_side_white self.siTiempo = dic_var["WITHTIME"] if self.siTiempo: self.maxSegundos = dic_var["MINUTES"] * 60.0 self.segundosJugada = dic_var["SECONDS"] self.segExtra = dic_var.get("MINEXTRA", 0) * 60.0 self.zeitnot = dic_var.get("ZEITNOT", 0) self.vtime = { WHITE: Util.Timer(self.maxSegundos), BLACK: Util.Timer(self.maxSegundos) } if self.segExtra: self.vtime[self.human_side].ponSegExtra(self.segExtra) time_control = "%d" % int(self.maxSegundos) if self.segundosJugada: time_control += "+%d" % self.segundosJugada self.game.set_tag("TimeControl", time_control) if self.segExtra: self.game.set_tag( "TimeExtra" + "White" if self.human_side else "Black", "%d" % self.segExtra) self.pon_toolbar() self.main_window.activaJuego(True, self.siTiempo) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.show_side_indicator(True) if self.ayudas_iniciales: self.ponAyudasEM() else: self.remove_hints(siQuitarAtras=False) self.put_pieces_bottom(is_white) self.ponRotuloBasico() self.set_label2("") if self.nAjustarFuerza != ADJUST_BETTER: pers = Personalities.Personalities(None, self.configuration) label = pers.label(self.nAjustarFuerza) if label: self.game.set_tag("Strength", label) self.ponCapInfoPorDefecto() self.pgnRefresh(True) rival = self.xrival.name player = self.configuration.x_player bl, ng = player, rival if self.is_engine_side_white: bl, ng = ng, bl active_clock = max(self.thoughtOp, self.thoughtTt) > -1 if self.siTiempo: tp_bl = self.vtime[True].etiqueta() tp_ng = self.vtime[False].etiqueta() self.main_window.ponDatosReloj(bl, tp_bl, ng, tp_ng) active_clock = True self.refresh() else: self.main_window.base.change_player_labels(bl, ng) if active_clock: self.main_window.start_clock(self.set_clock, 400) self.main_window.set_notify(self.mueve_rival_base) self.is_analyzed_by_tutor = False self.game.tag_timestart() self.check_boards_setposition()
def base_inicio(self, datos_motor): self.game_type = GT_ELO self.is_competitive = True self.resultado = None self.human_is_playing = False self.state = ST_PLAYING is_white = self.determina_side(datos_motor) self.human_side = is_white self.is_engine_side_white = not is_white self.lirm_engine = [] self.next_test_resign = 5 self.resign_limit = -1000 self.is_tutor_enabled = False self.main_window.set_activate_tutor(self.is_tutor_enabled) self.hints = 0 self.ayudas_iniciales = self.hints self.in_the_opening = True self.datosMotor = datos_motor self.opening = Opening.OpeningPol(100, elo=self.datosMotor.elo) eloengine = self.datosMotor.elo eloplayer = self.configuration.eloActivo() self.whiteElo = eloplayer if is_white else eloengine self.blackElo = eloplayer if not is_white else eloengine self.siRivalInterno = self.datosMotor.siInterno if self.siRivalInterno: rival = self.configuration.buscaRival("irina") depth = 2 if self.datosMotor.key in ("Rat", "Snake") else 1 self.xrival = self.procesador.creaManagerMotor(rival, None, depth) self.xrival.set_option("Personality", self.datosMotor.key) else: rival = self.configuration.buscaRival(self.datosMotor.key) self.xrival = self.procesador.creaManagerMotor(rival, None, self.datosMotor.depth) self.pte_tool_resigndraw = True self.pon_toolbar() self.main_window.activaJuego(True, False, siAyudas=False) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.put_pieces_bottom(is_white) self.remove_hints(True, siQuitarAtras=True) self.show_side_indicator(True) label = "%s: <b>%s</b>" % (_("Opponent"), self.datosMotor.label()) self.set_label1(label) nbsp = " " * 3 txt = "%s:%+d%s%s:%+d%s%s:%+d" % ( _("Win"), self.datosMotor.pgana, nbsp, _("Draw"), self.datosMotor.ptablas, nbsp, _("Loss"), self.datosMotor.ppierde, ) self.set_label2("<center>%s</center>" % txt) self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.check_boards_setposition() self.game.add_tag("Event", _("Lucas-Elo")) player = self.configuration.nom_player() other = self.datosMotor.name w, b = (player, other) if self.human_side else (other, player) self.game.add_tag("White", w) self.game.add_tag("Black", b)
def base_inicio(self, categorias, categoria, nivel, is_white, puntos): self.game_type = GT_COMPETITION_WITH_TUTOR self.liReiniciar = categoria, nivel, is_white self.dbm = CompetitionWithTutor.DBManagerCWT() self.resultado = None self.human_is_playing = False self.state = ST_PLAYING self.is_competitive = True self.plays_instead_of_me_option = True self.human_side = is_white self.is_engine_side_white = not is_white self.rm_rival = None self.categorias = categorias self.categoria = categoria self.nivelJugado = nivel self.puntos = puntos self.is_tutor_enabled = ( Code.dgtDispatch is None) and self.configuration.x_default_tutor_active self.main_window.set_activate_tutor(self.is_tutor_enabled) self.tutor_book = Books.BookGame(Code.tbook) self.hints = categoria.hints self.ayudas_iniciales = self.hints # Se guarda para guardar el PGN self.in_the_opening = True self.opening = Opening.OpeningPol(nivel) # lee las aperturas self.rival_conf = self.dbm.get_current_rival() self.xrival = self.procesador.creaManagerMotor(self.rival_conf, None, nivel) self.main_window.pon_toolbar( (TB_CANCEL, TB_RESIGN, TB_TAKEBACK, TB_REINIT, TB_ADJOURN, TB_CONFIG, TB_UTILITIES)) self.main_window.activaJuego(True, False) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.put_pieces_bottom(is_white) self.ponAyudas(self.hints) self.show_side_indicator(True) label = "%s: %s\n%s %s %d" % (_("Opponent"), self.xrival.name, categoria.name(), _("Level"), nivel) if self.puntos: label += " (+%d %s)" % (self.puntos, _("points")) self.set_label1(label) self.xrotulo2() self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.game.set_tag("Event", _("Competition with tutor")) player = self.configuration.nom_player() other = "%s (%s %d)" % (self.xrival.name, _("Level"), self.nivelJugado) w, b = (player, other) if self.human_side else (other, player) self.game.set_tag("White", w) self.game.set_tag("Black", b) self.is_analyzed_by_tutor = False self.check_boards_setposition() self.game.tag_timestart()
def start(self, resistance, numEngine, key): self.game_type = GT_RESISTANCE self.resistance = resistance self.numEngine = numEngine self.key = key is_white = "WHITE" in key self.segundos, self.puntos, self.maxerror = resistance.actual() self.movimientos = 0 self.puntosRival = 0 self.human_is_playing = False self.state = ST_PLAYING self.human_side = is_white self.is_engine_side_white = not is_white self.siBoxing = True self.rm_rival = None self.in_the_opening = False self.opening = Opening.OpeningPol(5) # lee las aperturas # debe hacerse antes que rival self.xarbitro = self.procesador.creaManagerMotor( self.configuration.tutor, self.segundos * 1000, None) self.xarbitro.anulaMultiPV() engine = resistance.dameClaveEngine(numEngine) rival = self.configuration.buscaRival(engine) self.xrival = self.procesador.creaManagerMotor(rival, self.segundos * 1000, None) self.main_window.pon_toolbar( (TB_RESIGN, TB_REINIT, TB_CONFIG, TB_UTILITIES)) self.main_window.activaJuego(True, False, siAyudas=False) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.put_pieces_bottom(is_white) self.remove_hints() self.set_activate_tutor(False) self.show_side_indicator(True) self.ponRotuloObjetivo() self.ponRotuloActual() self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.check_boards_setposition() tp = self.resistance.tipo if tp: b = n = False if tp == "p2": if is_white: b = True else: n = True elif tp == "p1": if is_white: n = True else: b = True self.board.mostrarPiezas(b, n) self.play_next_move()
def base_inicio(self, record): self.game_type = GT_AGAINST_GM self.hints = 9999 # Para que analice sin problemas self.puntos = 0 self.record = record self.gm = record.gm self.is_white = record.is_white self.modo = record.modo self.with_adjudicator = record.with_adjudicator self.show_evals = record.show_evals self.engine = record.engine self.vtime = record.vtime self.depth = record.depth self.multiPV = record.multiPV self.mostrar = record.mostrar self.select_rival_move = record.select_rival_move self.jugInicial = record.jugInicial self.gameElegida = record.gameElegida self.bypass_book = record.bypass_book self.opening = record.opening self.on_bypass_book = True if self.bypass_book else False if self.on_bypass_book: self.bypass_book.polyglot() self.on_opening = True if self.opening else False self.siAnalizando = False if self.with_adjudicator: self.puntos = 0 tutor = self.configuration.buscaRival(self.engine) t_t = self.vtime * 100 self.xtutor = self.procesador.creaManagerMotor( tutor, t_t, self.depth) self.xtutor.set_multipv(self.multiPV) self.analysis = None self.continueTt = not Code.configuration.x_engine_notbackground self.book = Opening.OpeningPol(999) self.thinking(True) default = Code.path_resource("GM") carpeta = default if self.modo == "estandar" else self.configuration.personal_training_folder self.motorGM = GM.GM(carpeta, self.gm) self.motorGM.filter_side(self.is_white) if self.gameElegida is not None: self.motorGM.set_game_selected(self.gameElegida) self.human_side = self.is_white self.is_engine_side_white = not self.is_white self.thinking(False) self.main_window.pon_toolbar( (TB_CLOSE, TB_REINIT, TB_ADJOURN, TB_CONFIG, TB_UTILITIES)) self.main_window.activaJuego(True, False) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.show_side_indicator(True) self.remove_hints() self.put_pieces_bottom(self.is_white) dic = GM.dic_gm() self.nombreGM = dic[ self.gm.lower()] if self.modo == "estandar" else self.gm rot = _("Grandmaster") rotulo1 = rot + ": <b>%s</b>" if self.modo == "estandar" else "<b>%s</b>" self.set_label1(rotulo1 % self.nombreGM) self.rival_name = "" self.textoPuntuacion = "" self.ponRotuloSecundario() self.pgnRefresh(True) self.ponCapInfoPorDefecto() self.state = ST_PLAYING self.check_boards_setposition() self.play_next_move()
def start(self, dbwashing, washing, engine): self.dbwashing = dbwashing self.washing = washing self.engine = engine self.game_type = GT_WASHING_CREATE self.resultado = None self.human_is_playing = False self.state = ST_PLAYING is_white = self.engine.color self.human_side = is_white self.is_engine_side_white = not is_white self.is_competitive = True self.opening = Opening.OpeningPol(30, self.engine.elo) self.is_tutor_enabled = True self.siAnalizando = False # self.main_window.set_activate_tutor(self.is_tutor_enabled) rival = self.configuration.buscaRival(self.engine.key) self.xrival = self.procesador.creaManagerMotor(rival, None, None) self.xrival.is_white = self.is_engine_side_white self.rm_rival = None self.tmRival = 15.0 * 60.0 * engine.elo / 3000.0 self.xtutor.maximizaMultiPV() self.is_analyzed_by_tutor = False self.main_window.activaJuego(True, False, False) self.remove_hints() li = [TB_CLOSE, TB_REINIT, TB_TAKEBACK] self.main_window.pon_toolbar(li) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.show_side_indicator(True) self.put_pieces_bottom(is_white) self.set_label1("%s: %s\n%s: %s\n %s: %s" % (_("Rival"), self.engine.name, _("Task"), self.engine.lbState(), _("Tutor"), self.xtutor.name)) self.ponRotuloDatos() self.ponCapInfoPorDefecto() self.pgnRefresh(True) game = dbwashing.restoreGame(engine) if not (game is None): if not game.is_finished(): self.game = game self.goto_end() self.main_window.base.pgnRefresh() else: player = self.configuration.nom_player() other = self.xrival.name w, b = (player, other) if self.human_side else (other, player) self.game.set_tag("White", w) self.game.set_tag("Black", b) self.check_boards_setposition() self.play_next_move()
def base_inicio(self, dic_var): self.reinicio = dic_var self.cache = dic_var.get("cache", {}) self.game_type = GT_AGAINST_CHILD_ENGINE self.human_is_playing = False self.plays_instead_of_me_option = True self.state = ST_PLAYING self.summary = { } # numJugada : "a"ccepted, "s"ame, "r"ejected, dif points, time used self.with_summary = dic_var.get("SUMMARY", False) is_white = dic_var["ISWHITE"] self.human_side = is_white self.is_engine_side_white = not is_white w, b = self.configuration.nom_player(), _F(dic_var["RIVAL"]) if not is_white: w, b = b, w self.game.set_tag("Event", _("Opponents for young players")) self.game.set_tag("White", w) self.game.set_tag("Black", b) self.with_takeback = True cmrival = self.configuration.buscaRival("irina", None) self.xrival = self.procesador.creaManagerMotor(cmrival, None, 2) self.rival_name = dic_var["RIVAL"] self.xrival.set_option("Personality", self.rival_name) if not dic_var["FASTMOVES"]: self.xrival.set_option("Max Time", "5") self.xrival.set_option("Min Time", "1") self.xrival.name = _F(self.rival_name) self.lirm_engine = [] self.next_test_resign = 0 self.resign_limit = -99999 # never self.aperturaObl = self.aperturaStd = None self.human_is_playing = False self.state = ST_PLAYING self.siAnalizando = False self.aperturaStd = Opening.OpeningPol(1) self.set_dispatcher(self.player_has_moved) self.main_window.set_notify(self.mueve_rival_base) self.thinking(True) self.main_window.set_activate_tutor(False) self.hints = 0 self.ayudas_iniciales = 0 self.xrival.is_white = self.is_engine_side_white self.siTiempo = dic_var["SITIEMPO"] if self.siTiempo: self.maxSegundos = dic_var["MINUTOS"] * 60.0 self.segundosJugada = dic_var["SEGUNDOS"] self.secs_extra = dic_var.get("MINEXTRA", 0) * 60.0 self.vtime = { WHITE: Util.Timer(self.maxSegundos), BLACK: Util.Timer(self.maxSegundos) } time_control = "%d" % int(self.maxSegundos) if self.segundosJugada: time_control += "+%d" % self.segundosJugada self.game.set_tag("TimeControl", time_control) self.thinking(False) li = [ TB_CANCEL, TB_RESIGN, TB_TAKEBACK, TB_REINIT, TB_ADJOURN, TB_PAUSE, TB_CONFIG, TB_UTILITIES ] self.main_window.pon_toolbar(li) self.main_window.activaJuego(True, self.siTiempo) self.set_dispatcher(self.player_has_moved) self.set_position(self.game.last_position) self.show_side_indicator(True) self.remove_hints(True, siQuitarAtras=False) self.put_pieces_bottom(is_white) imagen = getattr(Iconos, "pm%s" % self.rival_name) self.main_window.base.lbRotulo1.ponImagen(imagen()) self.main_window.base.lbRotulo1.show() self.ponCapInfoPorDefecto() self.pgnRefresh(True) rival = self.xrival.name player = self.configuration.x_player bl, ng = player, rival if self.is_engine_side_white: bl, ng = ng, bl if self.siTiempo: tpBL = self.vtime[True].etiqueta() tpNG = self.vtime[False].etiqueta() self.main_window.ponDatosReloj(bl, tpBL, ng, tpNG) self.refresh() self.main_window.start_clock(self.set_clock, 400) else: self.main_window.base.change_player_labels(bl, ng) self.main_window.set_notify(self.mueve_rival_base) self.check_boards_setposition() self.game.tag_timestart()