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

Commit 69ead13

Browse files
committed
Version 11.11
1 parent 0603bef commit 69ead13

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+24043
-1753
lines changed

Code/EnginesBunch.py

+156
Large diffs are not rendered by default.

Code/EnginesWindows.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ def mas(cm):
288288
cm.elo = 2100
289289
mas(cm)
290290

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

Code/GestorOpeningLines.py

+70-40
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from Code import TrListas
77
from Code.QT import QTUtil2
88
from Code.QT import Iconos
9+
from Code.QT import QTVarios
910
from Code import Util
1011
from Code import OpeningLines
1112
from Code import XMotorRespuesta
@@ -52,6 +53,7 @@ def reinicio(self, dbop):
5253

5354
self.plies_mandatory = self.trainingEngines["MANDATORY"]
5455
self.plies_control = self.trainingEngines["CONTROL"]
56+
self.plies_pendientes = self.plies_control
5557
self.lost_points = self.trainingEngines["LOST_POINTS"]
5658

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

118120
siRival = siBlancas == self.siRivalConBlancas
119121

120-
if siRival:
121-
self.desactivaTodas()
122-
123-
if not self.runcontrol():
122+
if not self.runcontrol():
123+
if siRival:
124+
self.desactivaTodas()
124125
if self.mueveRival():
125126
self.siguienteJugada()
126127

127-
else:
128-
self.activaColor(siBlancas)
129-
self.siJuegaHumano = True
128+
else:
129+
self.activaColor(siBlancas)
130+
self.siJuegaHumano = True
130131

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

194195
def masJugada(self, jg, siNuestra):
195196
fenM2 = jg.posicionBase.fenM2()
197+
jg.es_linea = False
196198
if fenM2 in self.dicFENm2:
197199
if jg.movimiento() in self.dicFENm2[fenM2]:
198200
jg.criticaDirecta = "!"
201+
jg.es_linea = True
199202
self.partida.append_jg(jg)
200203
if self.partida.pendienteApertura:
201204
self.partida.asignaApertura()
@@ -222,13 +225,15 @@ def muestraInformacion(self):
222225
si_obligatorio = False
223226

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

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

231234
def runcontrol(self):
235+
puntosInicio, mateInicio = 0, 0
236+
puntosFinal, mateFinal = 0, 0
232237
numJugadas = self.partida.numJugadas()
233238
if numJugadas == 0:
234239
return False
@@ -249,13 +254,24 @@ def suspendido():
249254
self.muestraInformacion()
250255
self.mensajeEnPGN(mens)
251256

252-
def calcula(fen):
253-
um = self.unMomento()
254-
mrm = self.xjuez.analiza(fen)
255-
um.final()
257+
def calculaJG(jg, siinicio):
258+
fen = jg.posicionBase.fen() if siinicio else jg.posicion.fen()
259+
nombre = self.xjuez.nombre
260+
tiempo = self.xjuez.motorTiempoJugada
261+
mrm = self.dbop.get_cache_engines(nombre, tiempo, fen)
262+
if mrm is None:
263+
um = self.unMomento()
264+
mrm = self.xjuez.analiza(fen)
265+
self.dbop.set_cache_engines(nombre, tiempo, fen, mrm)
266+
um.final()
267+
256268
rm = mrm.mejorMov()
257-
return rm.puntosABS(), rm.mate
269+
if (" w " in fen) == self.siJugamosConBlancas:
270+
return rm.puntos, rm.mate
271+
else:
272+
return -rm.puntos, -rm.mate
258273

274+
siCalcularInicio = True
259275
if self.partida.siTerminada():
260276
self.ponFinJuego()
261277
jg = self.partida.jugada(-1)
@@ -269,35 +285,35 @@ def calcula(fen):
269285
puntosFinal, mateFinal = 0, 0
270286

271287
else:
272-
if numJugadas < self.plies_mandatory + self.plies_control:
273-
return False
274-
# Si la ultima jugada es de la linea no se calcula nada
275288
jg = self.partida.jugada(-1)
276-
if jg.criticaDirecta == "!":
277-
puntosFinal, mateFinal = 0, 0
289+
if jg.es_linea:
290+
self.plies_pendientes = self.plies_control
278291
else:
279-
puntosFinal, mateFinal = calcula(self.partida.ultPosicion.fen())
280-
puntosFinal, mateFinal = -puntosFinal, -mateFinal
292+
self.plies_pendientes -= 1
293+
if self.plies_pendientes > 0:
294+
return False
295+
# Si la ultima jugada es de la linea no se calcula nada
296+
puntosFinal, mateFinal = calculaJG(jg, False)
281297

