1212from Code import PGNreader
1313from Code import DBgames
1414from Code import AperturasStd
15+ from Code import EnginesBunch
1516from Code .QT import QTVarios
1617from 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
0 commit comments