Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Commit

Permalink
Version 11.11
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmonk committed Aug 29, 2018
1 parent 0603bef commit 69ead13
Show file tree
Hide file tree
Showing 75 changed files with 24,043 additions and 1,753 deletions.
156 changes: 156 additions & 0 deletions Code/EnginesBunch.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Code/EnginesWindows.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def mas(cm):
cm.elo = 2100
mas(cm)

cm = ConfigMotor("andscacs", "Daniel José Queraltó".decode("utf-8"), "0.9032n", "http://www.andscacs.com/")
cm.path = "andscacs32.exe"
cm = ConfigMotor("andscacs", "Daniel José Queraltó".decode("utf-8"), "0.9432n", "http://www.andscacs.com/")
cm.path = "andscacs_32_no_popcnt.exe"
cm.elo = 3150
mas(cm)

Expand Down
110 changes: 70 additions & 40 deletions Code/GestorOpeningLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from Code import TrListas
from Code.QT import QTUtil2
from Code.QT import Iconos
from Code.QT import QTVarios
from Code import Util
from Code import OpeningLines
from Code import XMotorRespuesta
Expand Down Expand Up @@ -52,6 +53,7 @@ def reinicio(self, dbop):

self.plies_mandatory = self.trainingEngines["MANDATORY"]
self.plies_control = self.trainingEngines["CONTROL"]
self.plies_pendientes = self.plies_control
self.lost_points = self.trainingEngines["LOST_POINTS"]

self.siJugamosConBlancas = self.trainingEngines["COLOR"] == "WHITE"
Expand Down Expand Up @@ -117,16 +119,15 @@ def siguienteJugada(self):

siRival = siBlancas == self.siRivalConBlancas

if siRival:
self.desactivaTodas()

if not self.runcontrol():
if not self.runcontrol():
if siRival:
self.desactivaTodas()
if self.mueveRival():
self.siguienteJugada()

else:
self.activaColor(siBlancas)
self.siJuegaHumano = True
else:
self.activaColor(siBlancas)
self.siJuegaHumano = True

def mueveRival(self):
si_obligatorio = self.partida.numJugadas() <= self.plies_mandatory
Expand Down Expand Up @@ -193,9 +194,11 @@ def mueveHumano(self, desde, hasta, coronacion=""):

def masJugada(self, jg, siNuestra):
fenM2 = jg.posicionBase.fenM2()
jg.es_linea = False
if fenM2 in self.dicFENm2:
if jg.movimiento() in self.dicFENm2[fenM2]:
jg.criticaDirecta = "!"
jg.es_linea = True
self.partida.append_jg(jg)
if self.partida.pendienteApertura:
self.partida.asignaApertura()
Expand All @@ -222,13 +225,15 @@ def muestraInformacion(self):
si_obligatorio = False

if not si_obligatorio and self.estado != kFinJuego:
tm = self.plies_mandatory + self.plies_control - self.partida.numJugadas()
if tm > 0:
li.append("%s: %d" % (_("Moves until the control"), tm))
tm = self.plies_pendientes
if tm > 1 and self.partida.numJugadas() and not self.partida.jugada(-1).es_linea:
li.append("%s: %d" % (_("Moves until the control"), tm-1))

self.ponRotulo1("<br>".join(li))

def runcontrol(self):
puntosInicio, mateInicio = 0, 0
puntosFinal, mateFinal = 0, 0
numJugadas = self.partida.numJugadas()
if numJugadas == 0:
return False
Expand All @@ -249,13 +254,24 @@ def suspendido():
self.muestraInformacion()
self.mensajeEnPGN(mens)

def calcula(fen):
um = self.unMomento()
mrm = self.xjuez.analiza(fen)
um.final()
def calculaJG(jg, siinicio):
fen = jg.posicionBase.fen() if siinicio else jg.posicion.fen()
nombre = self.xjuez.nombre
tiempo = self.xjuez.motorTiempoJugada
mrm = self.dbop.get_cache_engines(nombre, tiempo, fen)
if mrm is None:
um = self.unMomento()
mrm = self.xjuez.analiza(fen)
self.dbop.set_cache_engines(nombre, tiempo, fen, mrm)
um.final()