282298
# Se marcan todas las jugadas que no siguen las lineas
283299
# Y se busca la ultima del color del jugador
284-
fenM2_inicial = None
285-
for njg in range(numJugadas):
286-
jg = self.partida.jugada(njg)
287-
fenM2 = jg.posicionBase.fenM2()
288-
if fenM2 in self.dicFENm2:
289-
moves = self.dicFENm2[fenM2]
290-
if jg.movimiento() not in moves:
291-
jg.criticaDirecta = "?!"
292-
if fenM2_inicial is None and jg.siBlancas() == self.siJugamosConBlancas:
293-
fenM2_inicial = jg.posicion.fenM2()
294-
elif fenM2_inicial is None and jg.siBlancas() == self.siJugamosConBlancas:
295-
fenM2_inicial = jg.posicion.fenM2()
296-
if fenM2_inicial:
297-
puntosInicio, mateInicio = calcula(fenM2_inicial)
298-
puntosInicio, mateInicio = -puntosInicio, -mateInicio
299-
else:
300-
puntosInicio, mateInicio = 0, 0
300+
if siCalcularInicio:
301+
jg_inicial = None
302+
for njg in range(numJugadas):
303+
jg = self.partida.jugada(njg)
304+
fenM2 = jg.posicionBase.fenM2()
305+
if fenM2 in self.dicFENm2:
306+
moves = self.dicFENm2[fenM2]
307+
if jg.movimiento() not in moves:
308+
jg.criticaDirecta = "?!"
309+
if jg_inicial is None:
310+
jg_inicial = jg
311+
elif jg_inicial is None:
312+
jg_inicial = jg
313+
if jg_inicial:
314+
puntosInicio, mateInicio = calculaJG(jg_inicial, True)
315+
else:
316+
puntosInicio, mateInicio = 0, 0
301317

302318
self.li_info.append("<b>%s:</b>" %_("Score"))
303319
template = "&nbsp;&nbsp;&nbsp;&nbsp;<b>%s</b>: %d"
@@ -349,8 +365,22 @@ def procesarAccion(self, clave):
349365
if resp == "libros":
350366
self.librosConsulta(False)
351367
elif resp == "add_line":
352-
self.dbop.append(self.partida)
368+
numJugadas, nj, fila, siBlancas = self.jugadaActual()
369+
partida = self.partida
370+
if numJugadas != nj+1:
371+
menu = QTVarios.LCMenu(self.pantalla)
372+
menu.opcion("all", _("Add all moves"), Iconos.PuntoAzul())
373+
menu.separador()
374+
menu.opcion("parcial", _("Add until current move"), Iconos.PuntoVerde())
375+
resp = menu.lanza()
376+
if resp is None:
377+
return
378+
if resp == "parcial":
379+
partida = self.partida.copia(nj)
380+
381+
self.dbop.append(partida)
353382
self.dbop.updateTrainingEngines()
383+
QTUtil2.mensaje(self.pantalla, _("Done"))
354384

355385
else:
356386
Gestor.Gestor.rutinaAccionDef(self, clave)

Code/Init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from Code.Constantes import *
1010

1111
DEBUG = False
12-
VERSION = "11.10"
12+
VERSION = "11.11"
1313

1414
if DEBUG:
1515
prlkn("DEBUG " * 20)

Code/OpeningLines.py

+31-66
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from Code import PGNreader
1313
from Code import DBgames
1414
from Code import AperturasStd
15+
from Code import EnginesBunch
1516
from Code.QT import QTVarios
1617
from Code.QT import QTUtil2
1718

@@ -403,67 +404,17 @@ def recalcFenM2(self):
403404
LCEngine.makeMove(pv)
404405
return dicFENm2
405406

