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

Commit 0603bef

Browse files
committed
Version 11.10
1 parent 5c53141 commit 0603bef

Some content is hidden

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

84 files changed

+2055
-678
lines changed

Code/AnalisisIndexes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def genIndexes(partida, elos, elosFORM, alm):
368368
# for std, tit in ((Partida.OPENING, _("Opening")), (Partida.MIDDLEGAME, _("Middle game")), (Partida.ENDGAME, _("End game"))):
369369
# if elos[None][std]:
370370
# txt += plantillaC % ( tit, int(elos[True][std]), int(elos[False][std]), int(elos[None][std]))
371-
#
371+
372372
# txt += plantillaC % ("Elo WITH FORMULA", elosFORM[True][Partida.ALLGAME], elosFORM[False][Partida.ALLGAME], elosFORM[None][Partida.ALLGAME])
373373
# for std, tit in ((Partida.OPENING, _("Opening")), (Partida.MIDDLEGAME, _("Middle game")), (Partida.ENDGAME, _("End game"))):
374374
# if elos[None][std]:

Code/Books.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ def porDefecto(self, book=None):
5454
return book
5555
return self.lista[0]
5656

57+
def buscaLibro(self, nombre):
58+
for book in self.lista:
59+
if book.nombre == nombre:
60+
return book
61+
return None
62+
5763
def cambiaModo(self, apli):
5864
if apli in self._modoAnalisis:
5965
self._modoAnalisis = self._modoAnalisis.replace(apli, "")
@@ -231,7 +237,6 @@ def almListaJugadas(self, fen):
231237

232238
return listaJugadas
233239

234-
235240
def eligeJugadaTipo(self, fen, tipo):
236241
maxim = 0
237242
liMax = []
@@ -276,7 +281,7 @@ def eligeJugadaTipo(self, fen, tipo):
276281

277282
return pv.lower()
278283

279-
def miraListaPV(self, fen, siMax):
284+
def miraListaPV(self, fen, siMax, onlyone=True):
280285
li = self.book.lista(self.path, fen)
281286

282287
liResp = []
@@ -287,8 +292,8 @@ def miraListaPV(self, fen, siMax):
287292
if w > maxim:
288293
maxim = w
289294
liResp = [entry.pv()]
290-
# elif w == maxim:
291-
# liResp.append(entry.pv())
295+
elif w == maxim and not onlyone:
296+
liResp.append(entry.pv())
292297
else:
293298
for entry in li:
294299
liResp.append(entry.pv())

Code/Configuracion.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,6 @@ def lee(self):
792792
if not os.path.isdir(self.folderOpenings):
793793
self.folderOpenings = self.folderBaseOpenings
794794

795-
796795
for k in dic.keys():
797796
if k.startswith("RIVAL_"):
798797
claveK = k[6:]

Code/ControlPosicion.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,24 @@ def siFaltaMaterial(self):
345345

346346
return False
347347

348+
def siFaltaMaterialColor(self, siBlancas):
349+
piezas = ""
350+
nb = "nb"
351+
prq = "prq"
352+
if siBlancas:
353+
nb = nb.upper()
354+
prq = prq.upper()
355+
for v in self.casillas.itervalues():
356+
if v:
357+
if v in prq:
358+
return False
359+
if v in nb:
360+
if piezas:
361+
return False
362+
else:
363+
piezas = v
364+
return False
365+
348366
def numPiezas(self, pieza):
349367
if not self.siBlancas:
350368
pieza = pieza.lower()
@@ -435,5 +453,58 @@ def siPeonCoronando(self, desdeA1H8, hastaA1H8):
435453

436454
return True
437455