rm = mrm.mejorMov()
return rm.puntosABS(), rm.mate
if (" w " in fen) == self.siJugamosConBlancas:
return rm.puntos, rm.mate
else:
return -rm.puntos, -rm.mate

siCalcularInicio = True
if self.partida.siTerminada():
self.ponFinJuego()
jg = self.partida.jugada(-1)
Expand All @@ -269,35 +285,35 @@ def calcula(fen):
puntosFinal, mateFinal = 0, 0

else:
if numJugadas < self.plies_mandatory + self.plies_control:
return False
# Si la ultima jugada es de la linea no se calcula nada
jg = self.partida.jugada(-1)
if jg.criticaDirecta == "!":
puntosFinal, mateFinal = 0, 0
if jg.es_linea:
self.plies_pendientes = self.plies_control
else:
puntosFinal, mateFinal = calcula(self.partida.ultPosicion.fen())
puntosFinal, mateFinal = -puntosFinal, -mateFinal
self.plies_pendientes -= 1
if self.plies_pendientes > 0:
return False
# Si la ultima jugada es de la linea no se calcula nada
puntosFinal, mateFinal = calculaJG(jg, False)

# Se marcan todas las jugadas que no siguen las lineas
# Y se busca la ultima del color del jugador
fenM2_inicial = None
for njg in range(numJugadas):
jg = self.partida.jugada(njg)
fenM2 = jg.posicionBase.fenM2()
if fenM2 in self.dicFENm2:
moves = self.dicFENm2[fenM2]
if jg.movimiento() not in moves:
jg.criticaDirecta = "?!"
if fenM2_inicial is None and jg.siBlancas() == self.siJugamosConBlancas:
fenM2_inicial = jg.posicion.fenM2()
elif fenM2_inicial is None and jg.siBlancas() == self.siJugamosConBlancas:
fenM2_inicial = jg.posicion.fenM2()
if fenM2_inicial:
puntosInicio, mateInicio = calcula(fenM2_inicial)
puntosInicio, mateInicio = -puntosInicio, -mateInicio
else:
puntosInicio, mateInicio = 0, 0
if siCalcularInicio:
jg_inicial = None
for njg in range(numJugadas):
jg = self.partida.jugada(njg)
fenM2 = jg.posicionBase.fenM2()
if fenM2 in self.dicFENm2:
moves = self.dicFENm2[fenM2]
if jg.movimiento() not in moves:
jg.criticaDirecta = "?!"
if jg_inicial is None:
jg_inicial = jg
elif jg_inicial is None:
jg_inicial = jg
if jg_inicial:
puntosInicio, mateInicio = calculaJG(jg_inicial, True)
else:
puntosInicio, mateInicio = 0, 0

self.li_info.append("<b>%s:</b>" %_("Score"))
template = "&nbsp;&nbsp;&nbsp;&nbsp;<b>%s</b>: %d"
Expand Down Expand Up @@ -349,8 +365,22 @@ def procesarAccion(self, clave):
if resp == "libros":
self.librosConsulta(False)
elif resp == "add_line":
self.dbop.append(self.partida)
numJugadas, nj, fila, siBlancas = self.jugadaActual()
partida = self.partida
if numJugadas != nj+1:
menu = QTVarios.LCMenu(self.pantalla)
menu.opcion("all", _("Add all moves"), Iconos.PuntoAzul())
menu.separador()
menu.opcion("parcial", _("Add until current move"), Iconos.PuntoVerde())
resp = menu.lanza()
if resp is None:
return
if resp == "parcial":
partida = self.partida.copia(nj)

self.dbop.append(partida)
self.dbop.updateTrainingEngines()
QTUtil2.mensaje(self.pantalla, _("Done"))

else:
Gestor.Gestor.rutinaAccionDef(self, clave)
Expand Down
2 changes: 1 addition & 1 deletion Code/Init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from Code.Constantes import *

DEBUG = False
VERSION = "11.10"
VERSION = "11.11"