406-
def preparaTrainingEngines(self, reg):
407+
def preparaTrainingEngines(self, configuracion, reg):
407408
reg["DICFENM2"] = self.recalcFenM2()
408409
reg["TIMES"] = [500, 1000, 2000, 4000, 8000]
409-
reg["ENGINES"] = self.listaEngines()[reg["NUM_LISTA"]]
410+
411+
reg["ENGINES"] = EnginesBunch.getListaClave(configuracion, reg["NUM_ENGINES"], reg["KEY_ENGINE"])
410412

411413
def updateTrainingEngines(self):
412414
reg = self.trainingEngines()
413415
reg["DICFENM2"] = self.recalcFenM2()
414416
self.setTrainingEngines(reg)
415417

416-
def listaEngines(self):
417-
lista = [
418-
['irina', 'chispa', 'hamsters', 'zappa', 'demolito', 'wildcat', 'cheng', 'stockfish'],
419-
['irina', 'arminius', 'rodent', 'toga', 'rodentII', 'gaviota', 'texel', 'gull'],
420-
['tarrasch', 'cdrill', 'bikjump', 'garbochess', 'ufim', 'amyan', 'delfi', 'spike'],
421-
['rocinante', 'roce', 'cinnamon', 'gaia', 'greko', 'godel', 'rodent', 'mcbrain'],
422-
['zappa', 'demolito', 'rhetoric', 'critter', 'houdini', 'gull', 'andscacs', 'stockfish'],
423-
['clarabit', 'pawny', 'hamsters', 'cheng', 'spike', 'rybka', 'hannibal', 'texel'],
424-
['bikjump', 'clarabit', 'chispa', 'gaia', 'umko', 'greko', 'wildcat', 'critter'],
425-
['tarrasch', 'cdrill', 'lime', 'arminius', 'delfi', 'gaviota', 'andscacs', 'mcbrain'],
426-
['rocinante', 'cinnamon', 'pawny', 'amyan', 'alaric', 'daydreamer', 'godel', 'rodentII'],
427-
['irina', 'roce', 'demolito', 'rhetoric', 'toga', 'hannibal', 'komodo', 'stockfish'],
428-
['lime', 'zappa', 'wildcat', 'daydreamer', 'cheng', 'glaurung', 'critter', 'andscacs'],
429-
['bikjump', 'gaia', 'hamsters', 'umko', 'ufim', 'alaric', 'houdini', 'gull'],
430-
['cdrill', 'chispa', 'hamsters', 'amyan', 'spike', 'rybka', 'texel', 'komodo'],
431-
['tarrasch', 'clarabit', 'garbochess', 'ufim', 'delfi', 'fruit', 'rhetoric', 'mcbrain'],
432-
['rocinante', 'roce', 'cinnamon', 'pawny', 'alaric', 'cheng', 'fruit', 'rodent'],
433-
['irina', 'lime', 'garbochess', 'zappa', 'demolito', 'daydreamer', 'glaurung', 'spike'],
434-
['umko', 'greko', 'wildcat', 'glaurung', 'critter', 'gull', 'andscacs', 'stockfish'],
435-
['bikjump', 'chispa', 'gaia', 'wildcat', 'daydreamer', 'godel', 'fruit', 'toga'],
436-
['cdrill', 'clarabit', 'lime', 'umko', 'greko', 'amyan', 'delfi', 'texel'],
437-
['tarrasch', 'rocinante', 'roce', 'cinnamon', 'daydreamer', 'gaviota', 'houdini', 'mcbrain'],
438-
['irina', 'lime', 'umko', 'alaric', 'arminius', 'glaurung', 'fruit', 'stockfish'],
439-
['chispa', 'hamsters', 'zappa', 'demolito', 'cheng', 'rhetoric', 'houdini', 'andscacs'],
440-
['cdrill', 'bikjump', 'gaia', 'ufim', 'arminius', 'fruit', 'texel', 'gull'],
441-
['tarrasch', 'clarabit', 'simplex', 'amyan', 'delfi', 'godel', 'spike', 'hannibal'],
442-
['rocinante', 'roce', 'cinnamon', 'pawny', 'greko', 'glaurung', 'rhetoric', 'komodo'],
443-
['irina', 'lime', 'zappa', 'demolito', 'rodent', 'rodentII', 'gaviota', 'stockfish'],
444-
['bikjump', 'arminius', 'cheng', 'toga', 'critter', 'houdini', 'gull', 'mcbrain'],
445-
['chispa', 'gaia', 'umko', 'toga', 'hannibal', 'critter', 'texel', 'andscacs'],
446-
['cdrill', 'greko', 'godel', 'rodent', 'rhetoric', 'toga', 'rybka', 'hannibal'],
447-
['tarrasch', 'clarabit', 'arminius', 'delfi', 'rybka', 'gaviota', 'houdini', 'mcbrain'],
448-
['rocinante', 'roce', 'cinnamon', 'pawny', 'amyan', 'wildcat', 'godel', 'toga'],
449-
['irina', 'cdrill', 'zappa', 'demolito', 'daydreamer', 'fruit', 'andscacs', 'stockfish'],
450-
['lime', 'pawny', 'ufim', 'wildcat', 'alaric', 'glaurung', 'rhetoric', 'critter'],
451-
['chispa', 'gaia', 'amyan', 'arminius', 'rybka', 'hannibal', 'texel', 'gull'],
452-
['tarrasch', 'bikjump', 'alaric', 'delfi', 'cheng', 'spike', 'gaviota', 'mcbrain'],
453-
['cinnamon', 'simplex', 'umko', 'delfi', 'godel', 'spike', 'gaviota', 'komodo'],
454-
['irina', 'rocinante', 'roce', 'clarabit', 'zappa', 'daydreamer', 'houdini', 'stockfish'],
455-
['tarrasch', 'lime', 'umko', 'cheng', 'rodent', 'rybka', 'hannibal', 'gull'],
456-
['chispa', 'glaurung', 'spike', 'gaviota', 'critter', 'texel', 'andscacs', 'komodo'],
457-
['cdrill', 'bikjump', 'clarabit', 'hamsters', 'amyan', 'demolito', 'wildcat', 'mcbrain'],
458-
['cinnamon', 'godel', 'fruit', 'rhetoric', 'toga', 'hannibal', 'houdini', 'komodo'],
459-
['irina', 'rocinante', 'roce', 'hamsters', 'godel', 'glaurung', 'rodentII', 'stockfish'],
460-
['roce', 'umko', 'greko', 'garbochess', 'demolito', 'cheng', 'gull', 'andscacs'],
461-
['chispa', 'pawny', 'ufim', 'rodentII', 'spike', 'rybka', 'texel', 'komodo'],
462-
['bikjump', 'clarabit', 'lime', 'gaia', 'simplex', 'greko', 'rybka', 'hannibal'],
463-
['cdrill', 'rocinante', 'ufim', 'amyan', 'rhetoric', 'toga', 'rybka', 'komodo'],
464-
]
465-
return lista
466-
467418
def createTrainingSSP(self, reg, procesador):
468419
self.preparaTraining(reg, procesador)
469420

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