456+
def aura(self):
457+
lista = []
458+
459+
def add(lipos):
460+
for pos in lipos:
461+
lista.append(LCEngine.posA1(pos))
462+
463+
def liBR(npos, fi, ci):
464+
fil, col = LCEngine.posFC(npos)
465+
liM = []
466+
ft = fil + fi
467+
ct = col + ci
468+
while True:
469+
if ft < 0 or ft > 7 or ct < 0 or ct > 7:
470+
break
471+
t = LCEngine.FCpos(ft, ct)
472+
liM.append(t)
473+
474+
pz = self.casillas[LCEngine.posA1(t)]
475+
if pz:
476+
break
477+
ft += fi
478+
ct += ci
479+
add(liM)
480+
481+
pzs = "KQRBNP" if self.siBlancas else "kqrbnp"
482+
483+
for i in range(8):
484+
for j in range(8):
485+
a1 = chr(i + 97) + chr(j + 49)
486+
pz = self.casillas[a1]
487+
if pz and pz in pzs:
488+
pz = pz.upper()
489+
npos = LCEngine.a1Pos(a1)
490+
if pz == "K":
491+
add(LCEngine.liK(npos))
492+
elif pz == "Q":
493+
for f_i, c_i in ((1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1)):
494+
liBR(npos, f_i, c_i)
495+
elif pz == "R":
496+
for f_i, c_i in ((1, 0), (-1, 0), (0, 1), (0, -1)):
497+
liBR(npos, f_i, c_i)
498+
elif pz == "B":
499+
for f_i, c_i in ((1, 1), (1, -1), (-1, 1), (-1, -1)):
500+
liBR(npos, f_i, c_i)
501+
elif pz == "N":
502+
add(LCEngine.liN(npos))
503+
elif pz == "P":
504+
lim, lix = LCEngine.liP(npos, self.siBlancas)
505+
add(lix)
506+
return lista
507+
508+
438509
def distancia(desde, hasta):
439510
return ((ord(desde[0])-ord(hasta[0]))**2 + (ord(desde[1])-ord(hasta[1]))**2)**0.5

Code/EngineThread.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
DEBUG_ENGINE = False
1212

13-
def xpr(line):
13+
14+
def xpr(exe, line):
1415
if DEBUG_ENGINE:
1516
t = time.time()
1617
prlk("%0.04f %s" % (t - tdbg[0], line))
@@ -29,7 +30,7 @@ def xprli(li):
2930

3031
if DEBUG_ENGINE:
3132
tdbg = [time.time()]
32-
xpr("DEBUG XMOTOR")
33+
xpr("", "DEBUG XMOTOR")
3334

3435

3536
class Priorities:
@@ -87,7 +88,7 @@ def cerrar(self):
8788
self.working = False
8889

8990
def put_line(self, line):
90-
assert xpr("put>>> %s\n" % line)
91+
assert xpr(self.exe, "put>>> %s\n" % line)
9192
self.stdin_lock.acquire()
9293
self.stdin.write(line + "\n")
9394
self.stdin_lock.release()
@@ -109,7 +110,7 @@ def xstdout_thread(self, stdout, lock):
109110
try:
110111
while self.working:
111112
line = stdout.readline()
112-
assert xpr(line)
113+
assert xpr(self.exe, line)
113114
if not line:
114115
break
115116
lock.acquire()

Code/EnginesWindows.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def mas(cm):
137137
cm.ponMultiPV(1, 4)
138138
mas(cm)
139139

140-
cm = ConfigMotor("cheng", "Martin Sedlák", "4 0.39", "http://www.vlasak.biz/cheng")
140+
cm = ConfigMotor("cheng", "Martin Sedlák".decode("utf-8"), "4 0.39", "http://www.vlasak.biz/cheng")
141141
cm.path = "cheng4.exe"
142142
cm.elo = 2750
143143
cm.ponMultiPV(20, 256)
@@ -200,7 +200,7 @@ def mas(cm):
200200
cm.ponMultiPV(20, 100)
201201
mas(cm)
202202

203-
cm = ConfigMotor("texel", "Peter Österlund", "1.07 32bit", "http://hem.bredband.net/petero2b/javachess/index.html#texel")
203+
cm = ConfigMotor("texel", "Peter Österlund".decode("utf-8"), "1.07 32bit", "http://hem.bredband.net/petero2b/javachess/index.html#texel")
204204
cm.path = "texel32old.exe"
205205
cm.elo = 3100
206206
cm.ordenUCI("Hash", "32")
@@ -288,7 +288,7 @@ def mas(cm):
288288
cm.elo = 2100
289289
mas(cm)
290290