if DEBUG:
prlkn("DEBUG " * 20)
Expand Down
97 changes: 31 additions & 66 deletions Code/OpeningLines.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from Code import PGNreader
from Code import DBgames
from Code import AperturasStd
from Code import EnginesBunch
from Code.QT import QTVarios
from Code.QT import QTUtil2

Expand Down Expand Up @@ -403,67 +404,17 @@ def recalcFenM2(self):
LCEngine.makeMove(pv)
return dicFENm2

def preparaTrainingEngines(self, reg):
def preparaTrainingEngines(self, configuracion, reg):
reg["DICFENM2"] = self.recalcFenM2()
reg["TIMES"] = [500, 1000, 2000, 4000, 8000]
reg["ENGINES"] = self.listaEngines()[reg["NUM_LISTA"]]

reg["ENGINES"] = EnginesBunch.getListaClave(configuracion, reg["NUM_ENGINES"], reg["KEY_ENGINE"])

def updateTrainingEngines(self):
reg = self.trainingEngines()
reg["DICFENM2"] = self.recalcFenM2()
self.setTrainingEngines(reg)

def listaEngines(self):
lista = [
['irina', 'chispa', 'hamsters', 'zappa', 'demolito', 'wildcat', 'cheng', 'stockfish'],
['irina', 'arminius', 'rodent', 'toga', 'rodentII', 'gaviota', 'texel', 'gull'],
['tarrasch', 'cdrill', 'bikjump', 'garbochess', 'ufim', 'amyan', 'delfi', 'spike'],
['rocinante', 'roce', 'cinnamon', 'gaia', 'greko', 'godel', 'rodent', 'mcbrain'],
['zappa', 'demolito', 'rhetoric', 'critter', 'houdini', 'gull', 'andscacs', 'stockfish'],
['clarabit', 'pawny', 'hamsters', 'cheng', 'spike', 'rybka', 'hannibal', 'texel'],
['bikjump', 'clarabit', 'chispa', 'gaia', 'umko', 'greko', 'wildcat', 'critter'],
['tarrasch', 'cdrill', 'lime', 'arminius', 'delfi', 'gaviota', 'andscacs', 'mcbrain'],
['rocinante', 'cinnamon', 'pawny', 'amyan', 'alaric', 'daydreamer', 'godel', 'rodentII'],
['irina', 'roce', 'demolito', 'rhetoric', 'toga', 'hannibal', 'komodo', 'stockfish'],
['lime', 'zappa', 'wildcat', 'daydreamer', 'cheng', 'glaurung', 'critter', 'andscacs'],
['bikjump', 'gaia', 'hamsters', 'umko', 'ufim', 'alaric', 'houdini', 'gull'],
['cdrill', 'chispa', 'hamsters', 'amyan', 'spike', 'rybka', 'texel', 'komodo'],
['tarrasch', 'clarabit', 'garbochess', 'ufim', 'delfi', 'fruit', 'rhetoric', 'mcbrain'],
['rocinante', 'roce', 'cinnamon', 'pawny', 'alaric', 'cheng', 'fruit', 'rodent'],
['irina', 'lime', 'garbochess', 'zappa', 'demolito', 'daydreamer', 'glaurung', 'spike'],
['umko', 'greko', 'wildcat', 'glaurung', 'critter', 'gull', 'andscacs', 'stockfish'],
['bikjump', 'chispa', 'gaia', 'wildcat', 'daydreamer', 'godel', 'fruit', 'toga'],
['cdrill', 'clarabit', 'lime', 'umko', 'greko', 'amyan', 'delfi', 'texel'],
['tarrasch', 'rocinante', 'roce', 'cinnamon', 'daydreamer', 'gaviota', 'houdini', 'mcbrain'],
['irina', 'lime', 'umko', 'alaric', 'arminius', 'glaurung', 'fruit', 'stockfish'],
['chispa', 'hamsters', 'zappa', 'demolito', 'cheng', 'rhetoric', 'houdini', 'andscacs'],
['cdrill', 'bikjump', 'gaia', 'ufim', 'arminius', 'fruit', 'texel', 'gull'],
['tarrasch', 'clarabit', 'simplex', 'amyan', 'delfi', 'godel', 'spike', 'hannibal'],
['rocinante', 'roce', 'cinnamon', 'pawny', 'greko', 'glaurung', 'rhetoric', 'komodo'],
['irina', 'lime', 'zappa', 'demolito', 'rodent', 'rodentII', 'gaviota', 'stockfish'],
['bikjump', 'arminius', 'cheng', 'toga', 'critter', 'houdini', 'gull', 'mcbrain'],
['chispa', 'gaia', 'umko', 'toga', 'hannibal', 'critter', 'texel', 'andscacs'],
['cdrill', 'greko', 'godel', 'rodent', 'rhetoric', 'toga', 'rybka', 'hannibal'],
['tarrasch', 'clarabit', 'arminius', 'delfi', 'rybka', 'gaviota', 'houdini', 'mcbrain'],
['rocinante', 'roce', 'cinnamon', 'pawny', 'amyan', 'wildcat', 'godel', 'toga'],
['irina', 'cdrill', 'zappa', 'demolito', 'daydreamer', 'fruit', 'andscacs', 'stockfish'],
['lime', 'pawny', 'ufim', 'wildcat', 'alaric', 'glaurung', 'rhetoric', 'critter'],
['chispa', 'gaia', 'amyan', 'arminius', 'rybka', 'hannibal', 'texel', 'gull'],
['tarrasch', 'bikjump', 'alaric', 'delfi', 'cheng', 'spike', 'gaviota', 'mcbrain'],
['cinnamon', 'simplex', 'umko', 'delfi', 'godel', 'spike', 'gaviota', 'komodo'],
['irina', 'rocinante', 'roce', 'clarabit', 'zappa', 'daydreamer', 'houdini', 'stockfish'],
['tarrasch', 'lime', 'umko', 'cheng', 'rodent', 'rybka', 'hannibal', 'gull'],
['chispa', 'glaurung', 'spike', 'gaviota', 'critter', 'texel', 'andscacs', 'komodo'],
['cdrill', 'bikjump', 'clarabit', 'hamsters', 'amyan', 'demolito', 'wildcat', 'mcbrain'],
['cinnamon', 'godel', 'fruit', 'rhetoric', 'toga', 'hannibal', 'houdini', 'komodo'],
['irina', 'rocinante', 'roce', 'hamsters', 'godel', 'glaurung', 'rodentII', 'stockfish'],
['roce', 'umko', 'greko', 'garbochess', 'demolito', 'cheng', 'gull', 'andscacs'],
['chispa', 'pawny', 'ufim', 'rodentII', 'spike', 'rybka', 'texel', 'komodo'],
['bikjump', 'clarabit', 'lime', 'gaia', 'simplex', 'greko', 'rybka', 'hannibal'],
['cdrill', 'rocinante', 'ufim', 'amyan', 'rhetoric', 'toga', 'rybka', 'komodo'],
]
return lista

