def miraBuffer(self): if not self.siPlay: return self.lock = True li = self.buffer.split("\n") if self.buffer.endswith("\n"): self.buffer = "" else: self.buffer = li[-1] li = li[:-1] mrm = XMotorRespuesta.MRespuestaMotor("", " w " in self.fen) mrm.dispatch("\n".join(li), None, 9999) mrm.maxTiempo = None mrm.maxProfundidad = 9999 if mrm.liMultiPV: cp = ControlPosicion.ControlPosicion() cp.leeFen(self.fen) txt = ['<table border="1" cellpadding="4" cellspacing="0" style="border-color: #ACA899">', ] def tr(tp, mas=""): txt[0] += '<tr><th>%s</th><td align="right">%.01f%%</td><td>%s%s</td></tr>' % (tp[0], tp[1], mas, tp[2]) tp = AnalisisIndexes.tp_gamestage(cp, mrm) txt[0] += '<tr><th>%s</th><td align="right">%d</td><td>%s</td></tr>' % (tp[0], tp[1], tp[2]) pts = mrm.liMultiPV[0].puntosABS() if pts: w, b = _("White"), _("Black") siW = "w" in self.fen if pts > 0: mas = w if siW else b elif pts < 0: mas = b if siW else w mas += "-" else: mas = "" tr(AnalisisIndexes.tp_winprobability(cp, mrm), mas) tr(AnalisisIndexes.tp_complexity(cp, mrm)) tr(AnalisisIndexes.tp_efficientmobility(cp, mrm)) tr(AnalisisIndexes.tp_narrowness(cp, mrm)) tr(AnalisisIndexes.tp_piecesactivity(cp, mrm)) tr(AnalisisIndexes.tp_exchangetendency(cp, mrm)) tp = AnalisisIndexes.tp_positionalpressure(cp, mrm) txt[0] += '<tr><th>%s</th><td align="right">%dcp</td><td></td></tr>' % (tp[0], int(tp[1])) tr(AnalisisIndexes.tp_materialasymmetry(cp, mrm)) txt[0] += "</table>" self.em.ponHtml(txt[0]) self.lock = False
def compruebaInput(self): if not self.engine: return self.veces += 1 if self.veces == 3: self.veces = 0 if self.siPlay: mrm = self.engine.ac_estado() rm = mrm.rmBest() if rm and rm.depth > self.depth: if mrm.li_rm: cp = Position.Position() cp.read_fen(self.fen) self.liData = [] def tr(tp, mas=""): self.liData.append((tp[0], "%.01f%%" % tp[1], "%s%s" % (mas, tp[2]))) tp = AnalisisIndexes.tp_gamestage(cp, mrm) self.liData.append((tp[0], "%d" % tp[1], tp[2])) pts = mrm.li_rm[0].centipawns_abs() mas = "" if pts: w, b = _("White"), _("Black") siW = "w" in self.fen if pts > 0: mas = w if siW else b elif pts < 0: mas = b if siW else w mas += "-" tr(AnalisisIndexes.tp_winprobability(cp, mrm), mas) tr(AnalisisIndexes.tp_complexity(cp, mrm)) tr(AnalisisIndexes.tp_efficientmobility(cp, mrm)) tr(AnalisisIndexes.tp_narrowness(cp, mrm)) tr(AnalisisIndexes.tp_piecesactivity(cp, mrm)) tr(AnalisisIndexes.tp_exchangetendency(cp, mrm)) tp = AnalisisIndexes.tp_positionalpressure(cp, mrm) self.liData.append((tp[0], "%d" % int(tp[1]), "")) tr(AnalisisIndexes.tp_materialasymmetry(cp, mrm)) self.grid.refresh() self.grid.resizeRowsToContents() QTUtil.refresh_gui() self.cpu.compruebaInput()
def xprocesa(self, dicPGN, partida, tmpBP, textoOriginal): """ Realiza el analisis @param dicPGN: etiquetas de cabecera de la partida @param partida: partida a analizar @param textoOriginal: texto de la partida, por si se graba la partida original """ self.siBMTblunders = False self.siBMTbrilliancies = False siBP2 = hasattr( tmpBP, "bp2" ) # Para diferenciar el analisis de una partida que usa una progressbar unica del # analisis de muchas, que usa doble def guiDispatch(rm): return not tmpBP.siCancelado() self.xgestor.ponGuiDispatch( guiDispatch ) # Dispatch del motor, si esta puesto a 4 minutos por ejemplo que # compruebe si se ha indicado que se cancele. siBlunders = self.kblunders > 0 siBrilliancies = self.fnsbrilliancies or self.pgnbrilliancies or self.bmtbrilliancies if self.bmtblunders and self.bmt_listaBlunders is None: self.bmt_listaBlunders = BMT.BMT_Lista() if self.bmtbrilliancies and self.bmt_listaBrilliancies is None: self.bmt_listaBrilliancies = BMT.BMT_Lista() xlibroAperturas = self.libroAperturas xblancas = self.blancas xnegras = self.negras if self.liJugadores: for x in ["BLACK", "WHITE"]: if x in dicPGN: jugador = dicPGN[x].upper() si = False for uno in self.liJugadores: siZ = uno.endswith("*") siA = uno.startswith("*") uno = uno.replace("*", "").strip().upper() if siA: if jugador.endswith(uno): si = True if siZ: # form para poner siA y siZ si = uno in jugador elif siZ: if jugador.startswith(uno): si = True elif uno == jugador: si = True if si: break if not si: if x == "BLACK": xnegras = False else: xblancas = False if not (xblancas or xnegras): return clpartida = Util.microsegundosRnd() txtPartida = partida.guardaEnTexto() siPonerPGNOriginalBlunders = False siPonerPGNOriginalBrilliancies = False nJugadas = len(partida) if self.listaElegidas: liJugadas = self.listaElegidas else: liJugadas = range(nJugadas) if xlibroAperturas: liBorrar = [] for pos, njg in enumerate(liJugadas): if tmpBP.siCancelado(): self.xgestor.quitaGuiDispatch() return # # Si esta en el libro jg = partida.jugada(njg) if xlibroAperturas.miraListaJugadas(jg.posicionBase.fen()): liBorrar.append(pos) continue else: break if liBorrar: liBorrar.reverse() for x in liBorrar: del liJugadas[x] if self.desdeelfinal: liJugadas.reverse() nJugadas = len(liJugadas) if siBP2: tmpBP.ponTotal(2, nJugadas) else: tmpBP.ponTotal(nJugadas) for npos, njg in enumerate(liJugadas): if tmpBP.siCancelado(): self.xgestor.quitaGuiDispatch() return jg = partida.jugada(njg) if siBP2: tmpBP.pon(2, npos + 1) else: tmpBP.pon(npos + 1) if self.rutDispatchBP: self.rutDispatchBP(npos, nJugadas, njg) if tmpBP.siCancelado(): self.xgestor.quitaGuiDispatch() return # # Fin de partida # if jg.siJaqueMate or jg.siTablas(): # continue # # blancas y negras siBlancas = jg.posicionBase.siBlancas if siBlancas: if not xblancas: continue else: if not xnegras: continue # -# previos if not self.siBorrarPrevio: if jg.analisis: continue # -# Procesamos resp = self.xgestor.analizaJugadaPartida( partida, njg, self.tiempo, depth=self.depth, brDepth=self.dpbrilliancies, brPuntos=self.ptbrilliancies, stability=self.stability, st_centipawns=self.st_centipawns, st_depths=self.st_depths, st_timelimit=self.st_timelimit) if not resp: self.xgestor.quitaGuiDispatch() return jg.analisis = resp cp = jg.posicionBase mrm = resp[0] jg.complexity = AnalisisIndexes.calc_complexity(cp, mrm) jg.winprobability = AnalisisIndexes.calc_winprobability(cp, mrm) jg.narrowness = AnalisisIndexes.calc_narrowness(cp, mrm) jg.efficientmobility = AnalisisIndexes.calc_efficientmobility( cp, mrm) jg.piecesactivity = AnalisisIndexes.calc_piecesactivity(cp, mrm) jg.exchangetendency = AnalisisIndexes.calc_exchangetendency( cp, mrm) if siBlunders or siBrilliancies or self.siVariantes: mrm, posAct = jg.analisis rm = mrm.liMultiPV[posAct] rm.ponBlunder(0) mj = mrm.liMultiPV[0] rm_pts = rm.puntosABS() dif = mj.puntosABS() - rm_pts fen = jg.posicionBase.fen() if self.siVariantes: limite = self.alm.limitemasvariantes if (limite == 0) or (dif >= limite): if not (self.alm.mejorvariante and dif == 0): jg.analisis2variantes(Partida.Partida(), self.alm, self.siBorrarPrevio) if dif >= self.kblunders: rm.ponBlunder(dif) self.grabaTactic(dicPGN, partida, njg, mrm, posAct) if self.grabaPGN(self.pgnblunders, mrm.nombre, dicPGN, fen, jg, rm, mj): siPonerPGNOriginalBlunders = True if self.bmtblunders: self.grabaBMT(True, fen, mrm, posAct, clpartida, txtPartida) self.siBMTblunders = True if rm.nivelBrillante(): jg.masCritica1_4("3") self.grabaFNS(self.fnsbrilliancies, fen) if self.grabaPGN(self.pgnbrilliancies, mrm.nombre, dicPGN, fen, jg, rm, None): siPonerPGNOriginalBrilliancies = True if self.bmtbrilliancies: self.grabaBMT(False, fen, mrm, posAct, clpartida, txtPartida) self.siBMTbrilliancies = True else: nag, color = mrm.setNAG_Color(self.configuracion, rm) if nag: jg.masCritica1_4(str(nag)) # Ponemos el texto original en la ultima if siPonerPGNOriginalBlunders and self.oriblunders: f = codecs.open(self.pgnblunders, "a", 'utf-8', 'ignore') f.write("\n%s\n\n" % textoOriginal) f.close() if siPonerPGNOriginalBrilliancies and self.oribrilliancies: f = codecs.open(self.pgnbrilliancies, "a", 'utf-8', 'ignore') f.write("\n%s\n\n" % textoOriginal) f.close() self.xgestor.quitaGuiDispatch()
def piecesactivity(self): return AnalisisIndexes.get_piecesactivity(self.jg.posicionBase, self.mrm)
def efficientmobility(self): return AnalisisIndexes.get_efficientmobility(self.jg.posicionBase, self.mrm)
def narrowness(self): return AnalisisIndexes.get_narrowness(self.jg.posicionBase, self.mrm)
def complexity(self): return AnalisisIndexes.get_complexity(self.move.position_before, self.mrm)
def piecesactivity(self): return AnalisisIndexes.get_piecesactivity(self.move.position_before, self.mrm)
def efficientmobility(self): return AnalisisIndexes.get_efficientmobility(self.move.position_before, self.mrm)
def narrowness(self): return AnalisisIndexes.get_narrowness(self.move.position_before, self.mrm)
def winprobability(self): return AnalisisIndexes.get_winprobability(self.move.position_before, self.mrm)
def complexity(self): return AnalisisIndexes.get_complexity(self.jg.posicionBase, self.mrm)
def xprocesa(self, dicPGN, partida, tmpBP, textoOriginal): """ Realiza el analisis @param dicPGN: etiquetas de cabecera de la partida @param partida: partida a analizar @param textoOriginal: texto de la partida, por si se graba la partida original """ self.siBMTblunders = False self.siBMTbrilliancies = False siBP2 = hasattr(tmpBP, "bp2") # Para diferenciar el analisis de una partida que usa una progressbar unica del analisis de muchas, que usa doble def guiDispatch(rm): return not tmpBP.siCancelado() self.xgestor.ponGuiDispatch( guiDispatch) # Dispatch del motor, si esta puesto a 4 minutos por ejemplo que compruebe si se ha indicado que se cancele. siBlunders = self.kblunders > 0 siBrilliancies = self.fnsbrilliancies or self.pgnbrilliancies or self.bmtbrilliancies if self.bmtblunders and self.bmt_listaBlunders is None: self.bmt_listaBlunders = BMT.BMT_Lista() if self.bmtbrilliancies and self.bmt_listaBrilliancies is None: self.bmt_listaBrilliancies = BMT.BMT_Lista() xlibroAperturas = self.libroAperturas xblancas = self.blancas xnegras = self.negras if self.liJugadores: for x in ["BLACK", "WHITE"]: if x in dicPGN: jugador = dicPGN[x].upper() si = False for uno in self.liJugadores: siZ = uno.endswith("*") siA = uno.startswith("*") uno = uno.replace("*", "").strip().upper() if siA: if jugador.endswith(uno): si = True if siZ: # form apara poner siA y siZ si = uno in jugador elif siZ: if jugador.startswith(uno): si = True elif uno == jugador: si = True if si: break if not si: if x == "BLACK": xnegras = False else: xblancas = False if not ( xblancas or xnegras ): return clpartida = Util.microsegundosRnd() txtPartida = partida.guardaEnTexto() siPonerPGNOriginalBlunders = False siPonerPGNOriginalBrilliancies = False nJugadas = len(partida.liJugadas) if self.listaElegidas: liJugadas = self.listaElegidas else: liJugadas = range(nJugadas) if xlibroAperturas: liBorrar = [] for pos, njg in enumerate(liJugadas): if tmpBP.siCancelado(): self.xgestor.quitaGuiDispatch() return # # Si esta en el libro jg = partida.liJugadas[njg] if xlibroAperturas.miraListaJugadas(jg.posicionBase.fen()): liBorrar.append(pos) continue else: break if liBorrar: liBorrar.reverse() for x in liBorrar: del liJugadas[x] if self.desdeelfinal: liJugadas.reverse() nJugadas = len(liJugadas) if siBP2: tmpBP.ponTotal(2, nJugadas) else: tmpBP.ponTotal(nJugadas) for npos, njg in enumerate(liJugadas): if tmpBP.siCancelado(): self.xgestor.quitaGuiDispatch() return jg = partida.liJugadas[njg] if siBP2: tmpBP.pon(2, npos + 1) else: tmpBP.pon(npos + 1) if self.rutDispatchBP: self.rutDispatchBP(npos, nJugadas, njg) if tmpBP.siCancelado(): self.xgestor.quitaGuiDispatch() return # # Fin de partida # if jg.siJaqueMate or jg.siTablas(): # continue # # blancas y negras siBlancas = jg.posicionBase.siBlancas if siBlancas: if not xblancas: continue else: if not xnegras: continue ## previos if not self.siBorrarPrevio: if jg.analisis: continue ## Procesamos resp = self.xgestor.analizaJugada(jg, self.tiempo, depth=self.depth, brDepth=self.dpbrilliancies, brPuntos=self.ptbrilliancies) if not resp: self.xgestor.quitaGuiDispatch() return jg.analisis = resp cp = jg.posicionBase mrm = resp[0] jg.complexity = AnalisisIndexes.calc_complexity(cp, mrm) jg.winprobability = AnalisisIndexes.calc_winprobability(cp, mrm) jg.narrowness = AnalisisIndexes.calc_narrowness(cp, mrm) jg.efficientmobility = AnalisisIndexes.calc_efficientmobility(cp, mrm) jg.piecesactivity = AnalisisIndexes.calc_piecesactivity(cp, mrm) jg.exchangetendency = AnalisisIndexes.calc_exchangetendency(cp, mrm) if siBlunders or siBrilliancies or self.siVariantes: mrm, posAct = jg.analisis rm = mrm.liMultiPV[posAct] rm.ponBlunder(0) mj = mrm.liMultiPV[0] rm_pts = rm.puntosABS() dif = mj.puntosABS() - rm_pts if dif == 0 and len(mrm.liMultiPV) > 2: jg.masCritica1_4("1") fen = jg.posicionBase.fen() if self.siVariantes: limite = self.alm.limitemasvariantes if (limite == 0) or (dif >= limite): if not (self.alm.mejorvariante and dif == 0): jg.analisis2variantes(Partida.Partida(), self.alm, self.siBorrarPrevio) if dif >= self.kblunders: jg.masCritica1_4("2" if dif < 100 else "4") rm.ponBlunder(dif) self.grabaTactic(dicPGN, partida, njg, mrm, posAct) if self.grabaPGN(self.pgnblunders, mrm.nombre, dicPGN, fen, jg, rm, mj): siPonerPGNOriginalBlunders = True if self.bmtblunders: self.grabaBMT(True, fen, mrm, posAct, clpartida, txtPartida) self.siBMTblunders = True if rm.nivelBrillante(): jg.masCritica1_4("3") self.grabaFNS(self.fnsbrilliancies, fen) if self.grabaPGN(self.pgnbrilliancies, mrm.nombre, dicPGN, fen, jg, rm, None): siPonerPGNOriginalBrilliancies = True if self.bmtbrilliancies: self.grabaBMT(False, fen, mrm, posAct, clpartida, txtPartida) self.siBMTbrilliancies = True # Ponemos el texto original en la ultima if siPonerPGNOriginalBlunders and self.oriblunders: f = codecs.open(self.pgnblunders, "a", 'utf-8', 'ignore') f.write("\n%s\n\n" % textoOriginal) f.close() if siPonerPGNOriginalBrilliancies and self.oribrilliancies: f = codecs.open(self.pgnbrilliancies, "a", 'utf-8', 'ignore') f.write("\n%s\n\n" % textoOriginal) f.close() self.xgestor.quitaGuiDispatch()
def winprobability(self): return AnalisisIndexes.get_winprobability(self.jg.posicionBase, self.mrm)
def miraBuffer(self): if not self.siPlay: return self.lock = True li = self.buffer.split("\n") if self.buffer.endswith("\n"): self.buffer = "" else: self.buffer = li[-1] li = li[:-1] mrm = XMotorRespuesta.MRespuestaMotor("", " w " in self.fen) mrm.dispatch("\n".join(li)) mrm.ordena() mrm.maxTiempo = None mrm.maxProfundidad = 9999 if mrm.liMultiPV: cp = ControlPosicion.ControlPosicion() cp.leeFen(self.fen) litxt = ['<table border="1" cellpadding="4" cellspacing="0" style="border-color: #ACA899">', ] def tr(tp, mas=""): litxt.append('<tr><th>%s</th><td align="right">%.01f%%</td><td>%s%s</td></tr>' % (tp[0], tp[1], mas, tp[2])) tp = AnalisisIndexes.tp_gamestage(cp, mrm) litxt.append('<tr><th>%s</th><td align="right">%d</td><td>%s</td></tr>' % (tp[0], tp[1], tp[2])) pts = mrm.liMultiPV[0].puntosABS() if pts: w, b = _("White"), _("Black") siW = "w" in self.fen if pts > 0: mas = w if siW else b elif pts < 0: mas = b if siW else w mas += "-" else: mas = "" tr(AnalisisIndexes.tp_winprobability(cp, mrm), mas) tr(AnalisisIndexes.tp_complexity(cp, mrm)) tr(AnalisisIndexes.tp_efficientmobility(cp, mrm)) tr(AnalisisIndexes.tp_narrowness(cp, mrm)) tr(AnalisisIndexes.tp_piecesactivity(cp, mrm)) tr(AnalisisIndexes.tp_exchangetendency(cp, mrm)) tp = AnalisisIndexes.tp_positionalpressure(cp, mrm) litxt.append('<tr><th>%s</th><td align="right">%dcp</td><td></td></tr>' % (tp[0], int(tp[1]))) tr(AnalisisIndexes.tp_materialasymmetry(cp, mrm)) # tr(AnalisisIndexes.tp_test1(cp, mrm)) # tr(AnalisisIndexes.tp_test2(cp, mrm)) # tr(AnalisisIndexes.tp_test3(cp, mrm)) # tr(AnalisisIndexes.tp_test4(cp, mrm)) # tr(AnalisisIndexes.tp_test5(cp, mrm)) litxt.append("</table>") self.em.ponHtml("".join(litxt)) self.lock = False
def xprocesa(self, game, tmp_bp): self.si_bmt_blunders = False self.si_bmt_brilliancies = False si_bp2 = hasattr( tmp_bp, "bp2" ) # Para diferenciar el analisis de una game que usa una progressbar unica del # analisis de muchas, que usa doble def gui_dispatch(xrm): return not tmp_bp.is_canceled() self.xgestor.ponGuiDispatch( gui_dispatch ) # Dispatch del engine, si esta puesto a 4 minutos por ejemplo que # compruebe si se ha indicado que se cancele. si_blunders = self.kblunders > 0 si_brilliancies = self.fnsbrilliancies or self.pgnbrilliancies or self.bmtbrilliancies if self.bmtblunders and self.bmt_listaBlunders is None: self.bmt_listaBlunders = BMT.BMTLista() if self.bmtbrilliancies and self.bmt_listaBrilliancies is None: self.bmt_listaBrilliancies = BMT.BMTLista() xlibro_aperturas = self.book is_white = self.white is_black = self.black if self.li_players: for x in ["BLACK", "WHITE"]: player = game.get_tag(x) if player: si = False for uno in self.li_players: si_z = uno.endswith("*") si_a = uno.startswith("*") uno = uno.replace("*", "").strip().upper() if si_a: if player.endswith(uno): si = True if si_z: # form para poner si_a y si_z si = uno in player elif si_z: if player.startswith(uno): si = True elif uno == player: si = True if si: break if not si: if x == "BLACK": is_black = False else: is_white = False if not (is_white or is_black): return cl_game = Util.microsegundos_rnd() txt_game = game.save() si_poner_pgn_original_blunders = False si_poner_pgn_original_brilliancies = False n_jugadas = len(game) if self.li_selected: li_moves = self.li_selected else: li_moves = list(range(n_jugadas)) if xlibro_aperturas: li_borrar = [] for pos, njg in enumerate(li_moves): if tmp_bp.is_canceled(): self.xgestor.remove_gui_dispatch() return # # Si esta en el libro move = game.move(njg) if xlibro_aperturas.miraListaJugadas( move.position_before.fen()): li_borrar.append(pos) continue else: break if li_borrar: li_borrar.reverse() for x in li_borrar: del li_moves[x] if self.from_last_move: li_moves.reverse() n_jugadas = len(li_moves) if si_bp2: tmp_bp.ponTotal(2, n_jugadas) else: tmp_bp.ponTotal(n_jugadas) for npos, njg in enumerate(li_moves): if tmp_bp.is_canceled(): self.xgestor.remove_gui_dispatch() return move = game.move(njg) if si_bp2: tmp_bp.pon(2, npos + 1) else: tmp_bp.pon(npos) if self.rut_dispatch_bp: self.rut_dispatch_bp(npos, n_jugadas, njg) if tmp_bp.is_canceled(): self.xgestor.remove_gui_dispatch() return # # Fin de game # if move.siJaqueMate or move.is_draw: # continue # # white y black is_white = move.position_before.is_white if is_white: if not is_white: continue else: if not is_black: continue # -# previos if self.delete_previous: move.analysis = None # -# Procesamos if move.analysis is None: resp = self.xgestor.analizaJugadaPartida( game, njg, self.vtime, depth=self.depth, brDepth=self.dpbrilliancies, brPuntos=self.ptbrilliancies, stability=self.stability, st_centipawns=self.st_centipawns, st_depths=self.st_depths, st_timelimit=self.st_timelimit, ) if not resp: self.xgestor.remove_gui_dispatch() return move.analysis = resp cp = move.position_before mrm, pos_act = move.analysis move.complexity = AnalisisIndexes.calc_complexity(cp, mrm) move.winprobability = AnalisisIndexes.calc_winprobability(cp, mrm) move.narrowness = AnalisisIndexes.calc_narrowness(cp, mrm) move.efficientmobility = AnalisisIndexes.calc_efficientmobility( cp, mrm) move.piecesactivity = AnalisisIndexes.calc_piecesactivity(cp, mrm) move.exchangetendency = AnalisisIndexes.calc_exchangetendency( cp, mrm) if si_blunders or si_brilliancies or self.with_variations: rm = mrm.li_rm[pos_act] rm.ponBlunder(0) mj = mrm.li_rm[0] rm_pts = rm.centipawns_abs() dif = mj.centipawns_abs() - rm_pts fen = move.position_before.fen() if self.with_variations: limite = self.alm.limit_include_variations if (limite == 0) or (dif >= limite): if not (self.alm.best_variation and dif == 0): move.analisis2variantes(self.alm, self.delete_previous) if dif >= self.kblunders: rm.ponBlunder(dif) self.graba_tactic(game, njg, mrm, pos_act) if self.save_pgn(self.pgnblunders, mrm.name, game.dicTags(), fen, move, rm, mj): si_poner_pgn_original_blunders = True if self.bmtblunders: self.save_bmt(True, fen, mrm, pos_act, cl_game, txt_game) self.si_bmt_blunders = True if rm.level_brilliant(): move.add_nag(NAG_3) self.save_fns(self.fnsbrilliancies, fen) if self.save_pgn(self.pgnbrilliancies, mrm.name, game.dicTags(), fen, move, rm, None): si_poner_pgn_original_brilliancies = True if self.bmtbrilliancies: self.save_bmt(False, fen, mrm, pos_act, cl_game, txt_game) self.si_bmt_brilliancies = True else: nag, color = mrm.set_nag_color(self.configuracion, rm) if nag: move.add_nag(nag) # Ponemos el texto original en la ultima if si_poner_pgn_original_blunders and self.oriblunders: with open(self.pgnblunders, "at", encoding="utf-8", errors="ignore") as q: q.write("\n%s\n\n" % game.pgn()) if si_poner_pgn_original_brilliancies and self.oribrilliancies: with open(self.pgnbrilliancies, "at", encoding="utf-8", errors="ignore") as q: q.write("\n%s\n\n" % game.pgn()) self.xgestor.remove_gui_dispatch()