291-
cm = ConfigMotor("andscacs", "Daniel José Queraltó", "0.9032n", "http://www.andscacs.com/")
291+
cm = ConfigMotor("andscacs", "Daniel José Queraltó".decode("utf-8"), "0.9032n", "http://www.andscacs.com/")
292292
cm.path = "andscacs32.exe"
293293
cm.elo = 3150
294294
mas(cm)
@@ -308,12 +308,12 @@ def mas(cm):
308308
cm.elo = 2627
309309
mas(cm)
310310

311-
cm = ConfigMotor("spike", "Volker Böhm and Ralf Schäfer", "1.4", "http://spike.lazypics.de/index_en.html")
311+
cm = ConfigMotor("spike", "Volker Böhm and Ralf Schäfer".decode("utf-8"), "1.4", "http://spike.lazypics.de/index_en.html")
312312
cm.path = "Spike1.4.exe"
313313
cm.elo = 2921
314314
mas(cm)
315315

316-
cm = ConfigMotor("zappa", "Anthony Cozzie", "1.1", "http://www.acoz.net/zappa/")
316+
cm = ConfigMotor("zappa", "Anthony Cozzie", "1.1", "http://www.acoz.net/zappa/")
317317
cm.path = "zappa.exe"
318318
cm.elo = 2581
319319
cm.removeLog("zappa_log.txt")

Code/Entrenamientos.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def xopcion(menu, clave, texto, icono, siDeshabilitado=False):
140140
xopcion(menu, "wgm", _("Play like a Woman Grandmaster"), Iconos.WGranMaestro())
141141
menu.separador()
142142

143-
144143
# Mate --------------------------------------------------------------------------------------------------
145144
menu1 = menu.submenu(_("Training mates"), Iconos.Mate())
146145
for mate in range(1, 5):
@@ -190,7 +189,6 @@ def menuTacticas(submenu, tipo, carpetaBase, lista):
190189
menuTacticas(submenu1, tipo, carpeta, lista)
191190
return lista
192191

193-
194192
menuTacticas(menu1, "B", "Tactics", [])
195193
lista = []
196194
carpetaTacticasP = os.path.join(self.configuracion.dirPersonalTraining, "Tactics")
@@ -718,4 +716,4 @@ def xopcion(menu, clave, texto, icono, siDeshabilitado=False):
718716
td.reduce()
719717
td.menu(menu, xopcion)
720718
resp = menu.lanza()
721-
return resp if resp is None else resp[3:]
719+
return resp if resp is None else resp[3:]

Code/Gestor.py

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from Code import AnalisisIndexes
1010
from Code import AperturasStd
1111
from Code import ControlPGN
12+
from Code import ControlPosicion
1213
from Code import DGT
1314
from Code import Jugada
1415
from Code import Partida
@@ -28,6 +29,7 @@
2829
from Code.QT import QTUtil2
2930
from Code.QT import QTVarios
3031
from Code.QT import WOpeningGuide
32+
from Code.QT import TabTipos
3133
from Code import Util
3234
from Code import VarGen
3335
from Code import Kibitzers
@@ -285,18 +287,20 @@ def showCandidates():
285287
if not self.configuracion.siAtajosRaton:
286288
if li_destinos:
287289
self.atajosRatonOrigen = a1h8
288-
if self.atajosRatonDestino and self.atajosRatonDestino in li_destinos:
289-
mueve()
290-
else:
291-
self.atajosRatonDestino = None
292-
showCandidates()
290+
self.atajosRatonDestino = None
291+
# if self.atajosRatonDestino and self.atajosRatonDestino in li_destinos:
292+
# mueve()
293+
# else:
294+
# self.atajosRatonDestino = None
295+
showCandidates()
293296
return
294297
elif li_origenes:
295298
self.atajosRatonDestino = a1h8
296299
if self.atajosRatonOrigen and self.atajosRatonOrigen in li_origenes:
297300
mueve()
298301
else:
299302
self.atajosRatonOrigen = None
303+
self.atajosRatonDestino = None
300304
showCandidates()
301305
return
302306

@@ -520,6 +524,8 @@ def miraKibitzers(self, jg, columnaClave, soloNuevo=False):
520524
def paraKibitzers(self):
521525
for n, xkibitzer in enumerate(self.liKibitzersActivas):
522526
xkibitzer.terminar() #ponFen(None)
527+
self.procesador.quitaKibitzers()
528+
self.liKibitzersActivas = []
523529