def createTrainingSSP(self, reg, procesador):
self.preparaTraining(reg, procesador)

Expand All @@ -475,7 +426,7 @@ def createTrainingSSP(self, reg, procesador):
lo.add_training_file(os.path.basename(self.nomFichero))

def createTrainingEngines(self, reg, procesador):
self.preparaTrainingEngines(reg)
self.preparaTrainingEngines(procesador.configuracion, reg)
reg["DATECREATION"] = Util.hoy()
self.setTrainingEngines(reg)

Expand All @@ -490,6 +441,8 @@ def withTrainings(self):

def updateTraining(self, procesador):
reg = self.training()
if reg is None:
return
reg1 = {}
for key in ("MAXMOVES", "COLOR", "RANDOM"):
reg1[key] = reg[key]
Expand Down Expand Up @@ -890,8 +843,9 @@ def importarPGO(self, partidabase, ficheroPGO, maxDepth):
self.li_xpv.sort()
self._conexion.commit()

def guardaPartidas(self, label, liPartidas, minMoves=0):
self.saveHistory(_("Import"), label)
def guardaPartidas(self, label, liPartidas, minMoves=0, with_history=True):
if with_history:
self.saveHistory(_("Import"), label)
partidabase = self.getpartidabase()
sql_insert = "INSERT INTO LINES( XPV) VALUES( ? )"
sql_update = "UPDATE LINES SET XPV=? WHERE XPV=?"
Expand Down Expand Up @@ -937,20 +891,18 @@ def guardaLiXPV(self, label, liXPV):
self.li_xpv.sort()

