def gridDato(self, grid, fila, oColumna): rm = self.liData[fila] clave = oColumna.clave if clave == "EVALUATION": return rm.abrTexto() elif clave == "BESTMOVE": p = Partida.Partida(fen=self.fen) p.leerPV(rm.pv) li = p.pgnSP().split(" ") resp = "" if li: if ".." in li[0]: if len(li) > 1: resp = li[1] else: resp = li[0].lstrip("1234567890.") return resp else: p = Partida.Partida(fen=self.fen) p.leerPV(rm.pv) li = p.pgnSP().split(" ") if ".." in li[0]: li = li[1:] return " ".join(li[1:])
def grabaTactic(self, dicCab, partida, njg, mrm, posAct): if not self.tacticblunders: return # Esta creado el folder before = "AvoidBlunders.fns" after = "ExploitBlunders.fns" if not os.path.isdir(self.tacticblunders): dtactics = os.path.join(self.configuracion.dirPersonalTraining, "Tactics") if not os.path.isdir(dtactics): os.mkdir(dtactics) os.mkdir(self.tacticblunders) f = open(os.path.join(self.tacticblunders, "Config.ini"), "wb") f.write("""[COMMON] PUZZLES=20 REPEAT=0 SHOWTEXT=1 [TACTIC1] MENU=%s FILESW=%s:100 [TACTIC2] MENU=%s FILESW=%s:100 """ % (_("Avoid the blunder"), before, _("Take advantage of blunder"), after)) f.close() cab = "" for k, v in dicCab.iteritems(): ku = k.upper() if ku not in ("RESULT", "FEN"): cab += '[%s "%s"]' % (k, v) jg = partida.jugada(njg) fen = jg.posicionBase.fen() p = Partida.Partida(fen=fen) rm = mrm.liMultiPV[0] p.leerPV(rm.pv) f = open(os.path.join(self.tacticblunders, before), "ab") f.write( "%s||%s|%s%s\n" % (fen, p.pgnBaseRAW(), cab, partida.pgnBaseRAWcopy(None, njg - 1))) f.close() fen = jg.posicion.fen() p = Partida.Partida(fen=fen) rm = mrm.liMultiPV[posAct] li = rm.pv.split(" ") p.leerPV(" ".join(li[1:])) f = open(os.path.join(self.tacticblunders, after), "ab") f.write("%s||%s|%s%s\n" % (fen, p.pgnBaseRAW(), cab, partida.pgnBaseRAWcopy(None, njg))) f.close() self.siTacticBlunders = True self.procesador.entrenamientos.menu = None
def cambiarApertura(self, numero): self.partidaAperturas = Partida.Partida(self.ultPosicion) self.partidaAperturas.leerPV(self.liApPosibles[numero].a1h8) self.tableroAperturas.ponPosicion( self.partidaAperturas.jugada(0).posicion) self.maxApertura = len(self.partidaAperturas) self.mueveApertura(siInicio=True)
def leePGNRecno(self, recno): raw = self.leeAllRecno(recno) xpgn = raw["PGN"] result = raw["RESULT"] rtags = None if xpgn: xpgn = Util.blob2var(xpgn) if type(xpgn) in (str, unicode): return xpgn, result if "RTAGS" in xpgn: rtags = xpgn["RTAGS"] else: p = Partida.PartidaCompleta() p.restore(xpgn["FULLGAME"]) return p.pgn(), result pgn = xpv2pgn(raw["XPV"]) drots["PLIES"] = "PlyCount" litags = [] for field in self.liCamposBase: v = raw[field] if v: litags.append('[%s "%s"]' % (drots.get(field, field), str(v))) if rtags: for k, v in rtags: litags.append('[%s "%s"]' % (k, v)) tags = "\n".join(litags) return "%s\n\n%s\n" % (tags, pgn), result
def updateStatus(self): if self.terminado: return if not self.summaryActivo: txt = "" else: partida = self.summaryActivo.get("partida", Partida.PartidaCompleta()) nj = partida.numJugadas() if nj > 1: p = partida.copia(nj - 2) txt = "%s | " % p.pgnBaseRAW() else: txt = "" siPte = self.dbGames.siFaltanRegistrosPorLeer() if not siPte: recs = self.dbGames.reccount() if recs: txt += "%s: %d" % (_("Games"), recs) if self.where: txt += " | %s: %s" % (_("Filter"), self.where) if siPte: QtCore.QTimer.singleShot(1000, self.updateStatus) self.status.showMessage(txt, 0)
def ponPV(self, pvMirar): if not pvMirar: self.actualizaPV(None) self.cambiaInfoMove() else: self.analisisMRM = None dicAnalisis = {} self.fenM2 = None if pvMirar is not None: p = Partida.Partida() if pvMirar: p.leerPV(pvMirar) self.fenM2 = p.ultPosicion.fenM2() self.analisisMRM = self.bookGuide.dbAnalisis.mrm(self.fenM2) if self.analisisMRM: for rm in self.analisisMRM.liMultiPV: dicAnalisis[rm.movimiento()] = rm li = pvMirar.split(" ") self.pvBase = " ".join(li[:-1]) busca = li[-1] self.liMoves = self.dbGames.getSummary(pvMirar, dicAnalisis, self.siFigurinesPGN) for fila, move in enumerate(self.liMoves): if move["pvmove"] == busca: self.grid.goto(fila, 0)
def readID(self, xid): db = Base.DBBase(self._db) dbf = db.dbfT("data", "LEVEL,WHITE,CABS,MOVS", condicion="ROWID=%d" % xid) dbf.leer() dbf.gotop() self.nivel = dbf.LEVEL siBlancas = dbf.WHITE self.siJugamosConBlancas = siBlancas self.siRivalConBlancas = not siBlancas pv = LCEngine.xpv2pv(dbf.MOVS) self.partidaObj = Partida.Partida() self.partidaObj.leerPV(pv) self.posJugadaObj = 0 self.numJugadasObj = self.partidaObj.numJugadas() self.cabs = collections.OrderedDict() li = dbf.CABS.split("\n") for x in li: if x: clave, valor = x.split('=') self.cabs[clave] = valor dbf.cerrar() db.cerrar()
def haz_partida(liMoves): njg = len(liMoves) if njg > maxDepth: liMoves = liMoves[:maxDepth] pv = " ".join([move.pv for move in liMoves]) partida = Partida.Partida() partida.leerPV(pv) pv = partida.pv() if base and not pv.startswith(base): return xpv = LCEngine.pv2xpv(pv) updated = False for npos, xpv_ant in enumerate(self.li_xpv): if xpv_ant.startswith(xpv): return if xpv.startswith(xpv_ant): cursor.execute(sql_update, (xpv, xpv_ant)) self.li_xpv[npos] = xpv updated = True break if not updated: cursor.execute(sql_insert, (xpv, )) self.li_xpv.append(xpv) for njug, move in enumerate(liMoves): for lim in move.variantes: limovnv = [liMoves[j].clona() for j in range(njug)] for move in limovnv: move.variantes = [] limovnv.extend(lim.liMoves) haz_partida(limovnv)
def __init__(self, moveOwner, fen, dbCache): self.moveOwner = moveOwner self.dbCache = dbCache if not moveOwner: self.nivel = 0 cp = ControlPosicion.ControlPosicion() cp.leeFen(fen) self.partidaBase = Partida.Partida(cp) else: self.nivel = self.moveOwner.listaMovesPadre.nivel + 1 self.partidaBase = self.moveOwner.partida.copia() self.fenM2 = self.partidaBase.ultPosicion.fenM2() dicCache = self.dbCache[self.fenM2] LCEngine.setFen(self.fenM2 + " 0 1") liMov = [xpv[1:] for xpv in LCEngine.getMoves()] liMov.sort() liMoves = [] for pv in liMov: um = UnMove(self, pv, dicCache) liMoves.append(um) self.liMoves = liMoves self.liMovesInicial = liMoves[:] self.liAnalisis = dicCache.get("ANALISIS", []) if dicCache else [] # self.analisisActivo # self.dicAnalisis self.ponAnalisisActivo(dicCache.get("ANALISIS_ACTIVO", None) if dicCache else None)
def leePartidaRaw(self, raw): p = Partida.PartidaCompleta() xpgn = raw["PGN"] rtags = None if xpgn: xpgn = Util.blob2var(xpgn) if type(xpgn) in (str, unicode): # Version -9 p.readPGN(xpgn) return p if "RTAGS" in xpgn: rtags = xpgn["RTAGS"] else: p.restore(xpgn["FULLGAME"]) return p p.leerPV(xpv2pv(raw["XPV"])) rots = ["Event", "Site", "Date", "Round", "White", "Black", "Result", "WhiteTitle", "BlackTitle", "WhiteElo", "BlackElo", "WhiteUSCF", "BlackUSCF", "WhiteNA", "BlackNA", "WhiteType", "BlackType", "EventDate", "EventSponsor", "ECO", "UTCTime", "UTCDate", "TimeControl", "SetUp", "FEN", "PlyCount"] drots = {x.upper():x for x in rots} drots["PLIES"] = "PlyCount" litags = [] for field in self.liCamposBase: v = raw[field] if v: litags.append((drots.get(field, field), v if type(v) == unicode else str(v))) if rtags: litags.extend(rtags) p.setTags(litags) p.asignaApertura() return p
def miniatura(self): self.pensando(True) fichero = "./IntFiles/miniaturas.gm" tam = Util.tamFichero(fichero) pos = random.randint(0, tam - 600) with open(fichero) as fm: fm.seek(pos) fm.readline() linea = fm.readline() lig = linea.split("|") liTags = [] pv = lig[-1] for n in range(len(lig) - 1): if "·" in lig[n]: k, v = lig[n].split("·") liTags.append((k, v)) p = Partida.PartidaCompleta(liTags=liTags) p.leerPV(pv) txt = p.pgn() pgn = PGN.UnPGN() pgn.leeTexto(txt) self.pensando(False) if pgn.siError: return self.pgnPaste = txt self.mostrar(pgn, False)
def setPosicion(self, partida, njg, numTab=None): if partida is None: return jg = partida.jugada(njg) self.partida = partida self.njg = njg next = self.cb_nextmove.valor() if jg: if njg == 0: pv = partida.pv_hasta(njg) if next else "" else: pv = partida.pv_hasta(njg if next else njg - 1) posicion = jg.posicion if next else jg.posicionBase else: posicion = ControlPosicion.ControlPosicion().posInicial() pv = "" for ntab, (tipo, tab) in enumerate(self.liTabs): if ntab == 0: p = Partida.Partida() p.leerPV(pv) tab.setData(p.pgnHTML(siFigurines=self.configuracion.figurinesPGN), posicion) else: data = pv if tipo == "dbase" else posicion if numTab is not None: if ntab != numTab: continue if ntab > 1: tab.setData(data) tab.start()
def show_analisis(self, mrm): self.current_mrm = mrm self.current_posicion = self.posicion li = [] for rm in mrm.liMultiPV: partida = Partida.Partida(self.posicion) partida.leerPV(rm.pv) pgn = partida.pgnBaseRAW() lit = pgn.split(" ") siBlancas = self.posicion.siBlancas if siBlancas: pgn0 = lit[0].split(".")[-1] pgn1 = " ".join(lit[1:]) else: pgn0 = lit[1] pgn1 = " ".join(lit[2:]) if self.siFigurines: partida.ms_sol = pgn0, siBlancas, None, None, None, None, False, False else: partida.ms_sol = pgn0 partida.ms_pgn = pgn1 partida.ms_pdt = rm.abrTextoPDT() li.append(partida) self.li_analysis = li self.grid_analysis.refresh()
def siguienteJugada(self): self.pantalla.ponToolBar([k_mainmenu, k_abandonar]) self.estado = kJugando self.siJuegaHumano = False self.siCompetitivo = True self.linea_bloque = self.singularMoves.linea_bloque(self.pos_bloque) siBlancas = " w " in self.linea_bloque.fen self.siJugamosConBlancas = siBlancas self.siRivalConBlancas = not siBlancas self.pantalla.ponActivarTutor(False) self.quitaAyudas(True) self.partida = Partida.Partida(fen=self.linea_bloque.fen) self.ponPosicion(self.partida.ultPosicion) self.mostrarIndicador(True) self.ponPiezasAbajo(siBlancas) self.ponIndicador(siBlancas) self.pantalla.cambiaRotulosReloj("%d/10" % (self.pos_bloque+1,), _("Complete")) self.pantalla.ponRelojBlancas("", None) self.pantalla.ponRelojNegras(self.singularMoves.rotulo_media(), None) self.refresh() self.siJuegaHumano = True self.activaColor(siBlancas) self.pantalla.iniciaReloj(self.ponReloj, transicion=1500) self.time_inicio = time.time() self.ponReloj()
def mueveHumano(self, desde, hasta, coronacion=None): jgSel = self.checkMueveHumano(desde, hasta, coronacion) if not jgSel: return False fen = self.partida.ultPosicion.fen() pv = jgSel.movimiento().lower() if self.is_opening: op_pv = self.liPVopening[self.posOpening] if pv != op_pv: if self.must_win: QTUtil2.mensajeTemporal(self.pantalla, _("Wrong move"), 2) self.procesarAccion(k_reiniciar) else: QTUtil2.mensError( self.pantalla, "%s\n%s" % (_("Wrong move"), _("Right move: %s") % Partida.pv_san(fen, op_pv))) self.sigueHumano() return False self.posOpening += 1 if self.posOpening == len(self.liPVopening): self.is_opening = False self.movimientosPiezas(jgSel.liMovs) self.partida.ultPosicion = jgSel.posicion self.masJugada(jgSel, True) self.error = "" self.siguienteJugada() return True
def polyglot(self): recno = self.grid.recno() if recno < 0: return reg = self.lista[recno] # Pedimos el fichero a generar fbin = QTUtil2.salvaFichero(self, _("Polyglot book"), reg["NOMBRE"] + ".bin", _("Polyglot book") + " (*.bin)") if not fbin: return me = QTUtil2.unMomento(self) # Determinamos el fichero de trabajo plTMP = self.procesador.configuracion.ficheroTemporal( "deleteme_%d.pgn") n = 0 while True: fichTMP = plTMP % n if Util.existeFichero(fichTMP): n += 1 else: break # Creamos el fichero de trabajo f = open(fichTMP, "wb") for pv in reg["LISTA"]: f.write('[Result "1/2-1/2"]\n') p = Partida.Partida() p.leerPV(pv) f.write(p.pgnBase() + " 1/2-1/2\n\n") f.close() # Ejecutamos if VarGen.isWindows: exe = 'Engines/Windows/_tools/polyglot/polyglot.exe' else: exe = 'Engines/Linux/_tools/polyglot/polyglot' li = [ os.path.abspath(exe), 'make-book', "-pgn", fichTMP, "-bin", fbin, "-max-ply", "99", "-min-game", "1", "-uniform" ] Util.borraFichero(fbin) process = subprocess.Popen(li, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) me.final() # Mostramos el resultado txt = process.stdout.read() if os.path.isfile(fbin): txt += "\n" + _X(_("Book created : %1"), fbin) QTUtil2.mensaje(self, txt) Util.borraFichero(fichTMP)
def voyager2(self, partida): ptxt = Voyager.voyagerPartida(self, partida) if ptxt: partida = Partida.Partida() partida.recuperaDeTexto(ptxt) self.addPartida(partida) self.show_lines()
def __init__(self, moveOwner, fen, dbCache): self.moveOwner = moveOwner self.dbCache = dbCache if not moveOwner: self.nivel = 0 cp = ControlPosicion.ControlPosicion() cp.leeFen(fen) self.partidaBase = Partida.Partida(cp) else: self.nivel = self.moveOwner.listaMovesPadre.nivel + 1 self.partidaBase = self.moveOwner.partida.copia() self.fenM2 = self.partidaBase.ultPosicion.fenM2() dicCache = self.dbCache[self.fenM2] ml = MotorInterno.MotorInterno() ml.ponFen(self.fenM2 + " 0 1") ml.calculaEstado() liMov = ml.listaMovimientos() liMov.sort(key=lambda x: x.pv()) liMoves = [] for mov in liMov: um = UnMove(self, mov, dicCache) liMoves.append(um) self.liMoves = liMoves self.liMovesInicial = liMoves[:] self.liAnalisis = dicCache.get("ANALISIS", []) if dicCache else [] # self.analisisActivo # self.dicAnalisis self.ponAnalisisActivo(dicCache.get("ANALISIS_ACTIVO", None) if dicCache else None)
def actualizaPV(self, pvBase): self.pvBase = pvBase if not pvBase: pvMirar = "" else: pvMirar = self.pvBase self.analisisMRM = None dicAnalisis = {} self.fenM2 = None if pvMirar: p = Partida.Partida() if pvMirar: p.leerPV(pvMirar) self.fenM2 = p.ultPosicion.fenM2() self.analisisMRM = self.bookGuide.dbAnalisis.mrm(self.fenM2) if self.analisisMRM: for rm in self.analisisMRM.liMultiPV: dicAnalisis[rm.movimiento()] = rm self.liMoves = self.dbGames.getSummary(pvMirar, dicAnalisis, self.siFigurinesPGN, self.allmoves) self.grid.refresh() self.grid.gotop()
def ponPosRMactual(self, posRM): self.posRMactual = posRM self.rm = self.listaRM[self.posRMactual][0] self.partida = Partida.Partida(self.jg.posicionBase) self.partida.leerPV(self.rm.pv) self.partida.siTerminada() self.posMovActual = 0
def hazFEN(fen, lipv_ant, control): if bp.siCancelado(): return siWhite1 = " w " in fen book = bookW if siWhite1 else bookB liPV = book.miraListaPV(fen, siWhite1 == siWhite, onlyone=onlyone) if liPV and len(lipv_ant) < depth: for pv in liPV: setFen(fen) makeMove(pv) fenN = getFen() lipv_nue = lipv_ant[:] lipv_nue.append(pv) hazFEN(fenN, lipv_nue, control) else: p = Partida.Partida() p.leerLIPV(lipv_ant) control.liPartidas.append(p) control.num_partidas += 1 bp.ponTotal(control.num_partidas) bp.pon(control.num_partidas) if control.num_partidas and control.num_partidas % 1000 == 0: self.guardaPartidas(control.rotulo, control.liPartidas, minMoves, with_history=control.with_history) control.liPartidas = [] control.with_history = False
def leePGNRecno(self, recno): raw = self.leeAllRecno(recno) xpgn = raw["PGN"] result = raw["RESULT"] rtags = None if xpgn: xpgn = Util.blob2var(xpgn) if type(xpgn) in (str, unicode): return xpgn, result if "RTAGS" in xpgn: rtags = xpgn["RTAGS"] else: p = Partida.PartidaCompleta() p.restore(xpgn["FULLGAME"]) return p.pgn(), result pgn = xpv2pgn(raw["XPV"]) litags = [] st = set() for field in self.liCamposBase: v = raw[field] if v: if field not in st: litags.append('[%s "%s"]' % (drots.get( field, field), Util.primeraMayuscula(str(v)))) st.add(field) if rtags: for k, v in rtags: k = drots.get(k, Util.primeraMayuscula(k)) if k not in st: litags.append('[%s "%s"]' % (k, v)) st.add(k) tags = "\n".join(litags) return "%s\n\n%s\n" % (tags, pgn), result
def hazPV(lipv_ant): if bp.siCancelado(): return siWhite1 = len(lipv_ant) % 2 == 0 pv_ant = " ".join(lipv_ant) liChildren = dbSTAT.children(pv_ant, False) if len(liChildren) == 0 or len(lipv_ant) > depth: p = Partida.Partida() p.leerLIPV(lipv_ant) if len(p) > len_partidabase: liPartidas.append(p) bp.ponTotal(len(liPartidas)) bp.pon(len(liPartidas)) return if siWhite1 == siWhite: alm_max = None tt_max = 0 for alm in liChildren: tt = alm.W + alm.B + alm.O + alm.D if tt > tt_max: tt_max = tt alm_max = alm liChildren = [] if tt_max == 0 else [ alm_max, ] for alm in liChildren: li = lipv_ant[:] li.append(alm.move) hazPV(li)
def hazPV(lipv_ant): if bp.siCancelado(): return n_ant = len(lipv_ant) siWhite1 = n_ant % 2 == 0 pv_ant = " ".join(lipv_ant) if n_ant else "" liChildren = dbSTAT.children(pv_ant, False) if len(liChildren) == 0 or len(lipv_ant) > depth: p = Partida.Partida() p.leerLIPV(lipv_ant) if len(p) > len_partidabase: liPartidas.append(p) bp.ponTotal(len(liPartidas)) bp.pon(len(liPartidas)) return if siWhite1 == siWhite: tt_max = 0 limax = [] for alm in liChildren: tt = alm.W + alm.B + alm.O + alm.D if tt > tt_max: tt_max = tt limax = [alm] elif tt == tt_max and not onlyone: limax.append(alm) liChildren = limax for alm in liChildren: li = lipv_ant[:] li.append(alm.move) hazPV(li)
def reiniciar(self): if self.siCambios and not QTUtil2.pregunta( self.pantalla, _("You will loose all changes, are you sure?")): return p = Partida.PartidaCompleta() p.restore(self.reinicio) self.inicio(p, self.siCompleta)
def haz_partida(partida, liMoves): njg = len(partida) if len(liMoves) + njg > maxDepth: liMoves = liMoves[:maxDepth - njg] pv = " ".join([move.pv for move in liMoves]) partida.leerPV(pv) pv = partida.pv() if base and not pv.startswith(base) or partida.numJugadas( ) <= njugbase: return xpv = LCEngine.pv2xpv(pv) if xpv in self.li_xpv: return line_blob = partida.save2blob() updated = False for npos, xpv_ant in enumerate(self.li_xpv): if xpv.startswith(xpv_ant): cursor.execute(sql_update, (xpv, line_blob, xpv_ant)) self.li_xpv[npos] = xpv updated = True break if not updated: cursor.execute(sql_insert, (xpv, line_blob)) self.li_xpv.append(xpv) for njug, move in enumerate(liMoves): if move.variantes: for lim in move.variantes: p = partida.copia( njug - 1) if njug > 0 else Partida.Partida() haz_partida(p, lim.liMoves)
def gridCambiadoRegistro(self, grid, fila, columna): self.partida = Partida.Partida(self.posicion).leerPV( self.listaRM[fila].rm.pv) self.maxMoves = self.partida.numJugadas() self.mueve(siInicio=True) self.grid.setFocus()
def __init__(self, a1h8): p = Partida.Partida() p.leerPV(a1h8) self.dicFEN = {} for jg in p.liJugadas: self.dicFEN[jg.posicionBase.fen()] = jg self.activa = True
def leePartidaRecno(self, recno): raw = self.leeAllRecno(recno) p = Partida.PartidaCompleta(fen=raw["FEN"]) xpgn = raw["PGN"] rtags = None if xpgn: xpgn = Util.blob2var(xpgn) if type(xpgn) == str: # Version -9 p.readPGN(VarGen.configuracion, xpgn) return p p.restore(xpgn["FULLGAME"]) return p p.leerPV(xpv2pv(raw["XPV"])) rots = [ "Event", "Site", "Date", "Round", "White", "Black", "Result", "WhiteTitle", "BlackTitle", "WhiteElo", "BlackElo", "WhiteUSCF", "BlackUSCF", "WhiteNA", "BlackNA", "WhiteType", "BlackType", "EventDate", "EventSponsor", "ECO", "UTCTime", "UTCDate", "TimeControl", "SetUp", "FEN", "PlyCount" ] drots = {x.upper(): x for x in rots} drots["PLIES"] = "PlyCount" litags = [] for field in self.liCamposBase: v = raw[field] if v: litags.append((drots.get(field, field), str(v))) if rtags: litags.extend(rtags) p.setTags(litags) return p
def miraBuffer(self): 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.maxTiempo = None mrm.maxProfundidad = 9999 mrm.ordena() if mrm.liMultiPV: rm = mrm.liMultiPV[0] p = Partida.Partida(fen=self.fen) p.leerPV(rm.pv) li = p.pgnSP().split(" ") if len(li) > 20: li = li[:20] self.em.ponHtml("[%02d] %s | %s" % (rm.depth, rm.abrTexto(), " ".join(li))) self.lock = False
def hechaJugada(self, jg): self.tablero.desactivaTodas() self.jg = jg self.ponToolbar(self.seguir, self.analizar) donePV = jg.movimiento().lower() dicResults = self.alm.dicResults mens = "<h2>%s</h2><br>" % self.alm.name mens += '<table><tr><th>%s</th><th>%s</th></tr>'%(_("Move"), _("Points")) mx = 0 ok = False stylePV = ' style="color:red;"' for pv, points in dicResults.iteritems(): if donePV == pv.lower(): ok = True mas = stylePV else: mas = "" pgn = Partida.pv_pgn(self.alm.fen,pv) mens += '<tr%s><td align="center">%s</td><td align="right">%d</td></tr>'%(mas,pgn,points) if points > mx: mx = points if not ok: pgn = Partida.pv_pgn(self.alm.fen,donePV) mens += '<tr%s><td align="center">%s</td><td align="right">%d</td></tr>'%(stylePV,pgn,0) mens += "</table>" self.alm.donePV = donePV self.alm.puntos = dicResults.get(donePV,0) self.alm.total = mx mens += "<br><h2>%s: %d/%d</h2>"%(_("Points"), self.alm.puntos, self.alm.total) self.lbJuego.ponTexto(mens) self.workmap.winAim(donePV)