477428
def createTrainingEngines(self, reg, procesador):
478-
self.preparaTrainingEngines(reg)
429+
self.preparaTrainingEngines(procesador.configuracion, reg)
479430
reg["DATECREATION"] = Util.hoy()
480431
self.setTrainingEngines(reg)
481432

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

491442
def updateTraining(self, procesador):
492443
reg = self.training()
444+
if reg is None:
445+
return
493446
reg1 = {}
494447
for key in ("MAXMOVES", "COLOR", "RANDOM"):
495448
reg1[key] = reg[key]
@@ -890,8 +843,9 @@ def importarPGO(self, partidabase, ficheroPGO, maxDepth):
890843
self.li_xpv.sort()
891844
self._conexion.commit()
892845

893-
def guardaPartidas(self, label, liPartidas, minMoves=0):
894-
self.saveHistory(_("Import"), label)
846+
def guardaPartidas(self, label, liPartidas, minMoves=0, with_history=True):
847+
if with_history:
848+
self.saveHistory(_("Import"), label)
895849
partidabase = self.getpartidabase()
896850
sql_insert = "INSERT INTO LINES( XPV) VALUES( ? )"
897851
sql_update = "UPDATE LINES SET XPV=? WHERE XPV=?"
@@ -937,20 +891,18 @@ def guardaLiXPV(self, label, liXPV):
937891
self.li_xpv.sort()
938892