def importarPolyglot(self, ventana, partida, bookW, bookB, titulo, depth, siWhite, onlyone, minMoves):
bp = QTUtil2.BarraProgreso1(ventana, titulo)
bp = QTUtil2.BarraProgreso1(ventana, titulo, formato1="%m")
bp.ponTotal(0)
bp.ponRotulo(_X(_("Reading %1"), "..."))
bp.mostrar()

cp = partida.ultPosicion

liPartidas = []

setFen = LCEngine.setFen
makeMove = LCEngine.makeMove
getFen = LCEngine.getFen

def hazFEN(fen, lipv_ant):
def hazFEN(fen, lipv_ant, control):
if bp.siCancelado():
return
siWhite1 = " w " in fen
Expand All @@ -963,19 +915,32 @@ def hazFEN(fen, lipv_ant):
fenN = getFen()
lipv_nue = lipv_ant[:]
lipv_nue.append(pv)
hazFEN(fenN, lipv_nue)
hazFEN(fenN, lipv_nue, control)
else:
p = Partida.Partida()
p.leerLIPV(lipv_ant)
liPartidas.append(p)
bp.ponTotal(len(liPartidas))
bp.pon(len(liPartidas))
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 % 5000 == 0:
self.guardaPartidas(control.rotulo, control.liPartidas, minMoves, with_history=control.with_history)
control.liPartidas = []
control.with_history = False


control = Util.Almacen()
control.liPartidas = []
control.num_partidas = 0
control.with_history = True
control.rotulo = "%s,%s,%s" % (_("Polyglot book"), bookW.nombre, bookB.nombre)

hazFEN(cp.fen(), partida.lipv())
hazFEN(cp.fen(), partida.lipv(), control)

bp.ponRotulo(_("Writing..."))

self.guardaPartidas("%s,%s,%s"%(_("Polyglot book"), bookW.nombre, bookB.nombre), liPartidas, minMoves)
if control.liPartidas:
self.guardaPartidas(control.rotulo, control.liPartidas, minMoves, with_history=control.with_history)
bp.cerrar()

return True
Expand Down
2 changes: 1 addition & 1 deletion Code/Procesador.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def entrenaPos(self, posicion, nPosiciones, titentreno, liEntrenamientos, entren
self.estado = kJugando
self.gestor = GestorEntPos.GestorEntPos(self)
self.gestor.ponEntreno(entreno)
self.gestor.inicio(posicion, nPosiciones, titentreno, liEntrenamientos, jump=jump)
self.gestor.inicio(posicion, nPosiciones, titentreno, liEntrenamientos, saltoAutomatico=jump)

def playRoute(self, route):
if route.state == Routes.BETWEEN:
Expand Down
2 changes: 1 addition & 1 deletion Code/QT/InfoBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def listaMotores(self, bloque):
# ["SmartThink 1.97", "Sergei S. Markoff", "http://genes1s.net/smarthink.php"],
["Hannibal 1.4b", "Samuel N. Hamilton and Edsel G. Apostol", "http://sites.google.com/site/edapostol/hannibal"],
["Monarch 1.7", "Steve Maughan", "http://www.monarchchess.com/"],
["Andscacs 0.9032n", "Daniel José Queraltó", "http://www.andscacs.com/"],
["Andscacs 0.9432n", "Daniel José Queraltó", "http://www.andscacs.com/"],
["Arminius 2017-01-01", "Volker Annus", "http://www.nnuss.de/Hermann/Arminius2017-01-01.zip"],
["WildCat", "Igor Korshunov", "http://www.igorkorshunov.narod.ru/WildCat"],
["Demolito", "Lucas Braesch", "https://github.com/lucasart/Demolito"],
Expand Down
Loading

0 comments on commit 69ead13

Please sign in to comment.