12
12
from Code import PGNreader
13
13
from Code import DBgames
14
14
from Code import AperturasStd
15
+ from Code import EnginesBunch
15
16
from Code .QT import QTVarios
16
17
from Code .QT import QTUtil2
17
18
@@ -403,67 +404,17 @@ def recalcFenM2(self):
403
404
LCEngine .makeMove (pv )
404
405
return dicFENm2
405
406
406
- def preparaTrainingEngines (self , reg ):
407
+ def preparaTrainingEngines (self , configuracion , reg ):
407
408
reg ["DICFENM2" ] = self .recalcFenM2 ()
408
409
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" ])
410
412
411
413
def updateTrainingEngines (self ):
412
414
reg = self .trainingEngines ()
413
415
reg ["DICFENM2" ] = self .recalcFenM2 ()
414
416
self .setTrainingEngines (reg )
415
417
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
-
467
418
def createTrainingSSP (self , reg , procesador ):
468
419
self .preparaTraining (reg , procesador )
469
420
@@ -475,7 +426,7 @@ def createTrainingSSP(self, reg, procesador):
475
426
lo .add_training_file (os .path .basename (self .nomFichero ))
476
427
477
428
def createTrainingEngines (self , reg , procesador ):
478
- self .preparaTrainingEngines (reg )
429
+ self .preparaTrainingEngines (procesador . configuracion , reg )
479
430
reg ["DATECREATION" ] = Util .hoy ()
480
431
self .setTrainingEngines (reg )
481
432
@@ -490,6 +441,8 @@ def withTrainings(self):
490
441
491
442
def updateTraining (self , procesador ):
492
443
reg = self .training ()
444
+ if reg is None :
445
+ return
493
446
reg1 = {}
494
447
for key in ("MAXMOVES" , "COLOR" , "RANDOM" ):
495
448
reg1 [key ] = reg [key ]
@@ -890,8 +843,9 @@ def importarPGO(self, partidabase, ficheroPGO, maxDepth):
890
843
self .li_xpv .sort ()
891
844
self ._conexion .commit ()
892
845
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 )
895
849
partidabase = self .getpartidabase ()
896
850
sql_insert = "INSERT INTO LINES( XPV) VALUES( ? )"
897
851
sql_update = "UPDATE LINES SET XPV=? WHERE XPV=?"
@@ -937,20 +891,18 @@ def guardaLiXPV(self, label, liXPV):
937
891
self .li_xpv .sort ()
938
892
939
893
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" )
941
895
bp .ponTotal (0 )
942
896
bp .ponRotulo (_X (_ ("Reading %1" ), "..." ))
943
897
bp .mostrar ()
944
898
945
899
cp = partida .ultPosicion
946
900
947
- liPartidas = []
948
-
949
901
setFen = LCEngine .setFen
950
902
makeMove = LCEngine .makeMove
951
903
getFen = LCEngine .getFen
952
904
953
- def hazFEN (fen , lipv_ant ):
905
+ def hazFEN (fen , lipv_ant , control ):
954
906
if bp .siCancelado ():
955
907
return
956
908
siWhite1 = " w " in fen
@@ -963,19 +915,32 @@ def hazFEN(fen, lipv_ant):
963
915
fenN = getFen ()
964
916
lipv_nue = lipv_ant [:]
965
917
lipv_nue .append (pv )
966
- hazFEN (fenN , lipv_nue )
918
+ hazFEN (fenN , lipv_nue , control )
967
919
else :
968
920
p = Partida .Partida ()
969
921
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 )
973
937
974
- hazFEN (cp .fen (), partida .lipv ())
938
+ hazFEN (cp .fen (), partida .lipv (), control )
975
939
976
940
bp .ponRotulo (_ ("Writing..." ))
977
941
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 )
979
944
bp .cerrar ()
980
945
981
946
return True
0 commit comments