939893
def importarPolyglot(self, ventana, partida, bookW, bookB, titulo, depth, siWhite, onlyone, minMoves):
940-
bp = QTUtil2.BarraProgreso1(ventana, titulo)
894+
bp = QTUtil2.BarraProgreso1(ventana, titulo, formato1="%m")
941895
bp.ponTotal(0)
942896
bp.ponRotulo(_X(_("Reading %1"), "..."))
943897
bp.mostrar()
944898

945899
cp = partida.ultPosicion
946900

947-
liPartidas = []
948-
949901
setFen = LCEngine.setFen
950902
makeMove = LCEngine.makeMove
951903
getFen = LCEngine.getFen
952904

953-
def hazFEN(fen, lipv_ant):
905+
def hazFEN(fen, lipv_ant, control):
954906
if bp.siCancelado():
955907
return
956908
siWhite1 = " w " in fen
@@ -963,19 +915,32 @@ def hazFEN(fen, lipv_ant):
963915
fenN = getFen()
964916
lipv_nue = lipv_ant[:]
965917
lipv_nue.append(pv)
966-
hazFEN(fenN, lipv_nue)
918+
hazFEN(fenN, lipv_nue, control)
967919
else:
968920
p = Partida.Partida()
969921
p.leerLIPV(lipv_ant)
970-
liPartidas.append(p)
971-
bp.ponTotal(len(liPartidas))
972-
bp.pon(len(liPartidas))
922+
control.liPartidas.append(p)
923+
control.num_partidas += 1
924+
bp.ponTotal(control.num_partidas)
925+
bp.pon(control.num_partidas)
926+
if control.num_partidas and control.num_partidas % 5000 == 0:
927+
self.guardaPartidas(control.rotulo, control.liPartidas, minMoves, with_history=control.with_history)
928+
control.liPartidas = []
929+
control.with_history = False
930+
931+
932+
control = Util.Almacen()
933+
control.liPartidas = []
934+
control.num_partidas = 0
935+
control.with_history = True
936+
control.rotulo = "%s,%s,%s" % (_("Polyglot book"), bookW.nombre, bookB.nombre)
973937

974-
hazFEN(cp.fen(), partida.lipv())
938+
hazFEN(cp.fen(), partida.lipv(), control)
975939

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

978-
self.guardaPartidas("%s,%s,%s"%(_("Polyglot book"), bookW.nombre, bookB.nombre), liPartidas, minMoves)
942+
if control.liPartidas:
943+
self.guardaPartidas(control.rotulo, control.liPartidas, minMoves, with_history=control.with_history)
979944
bp.cerrar()
980945

981946
return True

Code/Procesador.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ def entrenaPos(self, posicion, nPosiciones, titentreno, liEntrenamientos, entren
778778
self.estado = kJugando
779779
self.gestor = GestorEntPos.GestorEntPos(self)
780780
self.gestor.ponEntreno(entreno)
781-
self.gestor.inicio(posicion, nPosiciones, titentreno, liEntrenamientos, jump=jump)
781+
self.gestor.inicio(posicion, nPosiciones, titentreno, liEntrenamientos, saltoAutomatico=jump)
782782

783783
def playRoute(self, route):
784784
if route.state == Routes.BETWEEN:

Code/QT/InfoBase.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def listaMotores(self, bloque):
6868
# ["SmartThink 1.97", "Sergei S. Markoff", "http://genes1s.net/smarthink.php"],
6969
["Hannibal 1.4b", "Samuel N. Hamilton and Edsel G. Apostol", "http://sites.google.com/site/edapostol/hannibal"],
7070
["Monarch 1.7", "Steve Maughan", "http://www.monarchchess.com/"],
71-
["Andscacs 0.9032n", "Daniel José Queraltó", "http://www.andscacs.com/"],
71+
["Andscacs 0.9432n", "Daniel José Queraltó", "http://www.andscacs.com/"],
7272
["Arminius 2017-01-01", "Volker Annus", "http://www.nnuss.de/Hermann/Arminius2017-01-01.zip"],
7373
["WildCat", "Igor Korshunov", "http://www.igorkorshunov.narod.ru/WildCat"],
7474
["Demolito", "Lucas Braesch", "https://github.com/lucasart/Demolito"],

0 commit comments

Comments
 (0)