524530
def ponPiezasAbajo(self, siBlancas):
525531
self.tablero.ponerPiezasAbajo(siBlancas)
@@ -829,7 +835,6 @@ def gridRightMouse(self, siShift, siControl, siAlt):
829835
self.pgnInformacion()
830836
self.pantalla.ajustaTam()
831837

832-
833838
def listado(self, tipo):
834839
if tipo == "pgn":
835840
return self.pgn.actual()
@@ -899,7 +904,7 @@ def cambioTutor(self):
899904
self.siAnalizadoTutor = False
900905

901906
if self.tipoJuego == kJugEntMaq:
902-
self.analizaTutorInicio()
907+
self.analizaInicio()
903908

904909
def siTerminada(self):
905910
return self.partida.ultPosicion.siTerminada()
@@ -1054,6 +1059,44 @@ def exePulsadoNum(self, siActivar, numero):
10541059
if self.tablero.flechaSC:
10551060
self.tablero.flechaSC.show()
10561061

1062+
elif numero in [2, 7]:
1063+
if siActivar:
1064+
# Que jugada esta en el tablero
1065+
fen = self.fenActivoConInicio()
1066+
siBlancas = " w " in fen
1067+
if numero == 2:
1068+
siMB = siBlancas
1069+
else:
1070+
siMB = not siBlancas
1071+
if siMB != siBlancas:
1072+
fen = LCEngine.fenOB(fen)
1073+
cp = ControlPosicion.ControlPosicion()
1074+
cp.leeFen(fen)
1075+
liMovs = cp.aura()
1076+
1077+
self.liMarcosTmp = []
1078+
regMarco = TabTipos.Marco()
1079+
color = self.tablero.confTablero.flechaActivoDefecto().colorinterior
1080+
if color == -1:
1081+
color = self.tablero.confTablero.flechaActivoDefecto().color
1082+
1083+
st = set()
1084+
for h8 in liMovs:
1085+
if h8 not in st:
1086+
regMarco.a1h8 = h8 + h8
1087+
regMarco.siMovible = True
1088+
regMarco.color = color
1089+
regMarco.colorinterior = color
1090+
regMarco.opacidad = 0.5
1091+
marco = self.tablero.creaMarco(regMarco)
1092+
self.liMarcosTmp.append(marco)
1093+
st.add(h8)
1094+
1095+
else:
1096+
for marco in self.liMarcosTmp:
1097+
self.tablero.xremoveItem(marco)
1098+
self.liMarcosTmp = []
1099+
10571100
def exePulsadaLetra(self, siActivar, letra):
10581101
if siActivar:
10591102
dic = { 'a':kMoverInicio,
@@ -1296,7 +1339,6 @@ def configurar(self, liMasOpciones=None, siCambioTutor=False, siSonidos=False, s
12961339
modoPosicionBlind = True
12971340
self.tablero.blindfoldChange(modoPosicionBlind)
12981341

1299-
13001342
elif orden == "conf":
13011343
self.tablero.blindfoldConfig()
13021344

@@ -1505,6 +1547,11 @@ def utilidades(self, liMasOpciones=None, siArbol=True):
15051547

15061548
return None
15071549

1550+
def mensajeEnPGN(self, mens, titulo=None):
1551+
p0 = self.pantalla.base.pgn.pos()
1552+
p = self.pantalla.mapToGlobal(p0)
1553+
QTUtil2.mensajeEnPunto(self.pantalla, mens, titulo, p)
1554+
15081555
def showAnalisis(self):
15091556
um = self.procesador.unMomento()
15101557
elos = self.partida.calc_elos(self.configuracion)

Code/GestorAlbum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def ponResultado(self, quien):
283283
self.resultado = kTablas
284284

285285
self.guardarGanados(quien == kGanamos)
286-
QTUtil2.mensaje(self.pantalla, mensaje)
286+
self.mensajeEnPGN(mensaje)
287287
self.ponFinJuego()
288288
self.xrival.cerrar()
289289
self.pantalla.ponToolBar((k_mainmenu, k_configurar, k_utilidades))

0 commit comments

Comments
 (0)