diff --git a/Code/Analisis.py b/Code/Analisis.py index 650e20e..8d45b17 100644 --- a/Code/Analisis.py +++ b/Code/Analisis.py @@ -419,7 +419,7 @@ def guiDispatch(rm): if siBP2: tmpBP.pon(2, npos + 1) else: - tmpBP.pon(npos + 1) + tmpBP.pon(npos) if self.rutDispatchBP: self.rutDispatchBP(npos, nJugadas, njg) diff --git a/Code/AnalisisIndexes.py b/Code/AnalisisIndexes.py index 9863f10..51c293e 100644 --- a/Code/AnalisisIndexes.py +++ b/Code/AnalisisIndexes.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import VarGen from Code import Partida diff --git a/Code/AperturasStd.py b/Code/AperturasStd.py index 5bcbf87..85a7586 100644 --- a/Code/AperturasStd.py +++ b/Code/AperturasStd.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from operator import attrgetter diff --git a/Code/CajonDesastre.py b/Code/CajonDesastre.py index a83b37b..6dfbc00 100644 --- a/Code/CajonDesastre.py +++ b/Code/CajonDesastre.py @@ -4,7 +4,7 @@ import shutil import sqlite3 -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import BaseConfig from Code import Util diff --git a/Code/Configuracion.py b/Code/Configuracion.py index 90ed3b6..c96fd4c 100644 --- a/Code/Configuracion.py +++ b/Code/Configuracion.py @@ -130,7 +130,7 @@ def __init__(self, user): self.estilo = "Cleanlooks" self.vistaTutor = kTutorH - self.efectosVisuales = True + self.efectosVisuales = False self.rapidezMovPiezas = 100 self.guardarVariantesTutor = True @@ -211,7 +211,7 @@ def __init__(self, user): self.dicRivales = Engines.leeRivales() - self.rivalInicial = "rocinante" if VarGen.isLinux else "tarrasch" + self.rivalInicial = "rocinante" if VarGen.isLinux else "irina" self.rival = self.buscaRival(self.rivalInicial) self.tutorInicial = "mcbrain" @@ -331,6 +331,7 @@ def ponCarpetas(self, user): self.ficheroPlayPGN = "%s/PlayPGN.db" % self.carpeta self.ficheroAlbumes = "%s/albumes.pkd" % self.carpeta self.ficheroPuntuaciones = "%s/hpoints.pkd" % self.carpeta + self.ficheroAnotar = "%s/anotar.db" % self.carpeta self.ficheroSelectedPositions = "%s/Selected positions.fns" % self.dirPersonalTraining self.ficheroPresentationPositions = "%s/Challenge 101.fns" % self.dirPersonalTraining @@ -895,10 +896,12 @@ def listaMotoresInternos(self): li = sorted(li, key=lambda cm: cm.nombre) return li - def listaMotoresExternos(self): + def listaMotoresExternos(self, ordenados=True): listaMotoresExt = MotoresExternos.ListaMotoresExternos(self.ficheroMExternos) listaMotoresExt.leer() - li = sorted(listaMotoresExt.liMotores, key=lambda cm: cm.alias) + li = listaMotoresExt.liMotores + if ordenados: + li.sort(key=lambda cm: cm.alias) return li def listaMotores(self): diff --git a/Code/Constantes.py b/Code/Constantes.py index 6930fa6..4fe10f8 100644 --- a/Code/Constantes.py +++ b/Code/Constantes.py @@ -6,8 +6,8 @@ kJugNueva, kJugEntPos, kJugPGN, kJugEntMaq, kJugGM, kJugRemoto, kJugSolo, kJug60, kJugElo, kJugMicElo, kJugBooks, kJugAperturas, kJugOpeningLines, kJugBoxing, kJugEntTac, kJugMvM, kJugAlbum, kJugFics, kJugFide, kJugLichess, kJugWorldMap, kJugRoute, kJugEntLight, kJugWashingCreate, kJugWashingTactics, kJugWashingReplay, - kJugSingularMoves -) = range(27) + kJugSingularMoves, kJugAnotar +) = range(28) kFinNormal, kFinReinicio = range(2) diff --git a/Code/ControlPGN.py b/Code/ControlPGN.py index 336cc25..5991341 100644 --- a/Code/ControlPGN.py +++ b/Code/ControlPGN.py @@ -154,7 +154,7 @@ def actual(self): if tipoJuego == kJugGM: return self.actualGM() - elif tipoJuego in (kJugPGN, kJugSolo, kJugRoute, kJugEntLight): + elif tipoJuego in (kJugPGN, kJugSolo, kJugRoute, kJugEntLight, kJugAnotar): return self.gestor.actualPGN() if tipoJuego == kJugRemoto: diff --git a/Code/ControlPosicion.py b/Code/ControlPosicion.py index eebfb4e..9850da6 100644 --- a/Code/ControlPosicion.py +++ b/Code/ControlPosicion.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import TrListas diff --git a/Code/DBgames.py b/Code/DBgames.py index b37e02d..6a973f4 100644 --- a/Code/DBgames.py +++ b/Code/DBgames.py @@ -4,7 +4,7 @@ import time import random -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import ControlPosicion from Code import Partida diff --git a/Code/DBgamesFEN.py b/Code/DBgamesFEN.py index 0c66424..77d096d 100644 --- a/Code/DBgamesFEN.py +++ b/Code/DBgamesFEN.py @@ -4,7 +4,7 @@ import time import random -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Partida from Code import Util diff --git a/Code/EnginesBunch.py b/Code/EnginesBunch.py index e050785..08b09dd 100644 --- a/Code/EnginesBunch.py +++ b/Code/EnginesBunch.py @@ -1,4 +1,5 @@ + def relaciones(dicRivales): result = """ stockfish=b2b3 e2e4 c1d2 e3e4 g1e2 c4c5 c1d2 b3e3 e1g1 b3d1 a4d7 d2c4 f1b5 d1d4 a1c1 c4c5 d4d5 a2a4 d1c1 e2e4 c1f4 e2c1 e1g1 d2d4 a4b5 h2h3 c1g5 d3d4 b2b3 a2a4 f2f4 a2a4 e1g1 d3d4 a2a4 b1c3 f1e1 d1c1 d1a4 b2b3 d4d5 c1d2 a2a3 h2h3 c4b5 c3e2 c3d1 e1g1 f1g2 e3d4 d1e2 f1e1 a4c4 a4b5 a4b5 d2d4 e1g1 c2c3 d2d4 e1g1 a2a4 d4d5 e1g1 d2b3 b1c3 d2d3 g2c6 b2b3 d4d5 c1e3 c4d3 c4d3 a2a4 f1d3 d4e5 b1a3 g2g3 b5e2 d2d3 c1e3 e1g1 d4d5 c4c5 e2f4 c4c5 d2d4 b1c3 e3d4 g2g4 f1e1 c1f4 d2d4 b2b3 c1b2 b5c3 a2a4 d2d3 f1e2 e2e3 f1g2 @@ -76,6 +77,7 @@ def relaciones(dicRivales): d[s] = n return d + def filtra(dicRivales): d = relaciones(dicRivales) stkeys = set() @@ -85,6 +87,7 @@ def filtra(dicRivales): dresp = {k:v for k,v in dicRivales.iteritems() if k in stkeys} return dresp + def getLista(configuracion, num_elementos): def haz(xdrel, clave): s = set() @@ -106,7 +109,7 @@ def haz(xdrel, clave): resp = otro mx = x if resp == None: - print "error", repet, clave + pass s.add(resp) total += mx li = list(s) @@ -151,6 +154,7 @@ def haz(xdrel, clave): dlista[clave] = s return dlista + def getListaClave(configuracion, num_elementos, clave): dlista = getLista(configuracion, num_elementos) - return dlista[clave] \ No newline at end of file + return dlista[clave] diff --git a/Code/EnginesLinux32.py b/Code/EnginesLinux32.py index ade23b1..ce363f6 100644 --- a/Code/EnginesLinux32.py +++ b/Code/EnginesLinux32.py @@ -151,8 +151,8 @@ def mas(cm): cm.ordenUCI("Hash", "64") mas(cm) - cm = ConfigMotor("mcbrain", "Michael Byrne", "9.1", "https://github.com/MichaelB7/Stockfish/releases") - cm.path = "McBrain-91_x32_linux" + cm = ConfigMotor("mcbrain", "Michael Byrne", "9.9", "https://github.com/MichaelB7/Stockfish/releases") + cm.path = "McBrain-v99_x32_linux" cm.elo = 3200 cm.ordenUCI("Contempt", "0") cm.ordenUCI("Hash", "64") diff --git a/Code/EnginesLinux64.py b/Code/EnginesLinux64.py index d3aff76..d52881b 100644 --- a/Code/EnginesLinux64.py +++ b/Code/EnginesLinux64.py @@ -138,8 +138,8 @@ def mas(cm): cm.ordenUCI("Hash", "64") mas(cm) - cm = ConfigMotor("mcbrain", "Michael Byrne", "9.1", "https://github.com/MichaelB7/Stockfish/releases") - cm.path = "McBrain-91_x64_linux" + cm = ConfigMotor("mcbrain", "Michael Byrne", "9.9", "https://github.com/MichaelB7/Stockfish/releases") + cm.path = "McBrain-v99_x64_linux" cm.elo = 3200 cm.ordenUCI("Contempt", "0") cm.ordenUCI("Hash", "64") diff --git a/Code/EnginesWindows.py b/Code/EnginesWindows.py index b758492..99c19f3 100644 --- a/Code/EnginesWindows.py +++ b/Code/EnginesWindows.py @@ -218,9 +218,9 @@ def mas(cm): cm.ponMultiPV(20, 500) mas(cm) - cm = ConfigMotor("mcbrain", "Michael Byrne", "9.1 32bit", "https://github.com/MichaelB7/Stockfish/releases") - cm.path = "McBrain-91_x32_old.exe" - cm.path_64 = "McBrain-91_x64_bmi2.exe", "9.1 64bit bmi2" + cm = ConfigMotor("mcbrain", "Michael Byrne", "9.9 32bit", "https://github.com/MichaelB7/Stockfish/releases") + cm.path = "McBrain-v99_x32_old.exe" + cm.path_64 = "McBrain-v99_x64_bmi2.exe", "9.9 64bit bmi2" cm.elo = 3200 cm.ordenUCI("Contempt", "0") cm.ordenUCI("Hash", "64") diff --git a/Code/Entrenamientos.py b/Code/Entrenamientos.py index fab613c..f2429e2 100644 --- a/Code/Entrenamientos.py +++ b/Code/Entrenamientos.py @@ -350,6 +350,9 @@ def menuTacticas(submenu, tipo, carpetaBase, lista): menu1.separador() xopcion(menu1, "visualiza", _("The board at a glance"), Iconos.Gafas()) + menu1.separador() + xopcion(menu1, "anotar", _("Writing down moves of a game"), Iconos.Write()) + # menu2 = menu1.submenu(_("Endings with 3/4 pieces"), Iconos.Puente()) # xopcion(menu2, "end_t4-1", "%s %d"%(_("Level"), 1), Iconos.PuntoAzul()) # xopcion(menu2, "end_t4-2", "%s %d"%(_("Level"), 2), Iconos.PuntoMagenta()) @@ -406,6 +409,9 @@ def menu_run(self, resp): elif resp == "visualiza": self.visualiza() + elif resp == "anotar": + self.anotar() + elif resp.startswith("tactica|"): nada, tipo, nombre, carpeta, ini = resp.split("|") self.tacticas(tipo, nombre, carpeta, ini) @@ -630,6 +636,9 @@ def potencia(self): def visualiza(self): PantallaVisualiza.pantallaVisualiza(self.procesador) + def anotar(self): + self.procesador.show_anotar() + def puente(self, nivel): PantallaPuente.pantallaPuente(self.procesador, nivel) diff --git a/Code/Everest.py b/Code/Everest.py index 3bc652d..a7d75d7 100644 --- a/Code/Everest.py +++ b/Code/Everest.py @@ -1,4 +1,7 @@ -import LCEngineV1 as LCEngine +import os +import random + +import LCEngine2 as LCEngine from Code import Partida from Code.SQL import Base @@ -10,6 +13,22 @@ def str_file(fichero): return eval(f.read()) +def get_partida_random(): + path = "./IntFiles/Everest" + li = [fich for fich in os.listdir(path) if fich.endswith(".str")] + fichero = random.choice(li) + litourneys = str_file(os.path.join(path, fichero)) + dictourney = random.choice(litourneys) + games = dictourney["GAMES"] + game = random.choice(games) + labels = game["LABELS"] + xpv = game["XPV"] + pc = Partida.PartidaCompleta(liTags=labels) + pv = LCEngine.xpv2pv(xpv) + pc.leerPV(pv) + return pc + + def gen_list(txt): # tolerance and tries in 12 xmin, xmax = txt.split(",") xmin = int(xmin) diff --git a/Code/GM.py b/Code/GM.py index e52dc90..aed9f45 100644 --- a/Code/GM.py +++ b/Code/GM.py @@ -1,7 +1,7 @@ import operator import os -from LCEngineV1 import xpv2pv, pv2xpv +from LCEngine2 import xpv2pv, pv2xpv from Code import Jugada from Code import Util diff --git a/Code/Gestor.py b/Code/Gestor.py index c27dbd6..418d94a 100644 --- a/Code/Gestor.py +++ b/Code/Gestor.py @@ -3,7 +3,7 @@ import random import time -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Analisis from Code import AnalisisIndexes diff --git a/Code/Gestor60.py b/Code/Gestor60.py index 92987b2..aa40f0a 100644 --- a/Code/Gestor60.py +++ b/Code/Gestor60.py @@ -2,7 +2,7 @@ import random import time -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import ControlPosicion from Code import Gestor diff --git a/Code/GestorAnotar.py b/Code/GestorAnotar.py new file mode 100644 index 0000000..98155c4 --- /dev/null +++ b/Code/GestorAnotar.py @@ -0,0 +1,166 @@ +import time + +from Code import Util +from Code import Gestor +from Code import Partida +from Code.QT import QTVarios +from Code.Constantes import * + + +class GestorAnotar(Gestor.Gestor): + def inicio(self, partidaObjetivo, siBlancaAbajo): + + self.partida = Partida.Partida() + self.tipoJuego = kJugAnotar + self.partidaObjetivo = partidaObjetivo + self.jugadaActual = -1 + self.totalJugadas = len(self.partidaObjetivo) + self.tablero.showCoordenadas(False) + + self.ayudasRecibidas = 0 + self.errores = 0 + self.cancelado = False + + self.pantalla.ponActivarTutor(False) + self.siBlancasAbajo = siBlancaAbajo + self.ponPiezasAbajo(self.siBlancasAbajo) + self.mostrarIndicador(True) + self.siTerminar = False + self.pantalla.ponToolBar((k_mainmenu,)) + self.pantalla.habilitaToolbar(k_mainmenu, False) + self.informacionActivable = False + self.pantalla.activaInformacionPGN(False) + self.pantalla.activaJuego(False, False, siAyudas=False) + self.ponActivarTutor(False) + self.quitaAyudas() + self.ponVista() + self.ponRotulo1("") + self.ponRotulo2("") + + self.estado = kJugando + + self.desactivaTodas() + + self.tiempo = 0.0 + + self.siguienteJugada() + + def siguienteJugada(self): + if self.estado == kFinJuego: + return False + + self.estado = kJugando + + self.jugadaActual += 1 + if self.jugadaActual >= self.totalJugadas: + self.finalizar() + return False + + self.ponPiezasAbajo(self.siBlancasAbajo) + + self.ponPosicion(self.partida.ultPosicion) + + siBlancas = self.partida.siBlancas() + self.colorJugando = siBlancas + + self.ponIndicador(siBlancas) + jg = self.partidaObjetivo.jugada(self.jugadaActual) + self.partida.append_jg(jg) + if self.partida.pendienteApertura: + self.partida.asignaApertura() + self.movimientosPiezas(jg.liMovs, True) + self.tablero.ponFlechaSC(jg.desde, jg.hasta) + + tm = time.time() + + w = QTVarios.ReadAnnotation(self.pantalla, jg.pgnSP()) + if not w.exec_(): + self.cancelado = True + self.finalizar() + return False + + self.tiempo += time.time() - tm + conAyuda, errores = w.resultado + if conAyuda: + self.ayudasRecibidas += 1 + self.errores += errores + + self.refresh() + + return self.siguienteJugada() + + def procesarAccion(self, clave): + if clave == k_reiniciar: + self.inicio(self.partidaObjetivo, self.siBlancasAbajo) + + elif clave in (k_cancelar, k_mainmenu): + self.tablero.showCoordenadas(True) + self.procesador.inicio() + self.procesador.show_anotar() + + elif clave == k_configurar: + self.configurar() + + elif clave == k_utilidades: + self.utilidades() + + else: + Gestor.Gestor.rutinaAccionDef(self, clave) + + def finalX(self): + self.tablero.showCoordenadas(True) + return True + + def finalizar(self): + self.informacionActivable = True + self.tablero.showCoordenadas(True) + self.pantalla.activaJuego(True, False, siAyudas=False) + self.quitaAyudas() + self.pantalla.ponToolBar((k_mainmenu, k_reiniciar, k_configurar, k_utilidades)) + if self.cancelado: + self.partida = self.partidaObjetivo + self.ponteAlFinal() + blancas, negras, fecha, event, result = "", "", "", "", "" + for key, value in self.partidaObjetivo.liTags: + key = key.upper() + if key == "WHITE": + blancas = value + elif key == "BLACK": + negras = value + elif key == "DATE": + fecha = value + elif key == "EVENT": + event = value + elif key == "RESULT": + result = value + + self.ponRotulo1("%s - %s
%s: %s
%s: %s
%s: %s" % ( + fecha, event, + _("White"), blancas, + _("Black"), negras, + _("Result"), result)) + numjug = self.jugadaActual + if numjug > 0: + self.ponRotulo2("%s: %d
%s: %0.2f\"
%s: %d
%s: %d" % ( + _("Moves"), numjug, + _("Average time"), self.tiempo/numjug, + _("Errors"), self.errores, + _("Hints"), self.ayudasRecibidas + )) + if numjug > 2: + db = Util.DicSQL(self.configuracion.ficheroAnotar) + f = Util.hoy() + key = "%04d-%02d-%02d %02d:%02d:%02d" % (f.year, f.month, f.day, f.hour, f.minute, f.second) + db[key] = { + "PC": self.partidaObjetivo, + "MOVES": numjug, + "TIME": self.tiempo/numjug, + "HINTS": self.ayudasRecibidas, + "ERRORS": self.errores, + "COLOR": self.siBlancasAbajo, + } + db.close() + + def actualPGN(self): + return self.partidaObjetivo.pgn() + diff --git a/Code/GestorEntMaq.py b/Code/GestorEntMaq.py index 9c11a92..3f56cb2 100644 --- a/Code/GestorEntMaq.py +++ b/Code/GestorEntMaq.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtCore from Code import Analisis diff --git a/Code/GestorFideFics.py b/Code/GestorFideFics.py index 27f2dca..7204b97 100644 --- a/Code/GestorFideFics.py +++ b/Code/GestorFideFics.py @@ -3,7 +3,7 @@ import datetime import random -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Apertura from Code import Gestor diff --git a/Code/GestorOpeningLines.py b/Code/GestorOpeningLines.py index 849dd0d..d8693af 100644 --- a/Code/GestorOpeningLines.py +++ b/Code/GestorOpeningLines.py @@ -1,7 +1,9 @@ import time +import random from Code import Gestor from Code import Jugada +from Code import Books from Code import ControlPosicion from Code import TrListas from Code.QT import QTUtil2 @@ -32,9 +34,20 @@ def reinicio(self, dbop): self.trainingEngines = self.dbop.trainingEngines() - liTimes = self.trainingEngines["TIMES"] + self.auto_analysis = self.trainingEngines.get("AUTO_ANALYSIS", True) + self.ask_movesdifferent = self.trainingEngines.get("ASK_MOVESDIFFERENT", False) + + liTimes = self.trainingEngines.get("TIMES") + if not liTimes: + liTimes = [500, 1000, 2000, 4000, 8000] + liBooks = self.trainingEngines.get("BOOKS") + if not liBooks: + liBooks = ["", "", "", "", ""] liEngines = self.trainingEngines["ENGINES"] - num_engines = len(liEngines) + num_engines_base = len(liEngines) + liEnginesExt = self.trainingEngines.get("EXT_ENGINES", []) + num_engines = num_engines_base+len(liEnginesExt) + if self.numengine >= num_engines: self.level += 1 self.numengine = 0 @@ -49,7 +62,20 @@ def reinicio(self, dbop): return self.time = liTimes[self.level] - self.keyengine = liEngines[self.numengine] + nombook = liBooks[self.level] + if nombook: + listaLibros = Books.ListaLibros() + listaLibros.recuperaVar(self.configuracion.ficheroBooks) + self.book = listaLibros.buscaLibro(nombook) + if self.book: + self.book.polyglot() + else: + self.book = None + + if self.numengine < num_engines_base: + self.keyengine = liEngines[self.numengine] + else: + self.keyengine = "*" + liEnginesExt[self.numengine-num_engines_base-1] self.plies_mandatory = self.trainingEngines["MANDATORY"] self.plies_control = self.trainingEngines["CONTROL"] @@ -61,7 +87,7 @@ def reinicio(self, dbop): self.siAprobado = False - rival = self.configuracion.buscaRival(self.keyengine) + rival = self.configuracion.buscaRivalExt(self.keyengine) self.xrival = self.procesador.creaGestorMotor(rival, self.time, None) self.xrival.siBlancas = self.siRivalConBlancas @@ -133,18 +159,30 @@ def mueveRival(self): si_obligatorio = self.partida.numJugadas() <= self.plies_mandatory si_pensar = True fenM2 = self.partida.ultPosicion.fenM2() + moves = self.dicFENm2.get(fenM2, set()) if si_obligatorio: - moves = self.dicFENm2.get(fenM2, set()) nmoves = len(moves) if nmoves == 0: si_obligatorio = False - elif nmoves == 1: - move = list(moves)[0] + else: + move = self.dbop.get_cache_engines(self.keyengine, self.time, fenM2) + if move is None: + if self.book: + move_book = self.book.eligeJugadaTipo(self.partida.ultPosicion.fen(), "au") + if move_book in list(moves): + move = move_book + if move is None: + move = random.choice(list(moves)) + self.dbop.set_cache_engines(self.keyengine, self.time, fenM2, move) desde, hasta, coronacion = move[:2], move[2:4], move[4:] si_pensar = False if si_pensar: - move = self.dbop.get_cache_engines(self.keyengine, self.time, fenM2) + move = None + if self.book: + move = self.book.eligeJugadaTipo(self.partida.ultPosicion.fen(), "mp") + if move is None: + move = self.dbop.get_cache_engines(self.keyengine, self.time, fenM2) if move is None: rmRival = self.xrival.juegaPartida(self.partida) move = rmRival.movimiento() @@ -182,9 +220,16 @@ def mueveHumano(self, desde, hasta, coronacion=""): for move in moves: self.tablero.creaFlechaMulti(move, False) self.tablero.creaFlechaMulti(jg.movimiento(), True) - self.mensajeEnPGN(_("This is not the move in the opening lines, you must repeat the game")) - self.ponFinJuego() - return True + if self.ask_movesdifferent: + mensaje = "%s\n%s" % (_("This is not the move in the opening lines"), + _("Do you want to go on with this move?")) + if not QTUtil2.pregunta(self.pantalla, mensaje): + self.ponFinJuego() + return True + else: + self.mensajeEnPGN(_("This is not the move in the opening lines, you must repeat the game")) + self.ponFinJuego() + return True self.movimientosPiezas(jg.liMovs) @@ -214,13 +259,13 @@ def masJugada(self, jg, siNuestra): def muestraInformacion(self): li = [] li.extend(self.li_info) - + si_obligatorio = self.partida.numJugadas() < self.plies_mandatory if si_obligatorio and self.estado != kFinJuego: fenM2 = self.partida.ultPosicion.fenM2() moves = self.dicFENm2.get(fenM2, []) if len(moves) > 0: - li.append( "%s: %d/%d" % (_("Mandatory move"), self.partida.numJugadas(), self.plies_mandatory)) + li.append( "%s: %d/%d" % (_("Mandatory move"), self.partida.numJugadas()+1, self.plies_mandatory)) else: si_obligatorio = False @@ -238,6 +283,26 @@ def runcontrol(self): if numJugadas == 0: return False + um = [None] # controla unMomento + + def mensEspera(siFinal=False, siCancelar=False, masTitulo=None): + if siFinal: + if um[0]: + um[0].final() + else: + if um[0] is None: + um[0] = QTUtil2.mensajeTemporal(self.pantalla, _("Analyzing"), 0, posicion="ad", siCancelar=True, + titCancelar=_("Cancel")) + if masTitulo: + um[0].rotulo( _("Analyzing") + " " + masTitulo ) + um[0].me.activarCancelar(siCancelar) + + def siCancelado(): + si = um[0].cancelado() + if si: + um[0].final() + return si + def aprobado(): mens = "%s" % _("Congratulations, goal achieved") self.li_info.append("") @@ -260,10 +325,9 @@ def calculaJG(jg, siinicio): tiempo = self.xjuez.motorTiempoJugada mrm = self.dbop.get_cache_engines(nombre, tiempo, fen) if mrm is None: - um = self.unMomento() + mensEspera() mrm = self.xjuez.analiza(fen) self.dbop.set_cache_engines(nombre, tiempo, fen, mrm) - um.final() rm = mrm.mejorMov() if (" w " in fen) == self.siJugamosConBlancas: @@ -271,6 +335,35 @@ def calculaJG(jg, siinicio): else: return -rm.puntos, -rm.mate + def run_auto_analysis(): + lista = [] + for njg in range(self.partida.numJugadas()): + jg = self.partida.jugada(njg) + if jg.siBlancas() == self.siJugamosConBlancas: + fenM2 = jg.posicionBase.fenM2() + if fenM2 not in self.dicFENm2: + lista.append(jg) + jg.fenM2 = fenM2 + total = len(lista) + for pos, jg in enumerate(lista, 1): + if siCancelado(): + break + mensEspera(siCancelar=True, masTitulo="%d/%d" % (pos, total)) + nombre = self.xanalyzer.nombre + tiempo = self.xanalyzer.motorTiempoJugada + depth = self.xanalyzer.motorProfundidad + mrm = self.dbop.get_cache_engines(nombre, tiempo, jg.fenM2, depth) + ok = False + if mrm: + rm, pos = mrm.buscaRM(jg.movimiento()) + if rm: + ok = True + if not ok: + mrm, pos = self.xanalyzer.analizaJugada(jg, self.xanalyzer.motorTiempoJugada, self.xanalyzer.motorProfundidad) + self.dbop.set_cache_engines(nombre, tiempo, jg.fenM2, mrm, depth) + jg.analisis = mrm, pos + self.pantalla.base.pgnRefresh() + siCalcularInicio = True if self.partida.siTerminada(): self.ponFinJuego() @@ -293,6 +386,7 @@ def calculaJG(jg, siinicio): if self.plies_pendientes > 0: return False # Si la ultima jugada es de la linea no se calcula nada + mensEspera() puntosFinal, mateFinal = calculaJG(jg, False) # Se marcan todas las jugadas que no siguen las lineas @@ -331,9 +425,14 @@ def appendInfo(label, puntos, mate): self.li_info.append(mens) if perdidos > self.lost_points: + if self.auto_analysis: + run_auto_analysis() + mensEspera(siFinal=True) suspendido() else: + mensEspera(siFinal=True) aprobado() + self.ponFinJuego() return True @@ -357,13 +456,19 @@ def procesarAccion(self, clave): elif clave == k_utilidades: liMasOpciones = [] liMasOpciones.append(("libros", _("Consult a book"), Iconos.Libros())) - if self.siAprobado: - liMasOpciones.append((None, None, None)) - liMasOpciones.append(("add_line", _("Add this line"), Iconos.OpeningLines())) + liMasOpciones.append((None, None, None)) + liMasOpciones.append(("add_line", _("Add this line"), Iconos.OpeningLines())) + liMasOpciones.append((None, None, None)) + mens = _("cancel") if self.auto_analysis else _("activate") + liMasOpciones.append(("auto_analysis", "%s: %s" % (_("Automatic analysis"), mens), Iconos.Analizar())) + liMasOpciones.append((None, None, None)) + mens = _("cancel") if self.ask_movesdifferent else _("activate") + liMasOpciones.append(("ask_movesdifferent", "%s: %s" % (_("Ask when the moves are different from the line"), mens), Iconos.Pelicula_Seguir())) resp = self.utilidades(liMasOpciones) if resp == "libros": self.librosConsulta(False) + elif resp == "add_line": numJugadas, nj, fila, siBlancas = self.jugadaActual() partida = self.partida @@ -382,6 +487,16 @@ def procesarAccion(self, clave): self.dbop.updateTrainingEngines() QTUtil2.mensaje(self.pantalla, _("Done")) + elif resp == "auto_analysis": + self.auto_analysis = not self.auto_analysis + self.trainingEngines["AUTO_ANALYSIS"] = self.auto_analysis + self.dbop.setTrainingEngines(self.trainingEngines) + + elif resp == "ask_movesdifferent": + self.ask_movesdifferent = not self.ask_movesdifferent + self.trainingEngines["ASK_MOVESDIFFERENT"] = self.ask_movesdifferent + self.dbop.setTrainingEngines(self.trainingEngines) + else: Gestor.Gestor.rutinaAccionDef(self, clave) diff --git a/Code/GestorPerson.py b/Code/GestorPerson.py index aea2165..1262b28 100644 --- a/Code/GestorPerson.py +++ b/Code/GestorPerson.py @@ -23,6 +23,7 @@ def inicio(self, dic, aplazamiento=None, siPrimeraJugadaHecha=False): self.siJuegaHumano = False self.estado = kJugando self.timekeeper = Util.Timekeeper() + self.siAnalizando = False self.summary = {} self.siSummary = dic.get("SUMMARY", False) diff --git a/Code/GestorRoutes.py b/Code/GestorRoutes.py index 4aaac48..99ccea9 100644 --- a/Code/GestorRoutes.py +++ b/Code/GestorRoutes.py @@ -1,7 +1,7 @@ import random import time -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Util from Code import Books diff --git a/Code/Init.py b/Code/Init.py index beb2916..bde7492 100644 --- a/Code/Init.py +++ b/Code/Init.py @@ -9,7 +9,7 @@ from Code.Constantes import * DEBUG = False -VERSION = "11.11" +VERSION = "11.12a" if DEBUG: prlkn("DEBUG " * 20) diff --git a/Code/Kibitzers.py b/Code/Kibitzers.py index ef3757e..6394ff7 100644 --- a/Code/Kibitzers.py +++ b/Code/Kibitzers.py @@ -308,6 +308,8 @@ def escribe(self, orden): self.ipc.push(orden.bloqueEnvio()) def siActiva(self): + if self.popen is None: + return False return self.popen.poll() is None def ponFen(self, fen, fenBase): diff --git a/Code/LibChess.py b/Code/LibChess.py index ba0d14d..9b2d63d 100644 --- a/Code/LibChess.py +++ b/Code/LibChess.py @@ -1,6 +1,6 @@ import random -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine import chess import chess.syzygy diff --git a/Code/OpeningGuide.py b/Code/OpeningGuide.py index b1e773c..cdc00e4 100644 --- a/Code/OpeningGuide.py +++ b/Code/OpeningGuide.py @@ -2,7 +2,7 @@ import os import sqlite3 -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import AperturasStd from Code import Books diff --git a/Code/OpeningLines.py b/Code/OpeningLines.py index 20f0b6a..0194f0a 100644 --- a/Code/OpeningLines.py +++ b/Code/OpeningLines.py @@ -5,7 +5,7 @@ import datetime import collections -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Util from Code import Partida @@ -204,14 +204,24 @@ def open_cache_engines(self): if self.db_cache_engines is None: self.db_cache_engines = Util.DicSQL(self.nomFichero, tabla="CACHE_ENGINES") - def get_cache_engines(self, engine, ms, fenM2): - key = "%s-%d-%s" % (engine, ms, fenM2) + def get_cache_engines(self, engine, ms, fenM2, depth=None): + if depth: + key = "%s-%d-%s-%d" % (engine, ms, fenM2, depth) + else: + key = "%s-%d-%s" % (engine, ms, fenM2) return self.db_cache_engines[key] - def set_cache_engines(self, engine, ms, fenM2, move): - key = "%s-%d-%s" % (engine, ms, fenM2) + def set_cache_engines(self, engine, ms, fenM2, move, depth=None): + if depth: + key = "%s-%d-%s-%d" % (engine, ms, fenM2, depth) + else: + key = "%s-%d-%s" % (engine, ms, fenM2) self.db_cache_engines[key] = move + def reinit_cache_engines(self): + self.open_cache_engines() + self.db_cache_engines.deleteall() + def init_database(self): cursor = self._conexion.cursor() cursor.execute("pragma table_info(LINES)") @@ -435,6 +445,7 @@ def createTrainingEngines(self, reg, procesador): lo = ListaOpenings(procesador.configuracion) lo.add_training_engines_file(os.path.basename(self.nomFichero)) + self.reinit_cache_engines() def withTrainings(self): return "TRAINING" in self.db_config @@ -928,7 +939,6 @@ def hazFEN(fen, lipv_ant, control): control.liPartidas = [] control.with_history = False - control = Util.Almacen() control.liPartidas = [] control.num_partidas = 0 diff --git a/Code/PGNreader.py b/Code/PGNreader.py index 4ed6ea7..849564f 100644 --- a/Code/PGNreader.py +++ b/Code/PGNreader.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Util diff --git a/Code/Partida.py b/Code/Partida.py index 6055114..aa4b03f 100644 --- a/Code/Partida.py +++ b/Code/Partida.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Util from Code import VarGen from Code import ControlPosicion @@ -671,6 +671,14 @@ def resetFEN(self, fen): self.liTags.append(("FEN", fen)) Partida.resetFEN(self, fen) + def titulo(self, litags): + li = [] + for key in litags: + tag = self.getTAG(key) + if tag: + li.append(tag) + return "-".join(li) + # firstLG = [True] diff --git a/Code/Presentacion.py b/Code/Presentacion.py index 4cd4e7e..31de9c5 100644 --- a/Code/Presentacion.py +++ b/Code/Presentacion.py @@ -2,7 +2,7 @@ import time import codecs -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Util from Code import ControlPosicion diff --git a/Code/Procesador.py b/Code/Procesador.py index 6554a73..3a4f012 100644 --- a/Code/Procesador.py +++ b/Code/Procesador.py @@ -6,6 +6,7 @@ from Code import AperturasStd from Code import Routes from Code import VarGen +from Code import Everest from Code import XGestorMotor from Code.Constantes import * @@ -35,11 +36,13 @@ from Code import OpeningLines from Code import GestorWashing from Code import GestorPlayPGN +from Code import GestorAnotar from Code.QT import DatosNueva, BasicMenus from Code.QT import Iconos from Code.QT import Info from Code.QT import Pantalla from Code.QT import PantallaAlbumes +from Code.QT import PantallaAnotar from Code.QT import PantallaAperturas from Code.QT import PantallaBMT from Code.QT import PantallaColores @@ -691,6 +694,18 @@ def externBMT(self, fichero): self.configuracion.ficheroBMT = fichero PantallaBMT.pantallaBMT(self) + def anotar(self, partidacompleta, siblancasabajo): + self.gestor = GestorAnotar.GestorAnotar(self) + self.gestor.inicio(partidacompleta, siblancasabajo) + + def show_anotar(self): + w = PantallaAnotar.WAnotar(self) + if w.exec_(): + pc, siblancasabajo = w.resultado + if pc is None: + pc = Everest.get_partida_random() + self.anotar(pc, siblancasabajo) + def externDatabase(self, fichero): self.configuracion.ficheroDBgames = fichero self.database() diff --git a/Code/QT/Iconos.py b/Code/QT/Iconos.py index 65cff82..15ce56e 100644 --- a/Code/QT/Iconos.py +++ b/Code/QT/Iconos.py @@ -5,2456 +5,3281 @@ binIconos = f.read() f.close() + def icono(name): return eval( "%s()"%name ) + def pixmap(name): return eval( "pm%s()"%name ) + def PM(desde, hasta): pm = QtGui.QPixmap() pm.loadFromData( binIconos[desde:hasta] ) return pm + def pmLM(): return PM(0,1248) + def LM(): return QtGui.QIcon(pmLM()) + def pmAplicacion(): return PM(1248,2025) + def Aplicacion(): return QtGui.QIcon(pmAplicacion()) + def pmAplicacion64(): return PM(2025,6294) + def Aplicacion64(): return QtGui.QIcon(pmAplicacion64()) + def pmDatos(): return PM(6294,7481) + def Datos(): return QtGui.QIcon(pmDatos()) + def pmTutor(): return PM(7481,9510) + def Tutor(): return QtGui.QIcon(pmTutor()) + def pmTablero(): return PM(6294,7481) + def Tablero(): return QtGui.QIcon(pmTablero()) + def pmPartidaOriginal(): return PM(9510,11487) + def PartidaOriginal(): return QtGui.QIcon(pmPartidaOriginal()) + def pmDGT(): return PM(11487,12481) + def DGT(): return QtGui.QIcon(pmDGT()) + def pmZonaPrincipiantes(): return PM(12481,14515) + def ZonaPrincipiantes(): return QtGui.QIcon(pmZonaPrincipiantes()) + def pmJ60(): return PM(14515,16111) + def J60(): return QtGui.QIcon(pmJ60()) + def pmTamTablero(): return PM(14515,16111) + def TamTablero(): return QtGui.QIcon(pmTamTablero()) + def pmMensEspera(): return PM(16111,23085) + def MensEspera(): return QtGui.QIcon(pmMensEspera()) + def pmUtilidades(): return PM(23085,29514) + def Utilidades(): return QtGui.QIcon(pmUtilidades()) + def pmTerminar(): return PM(29514,31264) + def Terminar(): return QtGui.QIcon(pmTerminar()) + def pmNuevaPartida(): return PM(31264,33012) + def NuevaPartida(): return QtGui.QIcon(pmNuevaPartida()) + def pmOpciones(): return PM(33012,34740) + def Opciones(): return QtGui.QIcon(pmOpciones()) + def pmEntrenamiento(): return PM(7481,9510) + def Entrenamiento(): return QtGui.QIcon(pmEntrenamiento()) + def pmAplazar(): return PM(34740,37807) + def Aplazar(): return QtGui.QIcon(pmAplazar()) + def pmCapturas(): return PM(37807,39848) + def Capturas(): return QtGui.QIcon(pmCapturas()) + def pmReiniciar(): return PM(39848,42142) + def Reiniciar(): return QtGui.QIcon(pmReiniciar()) + def pmMotores(): return PM(42142,48041) + def Motores(): return QtGui.QIcon(pmMotores()) + def pmImportarGM(): return PM(48041,50641) + def ImportarGM(): return QtGui.QIcon(pmImportarGM()) + def pmAbandonar(): return PM(50641,54641) + def Abandonar(): return QtGui.QIcon(pmAbandonar()) + def pmEmpezar(): return PM(54641,56677) + def Empezar(): return QtGui.QIcon(pmEmpezar()) + def pmOtros(): return PM(56677,61147) + def Otros(): return QtGui.QIcon(pmOtros()) + def pmAnalizar(): return PM(61147,62684) + def Analizar(): return QtGui.QIcon(pmAnalizar()) + def pmMainMenu(): return PM(62684,66994) + def MainMenu(): return QtGui.QIcon(pmMainMenu()) + def pmFinPartida(): return PM(66994,69942) + def FinPartida(): return QtGui.QIcon(pmFinPartida()) + def pmGrabar(): return PM(69942,71405) + def Grabar(): return QtGui.QIcon(pmGrabar()) + def pmGrabarComo(): return PM(71405,73457) + def GrabarComo(): return QtGui.QIcon(pmGrabarComo()) + def pmRecuperar(): return PM(73457,76215) + def Recuperar(): return QtGui.QIcon(pmRecuperar()) + def pmInformacion(): return PM(76215,78174) + def Informacion(): return QtGui.QIcon(pmInformacion()) + def pmNuevo(): return PM(78174,78928) + def Nuevo(): return QtGui.QIcon(pmNuevo()) + def pmCopiar(): return PM(78928,80109) + def Copiar(): return QtGui.QIcon(pmCopiar()) + def pmModificar(): return PM(80109,84506) + def Modificar(): return QtGui.QIcon(pmModificar()) + def pmBorrar(): return PM(84506,89497) + def Borrar(): return QtGui.QIcon(pmBorrar()) + def pmMarcar(): return PM(89497,94426) + def Marcar(): return QtGui.QIcon(pmMarcar()) + def pmPegar(): return PM(94426,96737) + def Pegar(): return QtGui.QIcon(pmPegar()) + def pmFichero(): return PM(96737,101422) + def Fichero(): return QtGui.QIcon(pmFichero()) + def pmNuestroFichero(): return PM(101422,104469) + def NuestroFichero(): return QtGui.QIcon(pmNuestroFichero()) + def pmFicheroRepite(): return PM(104469,105965) + def FicheroRepite(): return QtGui.QIcon(pmFicheroRepite()) + def pmInformacionPGN(): return PM(105965,106983) + def InformacionPGN(): return QtGui.QIcon(pmInformacionPGN()) + def pmVer(): return PM(106983,108437) + def Ver(): return QtGui.QIcon(pmVer()) + def pmInicio(): return PM(108437,110451) + def Inicio(): return QtGui.QIcon(pmInicio()) + def pmFinal(): return PM(110451,112445) + def Final(): return QtGui.QIcon(pmFinal()) + def pmFiltrar(): return PM(112445,118935) + def Filtrar(): return QtGui.QIcon(pmFiltrar()) + def pmArriba(): return PM(118935,121088) + def Arriba(): return QtGui.QIcon(pmArriba()) + def pmAbajo(): return PM(121088,123196) + def Abajo(): return QtGui.QIcon(pmAbajo()) + def pmEstadisticas(): return PM(123196,125335) + def Estadisticas(): return QtGui.QIcon(pmEstadisticas()) + def pmRendirse(): return PM(125335,129181) + def Rendirse(): return QtGui.QIcon(pmRendirse()) + def pmCheck(): return PM(129181,132405) + def Check(): return QtGui.QIcon(pmCheck()) + def pmTablas(): return PM(132405,134028) + def Tablas(): return QtGui.QIcon(pmTablas()) + def pmAtras(): return PM(134028,135547) + def Atras(): return QtGui.QIcon(pmAtras()) + def pmBuscar(): return PM(135547,137532) + def Buscar(): return QtGui.QIcon(pmBuscar()) + def pmLibros(): return PM(137532,139660) + def Libros(): return QtGui.QIcon(pmLibros()) + def pmAceptar(): return PM(139660,143007) + def Aceptar(): return QtGui.QIcon(pmAceptar()) + def pmCancelar(): return PM(143007,144990) + def Cancelar(): return QtGui.QIcon(pmCancelar()) + def pmDefecto(): return PM(144990,148309) + def Defecto(): return QtGui.QIcon(pmDefecto()) + def pmGenerar(): return PM(148309,151525) + def Generar(): return QtGui.QIcon(pmGenerar()) + def pmInsertar(): return PM(151525,153921) + def Insertar(): return QtGui.QIcon(pmInsertar()) + def pmJugar(): return PM(153921,156130) + def Jugar(): return QtGui.QIcon(pmJugar()) + def pmConfigurar(): return PM(156130,159214) + def Configurar(): return QtGui.QIcon(pmConfigurar()) + def pmS_Aceptar(): return PM(139660,143007) + def S_Aceptar(): return QtGui.QIcon(pmS_Aceptar()) + def pmS_Cancelar(): return PM(143007,144990) + def S_Cancelar(): return QtGui.QIcon(pmS_Cancelar()) + def pmS_Microfono(): return PM(159214,164655) + def S_Microfono(): return QtGui.QIcon(pmS_Microfono()) + def pmS_LeerWav(): return PM(48041,50641) + def S_LeerWav(): return QtGui.QIcon(pmS_LeerWav()) + def pmS_Play(): return PM(164655,169993) + def S_Play(): return QtGui.QIcon(pmS_Play()) + def pmS_StopPlay(): return PM(169993,170603) + def S_StopPlay(): return QtGui.QIcon(pmS_StopPlay()) + def pmS_StopMicrofono(): return PM(169993,170603) + def S_StopMicrofono(): return QtGui.QIcon(pmS_StopMicrofono()) + def pmS_Record(): return PM(170603,173836) + def S_Record(): return QtGui.QIcon(pmS_Record()) + def pmS_Limpiar(): return PM(84506,89497) + def S_Limpiar(): return QtGui.QIcon(pmS_Limpiar()) + def pmHistorial(): return PM(173836,175099) + def Historial(): return QtGui.QIcon(pmHistorial()) + def pmPegar16(): return PM(175099,176093) + def Pegar16(): return QtGui.QIcon(pmPegar16()) + def pmRivalesMP(): return PM(176093,177219) + def RivalesMP(): return QtGui.QIcon(pmRivalesMP()) + def pmCamara(): return PM(177219,178741) + def Camara(): return QtGui.QIcon(pmCamara()) + def pmUsuarios(): return PM(178741,179981) + def Usuarios(): return QtGui.QIcon(pmUsuarios()) + def pmResistencia(): return PM(179981,183043) + def Resistencia(): return QtGui.QIcon(pmResistencia()) + def pmRemoto(): return PM(183043,187165) + def Remoto(): return QtGui.QIcon(pmRemoto()) + def pmRemotoServidor(): return PM(187165,188189) + def RemotoServidor(): return QtGui.QIcon(pmRemotoServidor()) + def pmRemotoCliente(): return PM(188189,189433) + def RemotoCliente(): return QtGui.QIcon(pmRemotoCliente()) + def pmCebra(): return PM(189433,191886) + def Cebra(): return QtGui.QIcon(pmCebra()) + def pmGafas(): return PM(191886,192870) + def Gafas(): return QtGui.QIcon(pmGafas()) + def pmPuente(): return PM(192870,193506) + def Puente(): return QtGui.QIcon(pmPuente()) + def pmWeb(): return PM(193506,194688) + def Web(): return QtGui.QIcon(pmWeb()) + def pmMail(): return PM(194688,195648) + def Mail(): return QtGui.QIcon(pmMail()) + def pmAyuda(): return PM(195648,196829) + def Ayuda(): return QtGui.QIcon(pmAyuda()) + def pmFAQ(): return PM(196829,198150) + def FAQ(): return QtGui.QIcon(pmFAQ()) + def pmPuntuacion(): return PM(198150,199078) + def Puntuacion(): return QtGui.QIcon(pmPuntuacion()) + def pmActualiza(): return PM(199078,199944) + def Actualiza(): return QtGui.QIcon(pmActualiza()) + def pmRefresh(): return PM(199944,202336) + def Refresh(): return QtGui.QIcon(pmRefresh()) + def pmJuegaSolo(): return PM(202336,203518) + def JuegaSolo(): return QtGui.QIcon(pmJuegaSolo()) + def pmPlayer(): return PM(202336,203518) + def Player(): return QtGui.QIcon(pmPlayer()) + def pmJS_Rotacion(): return PM(203518,205428) + def JS_Rotacion(): return QtGui.QIcon(pmJS_Rotacion()) + def pmCoordina(): return PM(203518,205428) + def Coordina(): return QtGui.QIcon(pmCoordina()) + def pmEstrellaAzul(): return PM(205428,206934) + def EstrellaAzul(): return QtGui.QIcon(pmEstrellaAzul()) + def pmElo(): return PM(205428,206934) + def Elo(): return QtGui.QIcon(pmElo()) + def pmMate(): return PM(206934,207495) + def Mate(): return QtGui.QIcon(pmMate()) + def pmEloTimed(): return PM(207495,208979) + def EloTimed(): return QtGui.QIcon(pmEloTimed()) + def pmPGN(): return PM(208979,210977) + def PGN(): return QtGui.QIcon(pmPGN()) + def pmPGN_Importar(): return PM(210977,212567) + def PGN_Importar(): return QtGui.QIcon(pmPGN_Importar()) + def pmAyudaGR(): return PM(212567,218445) + def AyudaGR(): return QtGui.QIcon(pmAyudaGR()) + def pmBotonAyuda(): return PM(218445,220905) + def BotonAyuda(): return QtGui.QIcon(pmBotonAyuda()) + def pmColores(): return PM(220905,222136) + def Colores(): return QtGui.QIcon(pmColores()) + def pmEditarColores(): return PM(222136,224439) + def EditarColores(): return QtGui.QIcon(pmEditarColores()) + def pmGranMaestro(): return PM(224439,225295) + def GranMaestro(): return QtGui.QIcon(pmGranMaestro()) + def pmWGranMaestro(): return PM(225295,225754) + def WGranMaestro(): return QtGui.QIcon(pmWGranMaestro()) + def pmFavoritos(): return PM(225754,227520) + def Favoritos(): return QtGui.QIcon(pmFavoritos()) + def pmCarpeta(): return PM(227520,228224) + def Carpeta(): return QtGui.QIcon(pmCarpeta()) + def pmDivision(): return PM(228224,228889) + def Division(): return QtGui.QIcon(pmDivision()) + def pmDivisionF(): return PM(228889,230003) + def DivisionF(): return QtGui.QIcon(pmDivisionF()) + def pmKibitzer(): return PM(230003,230542) + def Kibitzer(): return QtGui.QIcon(pmKibitzer()) + def pmKibitzer_Pausa(): return PM(230542,231406) + def Kibitzer_Pausa(): return QtGui.QIcon(pmKibitzer_Pausa()) + def pmKibitzer_Continuar(): return PM(231406,232237) + def Kibitzer_Continuar(): return QtGui.QIcon(pmKibitzer_Continuar()) + def pmKibitzer_Terminar(): return PM(232237,233161) + def Kibitzer_Terminar(): return QtGui.QIcon(pmKibitzer_Terminar()) + def pmDelete(): return PM(232237,233161) + def Delete(): return QtGui.QIcon(pmDelete()) + def pmModificarP(): return PM(233161,234227) + def ModificarP(): return QtGui.QIcon(pmModificarP()) + def pmGrupo_Si(): return PM(234227,234689) + def Grupo_Si(): return QtGui.QIcon(pmGrupo_Si()) + def pmGrupo_No(): return PM(234689,235012) + def Grupo_No(): return QtGui.QIcon(pmGrupo_No()) + def pmMotor_Si(): return PM(235012,235474) + def Motor_Si(): return QtGui.QIcon(pmMotor_Si()) + def pmMotor_No(): return PM(232237,233161) + def Motor_No(): return QtGui.QIcon(pmMotor_No()) + def pmMotor_Actual(): return PM(235474,236491) + def Motor_Actual(): return QtGui.QIcon(pmMotor_Actual()) + def pmMotor(): return PM(236491,237118) + def Motor(): return QtGui.QIcon(pmMotor()) + def pmMoverInicio(): return PM(237118,237971) + def MoverInicio(): return QtGui.QIcon(pmMoverInicio()) + def pmMoverFinal(): return PM(237971,238847) + def MoverFinal(): return QtGui.QIcon(pmMoverFinal()) + def pmMoverAdelante(): return PM(238847,239708) + def MoverAdelante(): return QtGui.QIcon(pmMoverAdelante()) + def pmMoverAtras(): return PM(239708,240576) + def MoverAtras(): return QtGui.QIcon(pmMoverAtras()) + def pmMoverLibre(): return PM(240576,241396) + def MoverLibre(): return QtGui.QIcon(pmMoverLibre()) + def pmMoverTiempo(): return PM(241396,242589) + def MoverTiempo(): return QtGui.QIcon(pmMoverTiempo()) + def pmMoverMas(): return PM(242589,243628) + def MoverMas(): return QtGui.QIcon(pmMoverMas()) + def pmMoverGrabar(): return PM(243628,244484) + def MoverGrabar(): return QtGui.QIcon(pmMoverGrabar()) + def pmMoverGrabarTodos(): return PM(244484,245528) + def MoverGrabarTodos(): return QtGui.QIcon(pmMoverGrabarTodos()) + def pmMoverJugar(): return PM(231406,232237) + def MoverJugar(): return QtGui.QIcon(pmMoverJugar()) + def pmPelicula(): return PM(245528,247662) + def Pelicula(): return QtGui.QIcon(pmPelicula()) + def pmPelicula_Pausa(): return PM(247662,249421) + def Pelicula_Pausa(): return QtGui.QIcon(pmPelicula_Pausa()) + def pmPelicula_Seguir(): return PM(249421,251510) + def Pelicula_Seguir(): return QtGui.QIcon(pmPelicula_Seguir()) + def pmPelicula_Rapido(): return PM(251510,253569) + def Pelicula_Rapido(): return QtGui.QIcon(pmPelicula_Rapido()) + def pmPelicula_Lento(): return PM(253569,255444) + def Pelicula_Lento(): return QtGui.QIcon(pmPelicula_Lento()) + def pmPelicula_Repetir(): return PM(39848,42142) + def Pelicula_Repetir(): return QtGui.QIcon(pmPelicula_Repetir()) + def pmPelicula_PGN(): return PM(255444,256352) + def Pelicula_PGN(): return QtGui.QIcon(pmPelicula_PGN()) + def pmMemoria(): return PM(256352,258293) + def Memoria(): return QtGui.QIcon(pmMemoria()) + def pmEntrenar(): return PM(258293,259832) + def Entrenar(): return QtGui.QIcon(pmEntrenar()) + def pmEnviar(): return PM(258293,259832) + def Enviar(): return QtGui.QIcon(pmEnviar()) + def pmTrasteros(): return PM(259832,264635) + def Trasteros(): return QtGui.QIcon(pmTrasteros()) + def pmTrastero(): return PM(264635,265097) + def Trastero(): return QtGui.QIcon(pmTrastero()) + def pmTrastero_Quitar(): return PM(232237,233161) + def Trastero_Quitar(): return QtGui.QIcon(pmTrastero_Quitar()) + def pmTrastero_Nuevo(): return PM(265097,266605) + def Trastero_Nuevo(): return QtGui.QIcon(pmTrastero_Nuevo()) + def pmNuevoMas(): return PM(265097,266605) + def NuevoMas(): return QtGui.QIcon(pmNuevoMas()) + def pmTemas(): return PM(266605,268828) + def Temas(): return QtGui.QIcon(pmTemas()) + def pmTutorialesCrear(): return PM(268828,275097) + def TutorialesCrear(): return QtGui.QIcon(pmTutorialesCrear()) + def pmMover(): return PM(275097,275679) + def Mover(): return QtGui.QIcon(pmMover()) + def pmSeleccionado(): return PM(275097,275679) + def Seleccionado(): return QtGui.QIcon(pmSeleccionado()) + def pmSeleccionar(): return PM(275679,281383) + def Seleccionar(): return QtGui.QIcon(pmSeleccionar()) + def pmVista(): return PM(281383,283307) + def Vista(): return QtGui.QIcon(pmVista()) + def pmInformacionPGNUno(): return PM(283307,284685) + def InformacionPGNUno(): return QtGui.QIcon(pmInformacionPGNUno()) + def pmDailyTest(): return PM(284685,287025) + def DailyTest(): return QtGui.QIcon(pmDailyTest()) + def pmJuegaPorMi(): return PM(287025,288745) + def JuegaPorMi(): return QtGui.QIcon(pmJuegaPorMi()) + def pmArbol(): return PM(288745,289379) + def Arbol(): return QtGui.QIcon(pmArbol()) + def pmGrabarFichero(): return PM(69942,71405) + def GrabarFichero(): return QtGui.QIcon(pmGrabarFichero()) + def pmClip(): return PM(289379,291525) + def Clip(): return QtGui.QIcon(pmClip()) + def pmFics(): return PM(291525,291942) + def Fics(): return QtGui.QIcon(pmFics()) + def pmFide(): return PM(9510,11487) + def Fide(): return QtGui.QIcon(pmFide()) + def pmFichPGN(): return PM(9510,11487) + def FichPGN(): return QtGui.QIcon(pmFichPGN()) + def pmFlechas(): return PM(291942,295294) + def Flechas(): return QtGui.QIcon(pmFlechas()) + def pmMarcos(): return PM(295294,296741) + def Marcos(): return QtGui.QIcon(pmMarcos()) + def pmSVGs(): return PM(296741,300310) + def SVGs(): return QtGui.QIcon(pmSVGs()) + def pmAmarillo(): return PM(300310,301562) + def Amarillo(): return QtGui.QIcon(pmAmarillo()) + def pmNaranja(): return PM(301562,302794) + def Naranja(): return QtGui.QIcon(pmNaranja()) + def pmVerde(): return PM(302794,304070) + def Verde(): return QtGui.QIcon(pmVerde()) + def pmAzul(): return PM(304070,305158) + def Azul(): return QtGui.QIcon(pmAzul()) + def pmMagenta(): return PM(305158,306446) + def Magenta(): return QtGui.QIcon(pmMagenta()) + def pmRojo(): return PM(306446,307665) + def Rojo(): return QtGui.QIcon(pmRojo()) + def pmGris(): return PM(307665,308623) + def Gris(): return QtGui.QIcon(pmGris()) + def pmEstrella(): return PM(198150,199078) + def Estrella(): return QtGui.QIcon(pmEstrella()) + def pmAmarillo32(): return PM(308623,310603) + def Amarillo32(): return QtGui.QIcon(pmAmarillo32()) + def pmNaranja32(): return PM(310603,312727) + def Naranja32(): return QtGui.QIcon(pmNaranja32()) + def pmVerde32(): return PM(312727,314848) + def Verde32(): return QtGui.QIcon(pmVerde32()) + def pmAzul32(): return PM(314848,317227) + def Azul32(): return QtGui.QIcon(pmAzul32()) + def pmMagenta32(): return PM(317227,319678) + def Magenta32(): return QtGui.QIcon(pmMagenta32()) + def pmRojo32(): return PM(319678,321493) + def Rojo32(): return QtGui.QIcon(pmRojo32()) + def pmGris32(): return PM(321493,323407) + def Gris32(): return QtGui.QIcon(pmGris32()) + def pmPuntoBlanco(): return PM(323407,323756) + def PuntoBlanco(): return QtGui.QIcon(pmPuntoBlanco()) + def pmPuntoAmarillo(): return PM(234227,234689) + def PuntoAmarillo(): return QtGui.QIcon(pmPuntoAmarillo()) + def pmPuntoNaranja(): return PM(323756,324218) + def PuntoNaranja(): return QtGui.QIcon(pmPuntoNaranja()) + def pmPuntoVerde(): return PM(235012,235474) + def PuntoVerde(): return QtGui.QIcon(pmPuntoVerde()) + def pmPuntoAzul(): return PM(264635,265097) + def PuntoAzul(): return QtGui.QIcon(pmPuntoAzul()) + def pmPuntoMagenta(): return PM(324218,324717) + def PuntoMagenta(): return QtGui.QIcon(pmPuntoMagenta()) + def pmPuntoRojo(): return PM(324717,325216) + def PuntoRojo(): return QtGui.QIcon(pmPuntoRojo()) + def pmPuntoNegro(): return PM(234689,235012) + def PuntoNegro(): return QtGui.QIcon(pmPuntoNegro()) + def pmPuntoEstrella(): return PM(325216,325643) + def PuntoEstrella(): return QtGui.QIcon(pmPuntoEstrella()) + def pmComentario(): return PM(325643,326280) + def Comentario(): return QtGui.QIcon(pmComentario()) + def pmComentarioMas(): return PM(326280,327219) + def ComentarioMas(): return QtGui.QIcon(pmComentarioMas()) + def pmComentarioEditar(): return PM(243628,244484) + def ComentarioEditar(): return QtGui.QIcon(pmComentarioEditar()) + def pmApertura(): return PM(327219,328185) + def Apertura(): return QtGui.QIcon(pmApertura()) + def pmAperturaComentario(): return PM(328185,329181) + def AperturaComentario(): return QtGui.QIcon(pmAperturaComentario()) + def pmBookGuide(): return PM(329181,330058) + def BookGuide(): return QtGui.QIcon(pmBookGuide()) + def pmMas(): return PM(330058,330567) + def Mas(): return QtGui.QIcon(pmMas()) + def pmMasR(): return PM(330567,331055) + def MasR(): return QtGui.QIcon(pmMasR()) + def pmMasDoc(): return PM(331055,331856) + def MasDoc(): return QtGui.QIcon(pmMasDoc()) + def pmNuevaDB(): return PM(331856,336490) + def NuevaDB(): return QtGui.QIcon(pmNuevaDB()) + def pmPotencia(): return PM(199078,199944) + def Potencia(): return QtGui.QIcon(pmPotencia()) + def pmSorpresa(): return PM(336490,337549) + def Sorpresa(): return QtGui.QIcon(pmSorpresa()) + def pmSonrisa(): return PM(337549,338631) + def Sonrisa(): return QtGui.QIcon(pmSonrisa()) + def pmBMT(): return PM(338631,339509) + def BMT(): return QtGui.QIcon(pmBMT()) + def pmCorazon(): return PM(339509,341387) + def Corazon(): return QtGui.QIcon(pmCorazon()) + def pmOjo(): return PM(341387,342509) + def Ojo(): return QtGui.QIcon(pmOjo()) + def pmOcultar(): return PM(341387,342509) + def Ocultar(): return QtGui.QIcon(pmOcultar()) + def pmMostrar(): return PM(342509,343565) + def Mostrar(): return QtGui.QIcon(pmMostrar()) + def pmBlog(): return PM(343565,344087) + def Blog(): return QtGui.QIcon(pmBlog()) + def pmVariantes(): return PM(344087,344994) + def Variantes(): return QtGui.QIcon(pmVariantes()) + def pmVariantesG(): return PM(344994,347421) + def VariantesG(): return QtGui.QIcon(pmVariantesG()) + def pmCambiar(): return PM(347421,349135) + def Cambiar(): return QtGui.QIcon(pmCambiar()) + def pmAnterior(): return PM(349135,351189) + def Anterior(): return QtGui.QIcon(pmAnterior()) + def pmSiguiente(): return PM(351189,353259) + def Siguiente(): return QtGui.QIcon(pmSiguiente()) + def pmSiguienteF(): return PM(353259,355434) + def SiguienteF(): return QtGui.QIcon(pmSiguienteF()) + def pmAnteriorF(): return PM(355434,357628) + def AnteriorF(): return QtGui.QIcon(pmAnteriorF()) + def pmX(): return PM(357628,358910) + def X(): return QtGui.QIcon(pmX()) + def pmTools(): return PM(358910,361511) + def Tools(): return QtGui.QIcon(pmTools()) + def pmTacticas(): return PM(361511,364084) + def Tacticas(): return QtGui.QIcon(pmTacticas()) + def pmCancelarPeque(): return PM(364084,364945) + def CancelarPeque(): return QtGui.QIcon(pmCancelarPeque()) + def pmAceptarPeque(): return PM(235474,236491) + def AceptarPeque(): return QtGui.QIcon(pmAceptarPeque()) + def pmP_16c(): return PM(364945,365469) + def P_16c(): return QtGui.QIcon(pmP_16c()) + def pmLibre(): return PM(365469,367861) + def Libre(): return QtGui.QIcon(pmLibre()) + def pmEnBlanco(): return PM(367861,368587) + def EnBlanco(): return QtGui.QIcon(pmEnBlanco()) + def pmDirector(): return PM(368587,371561) + def Director(): return QtGui.QIcon(pmDirector()) + def pmTorneos(): return PM(371561,373299) + def Torneos(): return QtGui.QIcon(pmTorneos()) + def pmAperturas(): return PM(373299,374224) + def Aperturas(): return QtGui.QIcon(pmAperturas()) + def pmV_Blancas(): return PM(374224,374504) + def V_Blancas(): return QtGui.QIcon(pmV_Blancas()) + def pmV_Blancas_Mas(): return PM(374504,374784) + def V_Blancas_Mas(): return QtGui.QIcon(pmV_Blancas_Mas()) + def pmV_Blancas_Mas_Mas(): return PM(374784,375056) + def V_Blancas_Mas_Mas(): return QtGui.QIcon(pmV_Blancas_Mas_Mas()) + def pmV_Negras(): return PM(375056,375331) + def V_Negras(): return QtGui.QIcon(pmV_Negras()) + def pmV_Negras_Mas(): return PM(375331,375606) + def V_Negras_Mas(): return QtGui.QIcon(pmV_Negras_Mas()) + def pmV_Negras_Mas_Mas(): return PM(375606,375875) + def V_Negras_Mas_Mas(): return QtGui.QIcon(pmV_Negras_Mas_Mas()) + def pmV_Blancas_Igual_Negras(): return PM(375875,376177) + def V_Blancas_Igual_Negras(): return QtGui.QIcon(pmV_Blancas_Igual_Negras()) + def pmMezclar(): return PM(151525,153921) + def Mezclar(): return QtGui.QIcon(pmMezclar()) + def pmVoyager(): return PM(376177,378139) + def Voyager(): return QtGui.QIcon(pmVoyager()) + def pmReindexar(): return PM(378139,379956) + def Reindexar(): return QtGui.QIcon(pmReindexar()) + def pmRename(): return PM(379956,380940) + def Rename(): return QtGui.QIcon(pmRename()) + def pmAdd(): return PM(380940,381893) + def Add(): return QtGui.QIcon(pmAdd()) + def pmMas22(): return PM(381893,382557) + def Mas22(): return QtGui.QIcon(pmMas22()) + def pmMenos22(): return PM(382557,383001) + def Menos22(): return QtGui.QIcon(pmMenos22()) + def pmTransposition(): return PM(383001,383520) + def Transposition(): return QtGui.QIcon(pmTransposition()) + def pmRat(): return PM(383520,389224) + def Rat(): return QtGui.QIcon(pmRat()) + def pmAlligator(): return PM(389224,394216) + def Alligator(): return QtGui.QIcon(pmAlligator()) + def pmAnt(): return PM(394216,400914) + def Ant(): return QtGui.QIcon(pmAnt()) + def pmBat(): return PM(400914,403868) + def Bat(): return QtGui.QIcon(pmBat()) + def pmBear(): return PM(403868,411147) + def Bear(): return QtGui.QIcon(pmBear()) + def pmBee(): return PM(411147,416149) + def Bee(): return QtGui.QIcon(pmBee()) + def pmBird(): return PM(416149,422208) + def Bird(): return QtGui.QIcon(pmBird()) + def pmBull(): return PM(422208,429177) + def Bull(): return QtGui.QIcon(pmBull()) + def pmBulldog(): return PM(429177,436068) + def Bulldog(): return QtGui.QIcon(pmBulldog()) + def pmButterfly(): return PM(436068,443442) + def Butterfly(): return QtGui.QIcon(pmButterfly()) + def pmCat(): return PM(443442,449714) + def Cat(): return QtGui.QIcon(pmCat()) + def pmChicken(): return PM(449714,455525) + def Chicken(): return QtGui.QIcon(pmChicken()) + def pmCow(): return PM(455525,462268) + def Cow(): return QtGui.QIcon(pmCow()) + def pmCrab(): return PM(462268,467857) + def Crab(): return QtGui.QIcon(pmCrab()) + def pmCrocodile(): return PM(467857,473998) + def Crocodile(): return QtGui.QIcon(pmCrocodile()) + def pmDeer(): return PM(473998,480305) + def Deer(): return QtGui.QIcon(pmDeer()) + def pmDog(): return PM(480305,486908) + def Dog(): return QtGui.QIcon(pmDog()) + def pmDonkey(): return PM(486908,492555) + def Donkey(): return QtGui.QIcon(pmDonkey()) + def pmDuck(): return PM(492555,499098) + def Duck(): return QtGui.QIcon(pmDuck()) + def pmEagle(): return PM(499098,503916) + def Eagle(): return QtGui.QIcon(pmEagle()) + def pmElephant(): return PM(503916,510397) + def Elephant(): return QtGui.QIcon(pmElephant()) + def pmFish(): return PM(510397,517238) + def Fish(): return QtGui.QIcon(pmFish()) + def pmFox(): return PM(517238,524021) + def Fox(): return QtGui.QIcon(pmFox()) + def pmFrog(): return PM(524021,530437) + def Frog(): return QtGui.QIcon(pmFrog()) + def pmGiraffe(): return PM(530437,537615) + def Giraffe(): return QtGui.QIcon(pmGiraffe()) + def pmGorilla(): return PM(537615,544154) + def Gorilla(): return QtGui.QIcon(pmGorilla()) + def pmHippo(): return PM(544154,551275) + def Hippo(): return QtGui.QIcon(pmHippo()) + def pmHorse(): return PM(551275,557822) + def Horse(): return QtGui.QIcon(pmHorse()) + def pmInsect(): return PM(557822,563757) + def Insect(): return QtGui.QIcon(pmInsect()) + def pmLion(): return PM(563757,572667) + def Lion(): return QtGui.QIcon(pmLion()) + def pmMonkey(): return PM(572667,580346) + def Monkey(): return QtGui.QIcon(pmMonkey()) + def pmMoose(): return PM(580346,586970) + def Moose(): return QtGui.QIcon(pmMoose()) + def pmMouse(): return PM(383520,389224) + def Mouse(): return QtGui.QIcon(pmMouse()) + def pmOwl(): return PM(586970,593676) + def Owl(): return QtGui.QIcon(pmOwl()) + def pmPanda(): return PM(593676,597710) + def Panda(): return QtGui.QIcon(pmPanda()) + def pmPenguin(): return PM(597710,603259) + def Penguin(): return QtGui.QIcon(pmPenguin()) + def pmPig(): return PM(603259,611299) + def Pig(): return QtGui.QIcon(pmPig()) + def pmRabbit(): return PM(611299,618600) + def Rabbit(): return QtGui.QIcon(pmRabbit()) + def pmRhino(): return PM(618600,624987) + def Rhino(): return QtGui.QIcon(pmRhino()) + def pmRooster(): return PM(624987,630250) + def Rooster(): return QtGui.QIcon(pmRooster()) + def pmShark(): return PM(630250,636020) + def Shark(): return QtGui.QIcon(pmShark()) + def pmSheep(): return PM(636020,639851) + def Sheep(): return QtGui.QIcon(pmSheep()) + def pmSnake(): return PM(639851,645876) + def Snake(): return QtGui.QIcon(pmSnake()) + def pmTiger(): return PM(645876,653913) + def Tiger(): return QtGui.QIcon(pmTiger()) + def pmTurkey(): return PM(653913,661327) + def Turkey(): return QtGui.QIcon(pmTurkey()) + def pmTurtle(): return PM(661327,668048) + def Turtle(): return QtGui.QIcon(pmTurtle()) + def pmWolf(): return PM(668048,671143) + def Wolf(): return QtGui.QIcon(pmWolf()) + def pmSteven(): return PM(671143,678295) + def Steven(): return QtGui.QIcon(pmSteven()) + def pmWheel(): return PM(678295,686360) + def Wheel(): return QtGui.QIcon(pmWheel()) + def pmWheelchair(): return PM(686360,695164) + def Wheelchair(): return QtGui.QIcon(pmWheelchair()) + def pmTouringMotorcycle(): return PM(695164,701476) + def TouringMotorcycle(): return QtGui.QIcon(pmTouringMotorcycle()) + def pmContainer(): return PM(701476,706811) + def Container(): return QtGui.QIcon(pmContainer()) + def pmBoatEquipment(): return PM(706811,712334) + def BoatEquipment(): return QtGui.QIcon(pmBoatEquipment()) + def pmCar(): return PM(712334,716980) + def Car(): return QtGui.QIcon(pmCar()) + def pmLorry(): return PM(716980,723016) + def Lorry(): return QtGui.QIcon(pmLorry()) + def pmCarTrailer(): return PM(723016,727113) + def CarTrailer(): return QtGui.QIcon(pmCarTrailer()) + def pmTowTruck(): return PM(727113,731871) + def TowTruck(): return QtGui.QIcon(pmTowTruck()) + def pmQuadBike(): return PM(731871,737840) + def QuadBike(): return QtGui.QIcon(pmQuadBike()) + def pmRecoveryTruck(): return PM(737840,742837) + def RecoveryTruck(): return QtGui.QIcon(pmRecoveryTruck()) + def pmContainerLoader(): return PM(742837,747979) + def ContainerLoader(): return QtGui.QIcon(pmContainerLoader()) + def pmPoliceCar(): return PM(747979,752811) + def PoliceCar(): return QtGui.QIcon(pmPoliceCar()) + def pmExecutiveCar(): return PM(752811,757489) + def ExecutiveCar(): return QtGui.QIcon(pmExecutiveCar()) + def pmTruck(): return PM(757489,762952) + def Truck(): return QtGui.QIcon(pmTruck()) + def pmExcavator(): return PM(762952,767843) + def Excavator(): return QtGui.QIcon(pmExcavator()) + def pmCabriolet(): return PM(767843,772681) + def Cabriolet(): return QtGui.QIcon(pmCabriolet()) + def pmMixerTruck(): return PM(772681,778991) + def MixerTruck(): return QtGui.QIcon(pmMixerTruck()) + def pmForkliftTruckLoaded(): return PM(778991,785139) + def ForkliftTruckLoaded(): return QtGui.QIcon(pmForkliftTruckLoaded()) + def pmAmbulance(): return PM(785139,791189) + def Ambulance(): return QtGui.QIcon(pmAmbulance()) + def pmDieselLocomotiveBoxcar(): return PM(791189,795195) + def DieselLocomotiveBoxcar(): return QtGui.QIcon(pmDieselLocomotiveBoxcar()) + def pmTractorUnit(): return PM(795195,800662) + def TractorUnit(): return QtGui.QIcon(pmTractorUnit()) + def pmFireTruck(): return PM(800662,807001) + def FireTruck(): return QtGui.QIcon(pmFireTruck()) + def pmCargoShip(): return PM(807001,811342) + def CargoShip(): return QtGui.QIcon(pmCargoShip()) + def pmSubwayTrain(): return PM(811342,816232) + def SubwayTrain(): return QtGui.QIcon(pmSubwayTrain()) + def pmTruckMountedCrane(): return PM(816232,821973) + def TruckMountedCrane(): return QtGui.QIcon(pmTruckMountedCrane()) + def pmAirAmbulance(): return PM(821973,827086) + def AirAmbulance(): return QtGui.QIcon(pmAirAmbulance()) + def pmAirplane(): return PM(827086,831974) + def Airplane(): return QtGui.QIcon(pmAirplane()) + def pmCaracol(): return PM(831974,833790) + def Caracol(): return QtGui.QIcon(pmCaracol()) + def pmDownloads(): return PM(833790,835632) + def Downloads(): return QtGui.QIcon(pmDownloads()) + def pmUno(): return PM(835632,838094) + def Uno(): return QtGui.QIcon(pmUno()) + def pmMotoresExternos(): return PM(838094,839996) + def MotoresExternos(): return QtGui.QIcon(pmMotoresExternos()) + def pmDatabase(): return PM(839996,840539) + def Database(): return QtGui.QIcon(pmDatabase()) + def pmDatabaseC(): return PM(840539,840964) + def DatabaseC(): return QtGui.QIcon(pmDatabaseC()) + def pmDatabaseF(): return PM(840964,841428) + def DatabaseF(): return QtGui.QIcon(pmDatabaseF()) + def pmDatabaseCNew(): return PM(841428,842283) + def DatabaseCNew(): return QtGui.QIcon(pmDatabaseCNew()) + def pmDatabaseMas(): return PM(842283,843906) + def DatabaseMas(): return QtGui.QIcon(pmDatabaseMas()) + def pmAtacante(): return PM(843906,844511) + def Atacante(): return QtGui.QIcon(pmAtacante()) + def pmAtacada(): return PM(844511,845077) + def Atacada(): return QtGui.QIcon(pmAtacada()) + def pmGoToNext(): return PM(845077,845489) + def GoToNext(): return QtGui.QIcon(pmGoToNext()) + def pmBlancas(): return PM(845489,845840) + def Blancas(): return QtGui.QIcon(pmBlancas()) + def pmNegras(): return PM(845840,846086) + def Negras(): return QtGui.QIcon(pmNegras()) + def pmFolderChange(): return PM(73457,76215) + def FolderChange(): return QtGui.QIcon(pmFolderChange()) + def pmMarkers(): return PM(846086,847781) + def Markers(): return QtGui.QIcon(pmMarkers()) + def pmTop(): return PM(847781,848365) + def Top(): return QtGui.QIcon(pmTop()) + def pmBottom(): return PM(848365,848954) + def Bottom(): return QtGui.QIcon(pmBottom()) + def pmSTS(): return PM(848954,851145) + def STS(): return QtGui.QIcon(pmSTS()) + def pmRun(): return PM(851145,852869) + def Run(): return QtGui.QIcon(pmRun()) + def pmWorldMap(): return PM(852869,855610) + def WorldMap(): return QtGui.QIcon(pmWorldMap()) + def pmAfrica(): return PM(855610,858096) + def Africa(): return QtGui.QIcon(pmAfrica()) + def pmMaps(): return PM(858096,859040) + def Maps(): return QtGui.QIcon(pmMaps()) + def pmSol(): return PM(859040,859966) + def Sol(): return QtGui.QIcon(pmSol()) + def pmSolNubes(): return PM(859966,860829) + def SolNubes(): return QtGui.QIcon(pmSolNubes()) + def pmSolNubesLluvia(): return PM(860829,861789) + def SolNubesLluvia(): return QtGui.QIcon(pmSolNubesLluvia()) + def pmLluvia(): return PM(861789,862628) + def Lluvia(): return QtGui.QIcon(pmLluvia()) + def pmInvierno(): return PM(862628,864204) + def Invierno(): return QtGui.QIcon(pmInvierno()) + def pmWords(): return PM(864204,867989) + def Words(): return QtGui.QIcon(pmWords()) + def pmAdaptVoice(): return PM(368587,371561) + def AdaptVoice(): return QtGui.QIcon(pmAdaptVoice()) + def pmFixedElo(): return PM(173836,175099) + def FixedElo(): return QtGui.QIcon(pmFixedElo()) + def pmX_Microfono(): return PM(867989,870442) + def X_Microfono(): return QtGui.QIcon(pmX_Microfono()) + def pmSoundTool(): return PM(870442,872901) + def SoundTool(): return QtGui.QIcon(pmSoundTool()) + def pmImportar(): return PM(872901,875569) + def Importar(): return QtGui.QIcon(pmImportar()) + def pmVoyager1(): return PM(875569,878019) + def Voyager1(): return QtGui.QIcon(pmVoyager1()) + def pmTrain(): return PM(878019,879389) + def Train(): return QtGui.QIcon(pmTrain()) + def pmPlay(): return PM(249421,251510) + def Play(): return QtGui.QIcon(pmPlay()) + def pmMeasure(): return PM(132405,134028) + def Measure(): return QtGui.QIcon(pmMeasure()) + def pmPlayGame(): return PM(879389,883747) + def PlayGame(): return QtGui.QIcon(pmPlayGame()) + def pmScanner(): return PM(883747,884088) + def Scanner(): return QtGui.QIcon(pmScanner()) + def pmMenos(): return PM(884088,884613) + def Menos(): return QtGui.QIcon(pmMenos()) + def pmSchool(): return PM(884613,885154) + def School(): return QtGui.QIcon(pmSchool()) + def pmLaw(): return PM(885154,885770) + def Law(): return QtGui.QIcon(pmLaw()) + def pmLearnGame(): return PM(885770,886203) + def LearnGame(): return QtGui.QIcon(pmLearnGame()) + def pmUniversity(): return PM(886203,886623) + def University(): return QtGui.QIcon(pmUniversity()) + def pmLonghaul(): return PM(886623,887549) + def Longhaul(): return QtGui.QIcon(pmLonghaul()) + def pmTrekking(): return PM(887549,888243) + def Trekking(): return QtGui.QIcon(pmTrekking()) + def pmPassword(): return PM(888243,888696) + def Password(): return QtGui.QIcon(pmPassword()) + def pmSQL_RAW(): return PM(879389,883747) + def SQL_RAW(): return QtGui.QIcon(pmSQL_RAW()) + def pmSun(): return PM(338631,339509) + def Sun(): return QtGui.QIcon(pmSun()) + def pmLight(): return PM(342509,343565) + def Light(): return QtGui.QIcon(pmLight()) + def pmLight32(): return PM(888696,890396) + def Light32(): return QtGui.QIcon(pmLight32()) + def pmTOL(): return PM(890396,891105) + def TOL(): return QtGui.QIcon(pmTOL()) + def pmUned(): return PM(886203,886623) + def Uned(): return QtGui.QIcon(pmUned()) + def pmUwe(): return PM(891105,892074) + def Uwe(): return QtGui.QIcon(pmUwe()) + def pmThinking(): return PM(892074,892446) + def Thinking(): return QtGui.QIcon(pmThinking()) + def pmWashingMachine(): return PM(892446,893109) + def WashingMachine(): return QtGui.QIcon(pmWashingMachine()) + def pmTerminal(): return PM(893109,896653) + def Terminal(): return QtGui.QIcon(pmTerminal()) + def pmManualSave(): return PM(896653,897236) + def ManualSave(): return QtGui.QIcon(pmManualSave()) + def pmSettings(): return PM(897236,897674) + def Settings(): return QtGui.QIcon(pmSettings()) + def pmStrength(): return PM(897674,898345) + def Strength(): return QtGui.QIcon(pmStrength()) + def pmSingular(): return PM(898345,899200) + def Singular(): return QtGui.QIcon(pmSingular()) + def pmScript(): return PM(899200,899769) + def Script(): return QtGui.QIcon(pmScript()) + def pmScriptFree(): return PM(899769,900329) + def ScriptFree(): return QtGui.QIcon(pmScriptFree()) + def pmTexto(): return PM(900329,903174) + def Texto(): return QtGui.QIcon(pmTexto()) + def pmLampara(): return PM(903174,903883) + def Lampara(): return QtGui.QIcon(pmLampara()) + def pmFile(): return PM(903883,906183) + def File(): return QtGui.QIcon(pmFile()) + def pmCalculo(): return PM(906183,907109) + def Calculo(): return QtGui.QIcon(pmCalculo()) + def pmOpeningLines(): return PM(907109,907787) + def OpeningLines(): return QtGui.QIcon(pmOpeningLines()) + def pmStudy(): return PM(907787,908700) + def Study(): return QtGui.QIcon(pmStudy()) + def pmLichess(): return PM(908700,909590) + def Lichess(): return QtGui.QIcon(pmLichess()) + def pmMiniatura(): return PM(909590,910517) + def Miniatura(): return QtGui.QIcon(pmMiniatura()) + def pmLocomotora(): return PM(910517,911298) + def Locomotora(): return QtGui.QIcon(pmLocomotora()) + def pmPositions(): return PM(911298,912889) + def Positions(): return QtGui.QIcon(pmPositions()) + def pmTrainSequential(): return PM(912889,914030) + def TrainSequential(): return QtGui.QIcon(pmTrainSequential()) + def pmTrainStatic(): return PM(914030,914990) + def TrainStatic(): return QtGui.QIcon(pmTrainStatic()) + def pmTrainPositions(): return PM(914990,915971) + def TrainPositions(): return QtGui.QIcon(pmTrainPositions()) + def pmTrainEngines(): return PM(915971,917405) + def TrainEngines(): return QtGui.QIcon(pmTrainEngines()) + def pmError(): return PM(50641,54641) + def Error(): return QtGui.QIcon(pmError()) + def pmAtajos(): return PM(917405,918584) + def Atajos(): return QtGui.QIcon(pmAtajos()) + def pmTOLline(): return PM(918584,919688) + def TOLline(): return QtGui.QIcon(pmTOLline()) + def pmTOLchange(): return PM(919688,921910) + def TOLchange(): return QtGui.QIcon(pmTOLchange()) + def pmPack(): return PM(921910,922575) + def Pack(): return QtGui.QIcon(pmPack()) + def pmHome(): return PM(193506,194688) + def Home(): return QtGui.QIcon(pmHome()) + def pmImport8(): return PM(922575,923785) + def Import8(): return QtGui.QIcon(pmImport8()) + def pmExport8(): return PM(923785,924410) + def Export8(): return QtGui.QIcon(pmExport8()) + def pmTablas8(): return PM(924410,925202) + def Tablas8(): return QtGui.QIcon(pmTablas8()) + def pmBlancas8(): return PM(925202,926232) + def Blancas8(): return QtGui.QIcon(pmBlancas8()) + def pmNegras8(): return PM(926232,927071) + def Negras8(): return QtGui.QIcon(pmNegras8()) + def pmBook(): return PM(927071,927645) + def Book(): return QtGui.QIcon(pmBook()) + +def pmWrite(): + return PM(927645,928551) + + +def Write(): + return QtGui.QIcon(pmWrite()) + diff --git a/Code/QT/InfoBase.py b/Code/QT/InfoBase.py index 6bcc77f..863e967 100644 --- a/Code/QT/InfoBase.py +++ b/Code/QT/InfoBase.py @@ -62,7 +62,7 @@ def listaMotores(self, bloque): ["Critter 1.6a 32bits", "Richard Vida", "http://www.vlasak.biz/critter/"], ["Texel 1.07", "Peter Österlund", "http://hem.bredband.net/petero2b/javachess/index.html#texel"], ["Stockfish 9", "Tord Romstad, Marco Costalba, Joona Kiiski", "http://stockfishchess.org/"], - ["McBrain 9.1", "Michael Byrne", "https://github.com/MichaelB7/Stockfish/releases"], + ["McBrain 9.9", "Michael Byrne", "https://github.com/MichaelB7/Stockfish/releases"], ["Gull 3", "Vadim Demichev", "https://sourceforge.net/projects/gullchess/"], ["Delfi 5.4", "Fabio Cavicchio", "http://www.msbsoftware.it/delfi/"], # ["SmartThink 1.97", "Sergei S. Markoff", "http://genes1s.net/smarthink.php"], @@ -244,7 +244,7 @@ def Images(self): ("Figurines", 'Armando H. Marroquín', 'http://www.enpassant.dk/chess/fonteng.htm', _("Freeware")), ("Icons for Windows8", 'Icons8', 'https://icons8.com', "Creative Commons Attribution-NoDerivs 3.0 Unported"), ("Transsiberian map", "Stefan Ertmann & Lokal Profil", - "https://commons.wikimedia.org/wiki/File%3ATrans-Siberian_railway_map.svg", "CC BY-SA 2.5 via Wikimedia Commons"), + "https://commons.wikimedia.org/wiki/File:Trans-Siberian_railway_map.svg", "CC BY-SA 2.5 via Wikimedia Commons"), ("Washing machine", "Shinnoske", "https://openclipart.org/detail/218905/simple-washing-machine", "Public domain"), ] for tipo, autor, web, licencia in li: diff --git a/Code/QT/POLAnalisis.py b/Code/QT/POLAnalisis.py index 7b89acd..133618b 100644 --- a/Code/QT/POLAnalisis.py +++ b/Code/QT/POLAnalisis.py @@ -1,6 +1,6 @@ import os -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtGui, QtCore diff --git a/Code/QT/PantallaAnotar.py b/Code/QT/PantallaAnotar.py new file mode 100644 index 0000000..a9c0a13 --- /dev/null +++ b/Code/QT/PantallaAnotar.py @@ -0,0 +1,118 @@ +from Code import Util +from Code.QT import Colocacion +from Code.QT import Columnas +from Code.QT import Controles +from Code.QT import Grid +from Code.QT import Iconos +from Code.QT import QTUtil2 +from Code.QT import QTVarios + + +class WAnotar(QTVarios.WDialogo): + def __init__(self, procesador): + + self.procesador = procesador + self.configuracion = procesador.configuracion + self.resultado = None + self.db = Util.DicSQL(self.configuracion.ficheroAnotar) + self.lista = self.db.keys(True, True) + self.resultado = None + + QTVarios.WDialogo.__init__(self, procesador.pantalla, _("Writing down moves of a game"), Iconos.Write(), "annotateagame") + + oColumnas = Columnas.ListaColumnas() + oColumnas.nueva("DATE", _("Date"), 110) + oColumnas.nueva("COLOR", _("Color"), 80, siCentrado=True) + oColumnas.nueva("GAME", _("Game"), 280) + oColumnas.nueva("MOVES", _("Moves"), 80, siCentrado=True) + oColumnas.nueva("TIME", _("Avg time"), 80, siCentrado=True) + oColumnas.nueva("ERRORS", _("Errors"), 80, siCentrado=True) + oColumnas.nueva("HINTS", _("Hints"), 80, siCentrado=True) + self.glista = Grid.Grid(self, oColumnas, siSelecFilas=True, siSeleccionMultiple=True) + + liAcciones = ( + (_("Close"), Iconos.MainMenu(), self.terminar), None, + (_("New"), Iconos.Nuevo(), self.new), None, + (_("Repeat"), Iconos.Copiar(), self.repetir), None, + (_("Remove"), Iconos.Borrar(), self.borrar), None, + ) + tb = Controles.TBrutina(self, liAcciones) + + ly = Colocacion.V().control(tb).control(self.glista).margen(4) + + self.setLayout(ly) + + self.registrarGrid(self.glista) + self.recuperarVideo(anchoDefecto=self.glista.anchoColumnas()+20) + + def gridDobleClick(self, grid, fila, oColumna): + self.repetir() + + def repetir(self): + recno = self.glista.recno() + if recno >= 0: + registro = self.db[self.lista[recno]] + self.haz(registro["PC"]) + + def new(self): + self.haz(None) + + def haz(self, que): + siblancasabajo = QTVarios.blancasNegras(self) + if siblancasabajo is None: + return + self.resultado = que, siblancasabajo + self.guardarVideo() + self.db.close() + self.accept() + + def borrar(self): + li = self.glista.recnosSeleccionados() + if len(li) > 0: + mens = _("Do you want to delete all selected records?") + if QTUtil2.pregunta(self, mens): + for fila in li: + del self.db[self.lista[fila]] + recno = self.glista.recno() + self.glista.refresh() + self.lista = self.db.keys(True, True) + if recno >= len(self.lista): + self.glista.gobottom() + + def gridNumDatos(self, grid): + return len(self.lista) + + def gridDato(self, grid, fila, oColumna): + col = oColumna.clave + reg = self.db[self.lista[fila]] + if not reg: + return "" + if col == "DATE": + return self.lista[fila] + elif col == "GAME": + return reg["PC"].titulo(("DATE", "EVENT", "WHITE", "BLACK", "RESULT")) + elif col == "MOVES": + total = len(reg["PC"]) + moves = reg["MOVES"] + if total == moves: + return str(total) + else: + return "%d/%d" % (moves, total) + elif col == "TIME": + return "%0.2f\"" % reg["TIME"] + elif col == "HINTS": + return str(reg["HINTS"]) + elif col == "ERRORS": + return str(reg["ERRORS"]) + elif col == "COLOR": + return _("White") if reg["COLOR"] else _("Black") + + def closeEvent(self, event): # Cierre con X + self.db.close() + self.guardarVideo() + + def terminar(self): + self.db.close() + self.guardarVideo() + self.reject() + diff --git a/Code/QT/PantallaArbol.py b/Code/QT/PantallaArbol.py index 106afea..1f1a641 100644 --- a/Code/QT/PantallaArbol.py +++ b/Code/QT/PantallaArbol.py @@ -1,6 +1,6 @@ import collections -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtGui, QtCore diff --git a/Code/QT/PantallaEverest.py b/Code/QT/PantallaEverest.py index 75f14aa..f41015d 100644 --- a/Code/QT/PantallaEverest.py +++ b/Code/QT/PantallaEverest.py @@ -1,7 +1,7 @@ import os.path import random -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtSvg, QtCore from Code import Everest diff --git a/Code/QT/PantallaHorses.py b/Code/QT/PantallaHorses.py index 24d64db..4cb4d2e 100644 --- a/Code/QT/PantallaHorses.py +++ b/Code/QT/PantallaHorses.py @@ -3,7 +3,7 @@ import random import time -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import ControlPosicion from Code.QT import Colocacion diff --git a/Code/QT/PantallaLearnPGN.py b/Code/QT/PantallaLearnPGN.py index db3b823..287d138 100644 --- a/Code/QT/PantallaLearnPGN.py +++ b/Code/QT/PantallaLearnPGN.py @@ -504,6 +504,7 @@ def mueveHumano(self, desde, hasta, coronacion=""): else: if hasta != desde: self.errors += 1 + self.tableroIni.ponFlechasTmp([(jg.desde, jg.hasta, False)]) self.ponInfo() return False diff --git a/Code/QT/PantallaOpeningLine.py b/Code/QT/PantallaOpeningLine.py index 69c3372..61b756f 100644 --- a/Code/QT/PantallaOpeningLine.py +++ b/Code/QT/PantallaOpeningLine.py @@ -258,7 +258,7 @@ def train(self): if trEng or trSSP: submenu.opcion("update", _("Update current trainings"), Iconos.Reindexar()) submenu.separador() - submenu1 = submenu.submenu(_("Re-create all trainings"), Iconos.Modificar()) + submenu1 = submenu.submenu(_("Create trainings"), Iconos.Modificar()) submenu1.opcion("new_ssp", "%s - %s - %s" %(_("Sequential"), _("Static"), _("Positions")), Iconos.TrainSequential()) submenu1.opcion("new_eng", "With engines", Iconos.TrainEngines()) @@ -331,6 +331,11 @@ def trainNewEngines(self): engine_time = 5.0 num_engines = 20 key_engine = "alaric" + ext_engines = [] + auto_analysis = True + ask_movesdifferent = False + times = [500, 1000, 2000, 4000, 8000] + books = ["", "", "", "", ""] if training is not None: color = training["COLOR"] @@ -341,6 +346,11 @@ def trainNewEngines(self): engine_time = training.get("ENGINE_TIME", engine_time) num_engines = training.get("NUM_ENGINES", num_engines) key_engine = training.get("KEY_ENGINE", key_engine) + ext_engines = training.get("EXT_ENGINES", ext_engines) + auto_analysis = training.get("AUTO_ANALYSIS", auto_analysis) + ask_movesdifferent = training.get("ASK_MOVESDIFFERENT", ask_movesdifferent) + times = training.get("TIMES", times) + books = training.get("BOOKS", books) separador = FormLayout.separador liGen = [separador] @@ -353,12 +363,12 @@ def trainNewEngines(self): liGen.append(separador) liGen.append((_("Moves until the control") + ":", control)) liGen.append(separador) - liGen.append((_("Maximum number of centipawns lost to pass control") + ":", lost_points)) + liGen.append((_("Maximum number of lost centipawns to pass control") + ":", lost_points)) liGen.append(separador) dicRivales = self.configuracion.dicRivales dicRivales = EnginesBunch.filtra(dicRivales) - config = FormLayout.Spinbox(_("Number of engines"), 2, len(dicRivales), 50) + config = FormLayout.Spinbox(_("Number of engines"), 0, len(dicRivales), 50) liGen.append((config, num_engines)) likeys = [(dicRivales[x].nombre, x) for x in dicRivales] @@ -371,16 +381,84 @@ def trainNewEngines(self): liGen.append((config, engine_control)) liGen.append((_("Duration of analysis (secs)") + ":", float(engine_time))) - resultado = FormLayout.fedit(liGen, title=_("With engines"), parent=self, anchoMinimo=360, icon=Iconos.Study()) + liGen.append(separador) + + liGen.append((_("Automatic analysis") + ":", auto_analysis)) + + liGen.append(separador) + + liGen.append((_("Ask when the moves are different from the line") + ":", ask_movesdifferent)) + + liMotoresExternos = self.configuracion.listaMotoresExternos(ordenados=False) + if liMotoresExternos: + liExt = [separador] + for cm in liMotoresExternos: + liExt.append((cm.nombre, cm.alias in ext_engines)) + else: + liExt = None + + liLevels = [separador] + listaLibros = Books.ListaLibros() + listaLibros.recuperaVar(self.configuracion.ficheroBooks) + listaLibros.comprueba() + libooks = [(bookx.nombre, bookx) for bookx in listaLibros.lista] + libooks.insert(0, ("--", None)) + for level in range(5): + n = level+1 + title = "%s %d" % (_("Level"), n) + liLevels.append((None, title)) + tm = times[level]/1000.0 if len(times) > level else 0.0 + liLevels.append((_("Time engines think in seconds") + ":", tm)) + + bk = books[level] if len(books) > level else "" + book = listaLibros.buscaLibro(bk) if bk else None + config = FormLayout.Combobox(_("Book"), libooks) + liLevels.append((config, book)) + + lista = [] + lista.append((liGen, _("Basic data"), "")) + if liExt: + lista.append((liExt, _("External engines"), "")) + lista.append((liLevels, _("Levels"), "")) + + resultado = FormLayout.fedit(lista, title=_("With engines"), parent=self, anchoMinimo=360, icon=Iconos.Study()) if resultado is None: return accion, liResp = resultado + selMotoresExt = [] + if liMotoresExternos: + liGen, liExt, liLevels = liResp + + for x in range(len(liMotoresExternos)): + if liExt[x]: + selMotoresExt.append(liMotoresExternos[x].alias) + else: + liGen, liLevels = liResp + reg = {} (reg["COLOR"], reg["MANDATORY"], reg["CONTROL"], reg["LOST_POINTS"], reg["NUM_ENGINES"], reg["KEY_ENGINE"], - reg["ENGINE_CONTROL"], reg["ENGINE_TIME"] ) = liResp + reg["ENGINE_CONTROL"], reg["ENGINE_TIME"], reg["AUTO_ANALYSIS"], reg["ASK_MOVESDIFFERENT"] ) = liGen + reg["EXT_ENGINES"] = selMotoresExt + + if (len(selMotoresExt) + reg["NUM_ENGINES"]) == 0: + reg["NUM_ENGINES"] = 1 + + times = [] + books = [] + for x in range(5): + tm = int(liLevels[x*2]*1000) + bk = liLevels[x*2+1] + if tm: + times.append(tm) + books.append(bk.nombre if bk else "") + if len(times) == 0: + times.append(500) + books.append(None) + reg["TIMES"] = times + reg["BOOKS"] = books self.dbop.createTrainingEngines(reg, self.procesador) diff --git a/Code/QT/PantallaTorneos.py b/Code/QT/PantallaTorneos.py index 217ce91..2b4e1ab 100644 --- a/Code/QT/PantallaTorneos.py +++ b/Code/QT/PantallaTorneos.py @@ -760,6 +760,8 @@ def gmGuardar(self): if w.exec_(): ws = PantallaSavePGN.FileSavePGN(self, w.dic_result) if ws.open(): + if not ws.is_new: + ws.write("\n\n") ws.write(pgn) ws.close() ws.um_final() diff --git a/Code/QT/PantallaVisualiza.py b/Code/QT/PantallaVisualiza.py index 07b8d2c..a40e645 100644 --- a/Code/QT/PantallaVisualiza.py +++ b/Code/QT/PantallaVisualiza.py @@ -1,7 +1,7 @@ import os.path import time -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtCore from Code import ControlPosicion diff --git a/Code/QT/QTUtil2.py b/Code/QT/QTUtil2.py index 6ce54ce..8fe3346 100644 --- a/Code/QT/QTUtil2.py +++ b/Code/QT/QTUtil2.py @@ -247,11 +247,14 @@ def test(): mensEspera = ControlMensEspera() -def mensajeTemporal(pantalla, mensaje, segundos, background=None, pmImagen=None, posicion="c", fixedSize=256, siCancelar=None): +def mensajeTemporal(pantalla, mensaje, segundos, background=None, pmImagen=None, posicion="c", fixedSize=256, + siCancelar=None, titCancelar=None): if siCancelar is None: siCancelar = segundos > 3.0 + if titCancelar is None: + titCancelar = _("Continue") me = mensEspera.inicio(pantalla, mensaje, background=background, pmImagen=pmImagen, siCancelar=siCancelar, - titCancelar=_("Continue"), posicion=posicion, fixedSize=fixedSize) + titCancelar=titCancelar, posicion=posicion, fixedSize=fixedSize) if segundos: me.time(segundos) return me @@ -416,6 +419,8 @@ def __init__(self, owner, titulo, mensaje, total): self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowMinimizeButtonHint) self.setWindowTitle(titulo) self.owner = owner + self.setAutoClose(False) + self.setAutoReset(False) def mostrar(self): if self.owner: diff --git a/Code/QT/QTVarios.py b/Code/QT/QTVarios.py index abc1761..3ae8810 100644 --- a/Code/QT/QTVarios.py +++ b/Code/QT/QTVarios.py @@ -1126,3 +1126,43 @@ def menuDB(submenu, configuracion, siFEN, siAll=False): for fich in lista: submenu.opcion("dbf_%s" % os.path.join(carpeta, fich), _F(fich[:-4]), rp.otro()) submenu.separador() + + +class ReadAnnotation(QtGui.QDialog): + def __init__(self, parent, objetivo): + QtGui.QDialog.__init__(self, parent) + self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint) + + self.edAnotacion = Controles.ED(self, "") + btAceptar = Controles.PB(self, "", rutina=self.aceptar).ponIcono(Iconos.Aceptar()) + btCancelar = Controles.PB(self, "", rutina=self.cancelar).ponIcono(Iconos.Cancelar()) + btAyuda = Controles.PB(self, "", rutina=self.ayuda).ponIcono(Iconos.AyudaGR()) + + self.objetivo = objetivo + self.conAyuda = False + self.errores = 0 + self.resultado = None + + layout = Colocacion.H().relleno(1).control(btAyuda).control(self.edAnotacion).control(btAceptar).control(btCancelar).margen(3) + self.setLayout(layout) + self.move(parent.x()+parent.tablero.width()-212, parent.y()+parent.tablero.y()-3) + + def aceptar(self): + txt = self.edAnotacion.texto() + txt = txt.strip().replace(" ", "").upper() + + if txt: + if txt == self.objetivo.upper(): + self.resultado = self.conAyuda, self.errores + self.accept() + else: + self.errores += 1 + self.edAnotacion.setStyleSheet("QWidget { color: red }") + + def cancelar(self): + self.reject() + + def ayuda(self): + self.conAyuda = True + self.edAnotacion.ponTexto(self.objetivo) + diff --git a/Code/QT/Tablero.py b/Code/QT/Tablero.py index 8cc7bb0..2872e36 100644 --- a/Code/QT/Tablero.py +++ b/Code/QT/Tablero.py @@ -1607,6 +1607,12 @@ def ponerPiezasAbajo(self, siBlancasAbajo): self.escena.update() + def showCoordenadas(self, ok): + for coord in self.liCoordenadasHorizontales: + coord.setVisible(ok) + for coord in self.liCoordenadasVerticales: + coord.setVisible(ok) + def peonCoronando(self, siBlancas): if self.configuracion.autocoronacion: modifiers = QtGui.QApplication.keyboardModifiers() diff --git a/Code/QT/WBG_Players.py b/Code/QT/WBG_Players.py index d8797de..ca26b42 100644 --- a/Code/QT/WBG_Players.py +++ b/Code/QT/WBG_Players.py @@ -1,4 +1,4 @@ -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtGui, QtCore diff --git a/Code/RunKibitzer.py b/Code/RunKibitzer.py index 8155d1b..13c85d1 100644 --- a/Code/RunKibitzer.py +++ b/Code/RunKibitzer.py @@ -2,7 +2,7 @@ import sys import time -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from PyQt4 import QtCore, QtGui import struct diff --git a/Code/Tacticas.py b/Code/Tacticas.py index 233b10d..aeb0d75 100644 --- a/Code/Tacticas.py +++ b/Code/Tacticas.py @@ -261,6 +261,12 @@ def leeDatos(self, carpetaUser): if reference is None: db["REFERENCE"] = "" + penalization = db["PENALIZATION"] + if penalization is None: + penalization = db["PENALIZATION"] = [1,2,3,4] + + self.PENALIZATION = penalization + def listaFicheros(self, clave): dalias = self.tts.dic.get("ALIAS", {}) if clave in dalias: @@ -393,6 +399,8 @@ def busca(desde, salto): db["REFERENCE"] = self.REFERENCE + db["PENALIZATION"] = self.PENALIZATION + # 6.3d---------------+ liHisto = db["HISTO"] if not liHisto: diff --git a/Code/Torneo.py b/Code/Torneo.py index 2f4f14a..44dfdfc 100644 --- a/Code/Torneo.py +++ b/Code/Torneo.py @@ -269,6 +269,10 @@ def pgn(self, torneo): ("Black", enb.alias), ("Result", rs), ] + if enw.elo: + li.append(("WhiteElo", "%d" % enw.elo)) + if enb.elo: + li.append(("BlackElo", "%d" % enb.elo)) if not self._partida.siFenInicial(): li.append(("FEN", self._partida.iniPosicion.fen())) diff --git a/Code/Tutor.py b/Code/Tutor.py index 4fb426a..7c44c86 100644 --- a/Code/Tutor.py +++ b/Code/Tutor.py @@ -1,7 +1,7 @@ import codecs import os -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import Analisis from Code import Partida diff --git a/Code/Util.py b/Code/Util.py index aa219f3..50328b8 100644 --- a/Code/Util.py +++ b/Code/Util.py @@ -994,6 +994,13 @@ def pack(self): cursor.close() self._conexion.commit() + def deleteall(self): + cursor = self._conexion.cursor() + cursor.execute("DELETE FROM %s" % self.table) + cursor.execute("VACUUM") + cursor.close() + self._conexion.commit() + def __enter__(self): return self diff --git a/Code/XGestorMotor.py b/Code/XGestorMotor.py index aaea40c..853a182 100644 --- a/Code/XGestorMotor.py +++ b/Code/XGestorMotor.py @@ -1,6 +1,6 @@ import os -import LCEngineV1 as LCEngine +import LCEngine2 as LCEngine from Code import VarGen from Code import XMotor diff --git a/Engines/Linux32/mcbrain/.DS_Store b/Engines/Linux32/mcbrain/.DS_Store index 01c2e2c..f2a08a1 100644 Binary files a/Engines/Linux32/mcbrain/.DS_Store and b/Engines/Linux32/mcbrain/.DS_Store differ diff --git a/Engines/Linux32/mcbrain/.gitignore b/Engines/Linux32/mcbrain/.gitignore new file mode 100644 index 0000000..b5f56bd --- /dev/null +++ b/Engines/Linux32/mcbrain/.gitignore @@ -0,0 +1,24 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +*.pdb +*.tlog +*.log +*.exe +*.obj +*.lastbuildstate +*.ilk +*.idb +*.ipch +*.opendb +*.db +*.suo +*.sqlite +*.json + +# Ignore temporary folders +.vs/ +/executable/Machine Learning/SugarMachineLearning.sml +/executable/Master/Cerebellum_Light_Poly.bin +/executable/Base Master/Cerebellum_Light_Poly.bin diff --git a/Engines/Linux32/mcbrain/.travis.yml b/Engines/Linux32/mcbrain/.travis.yml index 0a214d1..ded29e4 100644 --- a/Engines/Linux32/mcbrain/.travis.yml +++ b/Engines/Linux32/mcbrain/.travis.yml @@ -9,9 +9,9 @@ matrix: addons: apt: sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6', 'g++-6-multilib', 'g++-multilib', 'valgrind', 'expect'] + packages: ['g++-7', 'g++-7-multilib', 'g++-multilib', 'valgrind', 'expect', 'curl'] env: - - COMPILER=g++-6 + - COMPILER=g++-7 - COMP=gcc - os: linux @@ -19,7 +19,7 @@ matrix: addons: apt: sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0'] - packages: ['clang-5.0', 'llvm-5.0-dev', 'g++-multilib', 'valgrind', 'expect'] + packages: ['clang-5.0', 'llvm-5.0-dev', 'g++-multilib', 'valgrind', 'expect', 'curl'] env: - COMPILER=clang++-5.0 - COMP=clang @@ -69,6 +69,6 @@ script: # # Sanitizer # - # Use g++-6 as a proxy for having sanitizers, might need revision as they become available for more recent versions of clang/gcc - - if [[ "$COMPILER" == "g++-6" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=undefined optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-undefined; fi - - if [[ "$COMPILER" == "g++-6" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-thread; fi + # Use g++-7 as a proxy for having sanitizers, might need revision as they become available for more recent versions of clang/gcc + - if [[ "$COMPILER" == "g++-7" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=undefined optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-undefined; fi + - if [[ "$COMPILER" == "g++-7" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-thread; fi diff --git a/Engines/Linux32/mcbrain/AUTHORS b/Engines/Linux32/mcbrain/AUTHORS index 9b91b93..9c25509 100644 --- a/Engines/Linux32/mcbrain/AUTHORS +++ b/Engines/Linux32/mcbrain/AUTHORS @@ -1,98 +1,122 @@ -# Generated with 'git shortlog -sn | cut -c8-', which sorts by commits, manually ordered the first four authors, merged duplicates +# List of authors for Stockfish, updated just after version 9 -Tord Romstad +Tord Romstad (romstad) Marco Costalba (mcostalba) Joona Kiiski (zamar) Gary Linscott (glinscott) -Lucas Braesch (lucasart) -Bill Henry (VoyagerOne) -mstembera -Stéphane Nicolet (Stephane Nicolet, snicolet) -Stefan Geschwentner -Alain SAVARD (Rocky640) -Jörg Oster (Joerg Oster, joergoster) -Reuven Peleg -Chris Caino (Chris Cain, ceebo) -Jean-Francois Romang -homoSapiensSapiens -Leonid Pechenik -Stefano Cardanobile (Stefano80) -Arjun Temurnikar -Uri Blass (uriblass) -jundery -Ajith (ajithcj) -hxim -Ralph Stößer (Ralph Stoesser) -Guenther Demetz -Jonathan Calovski (Mysseno) -Tom Vijlbrief -mbootsector -Daylen Yang -ElbertoOne -Henri Wiechers -loco-loco -Joost VandeVondele (Joost Vandevondele) -Ronald de Man (syzygy) -DU-jdto -David Zar -Eelco de Groot -Jerry Donald -NicklasPersson -Ryan Schmitt + +absimaldata +Ajith Chandy Jose (ajithcj) +Alain Savard (Rocky640) Alexander Kure -Dan Schmidt -H. Felix Wittmann -Jacques -Joseph R. Prostko -Justin Blanchard -Linus Arver -Luca Brivio -Lyudmil Antonov -Rodrigo Exterckötter Tjäder -Ron Britvich -RyanTaker -Vince Negri -erbsenzaehler -Joseph Hellis (jhellis3) -shane31 -Andrew Grant +Ali AlZhrani (Cooffe) +Andrew Grant (AndyGrant) +Andrey Neporada (nepal) Andy Duplain +Aram Tumanian (atumanian) +Arjun Temurnikar Auguste Pop Balint Pfliegel +Ben Koshy (BKSpurgeon) +Bill Henry (VoyagerOne) +braich +Brian Sheppard (SapphireBrand) +Bryan Cross (crossbr) +Bujun Guo (noobpwnftw) +Chris Cain (ceebo) +Dan Schmidt +Daniel Dugovic (ddugovic) Dariusz Orzechowski +David Zar +Daylen Yang (daylen) DiscanX +Eelco de Groot +ElbertoOne +erbsenzaehler Ernesto Gatti +Fabian Beuke (madnight) +Fabian Fichter (ianfab) +fanon +Fauzi Akram Dabat (FauziAkram) +Felix Wittmann +gamander +gguliash +Gian-Carlo Pascutto (gcp) +Gontran Lemaire (gonlem) +Goodkov Vasiliy Aleksandrovich (goodkov) Gregor Cramer +GuardianRM +Günther Demetz (pb00067, pb00068) +Guy Vreuls (gvreuls) +Henri Wiechers Hiraoka Takuya (HiraokaTakuya) +homoSapiensSapiens Hongzhi Cheng -IIvec +Ivan Ivec (IIvec) +Jacques B. (Timshel) +Jan OndruÅ¡ (hxim) +Jarrod Torriero (DU-jdto) +Jean-Francois Romang +Jerry Donald Watson (jerrydonaldwatson) +Jonathan Calovski (Mysseno) +Joost VandeVondele (vondele) +Jörg Oster (joergoster) +Joseph Ellis (jhellis3) +Joseph R. Prostko +jundery +Justin Blanchard Kelly Wilson -Ken T Takusagawa +Ken Takusagawa +kinderchocolate +Kiran Panditrao (Krgp) Kojirion -Krgp -Matt Sullivan -Matthew Lai +Leonardo LjubiÄić (GM) +Leonid Pechenik (lp--) +Linus Arver +loco-loco +Luca Brivio (lucabrivio) +Lucas Braesch (lucasart) +Lyudmil Antonov (lantonov) +Matthew Lai (matthewlai) Matthew Sullivan -Michel Van den Bergh -Niklas Fiekas +Mark Tenzer (31m059) +Michael Byrne (MichaelB7) +Michael Stembera (mstembera) +Michel Van den Bergh (vdbergh) +Miguel Lahoz (miguel-l) +Mikael Bäckman (mbootsector) +Mike Whiteley (protonspring) +Miroslav Fontán (Hexik) +Moez Jellouli (MJZ1977) +Mohammed Li (tthsqe12) +Nathan Rugg (nmrugg) +Nicklas Persson (NicklasPersson) +Niklas Fiekas (niklasf) Oskar Werkelin Ahlin Pablo Vazquez Pascal Romaret +Pasquale Pigazzini (ppigazzini) +Patrick Jansen (mibere) +pellanda +Ralph Stößer (Ralph Stoesser) Raminder Singh +renouve +Reuven Peleg Richard Lloyd +Rodrigo Exterckötter Tjäder +Ron Britvich +Ronald de Man (syzygy1) +Ryan Schmitt Ryan Takker -Thanar2 -absimaldata -atumanian -braich -fanon -gamander -gguliash -kinderchocolate -pellanda -ppigazzini -renouve +Sergei Antonov (saproj) sf-x +shane31 +Stefan Geschwentner (locutus2) +Stefano Cardanobile (Stefano80) +Stéphane Nicolet (snicolet) +Thanar2 thaspel -unknown - +Tom Vijlbrief (tomtor) +Torsten Franz (torfranz) +Uri Blass (uriblass) +Vince Negri diff --git a/Engines/Linux32/mcbrain/McBrain-91_x32_linux b/Engines/Linux32/mcbrain/McBrain-91_x32_linux deleted file mode 100644 index 776a814..0000000 Binary files a/Engines/Linux32/mcbrain/McBrain-91_x32_linux and /dev/null differ diff --git a/Engines/Linux32/mcbrain/McBrain-v99_x32_linux b/Engines/Linux32/mcbrain/McBrain-v99_x32_linux new file mode 100644 index 0000000..de4e10a Binary files /dev/null and b/Engines/Linux32/mcbrain/McBrain-v99_x32_linux differ diff --git a/Engines/Linux32/mcbrain/Readme.md b/Engines/Linux32/mcbrain/Readme.md index 46f2609..8913595 100644 --- a/Engines/Linux32/mcbrain/Readme.md +++ b/Engines/Linux32/mcbrain/Readme.md @@ -1,33 +1,30 @@ -### Overview +### Overview [![Build Status](https://travis-ci.org/official-stockfish/Stockfish.svg?branch=master)](https://travis-ci.org/official-stockfish/Stockfish) -[![Build Status](https://travis-ci.org/official-stockfish/Stockfish.svg?branch=master)](https://travis-ci.org/official-stockfish/Stockfish) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/official-stockfish/Stockfish?svg=true)](https://ci.appveyor.com/project/mcostalba/stockfish) - -Stockfish is a free UCI chess engine derived from Glaurung 2.1. It is +SugaR is a free UCI chess engine derived from Stockfish. It is not a complete chess program and requires some UCI-compatible GUI (e.g. XBoard with PolyGlot, eboard, Arena, Sigma Chess, Shredder, Chess -Partner or Fritz) in order to be used comfortably. Read the +Partner, Aquarium or Fritz) in order to be used comfortably. Read the documentation for your GUI of choice for information about how to use -Stockfish with it. +SugaR with it. -This version of Stockfish supports up to 512 cores. The engine defaults +This version of SugaR supports up to 128 cores. The engine defaults to one search thread, so it is therefore recommended to inspect the value of the *Threads* UCI parameter, and to make sure it equals the number of CPU cores on your computer. -This version of Stockfish has support for Syzygybases. +This version of SugaR has support for Syzygybases. ### Files -This distribution of Stockfish consists of the following files: +This distribution of SugaR consists of the following files: * Readme.md, the file you are currently reading. * Copying.txt, a text file containing the GNU General Public License. - * src, a subdirectory containing the full source code, including a Makefile - that can be used to compile Stockfish on Unix-like systems. + * source, a subdirectory containing the full source code, including a Makefile + that can be used to compile SugaR on Unix-like systems. ### Syzygybases @@ -84,40 +81,37 @@ the 50-move rule. ### Compiling it yourself -On Unix-like systems, it should be possible to compile Stockfish +On Unix-like systems, it should be possible to compile SugaR directly from the source code with the included Makefile. -Stockfish has support for 32 or 64-bit CPUs, the hardware POPCNT +SugaR has support for 32 or 64-bit CPUs, the hardware POPCNT instruction, big-endian machines such as Power PC, and other platforms. +On Windows-like systems, it should be possible to compile SugaR +directly from the source code with the included Sugar.sln with Visual Studio 15.3 Community +from GUI or with command scenario using Visual Studio 15.3 Community Commands Shell. + In general it is recommended to run `make help` to see a list of make targets with corresponding descriptions. When not using the Makefile to -compile (for instance with Microsoft MSVC) you need to manually -set/unset some switches in the compiler command line; see file *types.h* +compile you need to manually +set/unset some switches in the compiler command line or use MSVC solution and project files provided; see file *types.h* for a quick reference. -### Resource For Understanding the Code Base - -* [Chess Programming Wiki](https://chessprogramming.wikispaces.com) has good overall chess engines explanations -(techniques used here are well explained like hash maps etc), it was -also recommended by the [support team at stockfish.](http://support.stockfishchess.org/discussions/questions/1132-how-to-understand-stockfish-sources) - -* [Here](https://chessprogramming.wikispaces.com/Stockfish) you can find a set of features and techniques used by stockfish and each of them is explained at the wiki, however, it's a generic way rather than focusing on stockfish's own implementation, but it will still help you. - ### Terms of use -Stockfish is free, and distributed under the **GNU General Public License** +SugaR is free, and distributed under the **GNU General Public License** (GPL). Essentially, this means that you are free to do almost exactly what you want with the program, including distributing it among your friends, making it available for download from your web site, selling it (either by itself or as part of some bigger software package), or using it as the starting point for a software project of your own. -The only real limitation is that whenever you distribute Stockfish in +The only real limitation is that whenever you distribute SugaR in some way, you must always include the full source code, or a pointer to where the source code can be found. If you make any changes to the source code, these changes must also be made available under the GPL. For full details, read the copy of the GPL found in the file named *Copying.txt*. + diff --git a/Engines/Linux32/mcbrain/SF-McBrain-v40_x32_linux b/Engines/Linux32/mcbrain/SF-McBrain-v40_x32_linux deleted file mode 100644 index 564c126..0000000 Binary files a/Engines/Linux32/mcbrain/SF-McBrain-v40_x32_linux and /dev/null differ diff --git a/Engines/Linux32/mcbrain/appveyor.yml b/Engines/Linux32/mcbrain/appveyor.yml index c711dd6..4b5e9eb 100644 --- a/Engines/Linux32/mcbrain/appveyor.yml +++ b/Engines/Linux32/mcbrain/appveyor.yml @@ -34,19 +34,16 @@ before_build: $src = get-childitem -Path *.cpp -Recurse | select -ExpandProperty FullName $src = $src -join ' ' $src = $src.Replace("\", "/") - # Build CMakeLists.txt $t = 'cmake_minimum_required(VERSION 3.8)', 'project(Stockfish)', 'set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src)', 'set(source_files', $src, ')', 'add_executable(stockfish ${source_files})' - # Write CMakeLists.txt withouth BOM $MyPath = (Get-Item -Path "." -Verbose).FullName + '\CMakeLists.txt' $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False [System.IO.File]::WriteAllLines($MyPath, $t, $Utf8NoBomEncoding) - # Obtain bench reference from git log $b = git log HEAD | sls "\b[Bb]ench[ :]+[0-9]{7}" | select -first 1 $bench = $b -match '\D+(\d+)' | % { $matches[1] } @@ -55,10 +52,8 @@ before_build: If (${env:PLATFORM} -eq 'x64') { $g = $g + ' Win64' } cmake -G "${g}" . Write-Host "Generated files for: " $g - build_script: - cmake --build . --config %CONFIGURATION% -- /verbosity:minimal - before_test: - cd src/%CONFIGURATION% - ps: | @@ -68,4 +63,4 @@ before_test: $r = ($s -match 'Nodes searched \D+(\d+)' | % { $matches[1] }) Write-Host "Engine bench:" $r Write-Host "Reference bench:" $bench - If ($r -ne $bench) { exit 1 } + If ($r -ne $bench) { exit 1 } \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/.DS_Store b/Engines/Linux32/mcbrain/src/.DS_Store index 5008ddf..ef9e3c3 100644 Binary files a/Engines/Linux32/mcbrain/src/.DS_Store and b/Engines/Linux32/mcbrain/src/.DS_Store differ diff --git a/Engines/Linux32/mcbrain/src/.cproject b/Engines/Linux32/mcbrain/src/.cproject new file mode 100644 index 0000000..54a0868 --- /dev/null +++ b/Engines/Linux32/mcbrain/src/.cproject @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Engines/Linux32/mcbrain/src/.depend b/Engines/Linux32/mcbrain/src/.depend new file mode 100644 index 0000000..bd25d9e --- /dev/null +++ b/Engines/Linux32/mcbrain/src/.depend @@ -0,0 +1,52 @@ +benchmark.o: benchmark.cpp position.h bitboard.h types.h +bitbase.o: bitbase.cpp bitboard.h types.h +bitboard.o: bitboard.cpp bitboard.h types.h misc.h +book.o: book.cpp book.h misc.h types.h position.h bitboard.h movegen.h +endgame.o: endgame.cpp bitboard.h types.h endgame.h position.h movegen.h +evaluate.o: evaluate.cpp bitboard.h types.h evaluate.h material.h \ + endgame.h position.h misc.h pawns.h thread.h movepick.h movegen.h \ + search.h thread_win32.h uci.h +main.o: main.cpp bitboard.h types.h position.h search.h misc.h movepick.h \ + movegen.h thread.h material.h endgame.h pawns.h thread_win32.h tt.h \ + uci.h syzygy/tbprobe.h syzygy/../search.h polybook.h +material.o: material.cpp material.h endgame.h position.h bitboard.h \ + types.h misc.h thread.h movepick.h movegen.h pawns.h search.h \ + thread_win32.h +misc.o: misc.cpp misc.h types.h thread.h material.h endgame.h position.h \ + bitboard.h movepick.h movegen.h pawns.h search.h thread_win32.h +movegen.o: movegen.cpp movegen.h types.h position.h bitboard.h +movepick.o: movepick.cpp movepick.h movegen.h types.h position.h \ + bitboard.h +pawns.o: pawns.cpp bitboard.h types.h pawns.h misc.h position.h thread.h \ + material.h endgame.h movepick.h movegen.h search.h thread_win32.h +position.o: position.cpp bitboard.h types.h misc.h movegen.h position.h \ + thread.h material.h endgame.h movepick.h pawns.h search.h thread_win32.h \ + tt.h uci.h syzygy/tbprobe.h syzygy/../search.h +psqt.o: psqt.cpp types.h +search.o: search.cpp book.h misc.h types.h position.h bitboard.h \ + evaluate.h movegen.h movepick.h polybook.h search.h thread.h material.h \ + endgame.h pawns.h thread_win32.h timeman.h tt.h uci.h syzygy/tbprobe.h \ + syzygy/../search.h +thread.o: thread.cpp movegen.h types.h search.h misc.h movepick.h \ + position.h bitboard.h thread.h material.h endgame.h pawns.h \ + thread_win32.h uci.h syzygy/tbprobe.h syzygy/../search.h tt.h +timeman.o: timeman.cpp search.h misc.h types.h movepick.h movegen.h \ + position.h bitboard.h timeman.h thread.h material.h endgame.h pawns.h \ + thread_win32.h uci.h +tt.o: tt.cpp uci.h types.h position.h bitboard.h thread.h material.h \ + endgame.h misc.h movepick.h movegen.h pawns.h search.h thread_win32.h \ + tt.h +uci.o: uci.cpp evaluate.h types.h movegen.h position.h bitboard.h \ + search.h misc.h movepick.h thread.h material.h endgame.h pawns.h \ + thread_win32.h timeman.h tt.h uci.h syzygy/tbprobe.h syzygy/../search.h +ucioption.o: ucioption.cpp misc.h types.h search.h movepick.h movegen.h \ + position.h bitboard.h thread.h material.h endgame.h pawns.h \ + thread_win32.h tt.h uci.h syzygy/tbprobe.h syzygy/../search.h polybook.h +polybook.o: polybook.cpp polybook.h bitboard.h types.h position.h uci.h \ + movegen.h thread.h material.h endgame.h misc.h movepick.h pawns.h \ + search.h thread_win32.h +tbprobe.o: syzygy/tbprobe.cpp syzygy/../bitboard.h syzygy/../types.h \ + syzygy/../movegen.h syzygy/../position.h syzygy/../bitboard.h \ + syzygy/../search.h syzygy/../misc.h syzygy/../movepick.h \ + syzygy/../movegen.h syzygy/../position.h syzygy/../thread_win32.h \ + syzygy/../types.h syzygy/../uci.h syzygy/tbprobe.h diff --git a/Engines/Linux32/mcbrain/src/.project b/Engines/Linux32/mcbrain/src/.project new file mode 100644 index 0000000..1c8747f --- /dev/null +++ b/Engines/Linux32/mcbrain/src/.project @@ -0,0 +1,27 @@ + + + SugaR + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Engines/Linux32/mcbrain/src/Build x64 - Ubuntu Commands.txt b/Engines/Linux32/mcbrain/src/Build x64 - Ubuntu Commands.txt new file mode 100644 index 0000000..5f78025 --- /dev/null +++ b/Engines/Linux32/mcbrain/src/Build x64 - Ubuntu Commands.txt @@ -0,0 +1,5 @@ +make clean +make profile-build ARCH=x86-64 -j14 +strip McBrain + + diff --git a/Engines/Linux32/mcbrain/src/Makefile b/Engines/Linux32/mcbrain/src/Makefile index 8942f03..a2bf194 100644 --- a/Engines/Linux32/mcbrain/src/Makefile +++ b/Engines/Linux32/mcbrain/src/Makefile @@ -1,43 +1,59 @@ -# Stockfish, a UCI chess playing engine derived from Glaurung 2.1 -# Copyright (C) 2004-2008 Tord Romstad (Glaurung author) -# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad -# Copyright (C) 2015-2018 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad -# -# Stockfish is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Stockfish is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - +### ========================================================================== +### Copyright Notice and License Information +### ========================================================================== +# McBrain, a UCI chess playing engine derived from SugaR, Stockfish and Glaurung 2.1 +# Copyright (C) 2004-2008 Tord Romstad (Glaurung Author) +# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) +# Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) +# Copyright (C) 2017-2018 Michael Byrne, Marco Zerbinati, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + +# McBrain is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# McBrain is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . ### ========================================================================== ### Section 1. General Configuration ### ========================================================================== ### Executable name +### McCain bench nodes 4717832 +### McBrain bench nodes 4576991 +VERSION= +#VERSION=maverick +ifeq ($(VERSION),maverick) +CXXFLAGS += -DMaverick ifeq ($(COMP),mingw) -EXE = McBrain-91.exe +EXE = McCain-v2.exe else -EXE = McBrain-91 +EXE = McCain-v2 +endif +else +CXXFLAGS += -DPAWN_SCORES +ifeq ($(COMP),mingw) +EXE = McBrain-v99.exe +else +EXE = McBrain-v99 +endif endif -##### bench nodes: 6045167 ### Installation dir definitions PREFIX = /usr/local BINDIR = $(PREFIX)/bin ### Built-in benchmark for pgo-builds -PGOBENCH = ./$(EXE) bench +PGOBENCH = ./$(EXE) bench 16 1 10 +PGOBENCH2 = ./$(EXE) bench 16 2 8 ### Object files -OBJS = benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o \ +OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \ material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \ search.o thread.o timeman.o tt.o uci.o ucioption.o polybook.o syzygy/tbprobe.o @@ -160,6 +176,7 @@ ifeq ($(COMP),gcc) CXXFLAGS += -pedantic -Wextra -Wshadow ifeq ($(ARCH),armv7) + CXXFLAGS += -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -mtune=cortex-a53 ifeq ($(OS),Android) CXXFLAGS += -m$(bits) LDFLAGS += -m$(bits) @@ -172,6 +189,9 @@ ifeq ($(COMP),gcc) ifneq ($(KERNEL),Darwin) LDFLAGS += -Wl,--no-as-needed endif + + gccversion=$(shell gcc --version) + gccmasqueraded=$(findstring clang,$(gccversion)) endif ifeq ($(COMP),mingw) @@ -334,15 +354,24 @@ endif ### needs access to the optimization flags. ifeq ($(optimize),yes) ifeq ($(debug), no) - ifeq ($(comp),$(filter $(comp),gcc clang)) + ifeq ($(comp),clang) CXXFLAGS += -flto LDFLAGS += $(CXXFLAGS) endif + ifeq ($(comp),gcc) + CXXFLAGS += -flto + ifeq ($(gccmasqueraded),) + LDFLAGS += $(CXXFLAGS) -flto=jobserver + else + LDFLAGS += $(CXXFLAGS) + endif + endif + ifeq ($(comp),mingw) ifeq ($(KERNEL),Linux) CXXFLAGS += -flto - LDFLAGS += $(CXXFLAGS) + LDFLAGS += $(CXXFLAGS) -flto=jobserver endif endif endif @@ -362,9 +391,13 @@ endif help: @echo "" - @echo "To compile stockfish, type: " + @echo "To compile McBrain, type: " + @echo "'make ARCH=arch [COMP=compiler] [COMPCXX=cxx]'" + @echo " would be 'build' or 'profile-build'" @echo "" - @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]" + @echo "To compile McCain, uncomment this line in the makefile: " + @echo "'### VERSION=maverick' by remvoing the 3 #(pound signs)" + @echo "then type: 'make ARCH=arch [COMP=compiler] [COMPCXX=cxx]'" @echo "" @echo "Supported targets:" @echo "" @@ -420,6 +453,7 @@ profile-build: config-sanity objclean profileclean @echo "" @echo "Step 2/4. Running benchmark for pgo-build ..." $(PGOBENCH) > /dev/null + $(PGOBENCH2) > /dev/null @echo "" @echo "Step 3/4. Building optimized executable ..." $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean @@ -427,6 +461,9 @@ profile-build: config-sanity objclean profileclean @echo "" @echo "Step 4/4. Deleting profile data ..." $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean + strip $(EXE) +# cp $(EXE) /Users/michaelbyrne/cluster.mfb +# cp $(EXE) /opt/picochess/engines/armv7l strip: strip $(EXE) @@ -436,13 +473,20 @@ install: -cp $(EXE) $(BINDIR) -strip $(BINDIR)/$(EXE) +both: + VERSION= + ARCH=x86-64-modern + COMP=gcc + target=build + $(MAKE) $(target) + #clean all clean: objclean profileclean @rm -f .depend *~ core # clean binaries and objects objclean: - @rm -f $(EXE) $(EXE).exe *.o ./syzygy/*.o + @rm -f $(EXE) *.o ./syzygy/*.o # clean auxiliary profiling files profileclean: @@ -505,19 +549,19 @@ clang-profile-make: clang-profile-use: llvm-profdata merge -output=stockfish.profdata *.profraw $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ - EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \ + EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata -Wno-profile-instr-out-of-date' \ EXTRALDFLAGS='-fprofile-use ' \ all gcc-profile-make: $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ - EXTRACXXFLAGS='-fprofile-generate' \ + EXTRACXXFLAGS='-fprofile-generate -fprofile-correction' \ EXTRALDFLAGS='-lgcov' \ all gcc-profile-use: $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ - EXTRACXXFLAGS='-fprofile-use -fno-peel-loops -fno-tracer' \ + EXTRACXXFLAGS='-fprofile-use -fprofile-correction -fno-peel-loops -fno-tracer' \ EXTRALDFLAGS='-lgcov' \ all @@ -536,4 +580,3 @@ icc-profile-use: -@$(CXX) $(DEPENDFLAGS) -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null -include .depend - diff --git a/Engines/Linux32/mcbrain/src/McBrain-92 b/Engines/Linux32/mcbrain/src/McBrain-92 deleted file mode 100644 index 2033719..0000000 Binary files a/Engines/Linux32/mcbrain/src/McBrain-92 and /dev/null differ diff --git a/Engines/Linux32/mcbrain/src/McBrain-92 - test b/Engines/Linux32/mcbrain/src/McBrain-92 - test deleted file mode 100644 index 9de862a..0000000 Binary files a/Engines/Linux32/mcbrain/src/McBrain-92 - test and /dev/null differ diff --git a/Engines/Linux32/mcbrain/src/McBrain.sln b/Engines/Linux32/mcbrain/src/McBrain.sln new file mode 100644 index 0000000..4b42ecd --- /dev/null +++ b/Engines/Linux32/mcbrain/src/McBrain.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sugar", "Sugar.vcxproj", "{2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release AVX|x64 = Release AVX|x64 + Release AVX|x86 = Release AVX|x86 + Release AVX2|x64 = Release AVX2|x64 + Release AVX2|x86 = Release AVX2|x86 + Release SSE|x64 = Release SSE|x64 + Release SSE|x86 = Release SSE|x86 + Release SSE2|x64 = Release SSE2|x64 + Release SSE2|x86 = Release SSE2|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.ActiveCfg = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Build.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Deploy.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.ActiveCfg = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.Build.0 = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.ActiveCfg = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.Build.0 = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.ActiveCfg = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.Build.0 = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.ActiveCfg = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.Build.0 = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.ActiveCfg = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.Build.0 = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.ActiveCfg = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.Build.0 = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.ActiveCfg = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.Build.0 = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.ActiveCfg = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.Build.0 = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.ActiveCfg = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.Build.0 = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.ActiveCfg = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.Build.0 = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.ActiveCfg = Release|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Engines/Linux32/mcbrain/src/McBrain.vcxproj b/Engines/Linux32/mcbrain/src/McBrain.vcxproj new file mode 100644 index 0000000..a8b3003 --- /dev/null +++ b/Engines/Linux32/mcbrain/src/McBrain.vcxproj @@ -0,0 +1,411 @@ + + + + + Debug + Win32 + + + Release AVX2 + Win32 + + + Release AVX2 + x64 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE + Win32 + + + Release SSE + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C} + Win32Proj + 10.0.10240.0 + + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + v141 + + + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH; + MultiThreadedDebugDLL + Level3 + + + MachineX86 + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + StreamingSIMDExtensions + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + + _WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH + + + + Console + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions2 + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + MultiThreaded + + + + + + + + Fast + true + Speed + AnySuitable + true + true + + + false + UseLinkTimeCodeGeneration + + + + + false + UseLinkTimeCodeGeneration + + + true + Speed + AnySuitable + true + StreamingSIMDExtensions2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/McBrain.vcxproj.filters b/Engines/Linux32/mcbrain/src/McBrain.vcxproj.filters new file mode 100644 index 0000000..859ce91 --- /dev/null +++ b/Engines/Linux32/mcbrain/src/McBrain.vcxproj.filters @@ -0,0 +1,147 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/McBrain.vcxproj.user b/Engines/Linux32/mcbrain/src/McBrain.vcxproj.user new file mode 100644 index 0000000..5b610ed --- /dev/null +++ b/Engines/Linux32/mcbrain/src/McBrain.vcxproj.user @@ -0,0 +1,6 @@ + + + + WindowsLocalDebugger + + \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/McCain.sln b/Engines/Linux32/mcbrain/src/McCain.sln new file mode 100644 index 0000000..4b42ecd --- /dev/null +++ b/Engines/Linux32/mcbrain/src/McCain.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sugar", "Sugar.vcxproj", "{2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release AVX|x64 = Release AVX|x64 + Release AVX|x86 = Release AVX|x86 + Release AVX2|x64 = Release AVX2|x64 + Release AVX2|x86 = Release AVX2|x86 + Release SSE|x64 = Release SSE|x64 + Release SSE|x86 = Release SSE|x86 + Release SSE2|x64 = Release SSE2|x64 + Release SSE2|x86 = Release SSE2|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.ActiveCfg = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Build.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Deploy.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.ActiveCfg = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.Build.0 = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.ActiveCfg = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.Build.0 = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.ActiveCfg = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.Build.0 = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.ActiveCfg = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.Build.0 = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.ActiveCfg = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.Build.0 = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.ActiveCfg = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.Build.0 = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.ActiveCfg = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.Build.0 = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.ActiveCfg = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.Build.0 = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.ActiveCfg = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.Build.0 = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.ActiveCfg = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.Build.0 = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.ActiveCfg = Release|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Engines/Linux32/mcbrain/src/McCain.vcxproj b/Engines/Linux32/mcbrain/src/McCain.vcxproj new file mode 100644 index 0000000..a8b3003 --- /dev/null +++ b/Engines/Linux32/mcbrain/src/McCain.vcxproj @@ -0,0 +1,411 @@ + + + + + Debug + Win32 + + + Release AVX2 + Win32 + + + Release AVX2 + x64 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE + Win32 + + + Release SSE + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C} + Win32Proj + 10.0.10240.0 + + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + v141 + + + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH; + MultiThreadedDebugDLL + Level3 + + + MachineX86 + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + StreamingSIMDExtensions + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + + _WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH + + + + Console + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions2 + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + MultiThreaded + + + + + + + + Fast + true + Speed + AnySuitable + true + true + + + false + UseLinkTimeCodeGeneration + + + + + false + UseLinkTimeCodeGeneration + + + true + Speed + AnySuitable + true + StreamingSIMDExtensions2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/VersionHelpers.h b/Engines/Linux32/mcbrain/src/VersionHelpers.h new file mode 100644 index 0000000..72e930b --- /dev/null +++ b/Engines/Linux32/mcbrain/src/VersionHelpers.h @@ -0,0 +1,211 @@ +#ifndef VERSIONHELPER_H_INCLUDED +#define VERSIONHELPER_H_INCLUDED + +#define VERSIONHELPERAPI inline bool + +#define _WIN32_WINNT_NT4 0x0400 +#define _WIN32_WINNT_WIN2K 0x0500 +#define _WIN32_WINNT_WINXP 0x0501 +#define _WIN32_WINNT_WS03 0x0502 +#define _WIN32_WINNT_WIN6 0x0600 +#define _WIN32_WINNT_VISTA 0x0600 +#define _WIN32_WINNT_WS08 0x0600 +#define _WIN32_WINNT_LONGHORN 0x0600 +#define _WIN32_WINNT_WIN7 0x0601 +#define _WIN32_WINNT_WIN8 0x0602 +#define _WIN32_WINNT_WINBLUE 0x0603 +#define _WIN32_WINNT_WIN10 0x0A00 + +typedef LONG(NTAPI *fnRtlGetVersion)(PRTL_OSVERSIONINFOEXW lpVersionInformation); + +enum eVerShort +{ + WinUnsupported, // Unsupported OS + WinXP, // Windows XP + Win7, // Windows 7 + Win8, // Windows 8 + Win8Point1, // Windows 8.1 + Win10, // Windows 10 + Win10AU, // Windows 10 Anniversary update + Win10CU // Windows 10 Creators update +}; + +struct WinVersion +{ + eVerShort ver = WinUnsupported; + RTL_OSVERSIONINFOEXW native; +}; + +inline WinVersion& WinVer() +{ + static WinVersion g_WinVer; + return g_WinVer; +} + +inline void InitVersion() +{ + auto& g_WinVer = WinVer(); + g_WinVer.native.dwOSVersionInfoSize = sizeof(g_WinVer.native); + auto RtlGetVersion = (fnRtlGetVersion)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetVersion"); + if (RtlGetVersion) + RtlGetVersion(&g_WinVer.native); + + if (g_WinVer.native.dwMajorVersion != 0) + { + auto fullver = (g_WinVer.native.dwMajorVersion << 8) | g_WinVer.native.dwMinorVersion; + switch (fullver) + { + case _WIN32_WINNT_WIN10: + if (g_WinVer.native.dwBuildNumber >= 15063) + g_WinVer.ver = Win10CU; + else if (g_WinVer.native.dwBuildNumber >= 14393) + g_WinVer.ver = Win10AU; + else if (g_WinVer.native.dwBuildNumber >= 10586) + g_WinVer.ver = Win10; + break; + + case _WIN32_WINNT_WINBLUE: + g_WinVer.ver = Win8Point1; + break; + + case _WIN32_WINNT_WIN8: + g_WinVer.ver = Win8; + break; + + case _WIN32_WINNT_WIN7: + g_WinVer.ver = Win7; + break; + + case _WIN32_WINNT_WINXP: + g_WinVer.ver = WinXP; + break; + + default: + g_WinVer.ver = WinUnsupported; + } + } +} + + +VERSIONHELPERAPI +IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor, DWORD dwBuild) +{ + auto& g_WinVer = WinVer(); + if (g_WinVer.native.dwMajorVersion != 0) + { + if (g_WinVer.native.dwMajorVersion > wMajorVersion) + return true; + else if (g_WinVer.native.dwMajorVersion < wMajorVersion) + return false; + + if (g_WinVer.native.dwMinorVersion > wMinorVersion) + return true; + else if (g_WinVer.native.dwMinorVersion < wMinorVersion) + return false; + + if (g_WinVer.native.wServicePackMajor > wServicePackMajor) + return true; + else if (g_WinVer.native.wServicePackMajor < wServicePackMajor) + return false; + + if (g_WinVer.native.dwBuildNumber >= dwBuild) + return true; + } + + return false; +} + +VERSIONHELPERAPI +IsWindowsXPOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP3OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2, 0); +} + +VERSIONHELPERAPI +IsWindows7OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0, 0); +} + +VERSIONHELPERAPI +IsWindows7SP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1, 0); +} + +VERSIONHELPERAPI +IsWindows8OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0, 0); +} + +VERSIONHELPERAPI +IsWindows8Point1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0, 0); +} + +VERSIONHELPERAPI +IsWindows10OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 0); +} + +VERSIONHELPERAPI +IsWindows10AnniversaryOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 14393); +} + +VERSIONHELPERAPI +IsWindows10CreatorsOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 15063); +} + +VERSIONHELPERAPI +IsWindowsServer() +{ + OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0, 0, VER_NT_WORKSTATION, 0 }; + DWORDLONG const dwlConditionMask = VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL); + + return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); +} + +#endif \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/benchmark.cpp b/Engines/Linux32/mcbrain/src/benchmark.cpp index 807f9de..1b792dd 100644 --- a/Engines/Linux32/mcbrain/src/benchmark.cpp +++ b/Engines/Linux32/mcbrain/src/benchmark.cpp @@ -91,13 +91,13 @@ const vector Defaults = { } // namespace /// setup_bench() builds a list of UCI commands to be run by bench. There -/// are five parameters: TT size in MB, number of search threads that +/// are five parameters: TT size in MiB, number of search threads that /// should be used, the limit value spent for each position, a file name /// where to look for positions in FEN format and the type of the limit: /// depth, perft, nodes and movetime (in millisecs). /// /// bench -> search default positions up to depth 13 -/// bench 64 1 15 -> search default positions up to depth 15 (TT = 64MB) +/// bench 64 1 15 -> search default positions up to depth 15 (TT = 64MiB) /// bench 64 4 5000 current movetime -> search current position with 4 threads for 5 sec /// bench 64 1 100000 default nodes -> search default positions for 100K nodes each /// bench 16 1 5 default perft -> run a perft 5 on default positions diff --git a/Engines/Linux32/mcbrain/src/bitboard.cpp b/Engines/Linux32/mcbrain/src/bitboard.cpp index c3e06b1..0d676a5 100644 --- a/Engines/Linux32/mcbrain/src/bitboard.cpp +++ b/Engines/Linux32/mcbrain/src/bitboard.cpp @@ -44,7 +44,7 @@ Bitboard PawnAttacks[COLOR_NB][SQUARE_NB]; Magic RookMagics[SQUARE_NB]; Magic BishopMagics[SQUARE_NB]; -namespace { +namespace { //Niklas Fiekas Bitboard AttackTable[HasPext ? 107648 : 88772] = { 0 }; @@ -231,7 +231,7 @@ void Bitboards::init() { PopCnt16[i] = (uint8_t) popcount16(i); for (Square s = SQ_A1; s <= SQ_H8; ++s) - SquareBB[s] = make_bitboard(s); + SquareBB[s] = (1ULL << s); for (File f = FILE_A; f <= FILE_H; ++f) FileBB[f] = f > FILE_A ? FileBB[f - 1] << 1 : FileABB; @@ -258,7 +258,7 @@ void Bitboards::init() { if (s1 != s2) { SquareDistance[s1][s2] = std::max(distance(s1, s2), distance(s1, s2)); - DistanceRingBB[s1][SquareDistance[s1][s2] - 1] |= s2; + DistanceRingBB[s1][SquareDistance[s1][s2]] |= s2; } int steps[][5] = { {}, { 7, 9 }, { 6, 10, 15, 17 }, {}, {}, {}, { 1, 7, 8, 9 } }; @@ -279,7 +279,7 @@ void Bitboards::init() { } } - Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST }; + Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST }; Direction BishopDirections[] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }; if (HasPext) @@ -348,8 +348,8 @@ namespace { // init_magics() computes all rook and bishop attacks at startup. Magic // bitboards are used to look up attacks of sliding pieces. As a reference see - // chessprogramming.wikispaces.com/Magic+Bitboards. In particular, we use - // precomputed fixed shift magics. + // chessprogramming.wikispaces.com/Magic+Bitboards. In particular, here we + // use the so called "fancy" approach. template void init_magics(MagicInit init[], Magic magics[], Direction directions[]) { diff --git a/Engines/Linux32/mcbrain/src/bitboard.h b/Engines/Linux32/mcbrain/src/bitboard.h index 0e7cabb..0a3816c 100644 --- a/Engines/Linux32/mcbrain/src/bitboard.h +++ b/Engines/Linux32/mcbrain/src/bitboard.h @@ -153,16 +153,6 @@ inline Bitboard file_bb(Square s) { } -/// make_bitboard() returns a bitboard from a list of squares - -constexpr Bitboard make_bitboard() { return 0; } - -template -constexpr Bitboard make_bitboard(Square s, Squares... squares) { - return (1ULL << s) | make_bitboard(squares...); -} - - /// shift() moves a bitboard one step along direction D (mainly for pawns) template @@ -338,6 +328,7 @@ inline Square msb(Bitboard b) { } #else // MSVC, WIN32 +#include inline Square lsb(Bitboard b) { assert(b); diff --git a/Engines/Linux32/mcbrain/src/book.cpp b/Engines/Linux32/mcbrain/src/book.cpp new file mode 100644 index 0000000..644e010 --- /dev/null +++ b/Engines/Linux32/mcbrain/src/book.cpp @@ -0,0 +1,479 @@ +/* + SugaR, a UCI chess playing engine derived from Stockfish + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad + + SugaR is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SugaR is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + The code in this file is based on the opening book code in PolyGlot + by Fabien Letouzey. PolyGlot is available under the GNU General + Public License, and can be downloaded from http://wbec-ridderkerk.nl + */ + +#include +#include + +#include "book.h" +#include "misc.h" +#include "movegen.h" + +using namespace std; + +namespace { + + // A Polyglot book is a series of "entries" of 16 bytes. All integers are + // stored in big-endian format, with the highest byte first (regardless of + // size). The entries are ordered according to the key in ascending order. + struct Entry { + uint64_t key; + uint16_t move; + uint16_t count; + uint32_t learn; + }; + + // Random numbers from PolyGlot, used to compute book hash keys + const union { + Key PolyGlotRandoms[781]; + struct { + Key psq[12][64]; // [piece][square] + Key castling[4]; // [castling flag] + Key enpassant[8]; // [file] + Key turn; + } Zobrist; + } PG = {{ + 0x9D39247E33776D41ULL, 0x2AF7398005AAA5C7ULL, 0x44DB015024623547ULL, + 0x9C15F73E62A76AE2ULL, 0x75834465489C0C89ULL, 0x3290AC3A203001BFULL, + 0x0FBBAD1F61042279ULL, 0xE83A908FF2FB60CAULL, 0x0D7E765D58755C10ULL, + 0x1A083822CEAFE02DULL, 0x9605D5F0E25EC3B0ULL, 0xD021FF5CD13A2ED5ULL, + 0x40BDF15D4A672E32ULL, 0x011355146FD56395ULL, 0x5DB4832046F3D9E5ULL, + 0x239F8B2D7FF719CCULL, 0x05D1A1AE85B49AA1ULL, 0x679F848F6E8FC971ULL, + 0x7449BBFF801FED0BULL, 0x7D11CDB1C3B7ADF0ULL, 0x82C7709E781EB7CCULL, + 0xF3218F1C9510786CULL, 0x331478F3AF51BBE6ULL, 0x4BB38DE5E7219443ULL, + 0xAA649C6EBCFD50FCULL, 0x8DBD98A352AFD40BULL, 0x87D2074B81D79217ULL, + 0x19F3C751D3E92AE1ULL, 0xB4AB30F062B19ABFULL, 0x7B0500AC42047AC4ULL, + 0xC9452CA81A09D85DULL, 0x24AA6C514DA27500ULL, 0x4C9F34427501B447ULL, + 0x14A68FD73C910841ULL, 0xA71B9B83461CBD93ULL, 0x03488B95B0F1850FULL, + 0x637B2B34FF93C040ULL, 0x09D1BC9A3DD90A94ULL, 0x3575668334A1DD3BULL, + 0x735E2B97A4C45A23ULL, 0x18727070F1BD400BULL, 0x1FCBACD259BF02E7ULL, + 0xD310A7C2CE9B6555ULL, 0xBF983FE0FE5D8244ULL, 0x9F74D14F7454A824ULL, + 0x51EBDC4AB9BA3035ULL, 0x5C82C505DB9AB0FAULL, 0xFCF7FE8A3430B241ULL, + 0x3253A729B9BA3DDEULL, 0x8C74C368081B3075ULL, 0xB9BC6C87167C33E7ULL, + 0x7EF48F2B83024E20ULL, 0x11D505D4C351BD7FULL, 0x6568FCA92C76A243ULL, + 0x4DE0B0F40F32A7B8ULL, 0x96D693460CC37E5DULL, 0x42E240CB63689F2FULL, + 0x6D2BDCDAE2919661ULL, 0x42880B0236E4D951ULL, 0x5F0F4A5898171BB6ULL, + 0x39F890F579F92F88ULL, 0x93C5B5F47356388BULL, 0x63DC359D8D231B78ULL, + 0xEC16CA8AEA98AD76ULL, 0x5355F900C2A82DC7ULL, 0x07FB9F855A997142ULL, + 0x5093417AA8A7ED5EULL, 0x7BCBC38DA25A7F3CULL, 0x19FC8A768CF4B6D4ULL, + 0x637A7780DECFC0D9ULL, 0x8249A47AEE0E41F7ULL, 0x79AD695501E7D1E8ULL, + 0x14ACBAF4777D5776ULL, 0xF145B6BECCDEA195ULL, 0xDABF2AC8201752FCULL, + 0x24C3C94DF9C8D3F6ULL, 0xBB6E2924F03912EAULL, 0x0CE26C0B95C980D9ULL, + 0xA49CD132BFBF7CC4ULL, 0xE99D662AF4243939ULL, 0x27E6AD7891165C3FULL, + 0x8535F040B9744FF1ULL, 0x54B3F4FA5F40D873ULL, 0x72B12C32127FED2BULL, + 0xEE954D3C7B411F47ULL, 0x9A85AC909A24EAA1ULL, 0x70AC4CD9F04F21F5ULL, + 0xF9B89D3E99A075C2ULL, 0x87B3E2B2B5C907B1ULL, 0xA366E5B8C54F48B8ULL, + 0xAE4A9346CC3F7CF2ULL, 0x1920C04D47267BBDULL, 0x87BF02C6B49E2AE9ULL, + 0x092237AC237F3859ULL, 0xFF07F64EF8ED14D0ULL, 0x8DE8DCA9F03CC54EULL, + 0x9C1633264DB49C89ULL, 0xB3F22C3D0B0B38EDULL, 0x390E5FB44D01144BULL, + 0x5BFEA5B4712768E9ULL, 0x1E1032911FA78984ULL, 0x9A74ACB964E78CB3ULL, + 0x4F80F7A035DAFB04ULL, 0x6304D09A0B3738C4ULL, 0x2171E64683023A08ULL, + 0x5B9B63EB9CEFF80CULL, 0x506AACF489889342ULL, 0x1881AFC9A3A701D6ULL, + 0x6503080440750644ULL, 0xDFD395339CDBF4A7ULL, 0xEF927DBCF00C20F2ULL, + 0x7B32F7D1E03680ECULL, 0xB9FD7620E7316243ULL, 0x05A7E8A57DB91B77ULL, + 0xB5889C6E15630A75ULL, 0x4A750A09CE9573F7ULL, 0xCF464CEC899A2F8AULL, + 0xF538639CE705B824ULL, 0x3C79A0FF5580EF7FULL, 0xEDE6C87F8477609DULL, + 0x799E81F05BC93F31ULL, 0x86536B8CF3428A8CULL, 0x97D7374C60087B73ULL, + 0xA246637CFF328532ULL, 0x043FCAE60CC0EBA0ULL, 0x920E449535DD359EULL, + 0x70EB093B15B290CCULL, 0x73A1921916591CBDULL, 0x56436C9FE1A1AA8DULL, + 0xEFAC4B70633B8F81ULL, 0xBB215798D45DF7AFULL, 0x45F20042F24F1768ULL, + 0x930F80F4E8EB7462ULL, 0xFF6712FFCFD75EA1ULL, 0xAE623FD67468AA70ULL, + 0xDD2C5BC84BC8D8FCULL, 0x7EED120D54CF2DD9ULL, 0x22FE545401165F1CULL, + 0xC91800E98FB99929ULL, 0x808BD68E6AC10365ULL, 0xDEC468145B7605F6ULL, + 0x1BEDE3A3AEF53302ULL, 0x43539603D6C55602ULL, 0xAA969B5C691CCB7AULL, + 0xA87832D392EFEE56ULL, 0x65942C7B3C7E11AEULL, 0xDED2D633CAD004F6ULL, + 0x21F08570F420E565ULL, 0xB415938D7DA94E3CULL, 0x91B859E59ECB6350ULL, + 0x10CFF333E0ED804AULL, 0x28AED140BE0BB7DDULL, 0xC5CC1D89724FA456ULL, + 0x5648F680F11A2741ULL, 0x2D255069F0B7DAB3ULL, 0x9BC5A38EF729ABD4ULL, + 0xEF2F054308F6A2BCULL, 0xAF2042F5CC5C2858ULL, 0x480412BAB7F5BE2AULL, + 0xAEF3AF4A563DFE43ULL, 0x19AFE59AE451497FULL, 0x52593803DFF1E840ULL, + 0xF4F076E65F2CE6F0ULL, 0x11379625747D5AF3ULL, 0xBCE5D2248682C115ULL, + 0x9DA4243DE836994FULL, 0x066F70B33FE09017ULL, 0x4DC4DE189B671A1CULL, + 0x51039AB7712457C3ULL, 0xC07A3F80C31FB4B4ULL, 0xB46EE9C5E64A6E7CULL, + 0xB3819A42ABE61C87ULL, 0x21A007933A522A20ULL, 0x2DF16F761598AA4FULL, + 0x763C4A1371B368FDULL, 0xF793C46702E086A0ULL, 0xD7288E012AEB8D31ULL, + 0xDE336A2A4BC1C44BULL, 0x0BF692B38D079F23ULL, 0x2C604A7A177326B3ULL, + 0x4850E73E03EB6064ULL, 0xCFC447F1E53C8E1BULL, 0xB05CA3F564268D99ULL, + 0x9AE182C8BC9474E8ULL, 0xA4FC4BD4FC5558CAULL, 0xE755178D58FC4E76ULL, + 0x69B97DB1A4C03DFEULL, 0xF9B5B7C4ACC67C96ULL, 0xFC6A82D64B8655FBULL, + 0x9C684CB6C4D24417ULL, 0x8EC97D2917456ED0ULL, 0x6703DF9D2924E97EULL, + 0xC547F57E42A7444EULL, 0x78E37644E7CAD29EULL, 0xFE9A44E9362F05FAULL, + 0x08BD35CC38336615ULL, 0x9315E5EB3A129ACEULL, 0x94061B871E04DF75ULL, + 0xDF1D9F9D784BA010ULL, 0x3BBA57B68871B59DULL, 0xD2B7ADEEDED1F73FULL, + 0xF7A255D83BC373F8ULL, 0xD7F4F2448C0CEB81ULL, 0xD95BE88CD210FFA7ULL, + 0x336F52F8FF4728E7ULL, 0xA74049DAC312AC71ULL, 0xA2F61BB6E437FDB5ULL, + 0x4F2A5CB07F6A35B3ULL, 0x87D380BDA5BF7859ULL, 0x16B9F7E06C453A21ULL, + 0x7BA2484C8A0FD54EULL, 0xF3A678CAD9A2E38CULL, 0x39B0BF7DDE437BA2ULL, + 0xFCAF55C1BF8A4424ULL, 0x18FCF680573FA594ULL, 0x4C0563B89F495AC3ULL, + 0x40E087931A00930DULL, 0x8CFFA9412EB642C1ULL, 0x68CA39053261169FULL, + 0x7A1EE967D27579E2ULL, 0x9D1D60E5076F5B6FULL, 0x3810E399B6F65BA2ULL, + 0x32095B6D4AB5F9B1ULL, 0x35CAB62109DD038AULL, 0xA90B24499FCFAFB1ULL, + 0x77A225A07CC2C6BDULL, 0x513E5E634C70E331ULL, 0x4361C0CA3F692F12ULL, + 0xD941ACA44B20A45BULL, 0x528F7C8602C5807BULL, 0x52AB92BEB9613989ULL, + 0x9D1DFA2EFC557F73ULL, 0x722FF175F572C348ULL, 0x1D1260A51107FE97ULL, + 0x7A249A57EC0C9BA2ULL, 0x04208FE9E8F7F2D6ULL, 0x5A110C6058B920A0ULL, + 0x0CD9A497658A5698ULL, 0x56FD23C8F9715A4CULL, 0x284C847B9D887AAEULL, + 0x04FEABFBBDB619CBULL, 0x742E1E651C60BA83ULL, 0x9A9632E65904AD3CULL, + 0x881B82A13B51B9E2ULL, 0x506E6744CD974924ULL, 0xB0183DB56FFC6A79ULL, + 0x0ED9B915C66ED37EULL, 0x5E11E86D5873D484ULL, 0xF678647E3519AC6EULL, + 0x1B85D488D0F20CC5ULL, 0xDAB9FE6525D89021ULL, 0x0D151D86ADB73615ULL, + 0xA865A54EDCC0F019ULL, 0x93C42566AEF98FFBULL, 0x99E7AFEABE000731ULL, + 0x48CBFF086DDF285AULL, 0x7F9B6AF1EBF78BAFULL, 0x58627E1A149BBA21ULL, + 0x2CD16E2ABD791E33ULL, 0xD363EFF5F0977996ULL, 0x0CE2A38C344A6EEDULL, + 0x1A804AADB9CFA741ULL, 0x907F30421D78C5DEULL, 0x501F65EDB3034D07ULL, + 0x37624AE5A48FA6E9ULL, 0x957BAF61700CFF4EULL, 0x3A6C27934E31188AULL, + 0xD49503536ABCA345ULL, 0x088E049589C432E0ULL, 0xF943AEE7FEBF21B8ULL, + 0x6C3B8E3E336139D3ULL, 0x364F6FFA464EE52EULL, 0xD60F6DCEDC314222ULL, + 0x56963B0DCA418FC0ULL, 0x16F50EDF91E513AFULL, 0xEF1955914B609F93ULL, + 0x565601C0364E3228ULL, 0xECB53939887E8175ULL, 0xBAC7A9A18531294BULL, + 0xB344C470397BBA52ULL, 0x65D34954DAF3CEBDULL, 0xB4B81B3FA97511E2ULL, + 0xB422061193D6F6A7ULL, 0x071582401C38434DULL, 0x7A13F18BBEDC4FF5ULL, + 0xBC4097B116C524D2ULL, 0x59B97885E2F2EA28ULL, 0x99170A5DC3115544ULL, + 0x6F423357E7C6A9F9ULL, 0x325928EE6E6F8794ULL, 0xD0E4366228B03343ULL, + 0x565C31F7DE89EA27ULL, 0x30F5611484119414ULL, 0xD873DB391292ED4FULL, + 0x7BD94E1D8E17DEBCULL, 0xC7D9F16864A76E94ULL, 0x947AE053EE56E63CULL, + 0xC8C93882F9475F5FULL, 0x3A9BF55BA91F81CAULL, 0xD9A11FBB3D9808E4ULL, + 0x0FD22063EDC29FCAULL, 0xB3F256D8ACA0B0B9ULL, 0xB03031A8B4516E84ULL, + 0x35DD37D5871448AFULL, 0xE9F6082B05542E4EULL, 0xEBFAFA33D7254B59ULL, + 0x9255ABB50D532280ULL, 0xB9AB4CE57F2D34F3ULL, 0x693501D628297551ULL, + 0xC62C58F97DD949BFULL, 0xCD454F8F19C5126AULL, 0xBBE83F4ECC2BDECBULL, + 0xDC842B7E2819E230ULL, 0xBA89142E007503B8ULL, 0xA3BC941D0A5061CBULL, + 0xE9F6760E32CD8021ULL, 0x09C7E552BC76492FULL, 0x852F54934DA55CC9ULL, + 0x8107FCCF064FCF56ULL, 0x098954D51FFF6580ULL, 0x23B70EDB1955C4BFULL, + 0xC330DE426430F69DULL, 0x4715ED43E8A45C0AULL, 0xA8D7E4DAB780A08DULL, + 0x0572B974F03CE0BBULL, 0xB57D2E985E1419C7ULL, 0xE8D9ECBE2CF3D73FULL, + 0x2FE4B17170E59750ULL, 0x11317BA87905E790ULL, 0x7FBF21EC8A1F45ECULL, + 0x1725CABFCB045B00ULL, 0x964E915CD5E2B207ULL, 0x3E2B8BCBF016D66DULL, + 0xBE7444E39328A0ACULL, 0xF85B2B4FBCDE44B7ULL, 0x49353FEA39BA63B1ULL, + 0x1DD01AAFCD53486AULL, 0x1FCA8A92FD719F85ULL, 0xFC7C95D827357AFAULL, + 0x18A6A990C8B35EBDULL, 0xCCCB7005C6B9C28DULL, 0x3BDBB92C43B17F26ULL, + 0xAA70B5B4F89695A2ULL, 0xE94C39A54A98307FULL, 0xB7A0B174CFF6F36EULL, + 0xD4DBA84729AF48ADULL, 0x2E18BC1AD9704A68ULL, 0x2DE0966DAF2F8B1CULL, + 0xB9C11D5B1E43A07EULL, 0x64972D68DEE33360ULL, 0x94628D38D0C20584ULL, + 0xDBC0D2B6AB90A559ULL, 0xD2733C4335C6A72FULL, 0x7E75D99D94A70F4DULL, + 0x6CED1983376FA72BULL, 0x97FCAACBF030BC24ULL, 0x7B77497B32503B12ULL, + 0x8547EDDFB81CCB94ULL, 0x79999CDFF70902CBULL, 0xCFFE1939438E9B24ULL, + 0x829626E3892D95D7ULL, 0x92FAE24291F2B3F1ULL, 0x63E22C147B9C3403ULL, + 0xC678B6D860284A1CULL, 0x5873888850659AE7ULL, 0x0981DCD296A8736DULL, + 0x9F65789A6509A440ULL, 0x9FF38FED72E9052FULL, 0xE479EE5B9930578CULL, + 0xE7F28ECD2D49EECDULL, 0x56C074A581EA17FEULL, 0x5544F7D774B14AEFULL, + 0x7B3F0195FC6F290FULL, 0x12153635B2C0CF57ULL, 0x7F5126DBBA5E0CA7ULL, + 0x7A76956C3EAFB413ULL, 0x3D5774A11D31AB39ULL, 0x8A1B083821F40CB4ULL, + 0x7B4A38E32537DF62ULL, 0x950113646D1D6E03ULL, 0x4DA8979A0041E8A9ULL, + 0x3BC36E078F7515D7ULL, 0x5D0A12F27AD310D1ULL, 0x7F9D1A2E1EBE1327ULL, + 0xDA3A361B1C5157B1ULL, 0xDCDD7D20903D0C25ULL, 0x36833336D068F707ULL, + 0xCE68341F79893389ULL, 0xAB9090168DD05F34ULL, 0x43954B3252DC25E5ULL, + 0xB438C2B67F98E5E9ULL, 0x10DCD78E3851A492ULL, 0xDBC27AB5447822BFULL, + 0x9B3CDB65F82CA382ULL, 0xB67B7896167B4C84ULL, 0xBFCED1B0048EAC50ULL, + 0xA9119B60369FFEBDULL, 0x1FFF7AC80904BF45ULL, 0xAC12FB171817EEE7ULL, + 0xAF08DA9177DDA93DULL, 0x1B0CAB936E65C744ULL, 0xB559EB1D04E5E932ULL, + 0xC37B45B3F8D6F2BAULL, 0xC3A9DC228CAAC9E9ULL, 0xF3B8B6675A6507FFULL, + 0x9FC477DE4ED681DAULL, 0x67378D8ECCEF96CBULL, 0x6DD856D94D259236ULL, + 0xA319CE15B0B4DB31ULL, 0x073973751F12DD5EULL, 0x8A8E849EB32781A5ULL, + 0xE1925C71285279F5ULL, 0x74C04BF1790C0EFEULL, 0x4DDA48153C94938AULL, + 0x9D266D6A1CC0542CULL, 0x7440FB816508C4FEULL, 0x13328503DF48229FULL, + 0xD6BF7BAEE43CAC40ULL, 0x4838D65F6EF6748FULL, 0x1E152328F3318DEAULL, + 0x8F8419A348F296BFULL, 0x72C8834A5957B511ULL, 0xD7A023A73260B45CULL, + 0x94EBC8ABCFB56DAEULL, 0x9FC10D0F989993E0ULL, 0xDE68A2355B93CAE6ULL, + 0xA44CFE79AE538BBEULL, 0x9D1D84FCCE371425ULL, 0x51D2B1AB2DDFB636ULL, + 0x2FD7E4B9E72CD38CULL, 0x65CA5B96B7552210ULL, 0xDD69A0D8AB3B546DULL, + 0x604D51B25FBF70E2ULL, 0x73AA8A564FB7AC9EULL, 0x1A8C1E992B941148ULL, + 0xAAC40A2703D9BEA0ULL, 0x764DBEAE7FA4F3A6ULL, 0x1E99B96E70A9BE8BULL, + 0x2C5E9DEB57EF4743ULL, 0x3A938FEE32D29981ULL, 0x26E6DB8FFDF5ADFEULL, + 0x469356C504EC9F9DULL, 0xC8763C5B08D1908CULL, 0x3F6C6AF859D80055ULL, + 0x7F7CC39420A3A545ULL, 0x9BFB227EBDF4C5CEULL, 0x89039D79D6FC5C5CULL, + 0x8FE88B57305E2AB6ULL, 0xA09E8C8C35AB96DEULL, 0xFA7E393983325753ULL, + 0xD6B6D0ECC617C699ULL, 0xDFEA21EA9E7557E3ULL, 0xB67C1FA481680AF8ULL, + 0xCA1E3785A9E724E5ULL, 0x1CFC8BED0D681639ULL, 0xD18D8549D140CAEAULL, + 0x4ED0FE7E9DC91335ULL, 0xE4DBF0634473F5D2ULL, 0x1761F93A44D5AEFEULL, + 0x53898E4C3910DA55ULL, 0x734DE8181F6EC39AULL, 0x2680B122BAA28D97ULL, + 0x298AF231C85BAFABULL, 0x7983EED3740847D5ULL, 0x66C1A2A1A60CD889ULL, + 0x9E17E49642A3E4C1ULL, 0xEDB454E7BADC0805ULL, 0x50B704CAB602C329ULL, + 0x4CC317FB9CDDD023ULL, 0x66B4835D9EAFEA22ULL, 0x219B97E26FFC81BDULL, + 0x261E4E4C0A333A9DULL, 0x1FE2CCA76517DB90ULL, 0xD7504DFA8816EDBBULL, + 0xB9571FA04DC089C8ULL, 0x1DDC0325259B27DEULL, 0xCF3F4688801EB9AAULL, + 0xF4F5D05C10CAB243ULL, 0x38B6525C21A42B0EULL, 0x36F60E2BA4FA6800ULL, + 0xEB3593803173E0CEULL, 0x9C4CD6257C5A3603ULL, 0xAF0C317D32ADAA8AULL, + 0x258E5A80C7204C4BULL, 0x8B889D624D44885DULL, 0xF4D14597E660F855ULL, + 0xD4347F66EC8941C3ULL, 0xE699ED85B0DFB40DULL, 0x2472F6207C2D0484ULL, + 0xC2A1E7B5B459AEB5ULL, 0xAB4F6451CC1D45ECULL, 0x63767572AE3D6174ULL, + 0xA59E0BD101731A28ULL, 0x116D0016CB948F09ULL, 0x2CF9C8CA052F6E9FULL, + 0x0B090A7560A968E3ULL, 0xABEEDDB2DDE06FF1ULL, 0x58EFC10B06A2068DULL, + 0xC6E57A78FBD986E0ULL, 0x2EAB8CA63CE802D7ULL, 0x14A195640116F336ULL, + 0x7C0828DD624EC390ULL, 0xD74BBE77E6116AC7ULL, 0x804456AF10F5FB53ULL, + 0xEBE9EA2ADF4321C7ULL, 0x03219A39EE587A30ULL, 0x49787FEF17AF9924ULL, + 0xA1E9300CD8520548ULL, 0x5B45E522E4B1B4EFULL, 0xB49C3B3995091A36ULL, + 0xD4490AD526F14431ULL, 0x12A8F216AF9418C2ULL, 0x001F837CC7350524ULL, + 0x1877B51E57A764D5ULL, 0xA2853B80F17F58EEULL, 0x993E1DE72D36D310ULL, + 0xB3598080CE64A656ULL, 0x252F59CF0D9F04BBULL, 0xD23C8E176D113600ULL, + 0x1BDA0492E7E4586EULL, 0x21E0BD5026C619BFULL, 0x3B097ADAF088F94EULL, + 0x8D14DEDB30BE846EULL, 0xF95CFFA23AF5F6F4ULL, 0x3871700761B3F743ULL, + 0xCA672B91E9E4FA16ULL, 0x64C8E531BFF53B55ULL, 0x241260ED4AD1E87DULL, + 0x106C09B972D2E822ULL, 0x7FBA195410E5CA30ULL, 0x7884D9BC6CB569D8ULL, + 0x0647DFEDCD894A29ULL, 0x63573FF03E224774ULL, 0x4FC8E9560F91B123ULL, + 0x1DB956E450275779ULL, 0xB8D91274B9E9D4FBULL, 0xA2EBEE47E2FBFCE1ULL, + 0xD9F1F30CCD97FB09ULL, 0xEFED53D75FD64E6BULL, 0x2E6D02C36017F67FULL, + 0xA9AA4D20DB084E9BULL, 0xB64BE8D8B25396C1ULL, 0x70CB6AF7C2D5BCF0ULL, + 0x98F076A4F7A2322EULL, 0xBF84470805E69B5FULL, 0x94C3251F06F90CF3ULL, + 0x3E003E616A6591E9ULL, 0xB925A6CD0421AFF3ULL, 0x61BDD1307C66E300ULL, + 0xBF8D5108E27E0D48ULL, 0x240AB57A8B888B20ULL, 0xFC87614BAF287E07ULL, + 0xEF02CDD06FFDB432ULL, 0xA1082C0466DF6C0AULL, 0x8215E577001332C8ULL, + 0xD39BB9C3A48DB6CFULL, 0x2738259634305C14ULL, 0x61CF4F94C97DF93DULL, + 0x1B6BACA2AE4E125BULL, 0x758F450C88572E0BULL, 0x959F587D507A8359ULL, + 0xB063E962E045F54DULL, 0x60E8ED72C0DFF5D1ULL, 0x7B64978555326F9FULL, + 0xFD080D236DA814BAULL, 0x8C90FD9B083F4558ULL, 0x106F72FE81E2C590ULL, + 0x7976033A39F7D952ULL, 0xA4EC0132764CA04BULL, 0x733EA705FAE4FA77ULL, + 0xB4D8F77BC3E56167ULL, 0x9E21F4F903B33FD9ULL, 0x9D765E419FB69F6DULL, + 0xD30C088BA61EA5EFULL, 0x5D94337FBFAF7F5BULL, 0x1A4E4822EB4D7A59ULL, + 0x6FFE73E81B637FB3ULL, 0xDDF957BC36D8B9CAULL, 0x64D0E29EEA8838B3ULL, + 0x08DD9BDFD96B9F63ULL, 0x087E79E5A57D1D13ULL, 0xE328E230E3E2B3FBULL, + 0x1C2559E30F0946BEULL, 0x720BF5F26F4D2EAAULL, 0xB0774D261CC609DBULL, + 0x443F64EC5A371195ULL, 0x4112CF68649A260EULL, 0xD813F2FAB7F5C5CAULL, + 0x660D3257380841EEULL, 0x59AC2C7873F910A3ULL, 0xE846963877671A17ULL, + 0x93B633ABFA3469F8ULL, 0xC0C0F5A60EF4CDCFULL, 0xCAF21ECD4377B28CULL, + 0x57277707199B8175ULL, 0x506C11B9D90E8B1DULL, 0xD83CC2687A19255FULL, + 0x4A29C6465A314CD1ULL, 0xED2DF21216235097ULL, 0xB5635C95FF7296E2ULL, + 0x22AF003AB672E811ULL, 0x52E762596BF68235ULL, 0x9AEBA33AC6ECC6B0ULL, + 0x944F6DE09134DFB6ULL, 0x6C47BEC883A7DE39ULL, 0x6AD047C430A12104ULL, + 0xA5B1CFDBA0AB4067ULL, 0x7C45D833AFF07862ULL, 0x5092EF950A16DA0BULL, + 0x9338E69C052B8E7BULL, 0x455A4B4CFE30E3F5ULL, 0x6B02E63195AD0CF8ULL, + 0x6B17B224BAD6BF27ULL, 0xD1E0CCD25BB9C169ULL, 0xDE0C89A556B9AE70ULL, + 0x50065E535A213CF6ULL, 0x9C1169FA2777B874ULL, 0x78EDEFD694AF1EEDULL, + 0x6DC93D9526A50E68ULL, 0xEE97F453F06791EDULL, 0x32AB0EDB696703D3ULL, + 0x3A6853C7E70757A7ULL, 0x31865CED6120F37DULL, 0x67FEF95D92607890ULL, + 0x1F2B1D1F15F6DC9CULL, 0xB69E38A8965C6B65ULL, 0xAA9119FF184CCCF4ULL, + 0xF43C732873F24C13ULL, 0xFB4A3D794A9A80D2ULL, 0x3550C2321FD6109CULL, + 0x371F77E76BB8417EULL, 0x6BFA9AAE5EC05779ULL, 0xCD04F3FF001A4778ULL, + 0xE3273522064480CAULL, 0x9F91508BFFCFC14AULL, 0x049A7F41061A9E60ULL, + 0xFCB6BE43A9F2FE9BULL, 0x08DE8A1C7797DA9BULL, 0x8F9887E6078735A1ULL, + 0xB5B4071DBFC73A66ULL, 0x230E343DFBA08D33ULL, 0x43ED7F5A0FAE657DULL, + 0x3A88A0FBBCB05C63ULL, 0x21874B8B4D2DBC4FULL, 0x1BDEA12E35F6A8C9ULL, + 0x53C065C6C8E63528ULL, 0xE34A1D250E7A8D6BULL, 0xD6B04D3B7651DD7EULL, + 0x5E90277E7CB39E2DULL, 0x2C046F22062DC67DULL, 0xB10BB459132D0A26ULL, + 0x3FA9DDFB67E2F199ULL, 0x0E09B88E1914F7AFULL, 0x10E8B35AF3EEAB37ULL, + 0x9EEDECA8E272B933ULL, 0xD4C718BC4AE8AE5FULL, 0x81536D601170FC20ULL, + 0x91B534F885818A06ULL, 0xEC8177F83F900978ULL, 0x190E714FADA5156EULL, + 0xB592BF39B0364963ULL, 0x89C350C893AE7DC1ULL, 0xAC042E70F8B383F2ULL, + 0xB49B52E587A1EE60ULL, 0xFB152FE3FF26DA89ULL, 0x3E666E6F69AE2C15ULL, + 0x3B544EBE544C19F9ULL, 0xE805A1E290CF2456ULL, 0x24B33C9D7ED25117ULL, + 0xE74733427B72F0C1ULL, 0x0A804D18B7097475ULL, 0x57E3306D881EDB4FULL, + 0x4AE7D6A36EB5DBCBULL, 0x2D8D5432157064C8ULL, 0xD1E649DE1E7F268BULL, + 0x8A328A1CEDFE552CULL, 0x07A3AEC79624C7DAULL, 0x84547DDC3E203C94ULL, + 0x990A98FD5071D263ULL, 0x1A4FF12616EEFC89ULL, 0xF6F7FD1431714200ULL, + 0x30C05B1BA332F41CULL, 0x8D2636B81555A786ULL, 0x46C9FEB55D120902ULL, + 0xCCEC0A73B49C9921ULL, 0x4E9D2827355FC492ULL, 0x19EBB029435DCB0FULL, + 0x4659D2B743848A2CULL, 0x963EF2C96B33BE31ULL, 0x74F85198B05A2E7DULL, + 0x5A0F544DD2B1FB18ULL, 0x03727073C2E134B1ULL, 0xC7F6AA2DE59AEA61ULL, + 0x352787BAA0D7C22FULL, 0x9853EAB63B5E0B35ULL, 0xABBDCDD7ED5C0860ULL, + 0xCF05DAF5AC8D77B0ULL, 0x49CAD48CEBF4A71EULL, 0x7A4C10EC2158C4A6ULL, + 0xD9E92AA246BF719EULL, 0x13AE978D09FE5557ULL, 0x730499AF921549FFULL, + 0x4E4B705B92903BA4ULL, 0xFF577222C14F0A3AULL, 0x55B6344CF97AAFAEULL, + 0xB862225B055B6960ULL, 0xCAC09AFBDDD2CDB4ULL, 0xDAF8E9829FE96B5FULL, + 0xB5FDFC5D3132C498ULL, 0x310CB380DB6F7503ULL, 0xE87FBB46217A360EULL, + 0x2102AE466EBB1148ULL, 0xF8549E1A3AA5E00DULL, 0x07A69AFDCC42261AULL, + 0xC4C118BFE78FEAAEULL, 0xF9F4892ED96BD438ULL, 0x1AF3DBE25D8F45DAULL, + 0xF5B4B0B0D2DEEEB4ULL, 0x962ACEEFA82E1C84ULL, 0x046E3ECAAF453CE9ULL, + 0xF05D129681949A4CULL, 0x964781CE734B3C84ULL, 0x9C2ED44081CE5FBDULL, + 0x522E23F3925E319EULL, 0x177E00F9FC32F791ULL, 0x2BC60A63A6F3B3F2ULL, + 0x222BBFAE61725606ULL, 0x486289DDCC3D6780ULL, 0x7DC7785B8EFDFC80ULL, + 0x8AF38731C02BA980ULL, 0x1FAB64EA29A2DDF7ULL, 0xE4D9429322CD065AULL, + 0x9DA058C67844F20CULL, 0x24C0E332B70019B0ULL, 0x233003B5A6CFE6ADULL, + 0xD586BD01C5C217F6ULL, 0x5E5637885F29BC2BULL, 0x7EBA726D8C94094BULL, + 0x0A56A5F0BFE39272ULL, 0xD79476A84EE20D06ULL, 0x9E4C1269BAA4BF37ULL, + 0x17EFEE45B0DEE640ULL, 0x1D95B0A5FCF90BC6ULL, 0x93CBE0B699C2585DULL, + 0x65FA4F227A2B6D79ULL, 0xD5F9E858292504D5ULL, 0xC2B5A03F71471A6FULL, + 0x59300222B4561E00ULL, 0xCE2F8642CA0712DCULL, 0x7CA9723FBB2E8988ULL, + 0x2785338347F2BA08ULL, 0xC61BB3A141E50E8CULL, 0x150F361DAB9DEC26ULL, + 0x9F6A419D382595F4ULL, 0x64A53DC924FE7AC9ULL, 0x142DE49FFF7A7C3DULL, + 0x0C335248857FA9E7ULL, 0x0A9C32D5EAE45305ULL, 0xE6C42178C4BBB92EULL, + 0x71F1CE2490D20B07ULL, 0xF1BCC3D275AFE51AULL, 0xE728E8C83C334074ULL, + 0x96FBF83A12884624ULL, 0x81A1549FD6573DA5ULL, 0x5FA7867CAF35E149ULL, + 0x56986E2EF3ED091BULL, 0x917F1DD5F8886C61ULL, 0xD20D8C88C8FFE65FULL, + 0x31D71DCE64B2C310ULL, 0xF165B587DF898190ULL, 0xA57E6339DD2CF3A0ULL, + 0x1EF6E6DBB1961EC9ULL, 0x70CC73D90BC26E24ULL, 0xE21A6B35DF0C3AD7ULL, + 0x003A93D8B2806962ULL, 0x1C99DED33CB890A1ULL, 0xCF3145DE0ADD4289ULL, + 0xD0E4427A5514FB72ULL, 0x77C621CC9FB3A483ULL, 0x67A34DAC4356550BULL, + 0xF8D626AAAF278509ULL + }}; + + // polyglot_key() returns the PolyGlot hash key of the given position + Key polyglot_key(const Position& pos) { + + Key key = 0; + Bitboard b = pos.pieces(); + + while (b) + { + Square s = pop_lsb(&b); + Piece pc = pos.piece_on(s); + + // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11 + key ^= PG.Zobrist.psq[2 * (type_of(pc) - 1) + (color_of(pc) == WHITE)][s]; + } + + b = pos.can_castle(ANY_CASTLING); + + while (b) + key ^= PG.Zobrist.castling[pop_lsb(&b)]; + + if (pos.ep_square() != SQ_NONE) + key ^= PG.Zobrist.enpassant[file_of(pos.ep_square())]; + + if (pos.side_to_move() == WHITE) + key ^= PG.Zobrist.turn; + + return key; + } + +} // namespace + +PolyglotBook::PolyglotBook() : rng(now() % 10000) {} + +PolyglotBook::~PolyglotBook() { if (is_open()) close(); } + + +/// operator>>() reads sizeof(T) chars from the file's binary byte stream and +/// converts them into a number of type T. A Polyglot book stores numbers in +/// big-endian format. + +template PolyglotBook& PolyglotBook::operator>>(T& n) { + + n = 0; + for (size_t i = 0; i < sizeof(T); ++i) + n = T((n << 8) + ifstream::get()); + + return *this; +} + +template<> PolyglotBook& PolyglotBook::operator>>(Entry& e) { + return *this >> e.key >> e.move >> e.count >> e.learn; +} + + +/// open() tries to open a book file with the given name after closing any +/// existing one. + +bool PolyglotBook::open(const char* fName) { + + if (is_open()) // Cannot close an already closed file + close(); + + ifstream::open(fName, ifstream::in | ifstream::binary); + + fileName = is_open() ? fName : ""; + ifstream::clear(); // Reset any error flag to allow a retry ifstream::open() + return !fileName.empty(); +} + + +/// probe() tries to find a book move for the given position. If no move is +/// found, it returns MOVE_NONE. If pickBest is true, then it always returns +/// the highest-rated move, otherwise it randomly chooses one based on the +/// move score. + +Move PolyglotBook::probe(const Position& pos, const string& fName, bool pickBest) { + + if (fileName != fName && !open(fName.c_str())) + return MOVE_NONE; + + Entry e; + uint16_t best = 0; + unsigned sum = 0; + Move move = MOVE_NONE; + Key key = polyglot_key(pos); + + seekg(find_first(key) * sizeof(Entry), ios_base::beg); + + while (*this >> e, e.key == key && good()) + { + best = max(best, e.count); + sum += e.count; + + // Choose book move according to its score. If a move has a very high + // score it has a higher probability of being choosen than a move with + // a lower score. Note that first entry is always chosen. + if ( (!pickBest && sum && rng.rand() % sum < e.count) + || (pickBest && e.count == best)) + move = Move(e.move); + } + + if (!move) + return MOVE_NONE; + + // A PolyGlot book move is encoded as follows: + // + // bit 0- 5: destination square (from 0 to 63) + // bit 6-11: origin square (from 0 to 63) + // bit 12-14: promotion piece (from KNIGHT == 1 to QUEEN == 4) + // + // Castling moves follow the "king captures rook" representation. If a book + // move is a promotion, we have to convert it to our representation and in + // all other cases, we can directly compare with a Move after having masked + // out the special Move flags (bit 14-15) that are not supported by PolyGlot. + int pt = (move >> 12) & 7; + if (pt) + move = make(from_sq(move), to_sq(move), PieceType(pt + 1)); + + // Add 'special move' flags and verify it is legal + for (const auto& m : MoveList(pos)) + if (move == (Move(m) ^ Move(type_of(m)))) + return m; + + return MOVE_NONE; +} + + +/// find_first() takes a book key as input, and does a binary search through +/// the book file for the given key. Returns the index of the leftmost book +/// entry with the same key as the input. + +size_t PolyglotBook::find_first(Key key) { + + seekg(0, ios::end); // Move pointer to end, so tellg() gets file's size + + size_t low = 0, mid, high = (size_t)tellg() / sizeof(Entry) - 1; + Entry e; + + assert(low <= high); + + while (low < high && good()) + { + mid = (low + high) / 2; + + assert(mid >= low && mid < high); + + seekg(mid * sizeof(Entry), ios_base::beg); + *this >> e; + + if (key <= e.key) + high = mid; + else + low = mid + 1; + } + + assert(low == high); + + return low; +} diff --git a/Engines/Linux32/mcbrain/src/book.h b/Engines/Linux32/mcbrain/src/book.h new file mode 100644 index 0000000..c88920f --- /dev/null +++ b/Engines/Linux32/mcbrain/src/book.h @@ -0,0 +1,53 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +/* + The code in this file is based on the opening book code in PolyGlot + by Fabien Letouzey. PolyGlot is available under the GNU General + Public License, and can be downloaded from http://wbec-ridderkerk.nl + */ + +#ifndef BOOK_H_INCLUDED +#define BOOK_H_INCLUDED + +#include +#include + +#include "misc.h" +#include "position.h" + +class PolyglotBook : private std::ifstream { +public: + PolyglotBook(); + ~PolyglotBook(); + Move probe(const Position& pos, const std::string& fName, bool pickBest); + +private: + template PolyglotBook& operator>>(T& n); + + bool open(const char* fName); + size_t find_first(Key key); + + PRNG rng; + std::string fileName; +}; + +#endif // #ifndef BOOK_H_INCLUDED diff --git a/Engines/Linux32/mcbrain/src/endgame.cpp b/Engines/Linux32/mcbrain/src/endgame.cpp index 86210af..3455e79 100644 --- a/Engines/Linux32/mcbrain/src/endgame.cpp +++ b/Engines/Linux32/mcbrain/src/endgame.cpp @@ -87,30 +87,6 @@ namespace { } // namespace -/// Endgames members definitions - -Endgames::Endgames() { - - add("KPK"); - add("KNNK"); - add("KBNK"); - add("KRKP"); - add("KRKB"); - add("KRKN"); - add("KQKP"); - add("KQKR"); - - add("KNPK"); - add("KNPKB"); - add("KRPKR"); - add("KRPKB"); - add("KBPKB"); - add("KBPKN"); - add("KBPPKB"); - add("KRPPKRP"); -} - - /// Mate with KX vs K. This function is used to evaluate positions with /// king and plenty of material vs a lone king. It simply gives the /// attacking side a bonus for driving the defending king towards the edge @@ -144,6 +120,28 @@ Value Endgame::operator()(const Position& pos) const { } +/// Mate with KQX vs KX. This is similar to KX vs K. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(pos.non_pawn_material(strongSide) > QueenValueMg + RookValueMg); + assert(pos.non_pawn_material(weakSide) <= RookValueMg); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + + Value result = VALUE_KNOWN_WIN + + pos.non_pawn_material(strongSide) + - pos.non_pawn_material(weakSide) + + PushClose[distance(winnerKSq, loserKSq)] + + PushToCorners[loserKSq]; + + result = std::min(result, VALUE_MATE_IN_MAX_PLY - 1); + + return strongSide == pos.side_to_move() ? result : -result; +} + + /// Mate with KBN vs K. This is similar to KX vs K, but we have to drive the /// defending king towards a corner square of the right color. template<> @@ -215,7 +213,7 @@ Value Endgame::operator()(const Position& pos) const { Value result; // If the stronger side's king is in front of the pawn, it's a win - if (wksq < psq && file_of(wksq) == file_of(psq)) + if (forward_file_bb(WHITE, wksq) & psq) result = RookValueEg - distance(wksq, psq); // If the weaker side's king is too far from the pawn and the rook, diff --git a/Engines/Linux32/mcbrain/src/endgame.h b/Engines/Linux32/mcbrain/src/endgame.h index eec1490..58338cc 100644 --- a/Engines/Linux32/mcbrain/src/endgame.h +++ b/Engines/Linux32/mcbrain/src/endgame.h @@ -39,6 +39,7 @@ enum EndgameCode { EVALUATION_FUNCTIONS, KNNK, // KNN vs K KXK, // Generic "mate lone king" eval + KQXKX, // Big material advantage eval KBNK, // KBN vs K KPK, // KP vs K KRKP, // KR vs KP @@ -65,6 +66,7 @@ enum EndgameCode { /// Endgame functions can be of two types depending on whether they return a /// Value or a ScaleFactor. + template using eg_type = typename std::conditional<(E < SCALING_FUNCTIONS), Value, ScaleFactor>::type; @@ -104,21 +106,40 @@ class Endgames { return std::get::value>(maps); } - template, typename P = Ptr> + template> void add(const std::string& code) { StateInfo st; - map()[Position().set(code, WHITE, &st).material_key()] = P(new Endgame(WHITE)); - map()[Position().set(code, BLACK, &st).material_key()] = P(new Endgame(BLACK)); + map()[Position().set(code, WHITE, &st).material_key()] = Ptr(new Endgame(WHITE)); + map()[Position().set(code, BLACK, &st).material_key()] = Ptr(new Endgame(BLACK)); } std::pair, Map> maps; public: - Endgames(); + Endgames() { + + add("KPK"); + add("KNNK"); + add("KBNK"); + add("KRKP"); + add("KRKB"); + add("KRKN"); + add("KQKP"); + add("KQKR"); + + add("KNPK"); + add("KNPKB"); + add("KRPKR"); + add("KRPKB"); + add("KBPKB"); + add("KBPKN"); + add("KBPPKB"); + add("KRPPKRP"); + } template - EndgameBase* probe(Key key) { + const EndgameBase* probe(Key key) { return map().count(key) ? map()[key].get() : nullptr; } }; diff --git a/Engines/Linux32/mcbrain/src/evaluate.cpp b/Engines/Linux32/mcbrain/src/evaluate.cpp index 6843268..0aa95e1 100644 --- a/Engines/Linux32/mcbrain/src/evaluate.cpp +++ b/Engines/Linux32/mcbrain/src/evaluate.cpp @@ -24,19 +24,27 @@ #include // For std::memset #include #include +#include #include "bitboard.h" #include "evaluate.h" #include "material.h" #include "pawns.h" #include "thread.h" +#include "uci.h" + +//#define PAWN_SCORES namespace Trace { enum Tracing { NO_TRACE, TRACE }; enum Term { // The first 8 entries are reserved for PieceType - MATERIAL = 8, IMBALANCE, MOBILITY, THREAT, PASSED, SPACE, INITIATIVE, TOTAL, TERM_NB + MATERIAL = 8, IMBALANCE, MOBILITY, THREAT, PASSED, SPACE, +#ifdef PAWN_SCORES + CENTER, +#endif + INITIATIVE, TOTAL, TERM_NB }; Score scores[TERM_NB][COLOR_NB]; @@ -80,9 +88,9 @@ namespace { constexpr Bitboard Center = (FileDBB | FileEBB) & (Rank4BB | Rank5BB); constexpr Bitboard KingFlank[FILE_NB] = { - QueenSide, QueenSide, QueenSide, + QueenSide ^ FileDBB, QueenSide, QueenSide, CenterFiles, CenterFiles, - KingSide, KingSide, KingSide + KingSide, KingSide, KingSide ^ FileEBB }; // Threshold for lazy and space evaluation @@ -90,7 +98,7 @@ namespace { constexpr Value SpaceThreshold = Value(12222); // KingAttackWeights[PieceType] contains king attack weights by piece type - constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 78, 56, 45, 11 }; + constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10 }; // Penalties for enemy's safe checks constexpr int QueenSafeCheck = 780; @@ -141,47 +149,81 @@ namespace { S(0, 0), S(0, 24), S(38, 71), S(38, 61), S(0, 38), S(36, 38) }; - // ThreatByKing[on one/on many] contains bonuses for king attacks on - // pawns or pieces which are not pawn-defended. - constexpr Score ThreatByKing[] = { S(3, 65), S(9, 145) }; - // PassedRank[Rank] contains a bonus according to the rank of a passed pawn constexpr Score PassedRank[RANK_NB] = { - S(0, 0), S(5, 7), S(5, 13), S(32, 42), S(70, 70), S(172, 170), S(217, 269) + S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 62), S(163, 167), S(271, 250) }; // PassedFile[File] contains a bonus according to the file of a passed pawn constexpr Score PassedFile[FILE_NB] = { - S( 9, 10), S(2, 10), S(1, -8), S(-20,-12), - S(-20,-12), S(1, -8), S(2, 10), S( 9, 10) + S( -1, 7), S( 0, 9), S(-9, -8), S(-30,-14), + S(-30,-14), S(-9, -8), S( 0, 9), S( -1, 7) }; // PassedDanger[Rank] contains a term to weight the passed score - constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 2, 7, 12, 19 }; + constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 }; + + // Knight Scores Board + constexpr Score KnightScoresBoard[RANK_NB][FILE_NB] = { + { S(-25, -25), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-25, -25) }, + { S(-15, -15), S(- 5, - 5), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(- 5, - 5), S(-15, -15) }, + { S(-10, -10), S(+ 0, + 0), S(+10, +10), S(+10, +10), S(+10, +10), S(+10, +10), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+10, +10), S(+25, +25), S(+25, +25), S(+10, +10), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+20, +20), S(+30, +30), S(+30, +30), S(+20, +20), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+15, +15), S(+20, +20), S(+20, +20), S(+15, +15), S(+ 0, + 0), S(-10, -10) }, + { S(-15, -15), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(-15, -15) }, + { S(-20, -20), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(-20, -20) }, + }; + // Pawn for Knight Scores advantage compensation + constexpr Score PawnScores = S(+ 4, + 6); + // Bishop for Knight Scores advantage compensation + constexpr Score BishopScores = S(+10, +5); + // Rook for Knight Scores advantage compensation + constexpr Score RookScores = S(+15, +30); + // Queen for Knight Scores advantage compensation + constexpr Score QueenScores = S(+20, +60); + + // Pawns Shelter for Knight Scores advantage compensation + constexpr Score PawnShelterCompensationKnightScores = S(+ 10, + 0); // Exact numbers to be determined + +#ifdef PAWN_SCORES + // Pawn Scores Board + constexpr Score PawnScoresBoard[RANK_NB][FILE_NB] = { + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 8, + 0), S(+ 8, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+10, + 0), S(+10, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 6, + 0), S(+ 6, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + }; - // KingProtector[PieceType-2] contains a penalty according to distance from king - constexpr Score KingProtector[] = { S(3, 5), S(4, 3), S(3, 0), S(1, -1) }; + // Undeveloped Piece Penalty + constexpr Score UndevelopedPiecePenalty = S(-20,-10); +#endif // Assorted bonuses and penalties - constexpr Score BishopPawns = S( 3, 5); - constexpr Score CloseEnemies = S( 7, 0); - constexpr Score Connectivity = S( 3, 1); + constexpr Score BishopPawns = S( 3, 7); + constexpr Score CloseEnemies = S( 6, 0); constexpr Score CorneredBishop = S( 50, 50); - constexpr Score Hanging = S( 52, 30); - constexpr Score HinderPassedPawn = S( 8, 1); + constexpr Score Hanging = S( 57, 32); + constexpr Score HinderPassedPawn = S( 8, 0); + constexpr Score KingProtector = S( 6, 6); constexpr Score KnightOnQueen = S( 21, 11); - constexpr Score LongDiagonalBishop = S( 22, 0); + constexpr Score LongDiagonalBishop = S( 46, 0); constexpr Score MinorBehindPawn = S( 16, 0); - constexpr Score Overload = S( 10, 5); - constexpr Score PawnlessFlank = S( 20, 80); - constexpr Score RookOnPawn = S( 8, 24); + constexpr Score Overload = S( 13, 6); + constexpr Score PawnlessFlank = S( 19, 84); + constexpr Score RookOnPawn = S( 10, 30); constexpr Score SliderOnQueen = S( 42, 21); - constexpr Score ThreatByPawnPush = S( 47, 26); + constexpr Score ThreatByKing = S( 23, 76); + constexpr Score ThreatByPawnPush = S( 45, 40); constexpr Score ThreatByRank = S( 16, 3); - constexpr Score ThreatBySafePawn = S(175,168); + constexpr Score ThreatBySafePawn = S(173,102); constexpr Score TrappedRook = S( 92, 0); constexpr Score WeakQueen = S( 50, 10); - constexpr Score WeakUnopposedPawn = S( 5, 25); + constexpr Score WeakUnopposedPawn = S( 5, 29); #undef S @@ -202,6 +244,9 @@ namespace { template Score threats() const; template Score passed() const; template Score space() const; +#ifdef PAWN_SCORES + template Score pawn_center() const; +#endif ScaleFactor scale_factor(Value eg) const; Score initiative(Value eg) const; @@ -282,7 +327,7 @@ namespace { else if (file_of(pos.square(Us)) == FILE_A) kingRing[Us] |= shift(kingRing[Us]); - kingAttackersCount[Them] = popcount(attackedBy[Us][KING] & pe->pawn_attacks(Them)); + kingAttackersCount[Them] = popcount(kingRing[Us] & pe->pawn_attacks(Them)); kingAttacksCount[Them] = kingAttackersWeight[Them] = 0; } else @@ -331,9 +376,6 @@ namespace { mobility[Us] += MobilityBonus[Pt - 2][mob]; - // Penalty if the piece is far from the king - score -= KingProtector[Pt - 2] * distance(s, pos.square(Us)); - if (Pt == BISHOP || Pt == KNIGHT) { // Bonus if piece is on an outpost square or can reach one @@ -344,11 +386,13 @@ namespace { else if (bb &= b & ~pos.pieces(Us)) score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & bb)]; - // Bonus when behind a pawn - if ( relative_rank(Us, s) < RANK_5 - && (pos.pieces(PAWN) & (s + pawn_push(Us)))) + // Knight and Bishop bonus for being right behind a pawn + if (shift(pos.pieces(PAWN)) & s) score += MinorBehindPawn; + // Penalty if the piece is far from the king + score -= KingProtector * distance(s, pos.square(Us)); + if (Pt == BISHOP) { // Penalty according to number of pawns on the same color square as the @@ -359,8 +403,13 @@ namespace { * (1 + popcount(blocked & CenterFiles)); // Bonus for bishop on a long diagonal which can "see" both center squares - if (more_than_one(Center & (attacks_bb(s, pos.pieces(PAWN)) | s))) + if (more_than_one(attacks_bb(s, pos.pieces(PAWN)) & Center)) score += LongDiagonalBishop; + + if (pos.piece_on(s) == make_piece(Us, BISHOP)) + { + score += BishopScores; + } } // An important Chess960 pattern: A cornered bishop blocked by a friendly @@ -376,6 +425,30 @@ namespace { : pos.piece_on(s + d + d) == make_piece(Us, PAWN) ? CorneredBishop * 2 : CorneredBishop; } + + if (Pt == KNIGHT) + { + if (pos.piece_on(s) == make_piece(Us, KNIGHT)) + { + int rank = rank_of(s); + int file = file_of(s); + if (Us == WHITE) + { + score += KnightScoresBoard[rank][file]; + } + else + { + if (Us == BLACK) + { + score += KnightScoresBoard[RANK_NB - 1 -rank][file]; + } + else + { + assert(false); + } + } + } + } } if (Pt == ROOK) @@ -395,6 +468,11 @@ namespace { if ((kf < FILE_E) == (file_of(s) < kf)) score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us)); } + + if (pos.piece_on(s) == make_piece(Us, ROOK)) + { + score += RookScores; + } } if (Pt == QUEEN) @@ -403,6 +481,11 @@ namespace { Bitboard queenPinners; if (pos.slider_blockers(pos.pieces(Them, ROOK, BISHOP), s, queenPinners)) score -= WeakQueen; + + if (pos.piece_on(s) == make_piece(Us, QUEEN)) + { + score += QueenScores; + } } } if (T) @@ -421,11 +504,19 @@ namespace { : AllSquares ^ Rank1BB ^ Rank2BB ^ Rank3BB); const Square ksq = pos.square(Us); - Bitboard weak, b, b1, b2, safe, unsafeChecks, pinned; + Bitboard kingFlank, weak, b, b1, b2, safe, unsafeChecks; // King shelter and enemy pawns storm Score score = pe->king_safety(pos, ksq); + // Find the squares that opponent attacks in our king flank, and the squares + // which are attacked twice in that flank but not defended by our pawns. + kingFlank = KingFlank[file_of(ksq)]; + b1 = attackedBy[Them][ALL_PIECES] & kingFlank & Camp; + b2 = b1 & attackedBy2[Them] & ~attackedBy[Us][PAWN]; + + int tropism = popcount(b1) + popcount(b2); + // Main king safety evaluation if (kingAttackersCount[Them] > 1 - pos.count(Them)) { @@ -473,38 +564,45 @@ namespace { // Unsafe or occupied checking squares will also be considered, as long as // the square is in the attacker's mobility area. unsafeChecks &= mobilityArea[Them]; - pinned = pos.blockers_for_king(Us) & pos.pieces(Us); kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them] - + 102 * kingAttacksCount[Them] - + 191 * popcount(kingRing[Us] & weak) - + 143 * popcount(pinned | unsafeChecks) - - 848 * !pos.count(Them) - - 9 * mg_value(score) / 8 - + 40; + + 69 * kingAttacksCount[Them] + + 185 * popcount(kingRing[Us] & weak) + + 129 * popcount(pos.blockers_for_king(Us) | unsafeChecks) + + 4 * tropism + - 873 * !pos.count(Them) + - 6 * mg_value(score) / 8 + - 30; // Transform the kingDanger units into a Score, and subtract it from the evaluation if (kingDanger > 0) { int mobilityDanger = mg_value(mobility[Them] - mobility[Us]); kingDanger = std::max(0, kingDanger + mobilityDanger); - score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); +#ifdef Maverick + score -= make_score(kingDanger * kingDanger / 3584, kingDanger / 14); +#else + score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); +#endif } } - Bitboard kf = KingFlank[file_of(ksq)]; - // Penalty when our king is on a pawnless flank - if (!(pos.pieces(PAWN) & kf)) + if (!(pos.pieces(PAWN) & kingFlank)) + { score -= PawnlessFlank; + + const Square* pl = pos.squares(Us); + Square s; + + while ((s = *pl++) != SQ_NONE) + { + score += PawnShelterCompensationKnightScores; + } + } - // Find the squares that opponent attacks in our king flank, and the squares - // which are attacked twice in that flank but not defended by our pawns. - b1 = attackedBy[Them][ALL_PIECES] & kf & Camp; - b2 = b1 & attackedBy2[Them] & ~attackedBy[Us][PAWN]; - - // King tropism, to anticipate slow motion attacks on our king - score -= CloseEnemies * (popcount(b1) + popcount(b2)); + // King tropism bonus, to anticipate slow motion attacks on our king + score -= CloseEnemies * tropism; if (T) Trace::add(KING, Us, score); @@ -522,7 +620,7 @@ namespace { constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB); - Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safeThreats; + Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe; Score score = SCORE_ZERO; // Non-pawn enemies @@ -539,6 +637,9 @@ namespace { // Enemies not strongly protected and under our attack weak = pos.pieces(Them) & ~stronglyProtected & attackedBy[Us][ALL_PIECES]; + // Safe or protected squares + safe = ~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]; + // Bonus according to the kind of attacking pieces if (defended | weak) { @@ -549,27 +650,29 @@ namespace { score += ThreatByMinor[type_of(pos.piece_on(s))]; if (type_of(pos.piece_on(s)) != PAWN) score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; } - b = (pos.pieces(Them, QUEEN) | weak) & attackedBy[Us][ROOK]; + b = weak & attackedBy[Us][ROOK]; while (b) { Square s = pop_lsb(&b); score += ThreatByRook[type_of(pos.piece_on(s))]; if (type_of(pos.piece_on(s)) != PAWN) score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; } - b = weak & attackedBy[Us][KING]; - if (b) - score += ThreatByKing[more_than_one(b)]; + if (weak & attackedBy[Us][KING]) + score += ThreatByKing; score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]); - // Bonus for overload (non-pawn enemies attacked and defended exactly once) - b = nonPawnEnemies - & attackedBy[Us][ALL_PIECES] & ~attackedBy2[Us] - & attackedBy[Them][ALL_PIECES] & ~attackedBy2[Them]; + b = weak & nonPawnEnemies & attackedBy[Them][ALL_PIECES]; score += Overload * popcount(b); } @@ -577,48 +680,39 @@ namespace { if (pos.pieces(Us, ROOK, QUEEN)) score += WeakUnopposedPawn * pe->weak_unopposed(Them); - // Our safe or protected pawns - b = pos.pieces(Us, PAWN) - & (~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]); - - safeThreats = pawn_attacks_bb(b) & nonPawnEnemies; - score += ThreatBySafePawn * popcount(safeThreats); - // Find squares where our pawns can push on the next move b = shift(pos.pieces(Us, PAWN)) & ~pos.pieces(); b |= shift(b & TRank3BB) & ~pos.pieces(); - // Keep only the squares which are not completely unsafe - b &= ~attackedBy[Them][PAWN] - & (attackedBy[Us][ALL_PIECES] | ~attackedBy[Them][ALL_PIECES]); + // Keep only the squares which are relatively safe + b &= ~attackedBy[Them][PAWN] & safe; // Bonus for safe pawn threats on the next move - b = pawn_attacks_bb(b) - & pos.pieces(Them) - & ~attackedBy[Us][PAWN]; - + b = pawn_attacks_bb(b) & pos.pieces(Them); score += ThreatByPawnPush * popcount(b); + // Our safe or protected pawns + b = pos.pieces(Us, PAWN) & safe; + + b = pawn_attacks_bb(b) & nonPawnEnemies; + score += ThreatBySafePawn * popcount(b); + // Bonus for threats on the next moves against enemy queen if (pos.count(Them) == 1) { Square s = pos.square(Them); - safeThreats = mobilityArea[Us] & ~stronglyProtected; + safe = mobilityArea[Us] & ~stronglyProtected; b = attackedBy[Us][KNIGHT] & pos.attacks_from(s); - score += KnightOnQueen * popcount(b & safeThreats); + score += KnightOnQueen * popcount(b & safe); b = (attackedBy[Us][BISHOP] & pos.attacks_from(s)) | (attackedBy[Us][ROOK ] & pos.attacks_from(s)); - score += SliderOnQueen * popcount(b & safeThreats & attackedBy2[Us]); + score += SliderOnQueen * popcount(b & safe & attackedBy2[Us]); } - // Connectivity: ensure that knights, bishops, rooks, and queens are protected - b = (pos.pieces(Us) ^ pos.pieces(Us, PAWN, KING)) & attackedBy[Us][ALL_PIECES]; - score += Connectivity * popcount(b); - if (T) Trace::add(THREAT, Us, score); @@ -649,8 +743,8 @@ namespace { assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up))); - bb = forward_file_bb(Us, s) & (attackedBy[Them][ALL_PIECES] | pos.pieces(Them)); - score -= HinderPassedPawn * popcount(bb); + if (forward_file_bb(Us, s) & pos.pieces(Them)) + score -= HinderPassedPawn; int r = relative_rank(Us, s); int w = PassedDanger[r]; @@ -719,6 +813,63 @@ namespace { } +#ifdef PAWN_SCORES + // Pawn Center evaluation + + template template + Score Evaluation::pawn_center() const { + + //constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + + const Square* pl = pos.squares(Us); + + Square s; + Score score = SCORE_ZERO; + + while ((s = *pl++) != SQ_NONE) + { + if (pos.piece_on(s) == make_piece(Us, PAWN)) + { + int rank = rank_of(s); + int file = file_of(s); + if (Us == WHITE) + { + score += PawnScoresBoard[rank][file]; + } + else + { + if (Us == BLACK) + { + score += PawnScoresBoard[RANK_NB - 1 - rank][file]; + } + else + { + assert(false); + } + } + } + } + + // Evaluation of development + + const Square* pld = pos.squares(Us); + + while ((s = *pld++) != SQ_NONE) + { + if (relative_rank(Us, s) == RANK_1) + { + score += UndevelopedPiecePenalty; + } + } + + if (T) + Trace::add(CENTER, Us, score); + + return score; + } +#endif + + // Evaluation::space() computes the space evaluation for a given side. The // space evaluation is a simple bonus based on the number of safe squares // available for minor pieces on the central four files on ranks 2--4. Safe @@ -729,14 +880,14 @@ namespace { template template Score Evaluation::space() const { + if (pos.non_pawn_material() < SpaceThreshold) + return SCORE_ZERO; + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); constexpr Bitboard SpaceMask = Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB) : CenterFiles & (Rank7BB | Rank6BB | Rank5BB); - if (pos.non_pawn_material() < SpaceThreshold) - return SCORE_ZERO; - // Find the available squares for our pieces inside the area defined by SpaceMask Bitboard safe = SpaceMask & ~pos.pieces(Us, PAWN) @@ -769,17 +920,26 @@ namespace { int outflanking = distance(pos.square(WHITE), pos.square(BLACK)) - distance(pos.square(WHITE), pos.square(BLACK)); - bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide) - && (pos.pieces(PAWN) & KingSide); - + bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide) + && (pos.pieces(PAWN) & KingSide); + +#ifdef Maverick + // Compute the initiative bonus for the attacking side + int complexity = 8 * pe->pawn_asymmetry() + + 12 * pos.count() + + 12 * outflanking + + 32 * pawnsOnBothFlanks + + 48 * !pos.non_pawn_material() + - 132; +#else // Compute the initiative bonus for the attacking side - int complexity = 8 * outflanking - + 8 * pe->pawn_asymmetry() + int complexity = 8 * pe->pawn_asymmetry() + 12 * pos.count() - + 16 * pawnsOnBothFlanks + + 12 * outflanking + + 16 * pawnsOnBothFlanks + 48 * !pos.non_pawn_material() - -136 ; - + - 116; +#endif // Now apply the bonus: note that we find the attacking side by extracting // the sign of the endgame value, and that we carefully cap the bonus so // that the endgame score will never change sign after the bonus. @@ -803,20 +963,12 @@ namespace { // If scale is not already specific, scale down the endgame via general heuristics if (sf == SCALE_FACTOR_NORMAL) { - if (pos.opposite_bishops()) - { - // Endgame with opposite-colored bishops and no other pieces is almost a draw - if ( pos.non_pawn_material(WHITE) == BishopValueMg - && pos.non_pawn_material(BLACK) == BishopValueMg) - sf = 31; - - // Endgame with opposite-colored bishops, but also other pieces. Still - // a bit drawish, but not as drawish as with only the two bishops. - else - sf = 46; - } + if ( pos.opposite_bishops() + && pos.non_pawn_material(WHITE) == BishopValueMg + && pos.non_pawn_material(BLACK) == BishopValueMg) + sf = 31; else - sf = std::min(40 + 7 * pos.count(strongSide), sf); + sf = std::min(40 + (pos.opposite_bishops() ? 2 : 7) * pos.count(strongSide), sf); } return ScaleFactor(sf); @@ -849,6 +1001,8 @@ namespace { pe = Pawns::probe(pos); score += pe->pawn_score(WHITE) - pe->pawn_score(BLACK); + score += PawnScores * pos.count(WHITE) - PawnScores * pos.count(BLACK); + // Early exit if score is high Value v = (mg_value(score) + eg_value(score)) / 2; if (abs(v) > LazyThreshold) @@ -865,14 +1019,45 @@ namespace { + pieces() - pieces() + pieces() - pieces(); - score += mobility[WHITE] - mobility[BLACK]; - - score += king< WHITE>() - king< BLACK>() - + threats() - threats() - + passed< WHITE>() - passed< BLACK>() - + space< WHITE>() - space< BLACK>(); - - score += initiative(eg_value(score)); + Value v_Dynamic_test = v; + + constexpr double DYNAMIC_ADVANTAGE_PAWNS_COUNT = 1.0; + constexpr Value DYNAMIC_ADVANTAGE_VALUE = Value(int(DYNAMIC_ADVANTAGE_PAWNS_COUNT * double(PawnValueMg + PawnValueEg) / 2.0)); + constexpr double Dynamic_Scale_Factor_Default = 1.0; + + double king_Dynamic_scale = Dynamic_Scale_Factor_Default; + double passed_Dynamic_scale = Dynamic_Scale_Factor_Default; + + constexpr double Dynamic_Winning_Scale_Factor_Default = 0.05; + constexpr double Alpha = 0.5; + const double Beta = fabs(Dynamic_Winning_Scale_Factor_Default * 2 / (MidgameLimit + EndgameLimit)); + + const double Dynamic_Scale_Factor_Bonus = (-abs(v_Dynamic_test / DYNAMIC_ADVANTAGE_VALUE) + Alpha); + + if (abs(v_Dynamic_test) >= double(PawnValueMg + PawnValueEg) / 2.0) + { + king_Dynamic_scale = Dynamic_Scale_Factor_Default - Dynamic_Scale_Factor_Bonus * Beta; + } + else + { + passed_Dynamic_scale = Dynamic_Scale_Factor_Default + Dynamic_Scale_Factor_Bonus * Beta; + } + + score += mobility[WHITE] - mobility[BLACK]; + Score default_king = king< WHITE>() - king< BLACK>(); + Score score_king = Score(int(double(default_king) * king_Dynamic_scale)); + score += score_king; + score += threats() - threats(); + Score default_passed = passed< WHITE>() - passed< BLACK>(); + Score score_passed = Score(int(double(default_passed) * passed_Dynamic_scale)); + score += score_passed; + score += space< WHITE>() - space< BLACK>(); + score += initiative(eg_value(score)); + + +#ifdef PAWN_SCORES + score += pawn_center() - pawn_center(); +#endif // Interpolate between a middlegame and a (scaled by 'sf') endgame score ScaleFactor sf = scale_factor(eg_value(score)); @@ -929,6 +1114,9 @@ std::string Eval::trace(const Position& pos) { << " Imbalance | " << Term(IMBALANCE) << " Initiative | " << Term(INITIATIVE) << " Pawns | " << Term(PAWN) +#ifdef PAWN_SCORES + << " Pawns Bonus | " << Term(CENTER) +#endif << " Knights | " << Term(KNIGHT) << " Bishops | " << Term(BISHOP) << " Rooks | " << Term(ROOK) diff --git a/Engines/Linux32/mcbrain/src/evaluate.h b/Engines/Linux32/mcbrain/src/evaluate.h index 5008072..976ccec 100644 --- a/Engines/Linux32/mcbrain/src/evaluate.h +++ b/Engines/Linux32/mcbrain/src/evaluate.h @@ -22,7 +22,6 @@ #ifndef EVALUATE_H_INCLUDED #define EVALUATE_H_INCLUDED -#include #include #include "types.h" diff --git a/Engines/Linux32/mcbrain/src/main.cpp b/Engines/Linux32/mcbrain/src/main.cpp index ee0ebe5..e62f857 100644 --- a/Engines/Linux32/mcbrain/src/main.cpp +++ b/Engines/Linux32/mcbrain/src/main.cpp @@ -20,6 +20,12 @@ */ #include +#include +#include +#include +#include +#include +#include #include "bitboard.h" #include "position.h" @@ -36,18 +42,51 @@ namespace PSQT { int main(int argc, char* argv[]) { - std::cout << engine_info() << std::endl; + { +#ifdef _WIN32 + const size_t time_length_const = 100; + char time_local[time_length_const]; + memset(time_local, char(0), time_length_const); + time_t result = time(NULL); + tm tm_local; + errno_t errno_local = localtime_s(&tm_local, &result); + if (errno_local == 0) + { + errno_local = asctime_s(time_local, time_length_const, &tm_local); + if (errno_local == 0) + { + std::cout << time_local; + } + else + { + assert(errno_local != 0); + } + } + else + { + assert(errno_local != 0); + } +#else + std::time_t result = std::time(NULL); + std::cout << std::asctime(std::localtime(&result)); +#endif + } + + std::cout << hardware_info() << std::endl; + std::cout << system_info() << std::endl; + std::cout << engine_info() << std::endl; + std::cout << cores_info() << std::endl; UCI::init(Options); PSQT::init(); Bitboards::init(); Position::init(); Bitbases::init(); - Search::init(); + + Search::init(Options["Clear Search"]); Pawns::init(); polybook.init(Options["BookFile"]); Tablebases::init(Options["SyzygyPath"]); // After Bitboards are set - TT.resize(Options["Hash"]); Threads.set(Options["Threads"]); Search::clear(); // After threads are up diff --git a/Engines/Linux32/mcbrain/src/material.cpp b/Engines/Linux32/mcbrain/src/material.cpp index c5fb9d7..760d671 100644 --- a/Engines/Linux32/mcbrain/src/material.cpp +++ b/Engines/Linux32/mcbrain/src/material.cpp @@ -35,12 +35,12 @@ namespace { constexpr int QuadraticOurs[][PIECE_TYPE_NB] = { // OUR PIECES // pair pawn knight bishop rook queen - {1667 }, // Bishop pair - { 40, 0 }, // Pawn - { 32, 255, -3 }, // Knight OUR PIECES + {1438 }, // Bishop pair + { 40, 38 }, // Pawn + { 32, 255, -62 }, // Knight OUR PIECES { 0, 104, 4, 0 }, // Bishop - { -26, -2, 47, 105, -149 }, // Rook - {-189, 24, 117, 133, -134, -10 } // Queen + { -26, -2, 47, 105, -208 }, // Rook + {-189, 24, 117, 133, -134, -6 } // Queen }; constexpr int QuadraticTheirs[][PIECE_TYPE_NB] = { @@ -56,7 +56,8 @@ namespace { // Endgame evaluation and scaling functions are accessed directly and not through // the function maps because they correspond to more than one material hash key. - Endgame EvaluateKXK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame EvaluateKXK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame EvaluateKQXKX[] = { Endgame(WHITE), Endgame(BLACK) }; Endgame ScaleKBPsK[] = { Endgame(WHITE), Endgame(BLACK) }; Endgame ScaleKQKRPs[] = { Endgame(WHITE), Endgame(BLACK) }; @@ -69,6 +70,14 @@ namespace { && pos.non_pawn_material(us) >= RookValueMg; } + bool is_KQXKX(const Position& pos, Color us) { + return more_than_one(pos.pieces(~us)) + && !pos.count(~us) + && pos.non_pawn_material(~us) <= RookValueMg + && pos.count(us) + && pos.non_pawn_material(us) > QueenValueMg + RookValueMg; + } + bool is_KBPsK(const Position& pos, Color us) { return pos.non_pawn_material(us) == BishopValueMg && pos.count(us) == 1 @@ -78,7 +87,7 @@ namespace { bool is_KQKRPs(const Position& pos, Color us) { return !pos.count(us) && pos.non_pawn_material(us) == QueenValueMg - && pos.count(us) == 1 + && pos.count(us) == 1 && pos.count(~us) == 1 && pos.count(~us) >= 1; } @@ -145,15 +154,22 @@ Entry* probe(const Position& pos) { return e; for (Color c = WHITE; c <= BLACK; ++c) + { if (is_KXK(pos, c)) { e->evaluationFunction = &EvaluateKXK[c]; return e; } + else if (is_KQXKX(pos, c)) + { + e->evaluationFunction = &EvaluateKQXKX[c]; + return e; + } + } // OK, we didn't find any special evaluation function for the current material // configuration. Is there a suitable specialized scaling function? - EndgameBase* sf; + const EndgameBase* sf; if ((sf = pos.this_thread()->endgames.probe(key)) != nullptr) { diff --git a/Engines/Linux32/mcbrain/src/material.h b/Engines/Linux32/mcbrain/src/material.h index 95d6c84..e15f2e0 100644 --- a/Engines/Linux32/mcbrain/src/material.h +++ b/Engines/Linux32/mcbrain/src/material.h @@ -57,9 +57,9 @@ struct Entry { } Key key; - EndgameBase* evaluationFunction; - EndgameBase* scalingFunction[COLOR_NB]; // Could be one for each - // side (e.g. KPKP, KBPsKs) + const EndgameBase* evaluationFunction; + const EndgameBase* scalingFunction[COLOR_NB]; // Could be one for each + // side (e.g. KPKP, KBPsKs) int16_t value; uint8_t factor[COLOR_NB]; Phase gamePhase; diff --git a/Engines/Linux32/mcbrain/src/misc.cpp b/Engines/Linux32/mcbrain/src/misc.cpp index e5f8107..36697c2 100644 --- a/Engines/Linux32/mcbrain/src/misc.cpp +++ b/Engines/Linux32/mcbrain/src/misc.cpp @@ -35,10 +35,12 @@ // the calls at compile time), try to load them at runtime. To do this we need // first to define the corresponding function pointers. extern "C" { -typedef bool(*fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP, +typedef bool(WINAPI *fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD); -typedef bool(*fun2_t)(USHORT, PGROUP_AFFINITY); -typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); +typedef bool(WINAPI *fun2_t)(USHORT, PGROUP_AFFINITY); +typedef bool(WINAPI *fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); + +#include "VersionHelpers.h" } #endif @@ -47,7 +49,7 @@ typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); #include #include #include - +#include #include "misc.h" #include "thread.h" @@ -57,8 +59,13 @@ namespace { /// Version number. If Version is left empty, then compile date in the format /// DD-MM-YY and show in engine_info. -const string Version = "9.1"; +#ifdef Maverick +const string Version = "the Maverick"; +#else +const string Version = "9.9"; +#endif + /// Our fancy logging facility. The trick here is to replace cin.rdbuf() and /// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We /// can toggle the logging of std::cout and std:cin at runtime whilst preserving @@ -117,9 +124,9 @@ class Logger { } // namespace -/// engine_info() returns the full name of the current Stockfish version. This -/// will be either "Stockfish DD-MM-YY" (where DD-MM-YY is the date when -/// the program was compiled) or "Stockfish ", depending on whether +/// engine_info() returns the full name of the current SugaR version. This +/// will be either "SugaR DD-MM-YY" (where DD-MM-YY is the date when +/// the program was compiled) or "SugaR ", depending on whether /// Version is empty. const string engine_info(bool to_uci) { @@ -127,21 +134,245 @@ const string engine_info(bool to_uci) { const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); string month, day, year; stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008" - +#ifdef Maverick + ss << "McCain-v2 -> " << Version << setfill('0'); +#else ss << "McBrain " << Version << setfill('0'); - +#endif + if (Version.empty()) { date >> month >> day >> year; ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2); } +#ifdef Maverick + ss //<< (Is64Bit ? " 64" : " 32") + //<< (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : "")) + << (to_uci ? "\nid author ": "->") + << "dedicated to John S McCain, an American Hero."; +#else + ss << (Is64Bit ? " 64" : " 32") + << (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : "")) + << (to_uci ? "\nid author ": " by ") + << "M. Byrne and scores of others..."; +#endif + + return ss.str(); +} + +const std::string system_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + InitVersion(); + + if (IsWindowsXPOrGreater()) + { + if (IsWindowsXPSP1OrGreater()) + { + if (IsWindowsXPSP2OrGreater()) + { + if (IsWindowsXPSP3OrGreater()) + { + if (IsWindowsVistaOrGreater()) + { + if (IsWindowsVistaSP1OrGreater()) + { + if (IsWindowsVistaSP2OrGreater()) + { + if (IsWindows7OrGreater()) + { + if (IsWindows7SP1OrGreater()) + { + if (IsWindows8OrGreater()) + { + if (IsWindows8Point1OrGreater()) + { + if (IsWindows10OrGreater()) + { + result << std::string("Windows 10"); + } + else + { + result << std::string("Windows 8.1"); + } + } + else + { + result << std::string("Windows 8"); + } + } + else + { + result << std::string("Windows 7 SP1"); + } + } + else + { + result << std::string("Windows 7"); + } + } + else + { + result << std::string("Vista SP2"); + } + } + else + { + result << std::string("Vista SP1"); + } + } + else + { + result << std::string("Vista"); + } + } + else + { + result << std::string("XP SP3"); + } + } + else + { + result << std::string("XP SP2"); + } + } + else + { + result << std::string("XP SP1"); + } + } + else + { + result << std::string("XP"); + } + } + + if (IsWindowsServer()) + { + result << std::string(" Server "); + } + else + { + result << std::string(" Client "); + } + + result << std::string("Or Greater") << std::endl; + + result << std::endl; + } +#endif + + return result.str(); +} + +const std::string hardware_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + SYSTEM_INFO siSysInfo; + + // Copy the hardware information to the SYSTEM_INFO structure. + + GetSystemInfo(&siSysInfo); + + HKEY hKey = HKEY_LOCAL_MACHINE; + const DWORD Const_Data_Size = 10000; + TCHAR Data[Const_Data_Size]; + + ZeroMemory(Data, Const_Data_Size * sizeof(TCHAR)); + + DWORD buffersize = Const_Data_Size; + + LONG result_registry_functions = ERROR_SUCCESS; + + result_registry_functions = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0\\"), 0, KEY_READ, &hKey); + + if (result_registry_functions == ERROR_SUCCESS) + { + // Query the registry value + result_registry_functions = RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)&Data, &buffersize); + + if (result_registry_functions == ERROR_SUCCESS) + { + // Close the Registry Key + result_registry_functions = RegCloseKey(hKey); + + assert(result_registry_functions == ERROR_SUCCESS); + } + else + { + assert(result_registry_functions == ERROR_SUCCESS); + } + } + else + { + assert(result_registry_functions == ERROR_SUCCESS); + } + + std::string ProcessorName(Data); + + // Display the contents of the SYSTEM_INFO structure. + + result << std::endl; + + result << "Hardware information : " << std::endl; + result << " CPU Brand : " << ProcessorName << std::endl; + //result << " CPU Architecture : " << siSysInfo.wProcessorArchitecture << std::endl; + result << " CPU Core : " << siSysInfo.dwNumberOfProcessors << std::endl; + //result << " Processor type : " << siSysInfo.dwProcessorType << std::endl; + + // Used to convert bytes to MB + const size_t local_1000_000 = 1000 * 1000; + + MEMORYSTATUSEX statex; + + statex.dwLength = sizeof(statex); + + GlobalMemoryStatusEx(&statex); + + result << " Total RAM : " << statex.ullTotalPhys / local_1000_000 << "MB" << std::endl; + + result << std::endl; + } +#endif + + return result.str(); +} + +const std::string cores_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + SYSTEM_INFO siSysInfo; + + // Copy the hardware information to the SYSTEM_INFO structure. + + GetSystemInfo(&siSysInfo); + + result << std::endl; + + DWORD n = DWORD(std::thread::hardware_concurrency()); + result << "Test running " << n << " Cores\n"; + + DWORD local_mask = siSysInfo.dwActiveProcessorMask; + + for (DWORD core_counter = 0; core_counter DEPTH_ZERO); @@ -74,8 +74,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist /// MovePicker constructor for quiescence search MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh, - const CapturePieceToHistory* cph, Square rs) - : pos(p), mainHistory(mh), captureHistory(cph), recaptureSquare(rs), depth(d) { + const CapturePieceToHistory* cph, const PieceToHistory** ch, Square rs) + : pos(p), mainHistory(mh), captureHistory(cph), continuationHistory(ch), recaptureSquare(rs), depth(d) { assert(d <= DEPTH_ZERO); @@ -112,13 +112,13 @@ void MovePicker::score() { for (auto& m : *this) if (Type == CAPTURES) m.value = PieceValue[MG][pos.piece_on(to_sq(m))] - + (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 16; + + (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 8; else if (Type == QUIETS) m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] - + (*contHistory[0])[pos.moved_piece(m)][to_sq(m)] - + (*contHistory[1])[pos.moved_piece(m)][to_sq(m)] - + (*contHistory[3])[pos.moved_piece(m)][to_sq(m)]; + + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)] + + (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)] + + (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]; else // Type == EVASIONS { @@ -126,7 +126,9 @@ void MovePicker::score() { m.value = PieceValue[MG][pos.piece_on(to_sq(m))] - Value(type_of(pos.moved_piece(m))); else - m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] - (1 << 28); + m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] + + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)] + - (1 << 28); } } diff --git a/Engines/Linux32/mcbrain/src/movepick.h b/Engines/Linux32/mcbrain/src/movepick.h index ea9ea26..377874a 100644 --- a/Engines/Linux32/mcbrain/src/movepick.h +++ b/Engines/Linux32/mcbrain/src/movepick.h @@ -37,18 +37,16 @@ template class StatsEntry { - static const bool IsInt = std::is_integral::value; - typedef typename std::conditional::type TT; - T entry; public: - T* get() { return &entry; } void operator=(const T& v) { entry = v; } - operator TT() const { return entry; } + T* operator&() { return &entry; } + T* operator->() { return &entry; } + operator const T&() const { return entry; } void operator<<(int bonus) { - assert(abs(bonus) <= D); // Ensure range is [-D, D] + assert(abs(bonus) <= D); // Ensure range is [-D, D] static_assert(D <= std::numeric_limits::max(), "D overflows T"); entry += bonus - entry * abs(bonus) / D; @@ -65,18 +63,21 @@ class StatsEntry { template struct Stats : public std::array, Size> { - T* get() { return this->at(0).get(); } + typedef Stats stats; void fill(const T& v) { - T* p = get(); - std::fill(p, p + sizeof(*this) / sizeof(*p), v); + + // For standard-layout 'this' points to first struct member + assert(std::is_standard_layout::value); + + typedef StatsEntry entry; + entry* p = reinterpret_cast(this); + std::fill(p, p + sizeof(*this) / sizeof(entry), v); } }; template -struct Stats : public std::array, Size> { - T* get() { return this->at(0).get(); } -}; +struct Stats : public std::array, Size> {}; /// In stats table, D=0 means that the template parameter is not used enum StatsParams { NOT_USED = 0 }; @@ -86,14 +87,14 @@ enum StatsParams { NOT_USED = 0 }; /// unsuccessful during the current search, and is used for reduction and move /// ordering decisions. It uses 2 tables (one for each color) indexed by /// the move's from and to squares, see chessprogramming.wikispaces.com/Butterfly+Boards -typedef Stats ButterflyHistory; +typedef Stats ButterflyHistory; /// CounterMoveHistory stores counter moves indexed by [piece][to] of the previous /// move, see chessprogramming.wikispaces.com/Countermove+Heuristic typedef Stats CounterMoveHistory; /// CapturePieceToHistory is addressed by a move's [piece][to][captured piece type] -typedef Stats CapturePieceToHistory; +typedef Stats CapturePieceToHistory; /// PieceToHistory is like ButterflyHistory but is addressed by a move's [piece][to] typedef Stats PieceToHistory; @@ -118,10 +119,16 @@ class MovePicker { MovePicker(const MovePicker&) = delete; MovePicker& operator=(const MovePicker&) = delete; MovePicker(const Position&, Move, Value, const CapturePieceToHistory*); - MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, Square); - MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, const PieceToHistory**, Move, Move*); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Square); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Move, + Move*); Move next_move(bool skipQuiets = false); - bool is_refutation(Move m) const { return m == refutations[0] || m == refutations[1] || m == refutations[2]; } private: template Move select(Pred); @@ -132,7 +139,7 @@ class MovePicker { const Position& pos; const ButterflyHistory* mainHistory; const CapturePieceToHistory* captureHistory; - const PieceToHistory** contHistory; + const PieceToHistory** continuationHistory; Move ttMove; ExtMove refutations[3], *cur, *endMoves, *endBadCaptures; int stage; diff --git a/Engines/Linux32/mcbrain/src/pawns.cpp b/Engines/Linux32/mcbrain/src/pawns.cpp index a92df0a..bce5d3a 100644 --- a/Engines/Linux32/mcbrain/src/pawns.cpp +++ b/Engines/Linux32/mcbrain/src/pawns.cpp @@ -27,54 +27,58 @@ #include "position.h" #include "thread.h" +//#define PAWN_SCORES //not inclued in McCain + namespace { #define V Value #define S(mg, eg) make_score(mg, eg) - // Isolated pawn penalty - constexpr Score Isolated = S(13, 18); + // Pawn penalties + constexpr Score Isolated = S( 5, 15); + constexpr Score Backward = S( 9, 24); + constexpr Score Doubled = S(11, 56); + + +#ifdef PAWN_SCORES + // Pawn Scores Isolated in Rank 3 + constexpr Score PawnScoresIsolatedRank3 = S(- 5, + 0); - // Backward pawn penalty - constexpr Score Backward = S(24, 12); + // Pawn Scores Connected Passed + constexpr Score PawnScoresConnectedPassed = S(-16, +16); + constexpr Score KingSafetyCompensationPawnScoresConnectedPassed = S(- 5, + 0); + // Protected Passed Pawn + constexpr Score ProtectedPassedPawn = S(+ 5, + 5); + constexpr Score RemotePassedPawn = S(+ 4, + 4); + +#endif // Connected pawn bonus by opposed, phalanx, #support and rank Score Connected[2][2][3][RANK_NB]; - // Doubled pawn penalty - constexpr Score Doubled = S(18, 38); - // Strength of pawn shelter for our king by [distance from edge][rank]. // RANK_1 = 0 is used for files where we have no pawn, or pawn is behind our king. constexpr Value ShelterStrength[int(FILE_NB) / 2][RANK_NB] = { - { V( -9), V(64), V(77), V( 44), V( 4), V( -1), V(-11) }, - { V(-15), V(83), V(51), V(-10), V( 1), V(-10), V(-28) }, - { V(-18), V(84), V(27), V(-12), V(21), V( -7), V(-36) }, - { V( 12), V(79), V(25), V( 19), V( 9), V( -6), V(-33) } + { V( -6), V( 81), V( 93), V( 58), V( 39), V( 18), V( 25) }, + { V(-43), V( 61), V( 35), V(-49), V(-29), V(-11), V( -63) }, + { V(-10), V( 75), V( 23), V( -2), V( 32), V( 3), V( -45) }, + { V(-39), V(-13), V(-29), V(-52), V(-48), V(-67), V(-166) } }; - // Danger of enemy pawns moving toward our king by [type][distance from edge][rank]. - // For the unopposed and unblocked cases, RANK_1 = 0 is used when opponent has - // no pawn on the given file, or their pawn is behind our king. - constexpr Value StormDanger[][4][RANK_NB] = { - { { V( 0), V(-290), V(-274), V(57), V(41) }, // BlockedByKing - { V( 0), V( 60), V( 144), V(39), V(13) }, - { V( 0), V( 65), V( 141), V(41), V(34) }, - { V( 0), V( 53), V( 127), V(56), V(14) } }, - { { V( 4), V( 73), V( 132), V(46), V(31) }, // Unopposed - { V( 1), V( 64), V( 143), V(26), V(13) }, - { V( 1), V( 47), V( 110), V(44), V(24) }, - { V( 0), V( 72), V( 127), V(50), V(31) } }, - { { V( 0), V( 0), V( 19), V(23), V( 1) }, // BlockedByPawn - { V( 0), V( 0), V( 88), V(27), V( 2) }, - { V( 0), V( 0), V( 101), V(16), V( 1) }, - { V( 0), V( 0), V( 111), V(22), V(15) } }, - { { V(22), V( 45), V( 104), V(62), V( 6) }, // Unblocked - { V(31), V( 30), V( 99), V(39), V(19) }, - { V(23), V( 29), V( 96), V(41), V(15) }, - { V(21), V( 23), V( 116), V(41), V(15) } } + // Danger of enemy pawns moving toward our king by [distance from edge][rank]. + // RANK_1 = 0 is used for files where the enemy has no pawn, or their pawn + // is behind our king. + constexpr Value UnblockedStorm[int(FILE_NB) / 2][RANK_NB] = { + { V( 89), V(107), V(123), V(93), V(57), V( 45), V( 51) }, + { V( 44), V(-18), V(123), V(46), V(39), V( -7), V( 23) }, + { V( 4), V( 52), V(162), V(37), V( 7), V(-14), V( -2) }, + { V(-10), V(-14), V( 90), V(15), V( 2), V( -7), V(-16) } }; + // Danger of blocked enemy pawns storming our king, by rank + constexpr Value BlockedStorm[RANK_NB] = + { V(0), V(0), V(66), V(6), V(5), V(1), V(15) }; + #undef S #undef V @@ -121,29 +125,16 @@ namespace { phalanx = neighbours & rank_bb(s); supported = neighbours & rank_bb(s - Up); - // A pawn is backward when it is behind all pawns of the same color on the - // adjacent files and cannot be safely advanced. - if (!neighbours || lever || relative_rank(Us, s) >= RANK_5) - backward = false; - else - { - // Find the backmost rank with neighbours or stoppers - b = rank_bb(backmost_sq(Us, neighbours | stoppers)); - - // The pawn is backward when it cannot safely progress to that rank: - // either there is a stopper in the way on this rank, or there is a - // stopper on adjacent file which controls the way to that rank. - backward = (b | shift(b & adjacent_files_bb(f))) & stoppers; - - assert(!(backward && (forward_ranks_bb(Them, s + Up) & neighbours))); - } + // A pawn is backward when it is behind all pawns of the same color + // on the adjacent files and cannot be safely advanced. + backward = !(ourPawns & pawn_attack_span(Them, s + Up)) + && (stoppers & (leverPush | (s + Up))); // Passed pawns will be properly scored in evaluation because we need // full attack info to evaluate them. Include also not passed pawns // which could become passed after one or two pawn pushes when are // not attacked more times than defended. if ( !(stoppers ^ lever ^ leverPush) - && !(ourPawns & forward_file_bb(Us, s)) && popcount(supported) >= popcount(lever) - 1 && popcount(phalanx) >= popcount(leverPush)) e->passedPawns[Us] |= s; @@ -162,18 +153,170 @@ namespace { score += Connected[opposed][bool(phalanx)][popcount(supported)][relative_rank(Us, s)]; else if (!neighbours) - score -= Isolated, e->weakUnopposed[Us] += !opposed; - - else if (backward) - score -= Backward, e->weakUnopposed[Us] += !opposed; - - if (doubled && !supported) - score -= Doubled; - } - - return score; - } - + { + score -= Isolated, e->weakUnopposed[Us] += !opposed; + +#ifdef PAWN_SCORES + if (relative_rank(Us, s) == RANK_3) + { + score += PawnScoresIsolatedRank3; + } +#endif + } + + else if (backward) + score -= Backward, e->weakUnopposed[Us] += !opposed; + + + if (doubled && !supported) + score -= Doubled; + +#ifdef PAWN_SCORES + bool protected_passed_pawn = false; + + bool passed1 = bool(passed_pawn_mask(Us, s) & ourPawns); + + //File fp1 = file_of(s); + Rank rp1 = rank_of(s); + + File fp0 = f; + File fp2 = f; + + if (fp0 > FILE_A) + { + fp0 = File(fp0 - 1); + } + + if (f < FILE_H) + { + fp2 = File(fp2 + 1); + } + + Rank rpp = rp1; + + if (Us == WHITE) + { + if (rpp > RANK_2) + { + rpp = Rank(rpp - 1); + } + } + else + { + if (rpp < RANK_7) + { + rpp = Rank(rpp + 1); + } + } + + if (rpp != rp1) + { + if (fp0 != f) + { + protected_passed_pawn = make_piece(Us, PAWN) == pos.piece_on(make_square(fp0, rpp)); + } + + if (fp2 != f) + { + protected_passed_pawn = protected_passed_pawn || (make_piece(Us, PAWN) == pos.piece_on(make_square(fp2, rpp))); + } + + if (passed1 && protected_passed_pawn) + { + score += ProtectedPassedPawn; + } + } + + if (passed1) + { + bool passed_in_flang = (f < FILE_C) || (f > FILE_F); + + if (passed_in_flang) + { + score += RemotePassedPawn; + } + } +#endif + } + +#ifdef PAWN_SCORES + const Square* pl_1 = pos.squares(Us); + + // Loop through all pawns of the current color and score each pawn + while ((s = *pl_1++) != SQ_NONE) + { + assert(pos.piece_on(s) == make_piece(Us, PAWN)); + + File f = file_of(s); + + File f0 = f; + File f2 = f; + + if (f0 > FILE_A) + { + f0 = File(f0 - 1); + } + + if (f < FILE_H) + { + f2 = File(f2 + 1); + } + + bool passed1 = bool(passed_pawn_mask(Us, s) & ourPawns); + + if (f0 != f) + { + bool passed0 = false; + + if (passed1) + { + for (Rank r0 = RANK_2; r0 <= RANK_7; r0 = Rank(r0 + 1)) + { + Square s0 = make_square(f0, r0); + + if (pos.piece_on(s0) == make_piece(Us, PAWN)) + { + passed0 = e->passedPawns[Us] & s0; + + if (passed0) + { + break; + } + } + } + + if (passed0 && passed1) + { + score += PawnScoresConnectedPassed; + + Square UsKingSquare = SQ_A1; + + Piece UsKing = make_piece(Us, KING); + + while (pos.piece_on(UsKingSquare) != UsKing) + { + UsKingSquare = Square(UsKingSquare + 1); + + assert(UsKingSquare != SQUARE_NB); + } + + File UsKingFile = file_of(UsKingSquare); + //Rank UsKingRank = rank_of(UsKingSquare); + + bool connected_passed_defend_king = (UsKingFile >= f0 && UsKingFile <= f2); + + if (connected_passed_defend_king) + { + score += KingSafetyCompensationPawnScoresConnectedPassed; + } + } + } + } + } +#endif + + return score; + } } // namespace namespace Pawns { @@ -184,7 +327,7 @@ namespace Pawns { void init() { - static constexpr int Seed[RANK_NB] = { 0, 13, 24, 18, 76, 100, 175, 330 }; + static constexpr int Seed[RANK_NB] = { 0, 13, 24, 18, 65, 100, 175, 330 }; for (int opposed = 0; opposed <= 1; ++opposed) for (int phalanx = 0; phalanx <= 1; ++phalanx) @@ -229,32 +372,36 @@ Entry* probe(const Position& pos) { template Value Entry::evaluate_shelter(const Position& pos, Square ksq) { - enum { BlockedByKing, Unopposed, BlockedByPawn, Unblocked }; constexpr Color Them = (Us == WHITE ? BLACK : WHITE); constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH); + constexpr Bitboard BlockRanks = (Us == WHITE ? Rank1BB | Rank2BB : Rank8BB | Rank7BB); - Bitboard b = pos.pieces(PAWN) & (forward_ranks_bb(Us, ksq) | rank_bb(ksq)); + Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq); Bitboard ourPawns = b & pos.pieces(Us); Bitboard theirPawns = b & pos.pieces(Them); - - Value safety = (ourPawns & file_bb(ksq)) ? Value(5) : Value(-5); +#ifdef Maverick + Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ? + Value(448) : Value(6); +#else + Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ? + Value(374) : Value(5); +#endif File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq))); for (File f = File(center - 1); f <= File(center + 1); ++f) { - b = ourPawns & file_bb(f); - Rank rkUs = b ? relative_rank(Us, backmost_sq(Us, b)) : RANK_1; + if (more_than_one(theirPawns & FileBB[f])) safety -= Value( 18); + + b = ourPawns & file_bb(f); + int ourRank = b ? relative_rank(Us, backmost_sq(Us, b)) : 0; b = theirPawns & file_bb(f); - Rank rkThem = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1; + int theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : 0; int d = std::min(f, ~f); - safety += ShelterStrength[d][rkUs] - - StormDanger - [(shift(b) & ksq) ? BlockedByKing : - rkUs == RANK_1 ? Unopposed : - rkThem == (rkUs + 1) ? BlockedByPawn : Unblocked] - [d][rkThem]; + safety += ShelterStrength[d][ourRank]; + safety -= (ourRank && (ourRank == theirRank - 1)) ? BlockedStorm[theirRank] + : UnblockedStorm[d][theirRank]; } return safety; @@ -273,7 +420,7 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) { Bitboard pawns = pos.pieces(Us, PAWN); if (pawns) - while (!(DistanceRingBB[ksq][minKingPawnDistance++] & pawns)) {} + while (!(DistanceRingBB[ksq][++minKingPawnDistance] & pawns)) {} Value bonus = evaluate_shelter(pos, ksq); diff --git a/Engines/Linux32/mcbrain/src/polybook.cpp b/Engines/Linux32/mcbrain/src/polybook.cpp index 9aaacb4..6d27fb5 100644 --- a/Engines/Linux32/mcbrain/src/polybook.cpp +++ b/Engines/Linux32/mcbrain/src/polybook.cpp @@ -21,7 +21,7 @@ // polybook.cpp was written by Thomas Ziproth /* BrainFish, a UCI chess playing engine derived from Stockfish -Copyright (C) 2016-2017 Thomas Zipproth +Copyright (C) 2016-2018 Thomas Zipproth BrainFish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,8 +33,8 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "polybook.h" @@ -353,17 +353,25 @@ PolyBook::~PolyBook() void PolyBook::init(const std::string& bookfile) { if (bookfile.length() == 0) return; - const char *fnam = bookfile.c_str(); + const char *file_name = bookfile.c_str(); - if (strcmp(fnam, "") == 0) + if (strcmp(file_name, "") == 0) { enabled = false; return; } - FILE *fpt = fopen(fnam, "rb"); +#ifdef _WIN32 + FILE *fpt; + errno_t errno_local = fopen_s(&fpt, file_name, "rb"); + if (fpt == NULL || errno_local != 0) + { + assert(errno_local != 0); +#else + FILE *fpt = fopen(file_name, "rb"); if (fpt == NULL) { +#endif sync_cout << "info string Could not open " << bookfile << sync_endl; enabled = false; return; diff --git a/Engines/Linux32/mcbrain/src/polybook.h b/Engines/Linux32/mcbrain/src/polybook.h index 8696eda..8c0d11a 100644 --- a/Engines/Linux32/mcbrain/src/polybook.h +++ b/Engines/Linux32/mcbrain/src/polybook.h @@ -34,8 +34,8 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef POLYBOOK_H_INCLUDED diff --git a/Engines/Linux32/mcbrain/src/position.cpp b/Engines/Linux32/mcbrain/src/position.cpp index 67a9f00..2c10df8 100644 --- a/Engines/Linux32/mcbrain/src/position.cpp +++ b/Engines/Linux32/mcbrain/src/position.cpp @@ -37,10 +37,6 @@ using std::string; -namespace PSQT { - extern Score psq[PIECE_NB][SQUARE_NB]; -} - namespace Zobrist { Key psq[PIECE_NB][SQUARE_NB]; @@ -131,11 +127,17 @@ std::ostream& operator<<(std::ostream& os, const Position& pos) { } -// Marcel Kervinck's algorithm for Deep Blue’s "upcoming repetition" / "no progress" detectors -Key cuckoo[0x2000]; // Cuckoo table with Zobrist hashes of valid reversible moves -int16_t cuckooMove[0x2000]; // The move for cuckoo[i] -#define H1(h)( (h) &0x1fff) // First hash function for indexing the cuckoo table -#define H2(h)(((h)>>16)&0x1fff) // Second hash function +// Marcel van Kervinck's cuckoo algorithm for fast detection of "upcoming repetition" +// situations. Description of the algorithm in the following paper: +// https://marcelk.net/2013-04-06/paper/upcoming-rep-v2.pdf + +// First and second hash functions for indexing the cuckoo tables +inline int H1(Key h) { return h & 0x1fff; } +inline int H2(Key h) { return (h >> 16) & 0x1fff; } + +// Cuckoo tables with Zobrist hashes of valid reversible moves, and the moves themselves +Key cuckoo[8192]; +Move cuckooMove[8192]; /// Position::init() initializes at startup the various arrays used to compute @@ -166,30 +168,29 @@ void Position::init() { Zobrist::side = rng.rand(); Zobrist::noPawns = rng.rand(); - int num = 0; + // Prepare the cuckoo tables + std::memset(cuckoo, 0, sizeof(cuckoo)); + std::memset(cuckooMove, 0, sizeof(cuckooMove)); + int count = 0; for (Piece pc : Pieces) - { for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) - { - Bitboard b = PseudoAttacks[type_of(pc)][s1] & ~(SquareBB[s1]-1); - while (b) - { - Square s2 = pop_lsb(&b); - int16_t move16 = make_move(s1, s2); - Key moveKey = Zobrist::psq[pc][s1] ^ Zobrist::psq[pc][s2] ^ Zobrist::side; - unsigned int i = H1(moveKey); - while(true) - { // Insert in cuckoo table - std::swap(cuckoo[i], moveKey); - std::swap(cuckooMove[i], move16); - if (moveKey == 0) break; // Arrived at empty; slot so we are done for this move - i = (i == H1(moveKey)) ? H2(moveKey) : H1(moveKey); // Push victim to alternative slot - } - num++; - } - } - } - assert(num == 3668); + for (Square s2 = Square(s1 + 1); s2 <= SQ_H8; ++s2) + if (PseudoAttacks[type_of(pc)][s1] & s2) + { + Move move = make_move(s1, s2); + Key key = Zobrist::psq[pc][s1] ^ Zobrist::psq[pc][s2] ^ Zobrist::side; + int i = H1(key); + while (true) + { + std::swap(cuckoo[i], key); + std::swap(cuckooMove[i], move); + if (move == 0) // Arrived at empty slot ? + break; + i = (i == H1(key)) ? H2(key) : H1(key); // Push victim to alternative slot + } + count++; + } + assert(count == 3668); } @@ -379,7 +380,6 @@ void Position::set_state(StateInfo* si) const { si->key = si->materialKey = 0; si->pawnKey = Zobrist::noPawns; si->nonPawnMaterial[WHITE] = si->nonPawnMaterial[BLACK] = VALUE_ZERO; - si->psq = SCORE_ZERO; si->checkersBB = attackers_to(square(sideToMove)) & pieces(~sideToMove); set_check_info(si); @@ -389,7 +389,6 @@ void Position::set_state(StateInfo* si) const { Square s = pop_lsb(&b); Piece pc = piece_on(s); si->key ^= Zobrist::psq[pc][s]; - si->psq += PSQT::psq[pc][s]; } if (si->epSquare != SQ_NONE) @@ -750,7 +749,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { Square rfrom, rto; do_castling(us, from, to, rfrom, rto); - st->psq += PSQT::psq[captured][rto] - PSQT::psq[captured][rfrom]; k ^= Zobrist::psq[captured][rfrom] ^ Zobrist::psq[captured][rto]; captured = NO_PIECE; } @@ -789,9 +787,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { st->materialKey ^= Zobrist::psq[captured][pieceCount[captured]]; prefetch(thisThread->materialTable[st->materialKey]); - // Update incremental scores - st->psq -= PSQT::psq[captured][capsq]; - // Reset rule 50 counter st->rule50 = 0; } @@ -845,9 +840,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion]-1] ^ Zobrist::psq[pc][pieceCount[pc]]; - // Update incremental score - st->psq += PSQT::psq[promotion][to] - PSQT::psq[pc][to]; - // Update material st->nonPawnMaterial[us] += PieceValue[MG][promotion]; } @@ -860,9 +852,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { st->rule50 = 0; } - // Update incremental scores - st->psq += PSQT::psq[pc][to] - PSQT::psq[pc][from]; - // Set capture piece st->capturedPiece = captured; @@ -1144,10 +1133,11 @@ bool Position::is_draw(int ply) const { bool Position::has_repeated() const { StateInfo* stc = st; - while (true) { - int i = 4, e = std::min(stc->rule50, stc->pliesFromNull); + while (true) + { + int i = 4, end = std::min(stc->rule50, stc->pliesFromNull); - if (e < i) + if (end < i) return false; StateInfo* stp = st->previous->previous; @@ -1159,7 +1149,7 @@ bool Position::has_repeated() const { return true; i += 2; - } while (i <= e); + } while (i <= end); stc = stc->previous; } @@ -1167,10 +1157,12 @@ bool Position::has_repeated() const { /// Position::has_game_cycle() tests if the position has a move which draws by repetition, -/// or an earlier position has a move that directly reaches this one. +/// or an earlier position has a move that directly reaches the current position. bool Position::has_game_cycle(int ply) const { + int j; + int end = std::min(st->rule50, st->pliesFromNull); if (end < 3) @@ -1178,36 +1170,39 @@ bool Position::has_game_cycle(int ply) const { Key originalKey = st->key; StateInfo* stp = st->previous; - Key progressKey = stp->key ^ Zobrist::side; for (int i = 3; i <= end; i += 2) { - stp = stp->previous; - progressKey ^= stp->key ^ Zobrist::side; - stp = stp->previous; - // "originalKey ==" detects upcoming repetition, "progressKey ==" detects no-progress - if (originalKey == (progressKey ^ stp->key) || progressKey == Zobrist::side) + stp = stp->previous->previous; + + Key moveKey = originalKey ^ stp->key; + if ( (j = H1(moveKey), cuckoo[j] == moveKey) + || (j = H2(moveKey), cuckoo[j] == moveKey)) { - Key moveKey = originalKey ^ stp->key; - unsigned int j = H1(moveKey); - if (cuckoo[j] == moveKey || (j = H2(moveKey), cuckoo[j] == moveKey)) + Move move = cuckooMove[j]; + Square s1 = from_sq(move); + Square s2 = to_sq(move); + + if (!(between_bb(s1, s2) & pieces())) { - Move m = Move(cuckooMove[j]); - if (!(between_bb(from_sq(m), to_sq(m)) & pieces())) { - if (ply > i) - return true; - // For repetitions before or at the root, require one more. - StateInfo* next_stp = stp; - for (int k = i+2; k <= end; k += 2) - { - next_stp = next_stp->previous->previous; - if (next_stp->key == stp->key) - return true; - } + // In the cuckoo table, both moves Rc1c5 and Rc5c1 are stored in the same + // location. We select the legal one by reversing the move variable if necessary. + if (empty(s1)) + move = make_move(s2, s1); + + if (ply > i) + return true; + + // For repetitions before or at the root, require one more + StateInfo* next_stp = stp; + for (int k = i + 2; k <= end; k += 2) + { + next_stp = next_stp->previous->previous; + if (next_stp->key == stp->key) + return true; } } } - progressKey ^= stp->key; } return false; } diff --git a/Engines/Linux32/mcbrain/src/position.h b/Engines/Linux32/mcbrain/src/position.h index 63ba265..b7e3a7a 100644 --- a/Engines/Linux32/mcbrain/src/position.h +++ b/Engines/Linux32/mcbrain/src/position.h @@ -44,7 +44,6 @@ struct StateInfo { int castlingRights; int rule50; int pliesFromNull; - Score psq; Square epSquare; // Not copied when making a move (will be recomputed anyhow) @@ -124,6 +123,7 @@ class Position { bool capture_or_promotion(Move m) const; bool gives_check(Move m) const; bool advanced_pawn_push(Move m) const; + bool promotion_pawn_push(Move m) const; Piece moved_piece(Move m) const; Piece captured_piece() const; @@ -189,11 +189,16 @@ class Position { Bitboard castlingPath[CASTLING_RIGHT_NB]; int gamePly; Color sideToMove; + Score psq; Thread* thisThread; StateInfo* st; bool chess960; }; +namespace PSQT { + extern Score psq[PIECE_NB][SQUARE_NB]; +} + extern std::ostream& operator<<(std::ostream& os, const Position& pos); inline Color Position::side_to_move() const { @@ -314,6 +319,10 @@ inline bool Position::advanced_pawn_push(Move m) const { return type_of(moved_piece(m)) == PAWN && relative_rank(sideToMove, from_sq(m)) > RANK_4; } +inline bool Position::promotion_pawn_push(Move m) const { + return type_of(moved_piece(m)) == PAWN + && relative_rank(sideToMove, to_sq(m)) == RANK_8; +}//MichaelB7 inline Key Position::key() const { return st->key; @@ -328,7 +337,7 @@ inline Key Position::material_key() const { } inline Score Position::psq_score() const { - return st->psq; + return psq; } inline Value Position::non_pawn_material(Color c) const { @@ -385,6 +394,7 @@ inline void Position::put_piece(Piece pc, Square s) { index[s] = pieceCount[pc]++; pieceList[pc][index[s]] = s; pieceCount[make_piece(color_of(pc), ALL_PIECES)]++; + psq += PSQT::psq[pc][s]; } inline void Position::remove_piece(Piece pc, Square s) { @@ -402,20 +412,22 @@ inline void Position::remove_piece(Piece pc, Square s) { pieceList[pc][index[lastSquare]] = lastSquare; pieceList[pc][pieceCount[pc]] = SQ_NONE; pieceCount[make_piece(color_of(pc), ALL_PIECES)]--; + psq -= PSQT::psq[pc][s]; } inline void Position::move_piece(Piece pc, Square from, Square to) { // index[from] is not updated and becomes stale. This works as long as index[] // is accessed just by known occupied squares. - Bitboard from_to_bb = SquareBB[from] ^ SquareBB[to]; - byTypeBB[ALL_PIECES] ^= from_to_bb; - byTypeBB[type_of(pc)] ^= from_to_bb; - byColorBB[color_of(pc)] ^= from_to_bb; + Bitboard fromTo = SquareBB[from] ^ SquareBB[to]; + byTypeBB[ALL_PIECES] ^= fromTo; + byTypeBB[type_of(pc)] ^= fromTo; + byColorBB[color_of(pc)] ^= fromTo; board[from] = NO_PIECE; board[to] = pc; index[to] = index[from]; pieceList[pc][index[to]] = to; + psq += PSQT::psq[pc][to] - PSQT::psq[pc][from]; } inline void Position::do_move(Move m, StateInfo& newSt) { diff --git a/Engines/Linux32/mcbrain/src/psqt.cpp b/Engines/Linux32/mcbrain/src/psqt.cpp index 3799dc6..c51e594 100644 --- a/Engines/Linux32/mcbrain/src/psqt.cpp +++ b/Engines/Linux32/mcbrain/src/psqt.cpp @@ -58,14 +58,14 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-195,-109), S(-67,-89), S(-42,-50), S(-29,-13) } }, { // Bishop - { S(-44,-58), S(-13,-31), S(-25,-37), S(-34,-19) }, - { S(-20,-34), S( 20, -9), S( 12,-14), S( 1, 4) }, - { S( -9,-23), S( 27, 0), S( 21, -3), S( 11, 16) }, - { S(-11,-26), S( 28, -3), S( 21, -5), S( 10, 16) }, - { S(-11,-26), S( 27, -4), S( 16, -7), S( 9, 14) }, - { S(-17,-24), S( 16, -2), S( 12, 0), S( 2, 13) }, - { S(-23,-34), S( 17,-10), S( 6,-12), S( -2, 6) }, - { S(-35,-55), S(-11,-32), S(-19,-36), S(-29,-17) } + { S(-64,-58), S(-13,-31), S(-25,-37), S(-34,-19) }, + { S(-20,-34), S( 0, -9), S( 12,-14), S( 1, 4) }, + { S( -9,-23), S( 27, 0), S( 1, -3), S( 11, 16) }, + { S(-11,-26), S( 28, -3), S( 21, -5), S( 32, 16) }, + { S(-11,-26), S( 27, -4), S( 16, -7), S( 31, 14) }, + { S(-17,-24), S( 16, -2), S( -8, 0), S( 2, 13) }, + { S(-23,-34), S( -3,-10), S( 6,-12), S( -2, 6) }, + { S(-55,-55), S(-11,-32), S(-19,-36), S(-29,-17) } }, { // Rook { S(-25, 0), S(-16, 0), S(-16, 0), S(-9, 0) }, @@ -88,14 +88,14 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-1,-74), S(-4,-55), S(-1,-43), S( 0,-30) } }, { // King - { S(267, 0), S(320, 48), S(270, 75), S(195, 84) }, - { S(264, 43), S(304, 92), S(238,143), S(180,132) }, - { S(200, 83), S(245,138), S(176,167), S(110,165) }, - { S(177,106), S(185,169), S(148,169), S(110,179) }, - { S(149,108), S(177,163), S(115,200), S( 66,203) }, - { S(118, 95), S(159,155), S( 84,176), S( 41,174) }, - { S( 87, 50), S(128, 99), S( 63,122), S( 20,139) }, - { S( 63, 9), S( 88, 55), S( 47, 80), S( 0, 90) } + { S(272, 0), S(325, 41), S(273, 80), S(190, 93) }, + { S(277, 57), S(305, 98), S(241,138), S(183,131) }, + { S(198, 86), S(253,138), S(168,165), S(120,173) }, + { S(169,103), S(191,152), S(136,168), S(108,169) }, + { S(145, 98), S(176,166), S(112,197), S(69, 194) }, + { S(122, 87), S(159,164), S(85, 174), S(36, 189) }, + { S(87, 40), S(120, 99), S(64, 128), S(25, 141) }, + { S(64, 5), S(87, 60), S(49, 75), S(0, 75) } } }; diff --git a/Engines/Linux32/mcbrain/src/search.cpp b/Engines/Linux32/mcbrain/src/search.cpp index cbdca6c..895952e 100644 --- a/Engines/Linux32/mcbrain/src/search.cpp +++ b/Engines/Linux32/mcbrain/src/search.cpp @@ -26,14 +26,14 @@ #include //for sleep //MichaelB7 #include #include -#include // ELO MichaelB7 - +#include +#include "book.h" #include "evaluate.h" #include "misc.h" #include "movegen.h" #include "movepick.h" -#include "polybook.h" // Cerebellum #include "position.h" +#include "polybook.h" #include "search.h" #include "thread.h" #include "timeman.h" @@ -70,33 +70,23 @@ namespace { constexpr int SkipPhase[] = { 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7 }; // Razor and futility margins - constexpr int RazorMargin[] = {0, 590, 604}; + constexpr int RazorMargin = 600; Value futility_margin(Depth d, bool improving) { return Value((175 - 50 * improving) * d / ONE_PLY); } - // Margin for pruning capturing moves: almost linear in depth - constexpr int CapturePruneMargin[] = { 0, - 1 * PawnValueEg * 1055 / 1000, - 2 * PawnValueEg * 1042 / 1000, - 3 * PawnValueEg * 963 / 1000, - 4 * PawnValueEg * 1038 / 1000, - 5 * PawnValueEg * 950 / 1000, - 6 * PawnValueEg * 930 / 1000 - }; - // Futility and reductions lookup tables, initialized at startup int FutilityMoveCounts[2][16]; // [improving][depth] - int Reductions[2][2][128][96]; // [pv][improving][depth][moveNumber] //MichaelB7 + int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber] template Depth reduction(bool i, Depth d, int mn) { - return Reductions[PvNode][i][std::min(d / ONE_PLY, 127)][std::min(mn, 95)] * ONE_PLY; //MichaelB7 + return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY; } // History and stats update bonus, based on depth int stat_bonus(Depth depth) { int d = depth / ONE_PLY; - return d > 17 ? 0 : 32 * d * d + 64 * d - 64; + return d > 17 ? 0 : 29 * d * d + 138 * d - 134; } // Skill structure is used to implement strength limit @@ -109,13 +99,14 @@ namespace { int level; Move best = MOVE_NONE; }; - - int tactical; - - bool bookEnabled, bruteForce, limitStrength, noNULL; + + bool doNull, doLMR, cleanSearch, limitStrength, bookEnabled, bruteForce, minOutput; + Depth maxLMR; + + int tactical, variety; template - Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode, bool skipEarlyPruning); + Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode); template Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth = DEPTH_ZERO); @@ -126,6 +117,7 @@ namespace { void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus); void update_quiet_stats(const Position& pos, Stack* ss, Move move, Move* quiets, int quietsCnt, int bonus); void update_capture_stats(const Position& pos, Move move, Move* captures, int captureCnt, int bonus); + bool PV_is_draw(Position& pos); inline bool gives_check(const Position& pos, Move move) { Color us = pos.side_to_move(); @@ -165,13 +157,14 @@ namespace { /// Search::init() is called at startup to initialize various lookup tables -void Search::init() { +void Search::init(bool OptioncleanSearch) { + cleanSearch = OptioncleanSearch; for (int imp = 0; imp <= 1; ++imp) - for (int d = 1; d < 128; ++d) // MichaelB7 - for (int mc = 1; mc < 96; ++mc) // MichaelB7 + for (int d = 1; d < 64; ++d) + for (int mc = 1; mc < 64; ++mc) { - double r = log(d) * log(mc) / 2; // SF used "2" years ago + double r = log(d) * log(mc) / 1.95; Reductions[NonPV][imp][d][mc] = int(std::round(r)); Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - 1, 0); @@ -192,6 +185,10 @@ void Search::init() { /// Search::clear() resets search state to its initial value void Search::clear() { +//Hash + if (Options["NeverClearHash"]) + return; +//end_Hash Threads.main()->wait_for_search_finished(); @@ -212,17 +209,30 @@ void MainThread::search() { sync_cout << "\nNodes searched: " << nodes << "\n" << sync_endl; return; } - - bruteForce = Options["BruteForce"]; - limitStrength = Options["UCI_LimitStrength"]; - noNULL = Options["No_Null_Moves"]; - tactical = Options["Tactical"]; - bookEnabled = Options["Book_Enabled"]; + static PolyglotBook book; // Defined static to initialize the PRNG only once + limitStrength = Options["UCI_LimitStrength"]; + int uci_elo = (Options["UCI_ELO"]); + + + bookEnabled = Options["Book_Enabled"]; Color us = rootPos.side_to_move(); Time.init(Limits, us, rootPos.game_ply()); +//Hash + if (!Limits.infinite) TT.new_search(); - + else + TT.infinite_search(); +//end_hash + + // Read search options + bruteForce = Options["BruteForce"]; + doNull = Options["NullMove"]; + doLMR = Options["LMR"]; + maxLMR = Options["MaxLMReduction"] * ONE_PLY; + tactical = Options["ICCF Analysis"]; + variety = Options["Variety"]; + if (rootMoves.empty()) { rootMoves.emplace_back(MOVE_NONE); @@ -231,7 +241,17 @@ void MainThread::search() { << sync_endl; } else - { + { + if (bool(Options["OwnBook"]) && !Limits.infinite && !Limits.mate) + { + Move bookMove = book.probe(rootPos, Options["Book File"], Options["Best Book Line"]); + + if (bookMove && std::count(rootMoves.begin(), rootMoves.end(), bookMove)) + { + std::swap(rootMoves[0], *std::find(rootMoves.begin(), rootMoves.end(), bookMove)); + goto finalize; + } + } Move bookMove = MOVE_NONE; if (!Limits.infinite && !Limits.mate) @@ -244,9 +264,9 @@ void MainThread::search() { } else { + if (limitStrength) { - int uci_elo = (Options["UCI_ELO"]); std::mt19937 gen(now()); std::uniform_int_distribution dis(-33, 33); int rand = dis(gen); @@ -258,6 +278,10 @@ void MainThread::search() { Limits.nodes *= Time.optimum()/1000 ; std::this_thread::sleep_for (std::chrono::seconds(Time.optimum()/1000) * (1 - Limits.nodes/724000)); } + + + + for (Thread* th : Threads) if (th != this) th->start_searching(); @@ -266,6 +290,7 @@ void MainThread::search() { } } +finalize: // When we reach the maximum depth, we can arrive here without a raise of // Threads.stop. However, if we are pondering or in an infinite search, // the UCI protocol states that we shouldn't print the best move before the @@ -292,20 +317,35 @@ void MainThread::search() { // Check if there are threads with a better score than main thread Thread* bestThread = this; - if ( Options["MultiPV"] == 1 + if ( int(Options["MultiPV"]) == 1 && !Limits.depth - && !Skill(Options["Skill Level"]).enabled() + && !Skill(int(Options["Skill Level"])).enabled() && rootMoves[0].pv[0] != MOVE_NONE) { - for (Thread* th : Threads) + std::map votes; + Value minScore = this->rootMoves[0].score; + + // Find out minimum score and reset votes for moves which can be voted + for (Thread* th: Threads) { - Depth depthDiff = th->completedDepth - bestThread->completedDepth; - Value scoreDiff = th->rootMoves[0].score - bestThread->rootMoves[0].score; + minScore = std::min(minScore, th->rootMoves[0].score); + votes[th->rootMoves[0].pv[0]] = 0; + } + + // Vote according to score and depth + for (Thread* th : Threads) + votes[th->rootMoves[0].pv[0]] += int(th->rootMoves[0].score - minScore) + + int(th->completedDepth); - // Select the thread with the best score, always if it is a mate - if ( scoreDiff > 0 - && (depthDiff >= 0 || th->rootMoves[0].score >= VALUE_MATE_IN_MAX_PLY)) + // Select best thread + int bestVote = votes[this->rootMoves[0].pv[0]]; + for (Thread* th : Threads) + { + if (votes[th->rootMoves[0].pv[0]] > bestVote) + { + bestVote = votes[th->rootMoves[0].pv[0]]; bestThread = th; + } } } @@ -331,28 +371,33 @@ void MainThread::search() { void Thread::search() { Stack stack[MAX_PLY+7], *ss = stack+4; // To reference from (ss-4) to (ss+2) - Value bestValue, alpha, beta, delta1, delta2; + Value bestValue, alpha, beta, delta; Move lastBestMove = MOVE_NONE; Depth lastBestMoveDepth = DEPTH_ZERO; MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); double timeReduction = 1.0; Color us = rootPos.side_to_move(); + bool failedLow; std::memset(ss-4, 0, 7 * sizeof(Stack)); for (int i = 4; i > 0; i--) - (ss-i)->contHistory = this->contHistory[NO_PIECE][0].get(); // Use as sentinel + (ss-i)->continuationHistory = &this->continuationHistory[NO_PIECE][0]; // Use as sentinel + + if (cleanSearch) + Search::clear(); - bestValue = delta1 = delta2 = alpha = -VALUE_INFINITE; + bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; if (mainThread) - mainThread->bestMoveChanges = 0, mainThread->failedLow = false; + mainThread->bestMoveChanges = 0, failedLow = false; size_t multiPV = Options["MultiPV"]; - Skill skill(Options["Skill Level"]); - if (tactical) multiPV = pow(2, tactical); - + int local_int = Options["Skill Level"]; + Skill skill(local_int); + if (tactical) multiPV = size_t(pow(2, tactical)); + // When playing with strength handicap enable MultiPV search that we will // use behind the scenes to retrieve a set of possible moves. if (skill.enabled()) @@ -363,7 +408,7 @@ void Thread::search() { int ct = int(Options["Contempt"]) * PawnValueEg / 100; // From centipawns // In analysis mode, adjust contempt in accordance with user preference - if (Limits.infinite || Options["UCI_AnalyseMode"]) + if (Limits.infinite || bool(Options["UCI_AnalyseMode"])) ct = Options["Analysis Contempt"] == "Off" ? 0 : Options["Analysis Contempt"] == "Both" ? ct : Options["Analysis Contempt"] == "White" && us == BLACK ? -ct @@ -373,45 +418,42 @@ void Thread::search() { // In evaluate.cpp the evaluation is from the white point of view contempt = (us == WHITE ? make_score(ct, ct / 2) : -make_score(ct, ct / 2)); + pvDraw = false; - // UCI options specify 256 as the max MultiPv option - int consecutiveEarlyExits[257] = {0}; // Iterative deepening loop until requested to stop or the target depth is reached while ( (rootDepth += ONE_PLY) < DEPTH_MAX + && rootDepth <= MAX_PLY-1 && !Threads.stop && !(Limits.depth && mainThread && rootDepth / ONE_PLY > Limits.depth)) { - // Distribute search depths across the threads - if (idx) - { - int i = (idx - 1) % 20; - if (idx == Threads.size() - 1 && !ss->excludedMove && rootDepth < 14 * ONE_PLY && rootMoves.size() > 1 && rootPos.see_ge(rootMoves[0].pv[0], VALUE_ZERO + 1)) - ss->excludedMove = rootMoves[0].pv[0]; //lazy_or_stubborn by pb00068 - else - if (((rootDepth / ONE_PLY + rootPos.game_ply() + SkipPhase[i]) / SkipSize[i]) % 2) - continue; - } + // Distribute search depths across the helper threads + if (idx > 0) + { + int i = (idx - 1) % 20; + if (((rootDepth / ONE_PLY + SkipPhase[i]) / SkipSize[i]) % 2) + continue; // Retry with an incremented rootDepth + } // Age out PV variability metric if (mainThread) - mainThread->bestMoveChanges *= 0.517, mainThread->failedLow = false; + mainThread->bestMoveChanges *= 0.517, failedLow = false; // Save the last iteration's scores before first PV line is searched and // all the move scores except the (new) PV are set to -VALUE_INFINITE. for (RootMove& rm : rootMoves) rm.previousScore = rm.score; - size_t PVFirst = 0; - PVLast = 0; + size_t pvFirst = 0; + pvLast = 0; // MultiPV loop. We perform a full root search for each PV line - for (PVIdx = 0; PVIdx < multiPV && !Threads.stop; ++PVIdx) + for (pvIdx = 0; pvIdx < multiPV && !Threads.stop; ++pvIdx) { - if (PVIdx == PVLast) + if (pvIdx == pvLast) { - PVFirst = PVLast; - for (PVLast++; PVLast < rootMoves.size(); PVLast++) - if (rootMoves[PVLast].TBRank != rootMoves[PVFirst].TBRank) + pvFirst = pvLast; + for (pvLast++; pvLast < rootMoves.size(); pvLast++) + if (rootMoves[pvLast].tbRank != rootMoves[pvFirst].tbRank) break; } @@ -421,14 +463,13 @@ void Thread::search() { // Reset aspiration window starting size if (rootDepth >= 5 * ONE_PLY) { - Value prevScore = rootMoves[PVIdx].previousScore; - delta1 = (prevScore < 0) ? Value(int(8.0 + 0.1 * abs(prevScore))) : Value(18); - delta2 = (prevScore > 0) ? Value(int(8.0 + 0.1 * abs(prevScore))) : Value(18); - alpha = std::max(prevScore - delta1,-VALUE_INFINITE); - beta = std::min(prevScore + delta2, VALUE_INFINITE); + Value previousScore = rootMoves[pvIdx].previousScore; + delta = Value(18); + alpha = std::max(previousScore - delta,-VALUE_INFINITE); + beta = std::min(previousScore + delta, VALUE_INFINITE); // Adjust contempt based on root move's previousScore (dynamic contempt) - int dct = ct + (ct ? 88 * prevScore / (abs(prevScore) + 200) : 0); + int dct = ct + 88 * previousScore / (abs(previousScore) + 200); contempt = (us == WHITE ? make_score(dct, dct / 2) : -make_score(dct, dct / 2)); @@ -439,7 +480,7 @@ void Thread::search() { // high/low anymore. while (true) { - bestValue = ::search(rootPos, ss, alpha, beta, rootDepth, false, false); + bestValue = ::search(rootPos, ss, alpha, beta, rootDepth, false); // Bring the best move to the front. It is critical that sorting // is done with a stable algorithm because all the values but the @@ -447,7 +488,7 @@ void Thread::search() { // and we want to keep the same order for all the moves except the // new PV that goes to the front. Note that in case of MultiPV // search the already searched PV lines are preserved. - std::stable_sort(rootMoves.begin() + PVIdx, rootMoves.begin() + PVLast); + std::stable_sort(rootMoves.begin() + pvIdx, rootMoves.begin() + pvLast); // If search has been stopped, we break immediately. Sorting is // safe because RootMoves is still valid, although it refers to @@ -455,6 +496,9 @@ void Thread::search() { if (Threads.stop) break; + // record if the PV is draw + pvDraw = ::PV_is_draw(rootPos); + // When failing high/low give some update (without cluttering // the UI) before a re-search. if ( mainThread @@ -468,33 +512,29 @@ void Thread::search() { if (bestValue <= alpha) { beta = (alpha + beta) / 2; - alpha = std::max(bestValue - delta1, -VALUE_INFINITE); + alpha = std::max(bestValue - delta, -VALUE_INFINITE); if (mainThread) { - mainThread->failedLow = true; + failedLow = true; Threads.stopOnPonderhit = false; } } else if (bestValue >= beta) - beta = std::min(bestValue + delta2, VALUE_INFINITE); //Ivan Ivec + beta = std::min(bestValue + delta, VALUE_INFINITE); else - { - delta1 += delta1 / 4 + 5; //Ivan Ivec - delta2 += delta2 / 4 + 5; //Ivan Ivec - - assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); - - consecutiveEarlyExits[PVIdx] = (bestValue >= beta) ? consecutiveEarlyExits[PVIdx] + 1 : 0; break; - } + + delta += delta / 4 + 5; + + assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); } // Sort the PV lines searched so far and update the GUI - std::stable_sort(rootMoves.begin() + PVFirst, rootMoves.begin() + PVIdx + 1); + std::stable_sort(rootMoves.begin() + pvFirst, rootMoves.begin() + pvIdx + 1); if ( mainThread - && (Threads.stop || PVIdx + 1 == multiPV || Time.elapsed() > 3000)) + && (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000)) sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; } @@ -531,7 +571,7 @@ void Thread::search() { && !Threads.stop && !Threads.stopOnPonderhit) { - const int F[] = { mainThread->failedLow, + const int F[] = { failedLow, bestValue - mainThread->previousScore }; int improvingFactor = std::max(246, std::min(832, 306 + 119 * F[0] - 6 * F[1])); @@ -577,15 +617,27 @@ namespace { // search<>() is the main search function for both PV and non-PV nodes template - Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode, bool skipEarlyPruning) { - - // Use quiescence search when needed - if (depth < ONE_PLY) - return qsearch(pos, ss, alpha, beta); + Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode) { constexpr bool PvNode = NT == PV; const bool rootNode = PvNode && ss->ply == 0; + // Check if we have an upcoming move which draws by repetition, or + // if the opponent had an alternative move earlier to this position. + if ( pos.rule50_count() >= 3 + && alpha < VALUE_DRAW + && !rootNode + && pos.has_game_cycle(ss->ply)) + { + alpha = VALUE_DRAW; + if (alpha >= beta) + return alpha; + } + + // Dive into quiescence search when the depth reaches zero + if (depth < ONE_PLY) + return qsearch(pos, ss, alpha, beta); + assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE); assert(PvNode || (alpha == beta - 1)); assert(DEPTH_ZERO < depth && depth < DEPTH_MAX); @@ -598,7 +650,7 @@ namespace { Key posKey; Move ttMove, move, excludedMove, bestMove; Depth extension, newDepth; - Value bestValue, value, ttValue, eval, maxValue; + Value bestValue, value, ttValue, eval, maxValue, pureStaticEval; bool ttHit, inCheck, givesCheck, improving; bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact; Piece movedPiece; @@ -607,6 +659,7 @@ namespace { // Step 1. Initialize node Thread* thisThread = pos.this_thread(); inCheck = pos.checkers(); + Color us = pos.side_to_move(); moveCount = captureCount = quietCount = ss->moveCount = 0; bestValue = -VALUE_INFINITE; maxValue = VALUE_INFINITE; @@ -625,7 +678,8 @@ namespace { if ( Threads.stop.load(std::memory_order_relaxed) || pos.is_draw(ss->ply) || ss->ply >= MAX_PLY) - return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) : VALUE_DRAW; + return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) - 10 * ((ss-1)->statScore > 0) + : VALUE_DRAW; // Step 3. Mate distance pruning. Even if we mate at the next move our score // would be at best mate_in(ss->ply+1), but if alpha is already bigger because @@ -637,23 +691,13 @@ namespace { beta = std::min(mate_in(ss->ply+1), beta); if (alpha >= beta) return alpha; - - // Check for a move which draws by repetition, or an alternative earlier move to this position - if ( pos.rule50_count() >= 3 - && alpha < VALUE_DRAW - && pos.has_game_cycle(ss->ply)) - { - alpha = VALUE_DRAW; - if (alpha >= beta) - return alpha; - } } assert(0 <= ss->ply && ss->ply < MAX_PLY); (ss+1)->ply = ss->ply + 1; ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE; - ss->contHistory = thisThread->contHistory[NO_PIECE][0].get(); + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; Square prevSq = to_sq((ss-1)->currentMove); @@ -671,11 +715,12 @@ namespace { posKey = pos.key() ^ Key(excludedMove << 16); // Isn't a very good hash tte = TT.probe(posKey, ttHit); ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; - ttMove = rootNode ? thisThread->rootMoves[thisThread->PVIdx].pv[0] + ttMove = rootNode ? thisThread->rootMoves[thisThread->pvIdx].pv[0] : ttHit ? tte->move() : MOVE_NONE; // At non-PV nodes we check for an early TT cutoff if ( !PvNode + && !thisThread->pvDraw && ttHit && tte->depth() >= depth && ttValue != VALUE_NONE // Possible in case of TT access race @@ -698,7 +743,7 @@ namespace { else if (!pos.capture_or_promotion(ttMove)) { int penalty = -stat_bonus(depth); - thisThread->mainHistory[pos.side_to_move()][from_to(ttMove)] << penalty; + thisThread->mainHistory[us][from_to(ttMove)] << penalty; update_continuation_histories(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty); } } @@ -736,7 +781,7 @@ namespace { { tte->save(posKey, value_to_tt(value, ss->ply), b, std::min(DEPTH_MAX - ONE_PLY, depth + 6 * ONE_PLY), - MOVE_NONE, VALUE_NONE, TT.generation()); + MOVE_NONE, VALUE_NONE); return value; } @@ -752,18 +797,19 @@ namespace { } } - // Step 6. Evaluate the position statically + // Step 6. Static evaluation of the position if (inCheck) { - ss->staticEval = eval = VALUE_NONE; + ss->staticEval = eval = pureStaticEval = VALUE_NONE; improving = false; - goto moves_loop; + goto moves_loop; // Skip early pruning when in check } else if (ttHit) { // Never assume anything on values stored in TT - if ((ss->staticEval = eval = tte->eval()) == VALUE_NONE) - eval = ss->staticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval = tte->eval(); + if (eval == VALUE_NONE) + ss->staticEval = eval = pureStaticEval = evaluate(pos); // Can ttValue be used as a better position evaluation? if ( ttValue != VALUE_NONE @@ -772,59 +818,60 @@ namespace { } else { - ss->staticEval = eval = - (ss-1)->currentMove != MOVE_NULL ? evaluate(pos) - : -(ss-1)->staticEval + 2 * Eval::Tempo; + if ((ss-1)->currentMove != MOVE_NULL) + { + int p = (ss-1)->statScore; + int bonus = p > 0 ? (-p - 2500) / 512 : + p < 0 ? (-p + 2500) / 512 : 0; - tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, - ss->staticEval, TT.generation()); - } + pureStaticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval + bonus; + } + else + ss->staticEval = eval = pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo; - improving = ss->staticEval >= (ss-2)->staticEval - ||(ss-2)->staticEval == VALUE_NONE; + tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval); + } - if (skipEarlyPruning || !pos.non_pawn_material(pos.side_to_move())) - goto moves_loop; + // Step 7. Razoring (~2 Elo) + if ( !bruteForce && depth < 2 * ONE_PLY + && eval <= alpha - RazorMargin) + return qsearch(pos, ss, alpha, beta); - // Step 7. Razoring (skipped when in check), 2 Elo - if ( !bruteForce && !PvNode - && depth < 3 * ONE_PLY - && eval <= alpha - RazorMargin[depth / ONE_PLY]) - { - Value ralpha = alpha - (depth >= 2 * ONE_PLY) * RazorMargin[depth / ONE_PLY]; - Value v = qsearch(pos, ss, ralpha, ralpha+1); - if (depth < 2 * ONE_PLY || v <= ralpha) - return v; - } + improving = ss->staticEval >= (ss-2)->staticEval + || (ss-2)->staticEval == VALUE_NONE; - // Step 8. Futility pruning: child node (skipped when in check), 30 Elo + // Step 8. Futility pruning: child node (~30 Elo) if ( !bruteForce && !rootNode && depth < 7 * ONE_PLY && eval - futility_margin(depth, improving) >= beta && eval < VALUE_KNOWN_WIN) // Do not return unproven wins return eval; - // Step 9. Null move search with verification search, 40 Elo - if ( !noNULL && !PvNode + // Step 9. Null move search with verification search (~40 Elo) + if ( doNull + && !PvNode + && (ss-1)->currentMove != MOVE_NULL + && (ss-1)->statScore < 23200 && eval >= beta - && ss->staticEval >= beta - int(320 * log(depth / ONE_PLY)) + 500 // Ivan Ivec - && (((ss-2)->currentMove != MOVE_NULL) || (ss-2)->staticEval >= beta - 36 * depth / ONE_PLY + 225)// MichaeB7 - && thisThread->selDepth + 3 > thisThread->rootDepth / ONE_PLY // idea from Corchess/IIvec - && pos.non_pawn_material(pos.side_to_move()) > BishopValueMg //Ivam Ivec - && (ss->ply >= thisThread->nmp_ply || ss->ply % 2 != thisThread->nmp_odd) - && !(MoveList(pos).size() < 4)) //MichaelB7 + && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225 + && !excludedMove + && thisThread->selDepth + 3 > thisThread->rootDepth / ONE_PLY // idea from Corchess/IIvec + && pos.non_pawn_material(us) + && (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor) + && !(MoveList(pos).size() == 1)) //MichaelB7 { assert(eval - beta >= 0); // Null move dynamic reduction based on depth and value - Depth R = (int(2.6 * log(depth / ONE_PLY)) + std::min((eval - beta) / Value(170), 3)) * ONE_PLY; //Ivan Ivec + Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY; ss->currentMove = MOVE_NULL; - ss->contHistory = thisThread->contHistory[NO_PIECE][0].get(); + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; pos.do_null_move(st); - Value nullValue = -search(pos, ss+1, -beta, -beta+1, depth-R, !cutNode, true); + Value nullValue = -search(pos, ss+1, -beta, -beta+1, depth-R, !cutNode); pos.undo_null_move(); @@ -834,44 +881,44 @@ namespace { if (nullValue >= VALUE_MATE_IN_MAX_PLY) nullValue = beta; - if (abs(beta) < VALUE_KNOWN_WIN && (depth < 12 * ONE_PLY || thisThread->nmp_ply)) + if (thisThread->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 12 * ONE_PLY)) return nullValue; - // Do verification search at high depths. Disable null move pruning - // for side to move for the first part of the remaining search tree. - thisThread->nmp_ply = ss->ply + 3 * (depth-R) / 4; - thisThread->nmp_odd = ss->ply % 2; + assert(!thisThread->nmpMinPly); // Recursive verification is not allowed + + // Do verification search at high depths, with null move pruning disabled + // for us, until ply exceeds nmpMinPly. + thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / 4; + thisThread->nmpColor = us; - Value v = search(pos, ss, beta-1, beta, depth-R, false, true); + Value v = search(pos, ss, beta-1, beta, depth-R, false); - thisThread->nmp_odd = thisThread->nmp_ply = 0; + thisThread->nmpMinPly = 0; if (v >= beta) return nullValue; } } - // Step 10. ProbCut (skipped when in check), 10 Elo + // Step 10. ProbCut (~10 Elo) // If we have a good enough capture and a reduced search returns a value // much above beta, we can (almost) safely prune the previous move. if ( !PvNode && depth >= 5 * ONE_PLY && abs(beta) < VALUE_MATE_IN_MAX_PLY) { - assert(is_ok((ss-1)->currentMove)); - Value rbeta = std::min(beta + 216 - 48 * improving, VALUE_INFINITE); MovePicker mp(pos, ttMove, rbeta - ss->staticEval, &thisThread->captureHistory); int probCutCount = 0; while ( (move = mp.next_move()) != MOVE_NONE && probCutCount < 3) - if (pos.legal(move)) + if (move != excludedMove && pos.legal(move)) { probCutCount++; ss->currentMove = move; - ss->contHistory = thisThread->contHistory[pos.moved_piece(move)][to_sq(move)].get(); + ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; assert(depth >= 5 * ONE_PLY); @@ -882,7 +929,7 @@ namespace { // If the qsearch held perform the regular search if (value >= rbeta) - value = -search(pos, ss+1, -rbeta, -rbeta+1, depth - 4 * ONE_PLY, !cutNode, false); + value = -search(pos, ss+1, -rbeta, -rbeta+1, depth - 4 * ONE_PLY, !cutNode); pos.undo_move(move); @@ -891,13 +938,11 @@ namespace { } } - // Step 11. Internal iterative deepening (skipped when in check) , 2 Elo) - if ( depth >= 6 * ONE_PLY - && !ttMove - && (PvNode || ss->staticEval + 128 >= beta)) + // Step 11. Internal iterative deepening (~2 Elo) + if ( depth >= 8 * ONE_PLY + && !ttMove) { - Depth d = 3 * depth / 4 - 2 * ONE_PLY; - search(pos, ss, alpha, beta, d, cutNode, true); + search(pos, ss, alpha, beta, depth - 7 * ONE_PLY, cutNode); tte = TT.probe(posKey, ttHit); ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; @@ -906,10 +951,14 @@ namespace { moves_loop: // When in check, search starts from here - const PieceToHistory* contHist[] = { (ss-1)->contHistory, (ss-2)->contHistory, nullptr, (ss-4)->contHistory }; + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq]; - MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory, contHist, countermove, ss->killers); + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, + countermove, + ss->killers); value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc skipQuiets = false; @@ -929,16 +978,16 @@ namespace { // Move List. As a consequence any illegal move is also skipped. In MultiPV // mode we also skip PV moves which have been already searched and those // of lower "TB rank" if we are in a TB root position. - if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->PVIdx, - thisThread->rootMoves.begin() + thisThread->PVLast, move)) + if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->pvIdx, + thisThread->rootMoves.begin() + thisThread->pvLast, move)) continue; ss->moveCount = ++moveCount; - if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) + if (!minOutput && rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) sync_cout << "info depth " << depth / ONE_PLY << " currmove " << UCI::move(move, pos.is_chess960()) - << " currmovenumber " << moveCount + thisThread->PVIdx << sync_endl; + << " currmovenumber " << moveCount + thisThread->pvIdx << sync_endl; if (PvNode) (ss+1)->pv = nullptr; @@ -950,7 +999,7 @@ namespace { moveCountPruning = depth < 16 * ONE_PLY && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY]; - // Step 13. Extensions, 70 Elo + // Step 13. Extensions (~70 Elo) // Singular extension search (~60 Elo). If all moves but one fail low on a // search of (alpha-s, beta-s), and just one fails high on (alpha, beta), @@ -968,39 +1017,33 @@ namespace { { Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE); ss->excludedMove = move; - value = search(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode, true); + value = search(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode); ss->excludedMove = MOVE_NONE; if (value < rBeta) extension = ONE_PLY; } - - else if (!moveCountPruning) - { - if ( givesCheck - && (pos.see_ge(move) || PvNode )) - extension = ONE_PLY; - - else if ( PvNode - && depth < 12 * ONE_PLY - && (( givesCheck || pos.advanced_pawn_push(move)))) - extension = ONE_PLY; - } + else if ( (givesCheck // Check extension (~2 Elo) + && !moveCountPruning + && pos.see_ge(move)) + || (pos.promotion_pawn_push(move) + && !moveCountPruning)) + extension = ONE_PLY; + // Calculate new depth for this move newDepth = depth - ONE_PLY + extension; - // Step 14. Pruning at shallow depth, 170 Elo + // Step 14. Pruning at shallow depth (~170 Elo) if ( !rootNode - && pos.non_pawn_material(pos.side_to_move()) + && pos.non_pawn_material(us) && bestValue > VALUE_MATED_IN_MAX_PLY) { if ( !captureOrPromotion && !givesCheck && (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= Value(5000))) { - // Move count based pruning - if (moveCountPruning - && !mp.is_refutation(move)) + // Move count based pruning (~30 Elo) + if (moveCountPruning) { skipQuiets = true; continue; @@ -1009,26 +1052,24 @@ namespace { // Reduced depth of the next LMR search int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY; - // Countermoves based pruning, 20 Elo - if ( lmrDepth < 3 + // Countermoves based pruning (~20 Elo) + if ( lmrDepth < 3 + ((ss-1)->statScore > 0) && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold) continue; - // Futility pruning: parent node, 2 Elo + // Futility pruning: parent node (~2 Elo) if ( lmrDepth < 7 && !inCheck && ss->staticEval + 256 + 200 * lmrDepth <= alpha) continue; - // Prune moves with negative SEE, 10 Elo - if ( lmrDepth < 8 - && !pos.see_ge(move, Value(-35 * lmrDepth * lmrDepth))) + // Prune moves with negative SEE (~10 Elo) + if (!pos.see_ge(move, Value(-29 * lmrDepth * lmrDepth))) continue; } - else if ( depth < 7 * ONE_PLY // 20 Elo - && !extension - && !pos.see_ge(move, -Value(CapturePruneMargin[depth / ONE_PLY]))) + else if ( !extension // (~20 Elo) + && !pos.see_ge(move, -PawnValueEg * (depth / ONE_PLY))) continue; } @@ -1047,67 +1088,68 @@ namespace { // Update the current move (this must be done after singular extension search) ss->currentMove = move; - ss->contHistory = thisThread->contHistory[movedPiece][to_sq(move)].get(); + ss->continuationHistory = &thisThread->continuationHistory[movedPiece][to_sq(move)]; // Step 15. Make the move pos.do_move(move, st, givesCheck); // Step 16. Reduced depth search (LMR). If the move fails high it will be // re-searched at full depth. - if ( depth >= 3 * ONE_PLY + if ( doLMR + && depth >= 3 * ONE_PLY && moveCount > 1 - && (!captureOrPromotion || moveCountPruning) - && !(PvNode && abs(alpha) > VALUE_KNOWN_WIN)) + && (!captureOrPromotion || moveCountPruning)) { Depth r = reduction(improving, depth, moveCount); - if (captureOrPromotion) // 5 Elo - r -= r ? ONE_PLY : DEPTH_ZERO; - else - { - // Decrease reduction if opponent's move count is high , 5 Elo - if ((ss-1)->moveCount > 15) - r -= ONE_PLY; + // Decrease reduction if opponent's move count is high (~10 Elo) + if ((ss-1)->moveCount > 15) + r -= ONE_PLY; - // Decrease reduction for exact PV nodes., 0 Elo) + if (!captureOrPromotion) + { + // Decrease reduction for exact PV nodes (~0 Elo) if (pvExact) r -= ONE_PLY; - // Increase reduction if ttMove is a capture ,0 Elo + // Increase reduction if ttMove is a capture (~0 Elo) if (ttCapture) r += ONE_PLY; - // Increase reduction for cut nodes, 5 Elo + // Increase reduction for cut nodes (~5 Elo) if (cutNode) r += 2 * ONE_PLY; // Decrease reduction for moves that escape a capture. Filter out // castling moves, because they are coded as "king captures rook" and - // hence break make_move , 5 Elo + // hence break make_move(). (~5 Elo) else if ( type_of(move) == NORMAL && !pos.see_ge(make_move(to_sq(move), from_sq(move)))) r -= 2 * ONE_PLY; - ss->statScore = thisThread->mainHistory[~pos.side_to_move()][from_to(move)] + ss->statScore = thisThread->mainHistory[us][from_to(move)] + (*contHist[0])[movedPiece][to_sq(move)] + (*contHist[1])[movedPiece][to_sq(move)] + (*contHist[3])[movedPiece][to_sq(move)] - 4000; - // Decrease/increase reduction by comparing opponent's stat score, 10 Elo + // Decrease/increase reduction by comparing opponent's stat score (~10 Elo) if (ss->statScore >= 0 && (ss-1)->statScore < 0) r -= ONE_PLY; else if ((ss-1)->statScore >= 0 && ss->statScore < 0) r += ONE_PLY; - // Decrease/increase reduction for moves with a good/bad history, 30 Elo - r = std::max(DEPTH_ZERO, (r / ONE_PLY - ss->statScore / 20000) * ONE_PLY); + // Decrease/increase reduction for moves with a good/bad history (~30 Elo) + r -= ss->statScore / 20000 * ONE_PLY; } + + // Set maximum reduction + r = std::min(r, maxLMR); + + Depth d = std::max(newDepth - std::max(r, DEPTH_ZERO), ONE_PLY); - Depth d = std::max(newDepth - r, ONE_PLY); - - value = -search(pos, ss+1, -(alpha+1), -alpha, d, true, false); + value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); doFullDepthSearch = (value > alpha && d != newDepth); } @@ -1116,7 +1158,7 @@ namespace { // Step 17. Full depth search when LMR is skipped or fails high if (doFullDepthSearch) - value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode, false); + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); // For PV nodes only, do a full PV search on the first move or after a fail // high (in the latter case search only if value < beta), otherwise let the @@ -1126,7 +1168,7 @@ namespace { (ss+1)->pv = pv; (ss+1)->pv[0] = MOVE_NONE; - value = -search(pos, ss+1, -beta, -alpha, newDepth, false, false); + value = -search(pos, ss+1, -beta, -alpha, newDepth, false); } // Step 18. Undo move @@ -1187,7 +1229,7 @@ namespace { else { assert(value >= beta); // Fail high - ss->statScore = std::max(ss->statScore, 0); + ss->statScore = 0; break; } } @@ -1225,16 +1267,17 @@ namespace { { // Quiet best move: update move sorting heuristics if (!pos.capture_or_promotion(bestMove)) - update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth)); - else - update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth)); + update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, + stat_bonus(depth + (bestValue > beta + PawnValueMg ? ONE_PLY : DEPTH_ZERO))); + + update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY)); // Extra penalty for a quiet TT move in previous ply when it gets refuted if ((ss-1)->moveCount == 1 && !pos.captured_piece()) update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY)); } // Bonus for prior countermove that caused the fail low - else if ( depth >= 3 * ONE_PLY + else if ( (depth >= 3 * ONE_PLY || PvNode) && !pos.captured_piece() && is_ok((ss-1)->currentMove)) update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth)); @@ -1246,7 +1289,7 @@ namespace { tte->save(posKey, value_to_tt(bestValue, ss->ply), bestValue >= beta ? BOUND_LOWER : PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, - depth, bestMove, ss->staticEval, TT.generation()); + depth, bestMove, pureStaticEval); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); @@ -1283,8 +1326,10 @@ namespace { ss->pv[0] = MOVE_NONE; } + Thread* thisThread = pos.this_thread(); (ss+1)->ply = ss->ply + 1; ss->currentMove = bestMove = MOVE_NONE; + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; inCheck = pos.checkers(); moveCount = 0; @@ -1293,16 +1338,6 @@ namespace { || ss->ply >= MAX_PLY) return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) : VALUE_DRAW; - // Check for a move which draws by repetition, or an alternative earlier move to this position - if ( pos.rule50_count() >= 3 - && alpha < VALUE_DRAW - && pos.has_game_cycle(ss->ply)) - { - alpha = VALUE_DRAW; - if (alpha >= beta) - return alpha; - } - assert(0 <= ss->ply && ss->ply < MAX_PLY); // Decide whether or not to include checks: this fixes also the type of @@ -1320,8 +1355,8 @@ namespace { && ttHit && tte->depth() >= ttDepth && ttValue != VALUE_NONE // Only in case of TT access race - && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) - : (tte->bound() & BOUND_UPPER))) + && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) + : (tte->bound() & BOUND_UPPER))) return ttValue; // Evaluate the position statically @@ -1339,7 +1374,7 @@ namespace { ss->staticEval = bestValue = evaluate(pos); // Can ttValue be used as a better position evaluation? - if ( ttValue != VALUE_NONE + if ( ttValue != VALUE_NONE && (tte->bound() & (ttValue > bestValue ? BOUND_LOWER : BOUND_UPPER))) bestValue = ttValue; } @@ -1353,7 +1388,7 @@ namespace { { if (!ttHit) tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, - DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation()); + DEPTH_NONE, MOVE_NONE, ss->staticEval); return bestValue; } @@ -1364,11 +1399,16 @@ namespace { futilityBase = bestValue + 128; } + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; + // Initialize a MovePicker object for the current position, and prepare // to search the moves. Because the depth is <= 0 here, only captures, // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will // be generated. - MovePicker mp(pos, ttMove, depth, &pos.this_thread()->mainHistory, &pos.this_thread()->captureHistory, to_sq((ss-1)->currentMove)); + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, + to_sq((ss-1)->currentMove)); // Loop through the moves until no moves remain or a beta cutoff occurs while ((move = mp.next_move()) != MOVE_NONE) @@ -1424,6 +1464,7 @@ namespace { } ss->currentMove = move; + ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; // Make and search the move pos.do_move(move, st, givesCheck); @@ -1450,13 +1491,16 @@ namespace { else // Fail high { tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER, - ttDepth, move, ss->staticEval, TT.generation()); + ttDepth, move, ss->staticEval); return value; } } } } + + if (variety && (bestValue + (variety * PawnValueEg / 100) >= 0 )) + bestValue += rand() % (variety + 1); // All legal moves have been searched. A special case: If we're in check // and no legal moves were found, it is checkmate. @@ -1465,7 +1509,7 @@ namespace { tte->save(posKey, value_to_tt(bestValue, ss->ply), PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, - ttDepth, bestMove, ss->staticEval, TT.generation()); + ttDepth, bestMove, ss->staticEval); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); @@ -1515,7 +1559,7 @@ namespace { for (int i : {1, 2, 4}) if (is_ok((ss-i)->currentMove)) - (*(ss-i)->contHistory)[pc][to] << bonus; + (*(ss-i)->continuationHistory)[pc][to] << bonus; } @@ -1527,7 +1571,9 @@ namespace { CapturePieceToHistory& captureHistory = pos.this_thread()->captureHistory; Piece moved_piece = pos.moved_piece(move); PieceType captured = type_of(pos.piece_on(to_sq(move))); - captureHistory[moved_piece][to_sq(move)][captured] << bonus; + + if (pos.capture_or_promotion(move)) + captureHistory[moved_piece][to_sq(move)][captured] << bonus; // Decrease all the other played capture moves for (int i = 0; i < captureCnt; ++i) @@ -1602,6 +1648,23 @@ namespace { return best; } + // is the PV leading to a draw position ? + bool PV_is_draw(Position& pos) { + auto& pv = pos.this_thread()->rootMoves[0].pv; + StateInfo st[MAX_PLY]; + + for (size_t i = 0; i < pv.size(); i++) + pos.do_move(pv[i], st[i]); + + bool isDraw = pos.is_draw(pv.size()); + + for (size_t i = pv.size(); i > 0; i--) + pos.undo_move(pv[i-1]); + + return isDraw; + } + + } // namespace /// MainThread::check_time() is used to print debug info and, more importantly, @@ -1643,23 +1706,16 @@ void MainThread::check_time() { string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { std::stringstream ss; - int temp = 0; TimePoint elapsed = Time.elapsed() + 1; const RootMoves& rootMoves = pos.this_thread()->rootMoves; - size_t PVIdx = pos.this_thread()->PVIdx; + size_t pvIdx = pos.this_thread()->pvIdx; size_t multiPV = std::min((size_t)Options["MultiPV"], rootMoves.size()); uint64_t nodesSearched = Threads.nodes_searched(); uint64_t tbHits = Threads.tb_hits() + (TB::RootInTB ? rootMoves.size() : 0); - - if (tactical) - { - temp = multiPV; - multiPV = 1; - } for (size_t i = 0; i < multiPV; ++i) { - bool updated = (i <= PVIdx && rootMoves[i].score != -VALUE_INFINITE); + bool updated = (i <= pvIdx && rootMoves[i].score != -VALUE_INFINITE); if (depth == ONE_PLY && !updated) continue; @@ -1668,7 +1724,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { Value v = updated ? rootMoves[i].score : rootMoves[i].previousScore; bool tb = TB::RootInTB && abs(v) < VALUE_MATE - MAX_PLY; - v = tb ? rootMoves[i].TBScore : v; + v = tb ? rootMoves[i].tbScore : v; if (ss.rdbuf()->in_avail()) // Not at first line ss << "\n"; @@ -1679,7 +1735,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { << " multipv " << i + 1 << " score " << UCI::value(v); - if (!tb && i == PVIdx) + if (!tb && i == pvIdx) ss << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : ""); ss << " nodes " << nodesSearched @@ -1695,7 +1751,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { for (Move m : rootMoves[i].pv) ss << " " << UCI::move(m, pos.is_chess960()); } - if (tactical) multiPV = temp; + return ss.str(); } @@ -1762,16 +1818,16 @@ void Tablebases::rank_root_moves(Position& pos, Search::RootMoves& rootMoves) { { // Sort moves according to TB rank std::sort(rootMoves.begin(), rootMoves.end(), - [](const RootMove &a, const RootMove &b) { return a.TBRank > b.TBRank; } ); + [](const RootMove &a, const RootMove &b) { return a.tbRank > b.tbRank; } ); // Probe during search only if DTZ is not available and we are winning - if (dtz_available || rootMoves[0].TBScore <= VALUE_DRAW) + if (dtz_available || rootMoves[0].tbScore <= VALUE_DRAW) Cardinality = 0; } else { // Assign the same rank to all moves for (auto& m : rootMoves) - m.TBRank = 0; + m.tbRank = 0; } } diff --git a/Engines/Linux32/mcbrain/src/search.h b/Engines/Linux32/mcbrain/src/search.h index 5508001..7faa36c 100644 --- a/Engines/Linux32/mcbrain/src/search.h +++ b/Engines/Linux32/mcbrain/src/search.h @@ -29,7 +29,6 @@ #include "types.h" class Position; - namespace Search { /// Threshold used for countermoves based pruning @@ -42,7 +41,7 @@ constexpr int CounterMovePruneThreshold = 0; struct Stack { Move* pv; - PieceToHistory* contHistory; + PieceToHistory* continuationHistory; int ply; Move currentMove; Move excludedMove; @@ -70,8 +69,8 @@ struct RootMove { Value score = -VALUE_INFINITE; Value previousScore = -VALUE_INFINITE; int selDepth = 0; - int TBRank; - Value TBScore; + int tbRank; + Value tbScore; std::vector pv; }; @@ -101,7 +100,7 @@ struct LimitsType { extern LimitsType Limits; -void init(); +void init(bool OptioncleanSearch); void clear(); } // namespace Search diff --git a/Engines/Linux32/mcbrain/src/stockfish-current b/Engines/Linux32/mcbrain/src/stockfish-current deleted file mode 100644 index 6be8e6d..0000000 Binary files a/Engines/Linux32/mcbrain/src/stockfish-current and /dev/null differ diff --git a/Engines/Linux32/mcbrain/src/syzygy/.DS_Store b/Engines/Linux32/mcbrain/src/syzygy/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Engines/Linux32/mcbrain/src/syzygy/.DS_Store differ diff --git a/Engines/Linux32/mcbrain/src/syzygy/tbprobe.cpp b/Engines/Linux32/mcbrain/src/syzygy/tbprobe.cpp index fbd5c6d..dfcb33f 100644 --- a/Engines/Linux32/mcbrain/src/syzygy/tbprobe.cpp +++ b/Engines/Linux32/mcbrain/src/syzygy/tbprobe.cpp @@ -1,21 +1,23 @@ /* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (c) 2013 Ronald de Man - Copyright (C) 2016-2018 Marco Costalba, Lucas Braesch - - Stockfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Stockfish is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ #include #include @@ -55,13 +57,13 @@ int Tablebases::MaxCardinality; namespace { -constexpr int TBPIECES = 6; // Max number of supported pieces +constexpr int TBPIECES = 7; // Max number of supported pieces enum { BigEndian, LittleEndian }; enum TBType { KEY, WDL, DTZ }; // Used as template parameter // Each table has a set of flags: all of them refer to DTZ tables, the last one to WDL tables -enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, SingleValue = 128 }; +enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, Wide = 16, SingleValue = 128 }; inline WDLScore operator-(WDLScore d) { return WDLScore(-int(d)); } inline Square operator^=(Square& s, int i) { return s = Square(int(s) ^ i); } @@ -75,8 +77,8 @@ int MapA1D1D4[SQUARE_NB]; int MapKK[10][SQUARE_NB]; // [MapA1D1D4][SQUARE_NB] int Binomial[6][SQUARE_NB]; // [k][n] k elements from a set of n elements -int LeadPawnIdx[5][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] -int LeadPawnsSize[5][4]; // [leadPawnsCnt][FILE_A..FILE_D] +int LeadPawnIdx[6][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] +int LeadPawnsSize[6][4]; // [leadPawnsCnt][FILE_A..FILE_D] // Comparison function to sort leading pawns in ascending MapPawns[] order bool pawns_comp(Square i, Square j) { return MapPawns[i] < MapPawns[j]; } @@ -144,16 +146,15 @@ static_assert(sizeof(SparseEntry) == 6, "SparseEntry must be 6 bytes"); typedef uint16_t Sym; // Huffman symbol struct LR { - enum Side { Left, Right, Value }; + enum Side { Left, Right }; uint8_t lr[3]; // The first 12 bits is the left-hand symbol, the second 12 // bits is the right-hand symbol. If symbol has length 1, - // then the first byte is the stored value. + // then the left-hand symbol is the stored value. template Sym get() { return S == Left ? ((lr[1] & 0xF) << 8) | lr[0] : - S == Right ? (lr[2] << 4) | (lr[1] >> 4) : - S == Value ? lr[0] : (assert(false), Sym(-1)); + S == Right ? (lr[2] << 4) | (lr[1] >> 4) : (assert(false), Sym(-1)); } }; @@ -385,22 +386,35 @@ class TBTables { typedef std::tuple*, TBTable*> Entry; - static const int Size = 1 << 12; // 4K table, indexed by key's 12 lsb + static constexpr int Size = 1 << 12; // 4K table, indexed by key's 12 lsb + static constexpr int Overflow = 1; // Number of elements allowed to map to the last bucket - Entry hashTable[Size]; + Entry hashTable[Size + Overflow]; std::deque> wdlTable; std::deque> dtzTable; void insert(Key key, TBTable* wdl, TBTable* dtz) { - Entry* entry = &hashTable[(uint32_t)key & (Size - 1)]; + uint32_t homeBucket = (uint32_t)key & (Size - 1); + Entry entry = std::make_tuple(key, wdl, dtz); // Ensure last element is empty to avoid overflow when looking up - for ( ; entry - hashTable < Size - 1; ++entry) - if (std::get(*entry) == key || !std::get(*entry)) { - *entry = std::make_tuple(key, wdl, dtz); + for (uint32_t bucket = homeBucket; bucket < Size + Overflow - 1; ++bucket) { + Key otherKey = std::get(hashTable[bucket]); + if (otherKey == key || !std::get(hashTable[bucket])) { + hashTable[bucket] = entry; return; } + + // Robin Hood hashing: If we've probed for longer than this element, + // insert here and search for a new spot for the other element instead. + uint32_t otherHomeBucket = (uint32_t)otherKey & (Size - 1); + if (otherHomeBucket > homeBucket) { + swap(entry, hashTable[bucket]); + key = otherKey; + homeBucket = otherHomeBucket; + } + } std::cerr << "TB hash table size too low!" << std::endl; exit(1); } @@ -512,7 +526,7 @@ int decompress_pairs(PairsData* d, uint64_t idx) { offset -= d->blockLength[block++] + 1; // Finally, we find the start address of our block of canonical Huffman symbols - uint32_t* ptr = (uint32_t*)(d->data + block * d->sizeofBlock); + uint32_t* ptr = (uint32_t*)(d->data + ((uint64_t)block * d->sizeofBlock)); // Read the first 64 bits in our block, this is a (truncated) sequence of // unknown number of symbols of unknown length but we know the first one @@ -575,7 +589,7 @@ int decompress_pairs(PairsData* d, uint64_t idx) { } } - return d->btree[sym].get(); + return d->btree[sym].get(); } bool check_dtz_stm(TBTable*, int, File) { return true; } @@ -601,8 +615,12 @@ int map_score(TBTable* entry, File f, int value, WDLScore wdl) { uint8_t* map = entry->map; uint16_t* idx = entry->get(0, f)->map_idx; - if (flags & TBFlag::Mapped) - value = map[idx[WDLMap[wdl + 2]] + value]; + if (flags & TBFlag::Mapped) { + if (flags & TBFlag::Wide) + value = ((uint16_t *)map)[idx[WDLMap[wdl + 2]] + value]; + else + value = map[idx[WDLMap[wdl + 2]] + value]; + } // DTZ tables store distance to zero in number of moves or plies. We // want to return plies, so we have convert to plies when needed. @@ -973,7 +991,7 @@ uint8_t* set_sizes(PairsData* d, uint8_t* data) { d->symlen.resize(number(data)); data += sizeof(uint16_t); d->btree = (LR*)data; - // The comrpession scheme used is "Recursive Pairing", that replaces the most + // The compression scheme used is "Recursive Pairing", that replaces the most // frequent adjacent pair of symbols in the source message by a new symbol, // reevaluating the frequencies of all of the symbol pairs with respect to // the extended alphabet, and then repeating the process. @@ -994,11 +1012,22 @@ uint8_t* set_dtz_map(TBTable& e, uint8_t* data, File maxFile) { e.map = data; for (File f = FILE_A; f <= maxFile; ++f) { - if (e.get(0, f)->flags & TBFlag::Mapped) - for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x - e.get(0, f)->map_idx[i] = (uint16_t)(data - e.map + 1); - data += *data + 1; + auto flags = e.get(0, f)->flags; + if (flags & TBFlag::Mapped) { + if (flags & TBFlag::Wide) { + data += (uintptr_t)data & 1; // Word alignment, we may have a mixed table + for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x + e.get(0, f)->map_idx[i] = (uint16_t)((uint16_t *)data - (uint16_t *)e.map + 1); + data += 2 * number(data) + 2; + } } + else { + for (int i = 0; i < 4; ++i) { + e.get(0, f)->map_idx[i] = (uint16_t)(data - e.map + 1); + data += *data + 1; + } + } + } } return data += (uintptr_t)data & 1; // Word alignment @@ -1131,11 +1160,11 @@ Ret probe_table(const Position& pos, ProbeState* result, WDLScore wdl = WDLDraw) // All of this means that during probing, the engine must look at captures and probe // their results and must probe the position itself. The "best" result of these // probes is the correct result for the position. -// DTZ table don't store values when a following move is a zeroing winning move +// DTZ tables do not store values when a following move is a zeroing winning move // (winning capture or winning pawn move). Also DTZ store wrong values for positions // where the best move is an ep-move (even if losing). So in all these cases set // the state to ZEROING_BEST_MOVE. -template +template WDLScore search(Position& pos, ProbeState* result) { WDLScore value, bestValue = WDLLoss; @@ -1153,7 +1182,7 @@ WDLScore search(Position& pos, ProbeState* result) { moveCount++; pos.do_move(move, st); - value = -search(pos, result); + value = -search(pos, result); pos.undo_move(move); if (*result == FAIL) @@ -1274,9 +1303,9 @@ void Tablebases::init(const std::string& paths) { // among pawns with same file, the one with lowest rank. int availableSquares = 47; // Available squares when lead pawn is in a2 - // Init the tables for the encoding of leading pawns group: with 6-men TB we - // can have up to 4 leading pawns (KPPPPK). - for (int leadPawnsCnt = 1; leadPawnsCnt <= 4; ++leadPawnsCnt) + // Init the tables for the encoding of leading pawns group: with 7-men TB we + // can have up to 5 leading pawns (KPPPPPK). + for (int leadPawnsCnt = 1; leadPawnsCnt <= 5; ++leadPawnsCnt) for (File f = FILE_A; f <= FILE_D; ++f) { // Restart the index at every file because TB table is splitted @@ -1320,11 +1349,22 @@ void Tablebases::init(const std::string& paths) { for (PieceType p3 = PAWN; p3 <= p2; ++p3) { TBTables.add({KING, p1, p2, p3, KING}); - for (PieceType p4 = PAWN; p4 <= p3; ++p4) + for (PieceType p4 = PAWN; p4 <= p3; ++p4) { TBTables.add({KING, p1, p2, p3, p4, KING}); - for (PieceType p4 = PAWN; p4 < KING; ++p4) + for (PieceType p5 = PAWN; p5 <= p4; ++p5) + TBTables.add({KING, p1, p2, p3, p4, p5, KING}); + + for (PieceType p5 = PAWN; p5 < KING; ++p5) + TBTables.add({KING, p1, p2, p3, p4, KING, p5}); + } + + for (PieceType p4 = PAWN; p4 < KING; ++p4) { TBTables.add({KING, p1, p2, p3, KING, p4}); + + for (PieceType p5 = PAWN; p5 <= p4; ++p5) + TBTables.add({KING, p1, p2, p3, KING, p4, p5}); + } } for (PieceType p3 = PAWN; p3 <= p1; ++p3) @@ -1347,7 +1387,7 @@ void Tablebases::init(const std::string& paths) { WDLScore Tablebases::probe_wdl(Position& pos, ProbeState* result) { *result = OK; - return search(pos, result); + return search(pos, result); } // Probe the DTZ table for a particular position. @@ -1412,7 +1452,7 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result) { // otherwise we will get the dtz of the next move sequence. Search the // position after the move to get the score sign (because even in a // winning position we could make a losing capture or going for a draw). - dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) + dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) : -probe_dtz(pos, result); // If the move mates, force minDTZ to 1 @@ -1491,12 +1531,12 @@ bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves) { int r = dtz > 0 ? (dtz + cnt50 <= 99 && !rep ? 1000 : 1000 - (dtz + cnt50)) : dtz < 0 ? (-dtz * 2 + cnt50 < 100 ? -1000 : -1000 + (-dtz + cnt50)) : 0; - m.TBRank = r; + m.tbRank = r; // Determine the score to be displayed for this move. Assign at least // 1 cp to cursed wins and let it grow to 49 cp as the positions gets // closer to a real win. - m.TBScore = r >= bound ? VALUE_MATE - MAX_PLY - 1 + m.tbScore = r >= bound ? VALUE_MATE - MAX_PLY - 1 : r > 0 ? Value((std::max( 3, r - 800) * int(PawnValueEg)) / 200) : r == 0 ? VALUE_DRAW : r > -bound ? Value((std::min(-3, r + 800) * int(PawnValueEg)) / 200) @@ -1532,12 +1572,12 @@ bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves) { if (result == FAIL) return false; - m.TBRank = WDL_to_rank[wdl + 2]; + m.tbRank = WDL_to_rank[wdl + 2]; if (!rule50) wdl = wdl > WDLDraw ? WDLWin : wdl < WDLDraw ? WDLLoss : WDLDraw; - m.TBScore = WDL_to_value[wdl + 2]; + m.tbScore = WDL_to_value[wdl + 2]; } return true; diff --git a/Engines/Linux32/mcbrain/src/syzygy/tbprobe.h b/Engines/Linux32/mcbrain/src/syzygy/tbprobe.h index 572265b..3fcb3d8 100644 --- a/Engines/Linux32/mcbrain/src/syzygy/tbprobe.h +++ b/Engines/Linux32/mcbrain/src/syzygy/tbprobe.h @@ -1,21 +1,23 @@ /* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (c) 2013 Ronald de Man - Copyright (C) 2016-2018 Marco Costalba, Lucas Braesch - - Stockfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Stockfish is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ #ifndef TBPROBE_H #define TBPROBE_H diff --git a/Engines/Linux32/mcbrain/src/syzygy/tbprobe.o b/Engines/Linux32/mcbrain/src/syzygy/tbprobe.o new file mode 100644 index 0000000..992b27f Binary files /dev/null and b/Engines/Linux32/mcbrain/src/syzygy/tbprobe.o differ diff --git a/Engines/Linux32/mcbrain/src/tbprobe.cpp b/Engines/Linux32/mcbrain/src/tbprobe.cpp deleted file mode 100644 index 90a016b..0000000 --- a/Engines/Linux32/mcbrain/src/tbprobe.cpp +++ /dev/null @@ -1,1695 +0,0 @@ -/* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (c) 2013 Ronald de Man - Copyright (C) 2016-2017 Marco Costalba, Lucas Braesch - - Stockfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Stockfish is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#include -#include // For std::memset -#include -#include -#include -#include -#include -#include - -#include "bitboard.h" -#include "movegen.h" -#include "position.h" -#include "search.h" -#include "thread_win32.h" -#include "types.h" - -#include "tbprobe.h" - -#ifndef _WIN32 -#include -#include -#include -#include -#else -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX -#include -#endif - -using namespace Tablebases; - -int Tablebases::MaxCardinality; - -namespace { - -// Each table has a set of flags: all of them refer to DTZ tables, the last one to WDL tables -enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, SingleValue = 128 }; - -inline WDLScore operator-(WDLScore d) { return WDLScore(-int(d)); } -inline Square operator^=(Square& s, int i) { return s = Square(int(s) ^ i); } -inline Square operator^(Square s, int i) { return Square(int(s) ^ i); } - -// DTZ tables don't store valid scores for moves that reset the rule50 counter -// like captures and pawn moves but we can easily recover the correct dtz of the -// previous move if we know the position's WDL score. -int dtz_before_zeroing(WDLScore wdl) { - return wdl == WDLWin ? 1 : - wdl == WDLCursedWin ? 101 : - wdl == WDLBlessedLoss ? -101 : - wdl == WDLLoss ? -1 : 0; -} - -// Return the sign of a number (-1, 0, 1) -template int sign_of(T val) { - return (T(0) < val) - (val < T(0)); -} - -// Numbers in little endian used by sparseIndex[] to point into blockLength[] -struct SparseEntry { - char block[4]; // Number of block - char offset[2]; // Offset within the block -}; - -static_assert(sizeof(SparseEntry) == 6, "SparseEntry must be 6 bytes"); - -typedef uint16_t Sym; // Huffman symbol - -struct LR { - enum Side { Left, Right, Value }; - - uint8_t lr[3]; // The first 12 bits is the left-hand symbol, the second 12 - // bits is the right-hand symbol. If symbol has length 1, - // then the first byte is the stored value. - template - Sym get() { - return S == Left ? ((lr[1] & 0xF) << 8) | lr[0] : - S == Right ? (lr[2] << 4) | (lr[1] >> 4) : - S == Value ? lr[0] : (assert(false), Sym(-1)); - } -}; - -static_assert(sizeof(LR) == 3, "LR tree entry must be 3 bytes"); - -const int TBPIECES = 6; - -struct PairsData { - int flags; - size_t sizeofBlock; // Block size in bytes - size_t span; // About every span values there is a SparseIndex[] entry - int blocksNum; // Number of blocks in the TB file - int maxSymLen; // Maximum length in bits of the Huffman symbols - int minSymLen; // Minimum length in bits of the Huffman symbols - Sym* lowestSym; // lowestSym[l] is the symbol of length l with the lowest value - LR* btree; // btree[sym] stores the left and right symbols that expand sym - uint16_t* blockLength; // Number of stored positions (minus one) for each block: 1..65536 - int blockLengthSize; // Size of blockLength[] table: padded so it's bigger than blocksNum - SparseEntry* sparseIndex; // Partial indices into blockLength[] - size_t sparseIndexSize; // Size of SparseIndex[] table - uint8_t* data; // Start of Huffman compressed data - std::vector base64; // base64[l - min_sym_len] is the 64bit-padded lowest symbol of length l - std::vector symlen; // Number of values (-1) represented by a given Huffman symbol: 1..256 - Piece pieces[TBPIECES]; // Position pieces: the order of pieces defines the groups - uint64_t groupIdx[TBPIECES+1]; // Start index used for the encoding of the group's pieces - int groupLen[TBPIECES+1]; // Number of pieces in a given group: KRKN -> (3, 1) -}; - -// Helper struct to avoid manually defining entry copy constructor as we -// should because the default one is not compatible with std::atomic_bool. -struct Atomic { - Atomic() = default; - Atomic(const Atomic& e) { ready = e.ready.load(); } // MSVC 2013 wants assignment within body - std::atomic_bool ready; -}; - -// We define types for the different parts of the WLDEntry and DTZEntry with -// corresponding specializations for pieces or pawns. - -struct WLDEntryPiece { - PairsData* precomp; -}; - -struct WDLEntryPawn { - uint8_t pawnCount[2]; // [Lead color / other color] - WLDEntryPiece file[2][4]; // [wtm / btm][FILE_A..FILE_D] -}; - -struct DTZEntryPiece { - PairsData* precomp; - uint16_t map_idx[4]; // WDLWin, WDLLoss, WDLCursedWin, WDLBlessedLoss - uint8_t* map; -}; - -struct DTZEntryPawn { - uint8_t pawnCount[2]; - DTZEntryPiece file[4]; - uint8_t* map; -}; - -struct TBEntry : public Atomic { - void* baseAddress; - uint64_t mapping; - Key key; - Key key2; - int pieceCount; - bool hasPawns; - bool hasUniquePieces; -}; - -// Now the main types: WDLEntry and DTZEntry -struct WDLEntry : public TBEntry { - WDLEntry(const std::string& code); - ~WDLEntry(); - union { - WLDEntryPiece pieceTable[2]; // [wtm / btm] - WDLEntryPawn pawnTable; - }; -}; - -struct DTZEntry : public TBEntry { - DTZEntry(const WDLEntry& wdl); - ~DTZEntry(); - union { - DTZEntryPiece pieceTable; - DTZEntryPawn pawnTable; - }; -}; - -typedef decltype(WDLEntry::pieceTable) WDLPieceTable; -typedef decltype(DTZEntry::pieceTable) DTZPieceTable; -typedef decltype(WDLEntry::pawnTable ) WDLPawnTable; -typedef decltype(DTZEntry::pawnTable ) DTZPawnTable; - -auto item(WDLPieceTable& e, int stm, int ) -> decltype(e[stm])& { return e[stm]; } -auto item(DTZPieceTable& e, int , int ) -> decltype(e)& { return e; } -auto item(WDLPawnTable& e, int stm, int f) -> decltype(e.file[stm][f])& { return e.file[stm][f]; } -auto item(DTZPawnTable& e, int , int f) -> decltype(e.file[f])& { return e.file[f]; } - -template struct Ret { typedef int type; }; -template<> struct Ret { typedef WDLScore type; }; - -int MapPawns[SQUARE_NB]; -int MapB1H1H7[SQUARE_NB]; -int MapA1D1D4[SQUARE_NB]; -int MapKK[10][SQUARE_NB]; // [MapA1D1D4][SQUARE_NB] - -// Comparison function to sort leading pawns in ascending MapPawns[] order -bool pawns_comp(Square i, Square j) { return MapPawns[i] < MapPawns[j]; } -int off_A1H8(Square sq) { return int(rank_of(sq)) - file_of(sq); } - -const Value WDL_to_value[] = { - -VALUE_MATE + MAX_PLY + 1, - VALUE_DRAW - 2, - VALUE_DRAW, - VALUE_DRAW + 2, - VALUE_MATE - MAX_PLY - 1 -}; - -const std::string PieceToChar = " PNBRQK pnbrqk"; - -int Binomial[6][SQUARE_NB]; // [k][n] k elements from a set of n elements -int LeadPawnIdx[5][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] -int LeadPawnsSize[5][4]; // [leadPawnsCnt][FILE_A..FILE_D] - -enum { BigEndian, LittleEndian }; - -template -inline void swap_byte(T& x) -{ - char tmp, *c = (char*)&x; - for (int i = 0; i < Half; ++i) - tmp = c[i], c[i] = c[End - i], c[End - i] = tmp; -} -template<> inline void swap_byte(uint8_t&) {} - -template T number(void* addr) -{ - const union { uint32_t i; char c[4]; } Le = { 0x01020304 }; - const bool IsLittleEndian = (Le.c[0] == 4); - - T v; - - if ((uintptr_t)addr & (alignof(T) - 1)) // Unaligned pointer (very rare) - std::memcpy(&v, addr, sizeof(T)); - else - v = *((T*)addr); - - if (LE != IsLittleEndian) - swap_byte(v); - return v; -} - -class HashTable { - - typedef std::pair EntryPair; - typedef std::pair Entry; - - static const int TBHASHBITS = 10; - static const int HSHMAX = 5; - - Entry hashTable[1 << TBHASHBITS][HSHMAX]; - - std::deque wdlTable; - std::deque dtzTable; - - void insert(Key key, WDLEntry* wdl, DTZEntry* dtz) { - Entry* entry = hashTable[key >> (64 - TBHASHBITS)]; - - for (int i = 0; i < HSHMAX; ++i, ++entry) - if (!entry->second.first || entry->first == key) { - *entry = std::make_pair(key, std::make_pair(wdl, dtz)); - return; - } - - std::cerr << "HSHMAX too low!" << std::endl; - exit(1); - } - -public: - template::value ? 0 : 1> - E* get(Key key) { - Entry* entry = hashTable[key >> (64 - TBHASHBITS)]; - - for (int i = 0; i < HSHMAX; ++i, ++entry) - if (entry->first == key) - return std::get(entry->second); - - return nullptr; - } - - void clear() { - std::memset(hashTable, 0, sizeof(hashTable)); - wdlTable.clear(); - dtzTable.clear(); - } - size_t size() const { return wdlTable.size(); } - void insert(const std::vector& pieces); -}; - -HashTable EntryTable; - -class TBFile : public std::ifstream { - - std::string fname; - -public: - // Look for and open the file among the Paths directories where the .rtbw - // and .rtbz files can be found. Multiple directories are separated by ";" - // on Windows and by ":" on Unix-based operating systems. - // - // Example: - // C:\tb\wdl345;C:\tb\wdl6;D:\tb\dtz345;D:\tb\dtz6 - static std::string Paths; - - TBFile(const std::string& f) { - -#ifndef _WIN32 - const char SepChar = ':'; -#else - const char SepChar = ';'; -#endif - std::stringstream ss(Paths); - std::string path; - - while (std::getline(ss, path, SepChar)) { - fname = path + "/" + f; - std::ifstream::open(fname); - if (is_open()) - return; - } - } - - // Memory map the file and check it. File should be already open and will be - // closed after mapping. - uint8_t* map(void** baseAddress, uint64_t* mapping, const uint8_t* TB_MAGIC) { - - assert(is_open()); - - close(); // Need to re-open to get native file descriptor - -#ifndef _WIN32 - struct stat statbuf; - int fd = ::open(fname.c_str(), O_RDONLY); - fstat(fd, &statbuf); - *mapping = statbuf.st_size; - *baseAddress = mmap(nullptr, statbuf.st_size, PROT_READ, MAP_SHARED, fd, 0); - ::close(fd); - - if (*baseAddress == MAP_FAILED) { - std::cerr << "Could not mmap() " << fname << std::endl; - exit(1); - } -#else - HANDLE fd = CreateFile(fname.c_str(), GENERIC_READ, FILE_SHARE_READ, nullptr, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); - DWORD size_high; - DWORD size_low = GetFileSize(fd, &size_high); - HANDLE mmap = CreateFileMapping(fd, nullptr, PAGE_READONLY, size_high, size_low, nullptr); - CloseHandle(fd); - - if (!mmap) { - std::cerr << "CreateFileMapping() failed" << std::endl; - exit(1); - } - - *mapping = (uint64_t)mmap; - *baseAddress = MapViewOfFile(mmap, FILE_MAP_READ, 0, 0, 0); - - if (!*baseAddress) { - std::cerr << "MapViewOfFile() failed, name = " << fname - << ", error = " << GetLastError() << std::endl; - exit(1); - } -#endif - uint8_t* data = (uint8_t*)*baseAddress; - - if ( *data++ != *TB_MAGIC++ - || *data++ != *TB_MAGIC++ - || *data++ != *TB_MAGIC++ - || *data++ != *TB_MAGIC) { - std::cerr << "Corrupted table in file " << fname << std::endl; - unmap(*baseAddress, *mapping); - *baseAddress = nullptr; - return nullptr; - } - - return data; - } - - static void unmap(void* baseAddress, uint64_t mapping) { - -#ifndef _WIN32 - munmap(baseAddress, mapping); -#else - UnmapViewOfFile(baseAddress); - CloseHandle((HANDLE)mapping); -#endif - } -}; - -std::string TBFile::Paths; - -WDLEntry::WDLEntry(const std::string& code) { - - StateInfo st; - Position pos; - - memset(this, 0, sizeof(WDLEntry)); - - ready = false; - key = pos.set(code, WHITE, &st).material_key(); - pieceCount = popcount(pos.pieces()); - hasPawns = pos.pieces(PAWN); - - for (Color c = WHITE; c <= BLACK; ++c) - for (PieceType pt = PAWN; pt < KING; ++pt) - if (popcount(pos.pieces(c, pt)) == 1) - hasUniquePieces = true; - - if (hasPawns) { - // Set the leading color. In case both sides have pawns the leading color - // is the side with less pawns because this leads to better compression. - bool c = !pos.count(BLACK) - || ( pos.count(WHITE) - && pos.count(BLACK) >= pos.count(WHITE)); - - pawnTable.pawnCount[0] = pos.count(c ? WHITE : BLACK); - pawnTable.pawnCount[1] = pos.count(c ? BLACK : WHITE); - } - - key2 = pos.set(code, BLACK, &st).material_key(); -} - -WDLEntry::~WDLEntry() { - - if (baseAddress) - TBFile::unmap(baseAddress, mapping); - - for (int i = 0; i < 2; ++i) - if (hasPawns) - for (File f = FILE_A; f <= FILE_D; ++f) - delete pawnTable.file[i][f].precomp; - else - delete pieceTable[i].precomp; -} - -DTZEntry::DTZEntry(const WDLEntry& wdl) { - - memset(this, 0, sizeof(DTZEntry)); - - ready = false; - key = wdl.key; - key2 = wdl.key2; - pieceCount = wdl.pieceCount; - hasPawns = wdl.hasPawns; - hasUniquePieces = wdl.hasUniquePieces; - - if (hasPawns) { - pawnTable.pawnCount[0] = wdl.pawnTable.pawnCount[0]; - pawnTable.pawnCount[1] = wdl.pawnTable.pawnCount[1]; - } -} - -DTZEntry::~DTZEntry() { - - if (baseAddress) - TBFile::unmap(baseAddress, mapping); - - if (hasPawns) - for (File f = FILE_A; f <= FILE_D; ++f) - delete pawnTable.file[f].precomp; - else - delete pieceTable.precomp; -} - -void HashTable::insert(const std::vector& pieces) { - - std::string code; - - for (PieceType pt : pieces) - code += PieceToChar[pt]; - - TBFile file(code.insert(code.find('K', 1), "v") + ".rtbw"); // KRK -> KRvK - - if (!file.is_open()) - return; - - file.close(); - - MaxCardinality = std::max((int)pieces.size(), MaxCardinality); - - wdlTable.emplace_back(code); - dtzTable.emplace_back(wdlTable.back()); - - insert(wdlTable.back().key , &wdlTable.back(), &dtzTable.back()); - insert(wdlTable.back().key2, &wdlTable.back(), &dtzTable.back()); -} - -// TB tables are compressed with canonical Huffman code. The compressed data is divided into -// blocks of size d->sizeofBlock, and each block stores a variable number of symbols. -// Each symbol represents either a WDL or a (remapped) DTZ value, or a pair of other symbols -// (recursively). If you keep expanding the symbols in a block, you end up with up to 65536 -// WDL or DTZ values. Each symbol represents up to 256 values and will correspond after -// Huffman coding to at least 1 bit. So a block of 32 bytes corresponds to at most -// 32 x 8 x 256 = 65536 values. This maximum is only reached for tables that consist mostly -// of draws or mostly of wins, but such tables are actually quite common. In principle, the -// blocks in WDL tables are 64 bytes long (and will be aligned on cache lines). But for -// mostly-draw or mostly-win tables this can leave many 64-byte blocks only half-filled, so -// in such cases blocks are 32 bytes long. The blocks of DTZ tables are up to 1024 bytes long. -// The generator picks the size that leads to the smallest table. The "book" of symbols and -// Huffman codes is the same for all blocks in the table. A non-symmetric pawnless TB file -// will have one table for wtm and one for btm, a TB file with pawns will have tables per -// file a,b,c,d also in this case one set for wtm and one for btm. -int decompress_pairs(PairsData* d, uint64_t idx) { - - // Special case where all table positions store the same value - if (d->flags & TBFlag::SingleValue) - return d->minSymLen; - - // First we need to locate the right block that stores the value at index "idx". - // Because each block n stores blockLength[n] + 1 values, the index i of the block - // that contains the value at position idx is: - // - // for (i = -1, sum = 0; sum <= idx; i++) - // sum += blockLength[i + 1] + 1; - // - // This can be slow, so we use SparseIndex[] populated with a set of SparseEntry that - // point to known indices into blockLength[]. Namely SparseIndex[k] is a SparseEntry - // that stores the blockLength[] index and the offset within that block of the value - // with index I(k), where: - // - // I(k) = k * d->span + d->span / 2 (1) - - // First step is to get the 'k' of the I(k) nearest to our idx, using definition (1) - uint32_t k = idx / d->span; - - // Then we read the corresponding SparseIndex[] entry - uint32_t block = number(&d->sparseIndex[k].block); - int offset = number(&d->sparseIndex[k].offset); - - // Now compute the difference idx - I(k). From definition of k we know that - // - // idx = k * d->span + idx % d->span (2) - // - // So from (1) and (2) we can compute idx - I(K): - int diff = idx % d->span - d->span / 2; - - // Sum the above to offset to find the offset corresponding to our idx - offset += diff; - - // Move to previous/next block, until we reach the correct block that contains idx, - // that is when 0 <= offset <= d->blockLength[block] - while (offset < 0) - offset += d->blockLength[--block] + 1; - - while (offset > d->blockLength[block]) - offset -= d->blockLength[block++] + 1; - - // Finally, we find the start address of our block of canonical Huffman symbols - uint32_t* ptr = (uint32_t*)(d->data + block * d->sizeofBlock); - - // Read the first 64 bits in our block, this is a (truncated) sequence of - // unknown number of symbols of unknown length but we know the first one - // is at the beginning of this 64 bits sequence. - uint64_t buf64 = number(ptr); ptr += 2; - int buf64Size = 64; - Sym sym; - - while (true) { - int len = 0; // This is the symbol length - d->min_sym_len - - // Now get the symbol length. For any symbol s64 of length l right-padded - // to 64 bits we know that d->base64[l-1] >= s64 >= d->base64[l] so we - // can find the symbol length iterating through base64[]. - while (buf64 < d->base64[len]) - ++len; - - // All the symbols of a given length are consecutive integers (numerical - // sequence property), so we can compute the offset of our symbol of - // length len, stored at the beginning of buf64. - sym = (buf64 - d->base64[len]) >> (64 - len - d->minSymLen); - - // Now add the value of the lowest symbol of length len to get our symbol - sym += number(&d->lowestSym[len]); - - // If our offset is within the number of values represented by symbol sym - // we are done... - if (offset < d->symlen[sym] + 1) - break; - - // ...otherwise update the offset and continue to iterate - offset -= d->symlen[sym] + 1; - len += d->minSymLen; // Get the real length - buf64 <<= len; // Consume the just processed symbol - buf64Size -= len; - - if (buf64Size <= 32) { // Refill the buffer - buf64Size += 32; - buf64 |= (uint64_t)number(ptr++) << (64 - buf64Size); - } - } - - // Ok, now we have our symbol that expands into d->symlen[sym] + 1 symbols. - // We binary-search for our value recursively expanding into the left and - // right child symbols until we reach a leaf node where symlen[sym] + 1 == 1 - // that will store the value we need. - while (d->symlen[sym]) { - - Sym left = d->btree[sym].get(); - - // If a symbol contains 36 sub-symbols (d->symlen[sym] + 1 = 36) and - // expands in a pair (d->symlen[left] = 23, d->symlen[right] = 11), then - // we know that, for instance the ten-th value (offset = 10) will be on - // the left side because in Recursive Pairing child symbols are adjacent. - if (offset < d->symlen[left] + 1) - sym = left; - else { - offset -= d->symlen[left] + 1; - sym = d->btree[sym].get(); - } - } - - return d->btree[sym].get(); -} - -bool check_dtz_stm(WDLEntry*, int, File) { return true; } - -bool check_dtz_stm(DTZEntry* entry, int stm, File f) { - - int flags = entry->hasPawns ? entry->pawnTable.file[f].precomp->flags - : entry->pieceTable.precomp->flags; - - return (flags & TBFlag::STM) == stm - || ((entry->key == entry->key2) && !entry->hasPawns); -} - -// DTZ scores are sorted by frequency of occurrence and then assigned the -// values 0, 1, 2, ... in order of decreasing frequency. This is done for each -// of the four WDLScore values. The mapping information necessary to reconstruct -// the original values is stored in the TB file and read during map[] init. -WDLScore map_score(WDLEntry*, File, int value, WDLScore) { return WDLScore(value - 2); } - -int map_score(DTZEntry* entry, File f, int value, WDLScore wdl) { - - const int WDLMap[] = { 1, 3, 0, 2, 0 }; - - int flags = entry->hasPawns ? entry->pawnTable.file[f].precomp->flags - : entry->pieceTable.precomp->flags; - - uint8_t* map = entry->hasPawns ? entry->pawnTable.map - : entry->pieceTable.map; - - uint16_t* idx = entry->hasPawns ? entry->pawnTable.file[f].map_idx - : entry->pieceTable.map_idx; - if (flags & TBFlag::Mapped) - value = map[idx[WDLMap[wdl + 2]] + value]; - - // DTZ tables store distance to zero in number of moves or plies. We - // want to return plies, so we have convert to plies when needed. - if ( (wdl == WDLWin && !(flags & TBFlag::WinPlies)) - || (wdl == WDLLoss && !(flags & TBFlag::LossPlies)) - || wdl == WDLCursedWin - || wdl == WDLBlessedLoss) - value *= 2; - - return value + 1; -} - -// Compute a unique index out of a position and use it to probe the TB file. To -// encode k pieces of same type and color, first sort the pieces by square in -// ascending order s1 <= s2 <= ... <= sk then compute the unique index as: -// -// idx = Binomial[1][s1] + Binomial[2][s2] + ... + Binomial[k][sk] -// -template::type> -T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* result) { - - const bool IsWDL = std::is_same::value; - - Square squares[TBPIECES]; - Piece pieces[TBPIECES]; - uint64_t idx; - int next = 0, size = 0, leadPawnsCnt = 0; - PairsData* d; - Bitboard b, leadPawns = 0; - File tbFile = FILE_A; - - // A given TB entry like KRK has associated two material keys: KRvk and Kvkr. - // If both sides have the same pieces keys are equal. In this case TB tables - // only store the 'white to move' case, so if the position to lookup has black - // to move, we need to switch the color and flip the squares before to lookup. - bool symmetricBlackToMove = (entry->key == entry->key2 && pos.side_to_move()); - - // TB files are calculated for white as stronger side. For instance we have - // KRvK, not KvKR. A position where stronger side is white will have its - // material key == entry->key, otherwise we have to switch the color and - // flip the squares before to lookup. - bool blackStronger = (pos.material_key() != entry->key); - - int flipColor = (symmetricBlackToMove || blackStronger) * 8; - int flipSquares = (symmetricBlackToMove || blackStronger) * 070; - int stm = (symmetricBlackToMove || blackStronger) ^ pos.side_to_move(); - - // For pawns, TB files store 4 separate tables according if leading pawn is on - // file a, b, c or d after reordering. The leading pawn is the one with maximum - // MapPawns[] value, that is the one most toward the edges and with lowest rank. - if (entry->hasPawns) { - - // In all the 4 tables, pawns are at the beginning of the piece sequence and - // their color is the reference one. So we just pick the first one. - Piece pc = Piece(item(entry->pawnTable, 0, 0).precomp->pieces[0] ^ flipColor); - - assert(type_of(pc) == PAWN); - - leadPawns = b = pos.pieces(color_of(pc), PAWN); - do - squares[size++] = pop_lsb(&b) ^ flipSquares; - while (b); - - leadPawnsCnt = size; - - std::swap(squares[0], *std::max_element(squares, squares + leadPawnsCnt, pawns_comp)); - - tbFile = file_of(squares[0]); - if (tbFile > FILE_D) - tbFile = file_of(squares[0] ^ 7); // Horizontal flip: SQ_H1 -> SQ_A1 - - d = item(entry->pawnTable , stm, tbFile).precomp; - } else - d = item(entry->pieceTable, stm, tbFile).precomp; - - // DTZ tables are one-sided, i.e. they store positions only for white to - // move or only for black to move, so check for side to move to be stm, - // early exit otherwise. - if (!IsWDL && !check_dtz_stm(entry, stm, tbFile)) - return *result = CHANGE_STM, T(); - - // Now we are ready to get all the position pieces (but the lead pawns) and - // directly map them to the correct color and square. - b = pos.pieces() ^ leadPawns; - do { - Square s = pop_lsb(&b); - squares[size] = s ^ flipSquares; - pieces[size++] = Piece(pos.piece_on(s) ^ flipColor); - } while (b); - - assert(size >= 2); - - // Then we reorder the pieces to have the same sequence as the one stored - // in precomp->pieces[i]: the sequence that ensures the best compression. - for (int i = leadPawnsCnt; i < size; ++i) - for (int j = i; j < size; ++j) - if (d->pieces[i] == pieces[j]) - { - std::swap(pieces[i], pieces[j]); - std::swap(squares[i], squares[j]); - break; - } - - // Now we map again the squares so that the square of the lead piece is in - // the triangle A1-D1-D4. - if (file_of(squares[0]) > FILE_D) - for (int i = 0; i < size; ++i) - squares[i] ^= 7; // Horizontal flip: SQ_H1 -> SQ_A1 - - // Encode leading pawns starting with the one with minimum MapPawns[] and - // proceeding in ascending order. - if (entry->hasPawns) { - idx = LeadPawnIdx[leadPawnsCnt][squares[0]]; - - std::sort(squares + 1, squares + leadPawnsCnt, pawns_comp); - - for (int i = 1; i < leadPawnsCnt; ++i) - idx += Binomial[i][MapPawns[squares[i]]]; - - goto encode_remaining; // With pawns we have finished special treatments - } - - // In positions withouth pawns, we further flip the squares to ensure leading - // piece is below RANK_5. - if (rank_of(squares[0]) > RANK_4) - for (int i = 0; i < size; ++i) - squares[i] ^= 070; // Vertical flip: SQ_A8 -> SQ_A1 - - // Look for the first piece of the leading group not on the A1-D4 diagonal - // and ensure it is mapped below the diagonal. - for (int i = 0; i < d->groupLen[0]; ++i) { - if (!off_A1H8(squares[i])) - continue; - - if (off_A1H8(squares[i]) > 0) // A1-H8 diagonal flip: SQ_A3 -> SQ_C3 - for (int j = i; j < size; ++j) - squares[j] = Square(((squares[j] >> 3) | (squares[j] << 3)) & 63); - break; - } - - // Encode the leading group. - // - // Suppose we have KRvK. Let's say the pieces are on square numbers wK, wR - // and bK (each 0...63). The simplest way to map this position to an index - // is like this: - // - // index = wK * 64 * 64 + wR * 64 + bK; - // - // But this way the TB is going to have 64*64*64 = 262144 positions, with - // lots of positions being equivalent (because they are mirrors of each - // other) and lots of positions being invalid (two pieces on one square, - // adjacent kings, etc.). - // Usually the first step is to take the wK and bK together. There are just - // 462 ways legal and not-mirrored ways to place the wK and bK on the board. - // Once we have placed the wK and bK, there are 62 squares left for the wR - // Mapping its square from 0..63 to available squares 0..61 can be done like: - // - // wR -= (wR > wK) + (wR > bK); - // - // In words: if wR "comes later" than wK, we deduct 1, and the same if wR - // "comes later" than bK. In case of two same pieces like KRRvK we want to - // place the two Rs "together". If we have 62 squares left, we can place two - // Rs "together" in 62 * 61 / 2 ways (we divide by 2 because rooks can be - // swapped and still get the same position.) - // - // In case we have at least 3 unique pieces (inlcuded kings) we encode them - // together. - if (entry->hasUniquePieces) { - - int adjust1 = squares[1] > squares[0]; - int adjust2 = (squares[2] > squares[0]) + (squares[2] > squares[1]); - - // First piece is below a1-h8 diagonal. MapA1D1D4[] maps the b1-d1-d3 - // triangle to 0...5. There are 63 squares for second piece and and 62 - // (mapped to 0...61) for the third. - if (off_A1H8(squares[0])) - idx = ( MapA1D1D4[squares[0]] * 63 - + (squares[1] - adjust1)) * 62 - + squares[2] - adjust2; - - // First piece is on a1-h8 diagonal, second below: map this occurence to - // 6 to differentiate from the above case, rank_of() maps a1-d4 diagonal - // to 0...3 and finally MapB1H1H7[] maps the b1-h1-h7 triangle to 0..27. - else if (off_A1H8(squares[1])) - idx = ( 6 * 63 + rank_of(squares[0]) * 28 - + MapB1H1H7[squares[1]]) * 62 - + squares[2] - adjust2; - - // First two pieces are on a1-h8 diagonal, third below - else if (off_A1H8(squares[2])) - idx = 6 * 63 * 62 + 4 * 28 * 62 - + rank_of(squares[0]) * 7 * 28 - + (rank_of(squares[1]) - adjust1) * 28 - + MapB1H1H7[squares[2]]; - - // All 3 pieces on the diagonal a1-h8 - else - idx = 6 * 63 * 62 + 4 * 28 * 62 + 4 * 7 * 28 - + rank_of(squares[0]) * 7 * 6 - + (rank_of(squares[1]) - adjust1) * 6 - + (rank_of(squares[2]) - adjust2); - } else - // We don't have at least 3 unique pieces, like in KRRvKBB, just map - // the kings. - idx = MapKK[MapA1D1D4[squares[0]]][squares[1]]; - -encode_remaining: - idx *= d->groupIdx[0]; - Square* groupSq = squares + d->groupLen[0]; - - // Encode remainig pawns then pieces according to square, in ascending order - bool remainingPawns = entry->hasPawns && entry->pawnTable.pawnCount[1]; - - while (d->groupLen[++next]) - { - std::sort(groupSq, groupSq + d->groupLen[next]); - uint64_t n = 0; - - // Map down a square if "comes later" than a square in the previous - // groups (similar to what done earlier for leading group pieces). - for (int i = 0; i < d->groupLen[next]; ++i) - { - auto f = [&](Square s) { return groupSq[i] > s; }; - auto adjust = std::count_if(squares, groupSq, f); - n += Binomial[i + 1][groupSq[i] - adjust - 8 * remainingPawns]; - } - - remainingPawns = false; - idx += n * d->groupIdx[next]; - groupSq += d->groupLen[next]; - } - - // Now that we have the index, decompress the pair and get the score - return map_score(entry, tbFile, decompress_pairs(d, idx), wdl); -} - -// Group together pieces that will be encoded together. The general rule is that -// a group contains pieces of same type and color. The exception is the leading -// group that, in case of positions withouth pawns, can be formed by 3 different -// pieces (default) or by the king pair when there is not a unique piece apart -// from the kings. When there are pawns, pawns are always first in pieces[]. -// -// As example KRKN -> KRK + N, KNNK -> KK + NN, KPPKP -> P + PP + K + K -// -// The actual grouping depends on the TB generator and can be inferred from the -// sequence of pieces in piece[] array. -template -void set_groups(T& e, PairsData* d, int order[], File f) { - - int n = 0, firstLen = e.hasPawns ? 0 : e.hasUniquePieces ? 3 : 2; - d->groupLen[n] = 1; - - // Number of pieces per group is stored in groupLen[], for instance in KRKN - // the encoder will default on '111', so groupLen[] will be (3, 1). - for (int i = 1; i < e.pieceCount; ++i) - if (--firstLen > 0 || d->pieces[i] == d->pieces[i - 1]) - d->groupLen[n]++; - else - d->groupLen[++n] = 1; - - d->groupLen[++n] = 0; // Zero-terminated - - // The sequence in pieces[] defines the groups, but not the order in which - // they are encoded. If the pieces in a group g can be combined on the board - // in N(g) different ways, then the position encoding will be of the form: - // - // g1 * N(g2) * N(g3) + g2 * N(g3) + g3 - // - // This ensures unique encoding for the whole position. The order of the - // groups is a per-table parameter and could not follow the canonical leading - // pawns/pieces -> remainig pawns -> remaining pieces. In particular the - // first group is at order[0] position and the remaining pawns, when present, - // are at order[1] position. - bool pp = e.hasPawns && e.pawnTable.pawnCount[1]; // Pawns on both sides - int next = pp ? 2 : 1; - int freeSquares = 64 - d->groupLen[0] - (pp ? d->groupLen[1] : 0); - uint64_t idx = 1; - - for (int k = 0; next < n || k == order[0] || k == order[1]; ++k) - if (k == order[0]) // Leading pawns or pieces - { - d->groupIdx[0] = idx; - idx *= e.hasPawns ? LeadPawnsSize[d->groupLen[0]][f] - : e.hasUniquePieces ? 31332 : 462; - } - else if (k == order[1]) // Remaining pawns - { - d->groupIdx[1] = idx; - idx *= Binomial[d->groupLen[1]][48 - d->groupLen[0]]; - } - else // Remainig pieces - { - d->groupIdx[next] = idx; - idx *= Binomial[d->groupLen[next]][freeSquares]; - freeSquares -= d->groupLen[next++]; - } - - d->groupIdx[n] = idx; -} - -// In Recursive Pairing each symbol represents a pair of childern symbols. So -// read d->btree[] symbols data and expand each one in his left and right child -// symbol until reaching the leafs that represent the symbol value. -uint8_t set_symlen(PairsData* d, Sym s, std::vector& visited) { - - visited[s] = true; // We can set it now because tree is acyclic - Sym sr = d->btree[s].get(); - - if (sr == 0xFFF) - return 0; - - Sym sl = d->btree[s].get(); - - if (!visited[sl]) - d->symlen[sl] = set_symlen(d, sl, visited); - - if (!visited[sr]) - d->symlen[sr] = set_symlen(d, sr, visited); - - return d->symlen[sl] + d->symlen[sr] + 1; -} - -uint8_t* set_sizes(PairsData* d, uint8_t* data) { - - d->flags = *data++; - - if (d->flags & TBFlag::SingleValue) { - d->blocksNum = d->blockLengthSize = 0; - d->span = d->sparseIndexSize = 0; // Broken MSVC zero-init - d->minSymLen = *data++; // Here we store the single value - return data; - } - - // groupLen[] is a zero-terminated list of group lengths, the last groupIdx[] - // element stores the biggest index that is the tb size. - uint64_t tbSize = d->groupIdx[std::find(d->groupLen, d->groupLen + 7, 0) - d->groupLen]; - - d->sizeofBlock = 1ULL << *data++; - d->span = 1ULL << *data++; - d->sparseIndexSize = (tbSize + d->span - 1) / d->span; // Round up - int padding = number(data++); - d->blocksNum = number(data); data += sizeof(uint32_t); - d->blockLengthSize = d->blocksNum + padding; // Padded to ensure SparseIndex[] - // does not point out of range. - d->maxSymLen = *data++; - d->minSymLen = *data++; - d->lowestSym = (Sym*)data; - d->base64.resize(d->maxSymLen - d->minSymLen + 1); - - // The canonical code is ordered such that longer symbols (in terms of - // the number of bits of their Huffman code) have lower numeric value, - // so that d->lowestSym[i] >= d->lowestSym[i+1] (when read as LittleEndian). - // Starting from this we compute a base64[] table indexed by symbol length - // and containing 64 bit values so that d->base64[i] >= d->base64[i+1]. - // See http://www.eecs.harvard.edu/~michaelm/E210/huffman.pdf - for (int i = d->base64.size() - 2; i >= 0; --i) { - d->base64[i] = (d->base64[i + 1] + number(&d->lowestSym[i]) - - number(&d->lowestSym[i + 1])) / 2; - - assert(d->base64[i] * 2 >= d->base64[i+1]); - } - - // Now left-shift by an amount so that d->base64[i] gets shifted 1 bit more - // than d->base64[i+1] and given the above assert condition, we ensure that - // d->base64[i] >= d->base64[i+1]. Moreover for any symbol s64 of length i - // and right-padded to 64 bits holds d->base64[i-1] >= s64 >= d->base64[i]. - for (size_t i = 0; i < d->base64.size(); ++i) - d->base64[i] <<= 64 - i - d->minSymLen; // Right-padding to 64 bits - - data += d->base64.size() * sizeof(Sym); - d->symlen.resize(number(data)); data += sizeof(uint16_t); - d->btree = (LR*)data; - - // The comrpession scheme used is "Recursive Pairing", that replaces the most - // frequent adjacent pair of symbols in the source message by a new symbol, - // reevaluating the frequencies of all of the symbol pairs with respect to - // the extended alphabet, and then repeating the process. - // See http://www.larsson.dogma.net/dcc99.pdf - std::vector visited(d->symlen.size()); - - for (Sym sym = 0; sym < d->symlen.size(); ++sym) - if (!visited[sym]) - d->symlen[sym] = set_symlen(d, sym, visited); - - return data + d->symlen.size() * sizeof(LR) + (d->symlen.size() & 1); -} - -template -uint8_t* set_dtz_map(WDLEntry&, T&, uint8_t*, File) { return nullptr; } - -template -uint8_t* set_dtz_map(DTZEntry&, T& p, uint8_t* data, File maxFile) { - - p.map = data; - - for (File f = FILE_A; f <= maxFile; ++f) { - if (item(p, 0, f).precomp->flags & TBFlag::Mapped) - for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x - item(p, 0, f).map_idx[i] = (uint16_t)(data - p.map + 1); - data += *data + 1; - } - } - - return data += (uintptr_t)data & 1; // Word alignment -} - -template -void do_init(Entry& e, T& p, uint8_t* data) { - - const bool IsWDL = std::is_same::value; - - PairsData* d; - - enum { Split = 1, HasPawns = 2 }; - - assert(e.hasPawns == !!(*data & HasPawns)); - assert((e.key != e.key2) == !!(*data & Split)); - - data++; // First byte stores flags - - const int Sides = IsWDL && (e.key != e.key2) ? 2 : 1; - const File MaxFile = e.hasPawns ? FILE_D : FILE_A; - - bool pp = e.hasPawns && e.pawnTable.pawnCount[1]; // Pawns on both sides - - assert(!pp || e.pawnTable.pawnCount[0]); - - for (File f = FILE_A; f <= MaxFile; ++f) { - - for (int i = 0; i < Sides; i++) - item(p, i, f).precomp = new PairsData(); - - int order[][2] = { { *data & 0xF, pp ? *(data + 1) & 0xF : 0xF }, - { *data >> 4, pp ? *(data + 1) >> 4 : 0xF } }; - data += 1 + pp; - - for (int k = 0; k < e.pieceCount; ++k, ++data) - for (int i = 0; i < Sides; i++) - item(p, i, f).precomp->pieces[k] = Piece(i ? *data >> 4 : *data & 0xF); - - for (int i = 0; i < Sides; ++i) - set_groups(e, item(p, i, f).precomp, order[i], f); - } - - data += (uintptr_t)data & 1; // Word alignment - - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) - data = set_sizes(item(p, i, f).precomp, data); - - if (!IsWDL) - data = set_dtz_map(e, p, data, MaxFile); - - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) { - (d = item(p, i, f).precomp)->sparseIndex = (SparseEntry*)data; - data += d->sparseIndexSize * sizeof(SparseEntry); - } - - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) { - (d = item(p, i, f).precomp)->blockLength = (uint16_t*)data; - data += d->blockLengthSize * sizeof(uint16_t); - } - - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) { - data = (uint8_t*)(((uintptr_t)data + 0x3F) & ~0x3F); // 64 byte alignment - (d = item(p, i, f).precomp)->data = data; - data += d->blocksNum * d->sizeofBlock; - } -} - -template -void* init(Entry& e, const Position& pos) { - - const bool IsWDL = std::is_same::value; - - static Mutex mutex; - - // Avoid a thread reads 'ready' == true while another is still in do_init(), - // this could happen due to compiler reordering. - if (e.ready.load(std::memory_order_acquire)) - return e.baseAddress; - - std::unique_lock lk(mutex); - - if (e.ready.load(std::memory_order_relaxed)) // Recheck under lock - return e.baseAddress; - - // Pieces strings in decreasing order for each color, like ("KPP","KR") - std::string fname, w, b; - for (PieceType pt = KING; pt >= PAWN; --pt) { - w += std::string(popcount(pos.pieces(WHITE, pt)), PieceToChar[pt]); - b += std::string(popcount(pos.pieces(BLACK, pt)), PieceToChar[pt]); - } - - const uint8_t TB_MAGIC[][4] = { { 0xD7, 0x66, 0x0C, 0xA5 }, - { 0x71, 0xE8, 0x23, 0x5D } }; - - fname = (e.key == pos.material_key() ? w + 'v' + b : b + 'v' + w) - + (IsWDL ? ".rtbw" : ".rtbz"); - - uint8_t* data = TBFile(fname).map(&e.baseAddress, &e.mapping, TB_MAGIC[IsWDL]); - if (data) - e.hasPawns ? do_init(e, e.pawnTable, data) : do_init(e, e.pieceTable, data); - - e.ready.store(true, std::memory_order_release); - return e.baseAddress; -} - -template::type> -T probe_table(const Position& pos, ProbeState* result, WDLScore wdl = WDLDraw) { - - if (!(pos.pieces() ^ pos.pieces(KING))) - return T(WDLDraw); // KvK - - E* entry = EntryTable.get(pos.material_key()); - - if (!entry || !init(*entry, pos)) - return *result = FAIL, T(); - - return do_probe_table(pos, entry, wdl, result); -} - -// For a position where the side to move has a winning capture it is not necessary -// to store a winning value so the generator treats such positions as "don't cares" -// and tries to assign to it a value that improves the compression ratio. Similarly, -// if the side to move has a drawing capture, then the position is at least drawn. -// If the position is won, then the TB needs to store a win value. But if the -// position is drawn, the TB may store a loss value if that is better for compression. -// All of this means that during probing, the engine must look at captures and probe -// their results and must probe the position itself. The "best" result of these -// probes is the correct result for the position. -// DTZ table don't store values when a following move is a zeroing winning move -// (winning capture or winning pawn move). Also DTZ store wrong values for positions -// where the best move is an ep-move (even if losing). So in all these cases set -// the state to ZEROING_BEST_MOVE. -template -WDLScore search(Position& pos, ProbeState* result) { - - WDLScore value, bestValue = WDLLoss; - StateInfo st; - - auto moveList = MoveList(pos); - size_t totalCount = moveList.size(), moveCount = 0; - - for (const Move& move : moveList) - { - if ( !pos.capture(move) - && (!CheckZeroingMoves || type_of(pos.moved_piece(move)) != PAWN)) - continue; - - moveCount++; - - pos.do_move(move, st); - value = -search(pos, result); - pos.undo_move(move); - - if (*result == FAIL) - return WDLDraw; - - if (value > bestValue) - { - bestValue = value; - - if (value >= WDLWin) - { - *result = ZEROING_BEST_MOVE; // Winning DTZ-zeroing move - return value; - } - } - } - - // In case we have already searched all the legal moves we don't have to probe - // the TB because the stored score could be wrong. For instance TB tables - // do not contain information on position with ep rights, so in this case - // the result of probe_wdl_table is wrong. Also in case of only capture - // moves, for instance here 4K3/4q3/6p1/2k5/6p1/8/8/8 w - - 0 7, we have to - // return with ZEROING_BEST_MOVE set. - bool noMoreMoves = (moveCount && moveCount == totalCount); - - if (noMoreMoves) - value = bestValue; - else - { - value = probe_table(pos, result); - - if (*result == FAIL) - return WDLDraw; - } - - // DTZ stores a "don't care" value if bestValue is a win - if (bestValue >= value) - return *result = ( bestValue > WDLDraw - || noMoreMoves ? ZEROING_BEST_MOVE : OK), bestValue; - - return *result = OK, value; -} - -} // namespace - -void Tablebases::init(const std::string& paths) { - - EntryTable.clear(); - MaxCardinality = 0; - TBFile::Paths = paths; - - if (paths.empty() || paths == "") - return; - - // MapB1H1H7[] encodes a square below a1-h8 diagonal to 0..27 - int code = 0; - for (Square s = SQ_A1; s <= SQ_H8; ++s) - if (off_A1H8(s) < 0) - MapB1H1H7[s] = code++; - - // MapA1D1D4[] encodes a square in the a1-d1-d4 triangle to 0..9 - std::vector diagonal; - code = 0; - for (Square s = SQ_A1; s <= SQ_D4; ++s) - if (off_A1H8(s) < 0 && file_of(s) <= FILE_D) - MapA1D1D4[s] = code++; - - else if (!off_A1H8(s) && file_of(s) <= FILE_D) - diagonal.push_back(s); - - // Diagonal squares are encoded as last ones - for (auto s : diagonal) - MapA1D1D4[s] = code++; - - // MapKK[] encodes all the 461 possible legal positions of two kings where - // the first is in the a1-d1-d4 triangle. If the first king is on the a1-d4 - // diagonal, the other one shall not to be above the a1-h8 diagonal. - std::vector> bothOnDiagonal; - code = 0; - for (int idx = 0; idx < 10; idx++) - for (Square s1 = SQ_A1; s1 <= SQ_D4; ++s1) - if (MapA1D1D4[s1] == idx && (idx || s1 == SQ_B1)) // SQ_B1 is mapped to 0 - { - for (Square s2 = SQ_A1; s2 <= SQ_H8; ++s2) - if ((PseudoAttacks[KING][s1] | s1) & s2) - continue; // Illegal position - - else if (!off_A1H8(s1) && off_A1H8(s2) > 0) - continue; // First on diagonal, second above - - else if (!off_A1H8(s1) && !off_A1H8(s2)) - bothOnDiagonal.push_back(std::make_pair(idx, s2)); - - else - MapKK[idx][s2] = code++; - } - - // Legal positions with both kings on diagonal are encoded as last ones - for (auto p : bothOnDiagonal) - MapKK[p.first][p.second] = code++; - - // Binomial[] stores the Binomial Coefficents using Pascal rule. There - // are Binomial[k][n] ways to choose k elements from a set of n elements. - Binomial[0][0] = 1; - - for (int n = 1; n < 64; n++) // Squares - for (int k = 0; k < 6 && k <= n; ++k) // Pieces - Binomial[k][n] = (k > 0 ? Binomial[k - 1][n - 1] : 0) - + (k < n ? Binomial[k ][n - 1] : 0); - - // MapPawns[s] encodes squares a2-h7 to 0..47. This is the number of possible - // available squares when the leading one is in 's'. Moreover the pawn with - // highest MapPawns[] is the leading pawn, the one nearest the edge and, - // among pawns with same file, the one with lowest rank. - int availableSquares = 47; // Available squares when lead pawn is in a2 - - // Init the tables for the encoding of leading pawns group: with 6-men TB we - // can have up to 4 leading pawns (KPPPPK). - for (int leadPawnsCnt = 1; leadPawnsCnt <= 4; ++leadPawnsCnt) - for (File f = FILE_A; f <= FILE_D; ++f) - { - // Restart the index at every file because TB table is splitted - // by file, so we can reuse the same index for different files. - int idx = 0; - - // Sum all possible combinations for a given file, starting with - // the leading pawn on rank 2 and increasing the rank. - for (Rank r = RANK_2; r <= RANK_7; ++r) - { - Square sq = make_square(f, r); - - // Compute MapPawns[] at first pass. - // If sq is the leading pawn square, any other pawn cannot be - // below or more toward the edge of sq. There are 47 available - // squares when sq = a2 and reduced by 2 for any rank increase - // due to mirroring: sq == a3 -> no a2, h2, so MapPawns[a3] = 45 - if (leadPawnsCnt == 1) - { - MapPawns[sq] = availableSquares--; - MapPawns[sq ^ 7] = availableSquares--; // Horizontal flip - } - LeadPawnIdx[leadPawnsCnt][sq] = idx; - idx += Binomial[leadPawnsCnt - 1][MapPawns[sq]]; - } - // After a file is traversed, store the cumulated per-file index - LeadPawnsSize[leadPawnsCnt][f] = idx; - } - - for (PieceType p1 = PAWN; p1 < KING; ++p1) { - EntryTable.insert({KING, p1, KING}); - - for (PieceType p2 = PAWN; p2 <= p1; ++p2) { - EntryTable.insert({KING, p1, p2, KING}); - EntryTable.insert({KING, p1, KING, p2}); - - for (PieceType p3 = PAWN; p3 < KING; ++p3) - EntryTable.insert({KING, p1, p2, KING, p3}); - - for (PieceType p3 = PAWN; p3 <= p2; ++p3) { - EntryTable.insert({KING, p1, p2, p3, KING}); - - for (PieceType p4 = PAWN; p4 <= p3; ++p4) - EntryTable.insert({KING, p1, p2, p3, p4, KING}); - - for (PieceType p4 = PAWN; p4 < KING; ++p4) - EntryTable.insert({KING, p1, p2, p3, KING, p4}); - } - - for (PieceType p3 = PAWN; p3 <= p1; ++p3) - for (PieceType p4 = PAWN; p4 <= (p1 == p3 ? p2 : p3); ++p4) - EntryTable.insert({KING, p1, p2, KING, p3, p4}); - } - } - - sync_cout << "info string Found " << EntryTable.size() << " tablebases" << sync_endl; -} - -// Probe the WDL table for a particular position. -// If *result != FAIL, the probe was successful. -// The return value is from the point of view of the side to move: -// -2 : loss -// -1 : loss, but draw under 50-move rule -// 0 : draw -// 1 : win, but draw under 50-move rule -// 2 : win -WDLScore Tablebases::probe_wdl(Position& pos, ProbeState* result) { - - *result = OK; - return search(pos, result); -} - -// Probe the DTZ table for a particular position. -// If *result != FAIL, the probe was successful. -// The return value is from the point of view of the side to move: -// n < -100 : loss, but draw under 50-move rule -// -100 <= n < -1 : loss in n ply (assuming 50-move counter == 0) -// 0 : draw -// 1 < n <= 100 : win in n ply (assuming 50-move counter == 0) -// 100 < n : win, but draw under 50-move rule -// -// The return value n can be off by 1: a return value -n can mean a loss -// in n+1 ply and a return value +n can mean a win in n+1 ply. This -// cannot happen for tables with positions exactly on the "edge" of -// the 50-move rule. -// -// This implies that if dtz > 0 is returned, the position is certainly -// a win if dtz + 50-move-counter <= 99. Care must be taken that the engine -// picks moves that preserve dtz + 50-move-counter <= 99. -// -// If n = 100 immediately after a capture or pawn move, then the position -// is also certainly a win, and during the whole phase until the next -// capture or pawn move, the inequality to be preserved is -// dtz + 50-movecounter <= 100. -// -// In short, if a move is available resulting in dtz + 50-move-counter <= 99, -// then do not accept moves leading to dtz + 50-move-counter == 100. -int Tablebases::probe_dtz(Position& pos, ProbeState* result) { - - *result = OK; - WDLScore wdl = search(pos, result); - - if (*result == FAIL || wdl == WDLDraw) // DTZ tables don't store draws - return 0; - - // DTZ stores a 'don't care' value in this case, or even a plain wrong - // one as in case the best move is a losing ep, so it cannot be probed. - if (*result == ZEROING_BEST_MOVE) - return dtz_before_zeroing(wdl); - - int dtz = probe_table(pos, result, wdl); - - if (*result == FAIL) - return 0; - - if (*result != CHANGE_STM) - return (dtz + 100 * (wdl == WDLBlessedLoss || wdl == WDLCursedWin)) * sign_of(wdl); - - // DTZ stores results for the other side, so we need to do a 1-ply search and - // find the winning move that minimizes DTZ. - StateInfo st; - int minDTZ = 0xFFFF; - - for (const Move& move : MoveList(pos)) - { - bool zeroing = pos.capture(move) || type_of(pos.moved_piece(move)) == PAWN; - - pos.do_move(move, st); - - // For zeroing moves we want the dtz of the move _before_ doing it, - // otherwise we will get the dtz of the next move sequence. Search the - // position after the move to get the score sign (because even in a - // winning position we could make a losing capture or going for a draw). - dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) - : -probe_dtz(pos, result); - - pos.undo_move(move); - - if (*result == FAIL) - return 0; - - // Convert result from 1-ply search. Zeroing moves are already accounted - // by dtz_before_zeroing() that returns the DTZ of the previous move. - if (!zeroing) - dtz += sign_of(dtz); - - // Skip the draws and if we are winning only pick positive dtz - if (dtz < minDTZ && sign_of(dtz) == sign_of(wdl)) - minDTZ = dtz; - } - - // Special handle a mate position, when there are no legal moves, in this - // case return value is somewhat arbitrary, so stick to the original TB code - // that returns -1 in this case. - return minDTZ == 0xFFFF ? -1 : minDTZ; -} - -// Check whether there has been at least one repetition of positions -// since the last capture or pawn move. -static int has_repeated(StateInfo *st) -{ - while (1) { - int i = 4, e = std::min(st->rule50, st->pliesFromNull); - - if (e < i) - return 0; - - StateInfo *stp = st->previous->previous; - - do { - stp = stp->previous->previous; - - if (stp->key == st->key) - return 1; - - i += 2; - } while (i <= e); - - st = st->previous; - } -} - -// Use the DTZ tables to filter out moves that don't preserve the win or draw. -// If the position is lost, but DTZ is fairly high, only keep moves that -// maximise DTZ. -// -// A return value false indicates that not all probes were successful and that -// no moves were filtered out. -bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score) -{ - assert(rootMoves.size()); - - ProbeState result; - int dtz = probe_dtz(pos, &result); - - if (result == FAIL) - return false; - - StateInfo st; - - // Probe each move - for (size_t i = 0; i < rootMoves.size(); ++i) { - Move move = rootMoves[i].pv[0]; - pos.do_move(move, st); - int v = 0; - - if (pos.checkers() && dtz > 0) { - ExtMove s[MAX_MOVES]; - - if (generate(pos, s) == s) - v = 1; - } - - if (!v) { - if (st.rule50 != 0) { - v = -probe_dtz(pos, &result); - - if (v > 0) - ++v; - else if (v < 0) - --v; - } else { - v = -probe_wdl(pos, &result); - v = dtz_before_zeroing(WDLScore(v)); - } - } - - pos.undo_move(move); - - if (result == FAIL) - return false; - - rootMoves[i].score = (Value)v; - } - - // Obtain 50-move counter for the root position. - // In Stockfish there seems to be no clean way, so we do it like this: - int cnt50 = st.previous ? st.previous->rule50 : 0; - - // Use 50-move counter to determine whether the root position is - // won, lost or drawn. - WDLScore wdl = WDLDraw; - - if (dtz > 0) - wdl = (dtz + cnt50 <= 100) ? WDLWin : WDLCursedWin; - else if (dtz < 0) - wdl = (-dtz + cnt50 <= 100) ? WDLLoss : WDLBlessedLoss; - - // Determine the score to report to the user. - score = WDL_to_value[wdl + 2]; - - // If the position is winning or losing, but too few moves left, adjust the - // score to show how close it is to winning or losing. - // NOTE: int(PawnValueEg) is used as scaling factor in score_to_uci(). - if (wdl == WDLCursedWin && dtz <= 100) - score = (Value)(((200 - dtz - cnt50) * int(PawnValueEg)) / 200); - else if (wdl == WDLBlessedLoss && dtz >= -100) - score = -(Value)(((200 + dtz - cnt50) * int(PawnValueEg)) / 200); - - // Now be a bit smart about filtering out moves. - size_t j = 0; - - if (dtz > 0) { // winning (or 50-move rule draw) - int best = 0xffff; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - int v = rootMoves[i].score; - - if (v > 0 && v < best) - best = v; - } - - int max = best; - - // If the current phase has not seen repetitions, then try all moves - // that stay safely within the 50-move budget, if there are any. - if (!has_repeated(st.previous) && best + cnt50 <= 99) - max = 99 - cnt50; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - int v = rootMoves[i].score; - - if (v > 0 && v <= max) - rootMoves[j++] = rootMoves[i]; - } - } else if (dtz < 0) { // losing (or 50-move rule draw) - int best = 0; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - int v = rootMoves[i].score; - - if (v < best) - best = v; - } - - // Try all moves, unless we approach or have a 50-move rule draw. - if (-best * 2 + cnt50 < 100) - return true; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - if (rootMoves[i].score == best) - rootMoves[j++] = rootMoves[i]; - } - } else { // drawing - // Try all moves that preserve the draw. - for (size_t i = 0; i < rootMoves.size(); ++i) { - if (rootMoves[i].score == 0) - rootMoves[j++] = rootMoves[i]; - } - } - - rootMoves.resize(j, Search::RootMove(MOVE_NONE)); - - return true; -} - -// Use the WDL tables to filter out moves that don't preserve the win or draw. -// This is a fallback for the case that some or all DTZ tables are missing. -// -// A return value false indicates that not all probes were successful and that -// no moves were filtered out. -bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score) -{ - ProbeState result; - - WDLScore wdl = Tablebases::probe_wdl(pos, &result); - - if (result == FAIL) - return false; - - score = WDL_to_value[wdl + 2]; - - StateInfo st; - - int best = WDLLoss; - - // Probe each move - for (size_t i = 0; i < rootMoves.size(); ++i) { - Move move = rootMoves[i].pv[0]; - pos.do_move(move, st); - WDLScore v = -Tablebases::probe_wdl(pos, &result); - pos.undo_move(move); - - if (result == FAIL) - return false; - - rootMoves[i].score = (Value)v; - - if (v > best) - best = v; - } - - size_t j = 0; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - if (rootMoves[i].score == best) - rootMoves[j++] = rootMoves[i]; - } - - rootMoves.resize(j, Search::RootMove(MOVE_NONE)); - - return true; -} diff --git a/Engines/Linux32/mcbrain/src/tbprobe.h b/Engines/Linux32/mcbrain/src/tbprobe.h deleted file mode 100644 index 0c16662..0000000 --- a/Engines/Linux32/mcbrain/src/tbprobe.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (c) 2013 Ronald de Man - Copyright (C) 2016-2017 Marco Costalba, Lucas Braesch - - Stockfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Stockfish is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef TBPROBE_H -#define TBPROBE_H - -#include - -#include "search.h" - -namespace Tablebases { - -enum WDLScore { - WDLLoss = -2, // Loss - WDLBlessedLoss = -1, // Loss, but draw under 50-move rule - WDLDraw = 0, // Draw - WDLCursedWin = 1, // Win, but draw under 50-move rule - WDLWin = 2, // Win - - WDLScoreNone = -1000 -}; - -// Possible states after a probing operation -enum ProbeState { - FAIL = 0, // Probe failed (missing file table) - OK = 1, // Probe succesful - CHANGE_STM = -1, // DTZ should check the other side - ZEROING_BEST_MOVE = 2 // Best move zeroes DTZ (capture or pawn move) -}; - -extern int MaxCardinality; - -void init(const std::string& paths); -WDLScore probe_wdl(Position& pos, ProbeState* result); -int probe_dtz(Position& pos, ProbeState* result); -bool root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score); -bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score); -void filter_root_moves(Position& pos, Search::RootMoves& rootMoves); - -inline std::ostream& operator<<(std::ostream& os, const WDLScore v) { - - os << (v == WDLLoss ? "Loss" : - v == WDLBlessedLoss ? "Blessed loss" : - v == WDLDraw ? "Draw" : - v == WDLCursedWin ? "Cursed win" : - v == WDLWin ? "Win" : "None"); - - return os; -} - -inline std::ostream& operator<<(std::ostream& os, const ProbeState v) { - - os << (v == FAIL ? "Failed" : - v == OK ? "Success" : - v == CHANGE_STM ? "Probed opponent side" : - v == ZEROING_BEST_MOVE ? "Best move zeroes DTZ" : "None"); - - return os; -} - -} - -#endif diff --git a/Engines/Linux32/mcbrain/src/thread.cpp b/Engines/Linux32/mcbrain/src/thread.cpp index a4a152a..a72e91e 100644 --- a/Engines/Linux32/mcbrain/src/thread.cpp +++ b/Engines/Linux32/mcbrain/src/thread.cpp @@ -27,6 +27,7 @@ #include "thread.h" #include "uci.h" #include "syzygy/tbprobe.h" +#include "tt.h" ThreadPool Threads; // Global object @@ -61,11 +62,11 @@ void Thread::clear() { mainHistory.fill(0); captureHistory.fill(0); - for (auto& to : contHistory) + for (auto& to : continuationHistory) for (auto& h : to) - h.get()->fill(0); + h->fill(0); - contHistory[NO_PIECE][0].get()->fill(Search::CounterMovePruneThreshold - 1); + continuationHistory[NO_PIECE][0]->fill(Search::CounterMovePruneThreshold - 1); } /// Thread::start_searching() wakes up the thread that will start the search @@ -98,7 +99,7 @@ void Thread::idle_loop() { // some Windows NUMA hardware, for instance in fishtest. To make it simple, // just check if running threads are below a threshold, in this case all this // NUMA machinery is not needed. - if (Options["Threads"] >= 8) + if (int(Options["Threads"]) >= 8) WinProcGroup::bindThisThread(idx); while (true) @@ -118,7 +119,7 @@ void Thread::idle_loop() { } /// ThreadPool::set() creates/destroys threads to match the requested number. -/// Created and launched threads wil go immediately to sleep in idle_loop. +/// Created and launched threads will go immediately to sleep in idle_loop. /// Upon resizing, threads are recreated to allow for binding if necessary. void ThreadPool::set(size_t requested) { @@ -137,6 +138,9 @@ void ThreadPool::set(size_t requested) { push_back(new Thread(size())); clear(); } + + // Reallocate the hash with the new threadpool size + TT.resize(Options["Hash"]); } /// ThreadPool::clear() sets threadPool data to initial values. @@ -188,7 +192,7 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states, for (Thread* th : *this) { - th->nodes = th->tbHits = th->nmp_ply = th->nmp_odd = 0; + th->nodes = th->tbHits = th->nmpMinPly = 0; th->rootDepth = th->completedDepth = DEPTH_ZERO; th->rootMoves = rootMoves; th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th); diff --git a/Engines/Linux32/mcbrain/src/thread.h b/Engines/Linux32/mcbrain/src/thread.h index fcbfc9b..505dd27 100644 --- a/Engines/Linux32/mcbrain/src/thread.h +++ b/Engines/Linux32/mcbrain/src/thread.h @@ -61,8 +61,9 @@ class Thread { Pawns::Table pawnsTable; Material::Table materialTable; Endgames endgames; - size_t PVIdx, PVLast; - int selDepth, nmp_ply, nmp_odd; + size_t pvIdx, pvLast; + int selDepth, nmpMinPly; + Color nmpColor; std::atomic nodes, tbHits; Position rootPos; @@ -71,8 +72,9 @@ class Thread { CounterMoveHistory counterMoves; ButterflyHistory mainHistory; CapturePieceToHistory captureHistory; - ContinuationHistory contHistory; + ContinuationHistory continuationHistory; Score contempt; + bool pvDraw; }; @@ -85,7 +87,6 @@ struct MainThread : public Thread { void search() override; void check_time(); - bool failedLow; double bestMoveChanges, previousTimeReduction; Value previousScore; int callsCnt; diff --git a/Engines/Linux32/mcbrain/src/tt.cpp b/Engines/Linux32/mcbrain/src/tt.cpp index 1aed0f3..7408ea8 100644 --- a/Engines/Linux32/mcbrain/src/tt.cpp +++ b/Engines/Linux32/mcbrain/src/tt.cpp @@ -21,11 +21,126 @@ #include // For std::memset #include - +#include +#include +#include "uci.h" +using std::string; +#include +#include +#include +#include +#include +#include "position.h" +#include "thread.h" #include "bitboard.h" #include "tt.h" +#include "misc.h" +#include "tt.h" +#include "uci.h" + +#ifdef _WIN32 + +#include +#undef max +#undef min + +#endif + +//https://stackoverflow.com/questions/236129/most-elegant-way-to-split-a-string +template +void split(const std::string &s, char delim, Out result) { + std::stringstream ss; + ss.str(s); + std::string item; + while (std::getline(ss, item, delim)) { + *(result++) = item; + } +} + +std::vector split(const std::string &s, char delim) { + std::vector elems; + split(s, delim, std::back_inserter(elems)); + return elems; +} TranspositionTable TT; // Our global transposition table +#ifdef _WIN32 +int use_large_pages = -1; +int got_privileges = -1; +#endif + +#ifdef _WIN32 +bool Get_LockMemory_Privileges() +{ + HANDLE TH, PROC7; + TOKEN_PRIVILEGES tp; + bool ret = false; + + PROC7 = GetCurrentProcess(); + if (OpenProcessToken(PROC7, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &TH)) + { + if (LookupPrivilegeValue(NULL, TEXT("SeLockMemoryPrivilege"), &tp.Privileges[0].Luid)) + { + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + if (AdjustTokenPrivileges(TH, FALSE, &tp, 0, NULL, 0)) + { + if (GetLastError() != ERROR_NOT_ALL_ASSIGNED) + ret = true; + } + } + CloseHandle(TH); + } + return ret; +} + + +void Try_Get_LockMemory_Privileges() +{ + use_large_pages = 0; + + if (bool(Options["Large Pages"]) == false) + return; + + if (got_privileges == -1) + { + if (Get_LockMemory_Privileges() == true) + got_privileges = 1; + else + { + sync_cout << "No Privilege for Large Pages" << sync_endl; + got_privileges = 0; + } + } + + if (got_privileges == 0) + return; + + use_large_pages = 1; +} +#endif + +/// TTEntry::save saves a TTEntry +void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) { + + assert(d / ONE_PLY * ONE_PLY == d); + + // Preserve any existing move for the same position + if (m || (k >> 48) != key16) + move16 = (uint16_t)m; + + // Overwrite less valuable entries + if ( (k >> 48) != key16 + || d / ONE_PLY > depth8 - 4 + || b == BOUND_EXACT) + { + key16 = (uint16_t)(k >> 48); + value16 = (int16_t)v; + eval16 = (int16_t)ev; + genBound8 = (uint8_t)(TT.generation8 | b); + depth8 = (int8_t)(d / ONE_PLY); + } +} /// TranspositionTable::resize() sets the size of the transposition table, @@ -34,37 +149,460 @@ TranspositionTable TT; // Our global transposition table void TranspositionTable::resize(size_t mbSize) { + if (mbSize == 0) + mbSize = mbSize_last_used; + + if (mbSize == 0) + return; + + mbSize_last_used = mbSize; + +#ifdef _WIN32 + Try_Get_LockMemory_Privileges(); +#endif + size_t newClusterCount = mbSize * 1024 * 1024 / sizeof(Cluster); if (newClusterCount == clusterCount) - return; + { +#ifdef _WIN32 + if ((use_large_pages == 1) && (large_pages_used)) + return; + if ((use_large_pages == 0) && (large_pages_used == false)) +#endif + return; + } clusterCount = newClusterCount; + +#ifdef _WIN32 + if (use_large_pages < 1) +#endif + { + if (mem != NULL) + { +#ifdef _WIN32 + if (large_pages_used) + VirtualFree(mem, 0, MEM_RELEASE); + else +#endif + free(mem); + } - free(mem); - mem = malloc(clusterCount * sizeof(Cluster) + CacheLineSize - 1); + size_t memsize = clusterCount * sizeof(Cluster) + CacheLineSize - 1; + mem = calloc(memsize, 1); +#ifdef _WIN32 + large_pages_used = false; +#endif + } +#ifdef _WIN32 + else + { + if (mem != NULL) + { + if (large_pages_used) + VirtualFree(mem, 0, MEM_RELEASE); + else + free(mem); + } + + size_t memsize = clusterCount * sizeof(Cluster); + mem = VirtualAlloc(NULL, memsize, MEM_LARGE_PAGES | MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (mem == NULL) + { + std::cerr << "Failed to allocate " << mbSize + << "MB Large Page Memory for transposition table, switching to default" << std::endl; + + use_large_pages = 0; + memsize = clusterCount * sizeof(Cluster) + CacheLineSize - 1; + mem = malloc(memsize); + large_pages_used = false; + } + else + { + sync_cout << "info string LargePages " << (memsize >> 20) << " MiB" << sync_endl; + large_pages_used = true; + } + + } +#endif if (!mem) { std::cerr << "Failed to allocate " << mbSize - << "MB for transposition table." << std::endl; + << "MiB for transposition table." << std::endl; exit(EXIT_FAILURE); } table = (Cluster*)((uintptr_t(mem) + CacheLineSize - 1) & ~(CacheLineSize - 1)); - clear(); } -/// TranspositionTable::clear() overwrites the entire transposition table -/// with zeros. It is called whenever the table is resized, or when the -/// user asks the program to clear the table (from the UCI interface). +/// TranspositionTable::clear() initializes the entire transposition table to zero, +// in a multi-threaded way. void TranspositionTable::clear() { - std::memset(table, 0, clusterCount * sizeof(Cluster)); + std::vector threads; + + for (size_t idx = 0; idx < size_t(Options["Threads"]); idx++) + { + threads.push_back(std::thread([this, idx]() { + + // Thread binding gives faster search on systems with a first-touch policy + if (int(Options["Threads"]) >= 8) + WinProcGroup::bindThisThread(idx); + + // Each thread will zero its part of the hash table + const size_t stride = clusterCount / size_t(Options["Threads"]), + start = stride * idx, + len = idx != size_t(Options["Threads"]) - 1 ? + stride : clusterCount - start; + + std::memset(&table[start], 0, len * sizeof(Cluster)); + })); + } + + for (std::thread& th: threads) + th.join(); +} + +void TranspositionTable::set_hash_file_name(const std::string& fname) { hashfilename = fname; } + +bool TranspositionTable::save() { + std::ofstream b_stream(hashfilename, + std::fstream::out | std::fstream::binary); + if (b_stream) + { + //b_stream.write(reinterpret_cast(table), clusterCount * sizeof(Cluster)); + for (unsigned long long i = 0; i < clusterCount * sizeof(Cluster); i += (1 << 30)) { //1GB +#ifndef __min + #define __min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + unsigned long long j = __min((1 << 30), (clusterCount * sizeof(Cluster)) - i); + b_stream.write(reinterpret_cast(table) + i, j); + } + return (b_stream.good()); + } + return false; +} + +void TranspositionTable::load() { + //file size: https://stackoverflow.com/questions/2409504/using-c-filestreams-fstream-how-can-you-determine-the-size-of-a-file + std::ifstream file; + file.open(hashfilename, std::ios::in | std::ios::binary); + file.ignore(std::numeric_limits::max()); + std::streamsize size = file.gcount(); + file.clear(); // Since ignore will have set eof. + resize(size_t(size / 1024 / 1024)); + file.seekg(0, std::ios::beg); + file.read(reinterpret_cast(table), clusterCount * sizeof(Cluster)); +} + +enum { SAN_MOVE_NORMAL, SAN_PAWN_CAPTURE }; + +//taken from stockfish-TCEC6-PA_GTB +template inline Move test_move(Position &pos, Square fromsquare, Square tosquare, PieceType promotion) +{ + Move move; + + if (MoveType == SAN_MOVE_NORMAL) { + if (promotion != NO_PIECE_TYPE) { + move = make(fromsquare, tosquare, promotion); + } + else { + move = make(fromsquare, tosquare); + } + } + else if (MoveType == SAN_PAWN_CAPTURE) { + if (pos.ep_square() == tosquare) { + move = make(fromsquare, tosquare); + } + else { + if (promotion != NO_PIECE_TYPE) { + move = make(fromsquare, tosquare, promotion); + } + else { + move = make(fromsquare, tosquare); + } + } + } + //if (pos.pseudo_legal(move) && pos.legal(move, pos.pinned_pieces(pos.side_to_move()))) { + if (pos.pseudo_legal(move) && pos.legal(move)) { +#ifdef SAN_DEBUG + sync_cout << "found a move: " << move_to_uci(move, false) << sync_endl; +#endif + return move; + } + else { +#ifdef SAN_DEBUG + sync_cout << "invalid move: " << move_to_uci(move, false) << sync_endl; +#endif + return MOVE_NONE; // invalid; + } + return MOVE_NONE; +} + +//taken from stockfish-TCEC6-PA_GTB +Move san_to_move(Position& pos, std::string& str) +{ + std::string uci = str; + PieceType promotion = NO_PIECE_TYPE; + bool castles = false; + bool capture = false; + Move move = MOVE_NONE; + + size_t idx = uci.find_first_of("+#"); + if (idx != std::string::npos) { + uci.erase(idx); // erase to end of the string + } + idx = uci.find_first_of("="); + if (idx != std::string::npos) { + char promo = uci.at(idx); + switch (promo) { + case 'Q': promotion = QUEEN; break; + case 'R': promotion = ROOK; break; + case 'B': promotion = BISHOP; break; + case 'N': promotion = KNIGHT; break; + default: return MOVE_NONE; // invalid + } + uci.erase(idx); + } + else { // check the last char, is it QRBN? + char promo2 = uci.at(uci.size() - 1); + switch (promo2) { + case 'Q': promotion = QUEEN; break; + case 'R': promotion = ROOK; break; + case 'B': promotion = BISHOP; break; + case 'N': promotion = KNIGHT; break; + default:; // nixda + } + if (promotion != NO_PIECE_TYPE) + uci.erase(uci.size() - 1); + } + idx = uci.find_first_of("x"); + if (idx != std::string::npos) { + capture = true; + uci.erase(idx, 1); + } + + char piece = str.at(0); + PieceType piecetype; + std::string thepiece; + + switch (piece) { + case 'N': piecetype = KNIGHT; break; + case 'B': piecetype = BISHOP; break; + case 'R': piecetype = ROOK; break; + case 'Q': piecetype = QUEEN; break; + case 'K': piecetype = KING; break; + case '0': + case 'O': + castles = true; piecetype = NO_PIECE_TYPE; break; + default: piecetype = PAWN; + } + + if (castles) { // chess 960? + if (uci == "0-0" || uci == "O-O") { + if (pos.side_to_move() == WHITE) { + move = make(SQ_E1, SQ_H1); + } + else { + move = make(SQ_E8, SQ_H8); + } + } + else if (uci == "0-0-0" || uci == "O-O-O") { + if (pos.side_to_move() == WHITE) { + move = make(SQ_E1, SQ_A1); + } + else { + move = make(SQ_E8, SQ_A8); + } + } + if (pos.pseudo_legal(move) && pos.legal(move)) { + return move; + } + return MOVE_NONE; // invalid + } + + // normal move or promotion + int torank = uci.at(uci.size() - 1) - '1'; + int tofile = uci.at(uci.size() - 2) - 'a'; + int disambig_r = -1; + int disambig_f = -1; + if (piecetype != PAWN && piecetype != KING && uci.size() > 3) { + char ambig = uci.at(uci.size() - 3); + if (ambig >= 'a' && ambig <= 'h') { + disambig_f = ambig - 'a'; + } + else if (ambig >= '1' && ambig <= '8') { + disambig_r = ambig - '1'; + } + else { + return MOVE_NONE; // invalid; + } + } + + Square tosquare = Square((torank * 8) + tofile); + const Square *pl; + int piececount; + + switch (piecetype) { + case PAWN: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case KNIGHT: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case BISHOP: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case ROOK: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case QUEEN: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case KING: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + default: + return MOVE_NONE; // invalid + } + + if (piececount == 1) { + if (piecetype != PAWN || !capture) { + move = test_move(pos, *pl, tosquare, promotion); + } + else { + move = test_move(pos, *pl, tosquare, promotion); + } + if (move != MOVE_NONE) { + return move; + } + else { + return MOVE_NONE; + } + } + else if (piececount > 1) { + Square s; + while ((s = *pl++) != SQ_NONE) { + Square ss = SQ_NONE; + if (disambig_r >= 0 || disambig_f >= 0) { + if (disambig_r >= 0 && rank_of(s) == Rank(disambig_r)) { + ss = s; + } + else if (disambig_f >= 0 && file_of(s) == File(disambig_f)) { + ss = s; + } + } + else { + ss = s; + } + if (ss != SQ_NONE) { + if (piecetype != PAWN || !capture) { + move = test_move(pos, ss, tosquare, promotion); + } + else { + move = test_move(pos, ss, tosquare, promotion); + } + if (move != MOVE_NONE) { + return move; + } + else { + ; // don't return, we just need to keep trying + } + } + } + } + return MOVE_NONE; } +//taken from stockfish-TCEC6-PA_GTB +Value uci_to_score(std::string &str) +{ + Value uci = (Value)atoi(str.c_str()); + Value v = VALUE_NONE; + + if (uci > 32000) { + v = VALUE_MATE - (32767 - uci); + } + else if (uci < -32000) { + v = -VALUE_MATE + (32767 + uci); + } + else { + v = uci * int(PawnValueMg) / 100; + } + return v; +} + +void TranspositionTable::load_epd_to_hash() { + std::string line; + std::ifstream myfile(hashfilename); + Position pos; + Move bm; + int ce; + int depth; + generation8 = 4; //for storing the positions + + if (myfile.is_open()) + { + while (getline(myfile, line)) + { + std::vector x = split(line, ';'); + + //extract and set position + std::size_t i = x[0].find("acd"); //depth searched. Is after the fen string + StateListPtr states(new std::deque(1)); + sync_cout << x[0].substr(0, i) << sync_endl; + pos.set(x[0].substr(0, i), Options["UCI_Chess960"], &states->back(), Threads.main()); + + //depth + depth = std::stoi(x[0].substr(i + 4)); + sync_cout << depth << sync_endl; + + bm = MOVE_NONE; + ce = -1000000; + + for (std::vector::size_type j = 1; j <= x.size(); j++) { + if (bm == MOVE_NONE) { + i = x[j].find("bm "); + if (i == 1) { + sync_cout << x[j].substr(i + 3) << sync_endl; + std::string stri = x[j].substr(i + 3); + bm = san_to_move(pos, stri); + if (bm != MOVE_NONE) + sync_cout << "move ok" << sync_endl; + continue; + } + } + if (ce == -1000000) { + i = x[j].find("ce "); + if (i == 1) { + std::string stri = x[j].substr(i + 3); + ce = uci_to_score(stri); + sync_cout << "ce " << ce << sync_endl; + continue; + } + } + } + + TTEntry* tte; + bool ttHit; + tte = TT.probe(pos.key(), ttHit); + + tte->save(pos.key(), (Value)ce, BOUND_EXACT, (Depth)depth, + bm, VALUE_NONE); + } + myfile.close(); + } +} /// TranspositionTable::probe() looks up the current position in the transposition /// table. It returns true and a pointer to the TTEntry if the position is found. @@ -78,7 +616,7 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { TTEntry* const tte = first_entry(key); const uint16_t key16 = key >> 48; // Use the high 16 bits as key inside the cluster - for (int i = 0; i < ClusterSize; ++i) + for (size_t i = 0; i < ClusterSize; ++i) if (!tte[i].key16 || tte[i].key16 == key16) { if ((tte[i].genBound8 & 0xFC) != generation8 && tte[i].key16) @@ -89,7 +627,7 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { // Find an entry to be replaced according to the replacement strategy TTEntry* replace = tte; - for (int i = 1; i < ClusterSize; ++i) + for (size_t i = 1; i < ClusterSize; ++i) // Due to our packed storage format for generation and its cyclic // nature we add 259 (256 is the modulus plus 3 to keep the lowest // two bound bits from affecting the result) to calculate the entry @@ -108,10 +646,10 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { int TranspositionTable::hashfull() const { int cnt = 0; - for (int i = 0; i < 1000 / ClusterSize; i++) + for (size_t i = 0; i < 1000 / ClusterSize; i++) { const TTEntry* tte = &table[i].entry[0]; - for (int j = 0; j < ClusterSize; j++) + for (size_t j = 0; j < ClusterSize; j++) if ((tte[j].genBound8 & 0xFC) == generation8) cnt++; } diff --git a/Engines/Linux32/mcbrain/src/tt.h b/Engines/Linux32/mcbrain/src/tt.h index c8bebc3..6fdf90f 100644 --- a/Engines/Linux32/mcbrain/src/tt.h +++ b/Engines/Linux32/mcbrain/src/tt.h @@ -42,28 +42,7 @@ struct TTEntry { Value eval() const { return (Value)eval16; } Depth depth() const { return (Depth)(depth8 * int(ONE_PLY)); } Bound bound() const { return (Bound)(genBound8 & 0x3); } - - void save(Key k, Value v, Bound b, Depth d, Move m, Value ev, uint8_t g) { - - assert(d / ONE_PLY * ONE_PLY == d); - - // Preserve any existing move for the same position - if (m || (k >> 48) != key16) - move16 = (uint16_t)m; - - // Don't overwrite more valuable entries - if ( (k >> 48) != key16 - || d / ONE_PLY > depth8 - 4 - /* || g != (genBound8 & 0xFC) // Matching non-zero keys are already refreshed by probe() */ - || b == BOUND_EXACT) - { - key16 = (uint16_t)(k >> 48); - value16 = (int16_t)v; - eval16 = (int16_t)ev; - genBound8 = (uint8_t)(g | b); - depth8 = (int8_t)(d / ONE_PLY); - } - } + void save(Key k, Value v, Bound b, Depth d, Move m, Value ev); private: friend class TranspositionTable; @@ -86,8 +65,8 @@ struct TTEntry { class TranspositionTable { - static constexpr int CacheLineSize = 64; - static constexpr int ClusterSize = 3; + static constexpr size_t CacheLineSize = 64; + static constexpr size_t ClusterSize = 3; struct Cluster { TTEntry entry[ClusterSize]; @@ -97,13 +76,20 @@ class TranspositionTable { static_assert(CacheLineSize % sizeof(Cluster) == 0, "Cluster size incorrect"); public: - ~TranspositionTable() { free(mem); } + TranspositionTable() { mbSize_last_used = 0; mbSize_last_used = 0; } + ~TranspositionTable() {} void new_search() { generation8 += 4; } // Lower 2 bits are used by Bound + void infinite_search() { generation8 = 4; } uint8_t generation() const { return generation8; } TTEntry* probe(const Key key, bool& found) const; int hashfull() const; void resize(size_t mbSize); void clear(); + void set_hash_file_name(const std::string& fname); + bool save(); + void load(); + void load_epd_to_hash(); + std::string hashfilename = "hash.hsh"; // The 32 lowest order bits of the key are used to get the index of the cluster TTEntry* first_entry(const Key key) const { @@ -111,6 +97,14 @@ class TranspositionTable { } private: + friend struct TTEntry; + + size_t mbSize_last_used; + +#ifdef _WIN32 + bool large_pages_used; +#endif + size_t clusterCount; Cluster* table; void* mem; diff --git a/Engines/Linux32/mcbrain/src/types.h b/Engines/Linux32/mcbrain/src/types.h index 1105b4b..a659037 100644 --- a/Engines/Linux32/mcbrain/src/types.h +++ b/Engines/Linux32/mcbrain/src/types.h @@ -171,7 +171,27 @@ enum Bound { BOUND_LOWER, BOUND_EXACT = BOUND_UPPER | BOUND_LOWER }; - +#ifdef Maverick //MichaelB7 +enum Value : int { + VALUE_ZERO = 0, + VALUE_DRAW = 0, + VALUE_KNOWN_WIN = 10000, + VALUE_MATE = 32000, + VALUE_INFINITE = 32001, + VALUE_NONE = 32002, + + VALUE_MATE_IN_MAX_PLY = VALUE_MATE - 2 * MAX_PLY, + VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + 2 * MAX_PLY, + + PawnValueMg = 142*10/11, PawnValueEg = 207*10/11, + KnightValueMg = 784*9/10, KnightValueEg = 868*9/10, + BishopValueMg = 828*9/10, BishopValueEg = 916*9/10, + RookValueMg = 1286*8/9, RookValueEg = 1378*8/9, + QueenValueMg = 2547*7/8, QueenValueEg = 2698*7/8, + + MidgameLimit = 15258, EndgameLimit = 3915 +}; +#else enum Value : int { VALUE_ZERO = 0, VALUE_DRAW = 0, @@ -183,15 +203,15 @@ enum Value : int { VALUE_MATE_IN_MAX_PLY = VALUE_MATE - 2 * MAX_PLY, VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + 2 * MAX_PLY, - PawnValueMg = 171, PawnValueEg = 240, - KnightValueMg = 764, KnightValueEg = 848, - BishopValueMg = 826, BishopValueEg = 891, - RookValueMg = 1282, RookValueEg = 1373, - QueenValueMg = 2500, QueenValueEg = 2670, + PawnValueMg = 142, PawnValueEg = 207, + KnightValueMg = 784, KnightValueEg = 868, + BishopValueMg = 828, BishopValueEg = 916, + RookValueMg = 1286, RookValueEg = 1378, + QueenValueMg = 2547, QueenValueEg = 2698, MidgameLimit = 15258, EndgameLimit = 3915 }; - +#endif enum PieceType { NO_PIECE_TYPE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING, ALL_PIECES = 0, @@ -325,10 +345,10 @@ inline Value& operator+=(Value& v, int i) { return v = v + i; } inline Value& operator-=(Value& v, int i) { return v = v - i; } /// Additional operators to add a Direction to a Square -inline Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); } -inline Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); } -inline Square& operator+=(Square &s, Direction d) { return s = s + d; } -inline Square& operator-=(Square &s, Direction d) { return s = s - d; } +constexpr Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); } +constexpr Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); } +inline Square& operator+=(Square& s, Direction d) { return s = s + d; } +inline Square& operator-=(Square& s, Direction d) { return s = s - d; } /// Only declared but not defined. We don't want to multiply two scores due to /// a very high risk of overflow. So user should explicitly convert to integer. @@ -346,7 +366,7 @@ inline Score operator*(Score s, int i) { assert(eg_value(result) == (i * eg_value(s))); assert(mg_value(result) == (i * mg_value(s))); - assert((i == 0) || (result / i) == s ); + assert((i == 0) || (result / i) == s); return result; } @@ -449,7 +469,7 @@ constexpr PieceType promotion_type(Move m) { return PieceType(((m >> 12) & 3) + KNIGHT); } -inline Move make_move(Square from, Square to) { +constexpr Move make_move(Square from, Square to) { return Move((from << 6) + to); } diff --git a/Engines/Linux32/mcbrain/src/tzbook.cpp b/Engines/Linux32/mcbrain/src/tzbook.cpp deleted file mode 100644 index 4052256..0000000 --- a/Engines/Linux32/mcbrain/src/tzbook.cpp +++ /dev/null @@ -1,221 +0,0 @@ -#include "tzbook.h" -#include "uci.h" -#include "movegen.h" -#include "thread.h" -#include -#include "misc.h" -#include - -TZBook tzbook; // global TZBook - -using namespace std; - -int qsort_compare_int(const void* a, const void* b) -{ - const int int_a = *((const int*)a); - const int int_b = *((const int*)b); - - if (int_a == int_b) return 0; - else if (int_a < int_b) return -1; - else return 1; -} - -TZBook::TZBook() -{ - keycount = 0; - book_move2_probability = 0; - last_position = 0; - akt_position = 0; - last_anz_pieces = 0; - akt_anz_pieces = 0; - search_counter = 0; - tzhash2 = NULL; - do_search = true; - enabled = false; -} - -TZBook::~TZBook() -{ -} - - -void TZBook::init(const std::string& path) -{ - if (path.length() == 0) return; - - const char *p = path.c_str(); - if (strcmp(p, "") == 0) - return; - - FILE *fpt = fopen(p, "rb"); - if (fpt == NULL) - { - sync_cout << "info string Could not open " << path << sync_endl; - return; - } - - if (tzhash2 != NULL) - { - free(tzhash2); - tzhash2 = NULL; - } - - fseek(fpt, 0L, SEEK_END); - int filesize = ftell(fpt); - fseek(fpt, 0L, SEEK_SET); - - keycount = filesize / 8; - tzhash2 = new TZHash2[keycount]; - - fread(tzhash2, 1, filesize, fpt); - fclose(fpt); - - sync_cout << "info string Book loaded: " << path << sync_endl; - - srand((int)time(NULL)); - enabled = true; -} - - -void TZBook::set_book_move2_probability(int book_move2_prob) -{ - book_move2_probability = book_move2_prob; -} - - -Move TZBook::probe2(Position& pos) -{ - Move m = MOVE_NONE; - if (!enabled) return m; - - akt_position = pos.pieces(); - akt_anz_pieces = popcount(akt_position); - - if (do_search == false) - { - Bitboard b = akt_position ^ last_position; - int n2 = popcount(b); - - if (n2 > 4) do_search = true; - if (akt_anz_pieces > last_anz_pieces) do_search = true; - if (akt_anz_pieces < last_anz_pieces - 2) do_search = true; - } - - last_position = akt_position; - last_anz_pieces = akt_anz_pieces; - - if (do_search) - { - TZHash2 *tz = probe2(pos.key()); - if (tz == NULL) - { - search_counter++; - if (search_counter > 2) - { - do_search = false; - search_counter = 0; - } - } - else - { - if (pos.is_draw(64)) - m = get_move_from_draw_position(pos, tz); - else - m = get_move(pos, tz); - } - } - - return m; -} - - -TZHash2 *TZBook::probe2(Key key) -{ - uint32_t key1 = key >> 32; - unsigned short key2 = key >> 16 & 0xFFFF; - - int start = 0; - int end = keycount; - - for (;;) - { - int mid = (end + start) / 2; - - if (tzhash2[mid].key1 < key1) - start = mid; - else - { - if (tzhash2[mid].key1 > key1) - end = mid; - else - { - start = max(mid - 4, 0); - end = min(mid + 4, keycount); - } - } - - if (end - start < 9) - break; - } - - for (int i = start; i < end; i++) - if ((key1 == tzhash2[i].key1) && (key2 == tzhash2[i].key2)) - return &(tzhash2[i]); - - return NULL; -} - -Move TZBook::movenumber_to_move(Position& pos, int n) -{ - const ExtMove *m = MoveList(pos).begin(); - size_t size = MoveList(pos).size(); - Move *mv = new Move[size]; - for (unsigned int i = 0; i < size; i++) - mv[i] = m[i].move; - - qsort(mv, size, sizeof(mv[0]), qsort_compare_int); - - return mv[n]; -} - -bool TZBook::check_draw(Move m, Position& pos) -{ - StateInfo st; - - pos.do_move(m, st, pos.gives_check(m)); - bool draw = pos.is_draw(64); - pos.undo_move(m); - - return draw; -} - - -Move TZBook::get_move_from_draw_position(Position& pos, TZHash2 *tz) -{ - Move m = movenumber_to_move(pos, tz->move_number); - if (!check_draw(m, pos)) - return m; - - if (tz->move_number2 == 255) - return m; - - m = movenumber_to_move(pos, tz->move_number2); - if (!check_draw(m, pos)) - return m; - - return MOVE_NONE; -} - - -Move TZBook::get_move(Position& pos, TZHash2 *tz) -{ - Move m1 = movenumber_to_move(pos, tz->move_number); - if ((book_move2_probability == 0) || (tz->move_number2 == 255)) - return m1; - - Move m2 = movenumber_to_move(pos, tz->move_number2); - if ((book_move2_probability == 100) || (rand() % 100 < book_move2_probability)) - return m2; - - return m1; -} \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/tzbook.h b/Engines/Linux32/mcbrain/src/tzbook.h deleted file mode 100644 index 744618a..0000000 --- a/Engines/Linux32/mcbrain/src/tzbook.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef TZBOOK_H_INCLUDED -#define TZBOOK_H_INCLUDED - -#include "bitboard.h" -#include "position.h" -#include "string.h" - -struct TZHash2 -{ - uint32_t key1; - uint16_t key2; - unsigned char move_number; - unsigned char move_number2; -}; - -class TZBook -{ - public: - - Bitboard last_position; - Bitboard akt_position; - int last_anz_pieces; - int akt_anz_pieces; - int search_counter; - - bool enabled, do_search; - int book_move2_probability; - - TZBook(); - ~TZBook(); - - void init(const std::string& path); - void set_book_move2_probability(int book_move2_prob); - - Move probe2(Position& pos); - TZHash2 *probe2(Key key); - -private: - - int keycount; - TZHash2 *tzhash2; - bool check_draw(Move m, Position& pos); - Move get_move_from_draw_position(Position& pos, TZHash2 *tz); - Move get_move(Position& pos, TZHash2 *tz); - Move movenumber_to_move(Position& pos, int n); -}; - -extern TZBook tzbook; - -#endif // #ifndef TZBOOK_H_INCLUDED \ No newline at end of file diff --git a/Engines/Linux32/mcbrain/src/uci.cpp b/Engines/Linux32/mcbrain/src/uci.cpp index 75512a4..b21e97c 100644 --- a/Engines/Linux32/mcbrain/src/uci.cpp +++ b/Engines/Linux32/mcbrain/src/uci.cpp @@ -273,13 +273,13 @@ void UCI::loop(int argc, char* argv[]) { else if (token == "position") { position(pos, is, states); - if (Options["Clean_Search"] == true) + if (Options["Clear Search"]) Search::clear(); } else if (token == "p") { position(pos, is, states); - if (Options["Clean_Search"] == true) + if (Options["Clear Search"]) Search::clear(); } else if (token == "ucinewgame") Search::clear(); diff --git a/Engines/Linux32/mcbrain/src/uci.h b/Engines/Linux32/mcbrain/src/uci.h index 93764d5..ebed83a 100644 --- a/Engines/Linux32/mcbrain/src/uci.h +++ b/Engines/Linux32/mcbrain/src/uci.h @@ -50,14 +50,22 @@ class Option { Option(OnChange = nullptr); Option(bool v, OnChange = nullptr); Option(const char* v, OnChange = nullptr); - Option(double v, int minv, int maxv, OnChange = nullptr); - Option(const char* v, const char *cur, OnChange = nullptr); + Option(const char* v, const char* cur, OnChange = nullptr); + template Option(T v, T minv, T maxv, OnChange f = nullptr) : type("spin"), min(minv), max(maxv), on_change(f) + { + defaultValue = currentValue = std::to_string(v); + } Option& operator=(const std::string&); void operator<<(const Option&); - operator double() const; + template operator T() const + { + assert(type == "spin" || type == "check"); + return (type == "spin" ? T(stof(currentValue)): type == "check" ? (currentValue == "true") : T(0)); + } + operator std::string() const; - bool operator==(const char*); + bool operator==(const char*) const; private: friend std::ostream& operator<<(std::ostream&, const OptionsMap&); diff --git a/Engines/Linux32/mcbrain/src/ucioption.cpp b/Engines/Linux32/mcbrain/src/ucioption.cpp index ba66e63..ede37b9 100644 --- a/Engines/Linux32/mcbrain/src/ucioption.cpp +++ b/Engines/Linux32/mcbrain/src/ucioption.cpp @@ -22,14 +22,18 @@ #include #include #include +//Hash +#include +//end_Hash +#include #include "misc.h" -#include "polybook.h" #include "search.h" #include "thread.h" #include "tt.h" #include "uci.h" #include "syzygy/tbprobe.h" +#include "polybook.h" using std::string; @@ -40,15 +44,21 @@ namespace UCI { /// 'On change' actions, triggered by an option's value change void on_clear_hash(const Option&) { Search::clear(); } void on_hash_size(const Option& o) { TT.resize(o); } +void on_large_pages(const Option& o) { TT.resize(o); } // warning is ok, will be removed void on_logger(const Option& o) { start_logger(o); } void on_threads(const Option& o) { Threads.set(o); } void on_tb_path(const Option& o) { Tablebases::init(o); } - +//Hash +void on_HashFile(const Option& o) { TT.set_hash_file_name(o); } +void SaveHashtoFile(const Option&) { TT.save(); } +void LoadHashfromFile(const Option&) { TT.load(); } +void LoadEpdToHash(const Option&) { TT.load_epd_to_hash(); } +//end_Hash + void on_book_file(const Option& o) { polybook.init(o); } void on_best_book_move(const Option& o) { polybook.set_best_book_move(o); } void on_book_depth(const Option& o) { polybook.set_book_depth(o); } - /// Our case insensitive less() function as required by UCI protocol bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const { @@ -64,40 +74,56 @@ void init(OptionsMap& o) { // at most 2^32 clusters. constexpr int MaxHashMB = Is64Bit ? 131072 : 2048; - o["Debug Log File"] << Option("", on_logger); - o["Contempt"] << Option(12, -150, 150); - o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Off"); - o["UCI_AnalyseMode"] << Option(false); - o["Threads"] << Option(1, 1, 512, on_threads); - o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); - o["Clear_Hash"] << Option(on_clear_hash); - o["Clean_Search"] << Option(false); + unsigned n = std::thread::hardware_concurrency(); + if (!n) n = 1; - o["Tactical"] << Option(0, 0, 8); + o["Threads"] << Option(n, unsigned(1), unsigned(512), on_threads); + o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); + o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Both"); + o["UCI_Chess960"] << Option(false); o["Ponder"] << Option(false); + o["OwnBook"] << Option(false); + o["Book File"] << Option("book.bin"); + o["Best Book Move"] << Option(false); + + o["Contempt"] << Option(21, -150, 150); o["MultiPV"] << Option(1, 1, 256); - o["BruteForce"] << Option(false); + o["Variety"] << Option (0, 0, 20); + o["Clear Search"] << Option(false); + o["Large Pages"] << Option(false, on_large_pages); + o["Minimal_Output"] << Option(false); o["FastPlay"] << Option(false); - o["No_Null_Moves"] << Option(false); + o["BruteForce"] << Option(false); + o["NullMove"] << Option(true); + o["LMR"] << Option(true); + o["MaxLMReduction"] << Option(10, 0, 20); o["UCI_LimitStrength"] << Option(false); - o["UCI_ELO"] << Option(1500, 1500, 2800); + o["ICCF Analysis"] << Option(0, 0, 8); + o["Skill Level"] << Option(20, 0, 20); o["Move Overhead"] << Option(30, 0, 5000); o["Minimum Thinking Time"] << Option(20, 0, 5000); o["Slow Mover"] << Option(84, 10, 1000); o["nodestime"] << Option(0, 0, 10000); - o["UCI_Chess960"] << Option(false); + + o["Clear_Hash"] << Option(on_clear_hash); + o["SaveHashtoFile"] << Option(SaveHashtoFile); + o["LoadHashfromFile"] << Option(LoadHashfromFile); + o["LoadEpdToHash"] << Option(LoadEpdToHash); + o["NeverClearHash"] << Option(false); + o["HashFile"] << Option("hash.hsh", on_HashFile); o["UCI_AnalyseMode"] << Option(false); o["SyzygyPath"] << Option("", on_tb_path); o["SyzygyProbeDepth"] << Option(1, 1, 100); o["Syzygy50MoveRule"] << Option(true); - o["SyzygyProbeLimit"] << Option(6, 0, 6); + o["SyzygyProbeLimit"] << Option(7, 0, 7); + + o["Cerebellum Options"] << Option(true); o["Book_Enabled"] << Option(true); o["BookFile"] << Option("", on_book_file); o["BestBookMove"] << Option(true, on_best_book_move); - o["BookDepth"] << Option(255, 1, 255, on_book_depth); - o["Debug Log File"] << Option("", on_logger); + o["Debug Log File"] << Option("", on_logger); } @@ -129,6 +155,10 @@ std::ostream& operator<<(std::ostream& os, const OptionsMap& om) { /// Option class constructors and conversion operators +Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f) +{ + defaultValue = v; currentValue = cur; +} Option::Option(const char* v, OnChange f) : type("string"), min(0), max(0), on_change(f) { defaultValue = currentValue = v; } @@ -139,23 +169,12 @@ Option::Option(bool v, OnChange f) : type("check"), min(0), max(0), on_change(f) Option::Option(OnChange f) : type("button"), min(0), max(0), on_change(f) {} -Option::Option(double v, int minv, int maxv, OnChange f) : type("spin"), min(minv), max(maxv), on_change(f) -{ defaultValue = currentValue = std::to_string(v); } - -Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f) -{ defaultValue = v; currentValue = cur; } - -Option::operator double() const { - assert(type == "check" || type == "spin"); - return (type == "spin" ? stof(currentValue) : currentValue == "true"); -} - Option::operator std::string() const { assert(type == "string"); return currentValue; } -bool Option::operator==(const char* s) { +bool Option::operator==(const char* s) const { assert(type == "combo"); return !CaseInsensitiveLess()(currentValue, s) && !CaseInsensitiveLess()(s, currentValue); diff --git a/Engines/Linux64/mcbrain/.DS_Store b/Engines/Linux64/mcbrain/.DS_Store new file mode 100644 index 0000000..f2a08a1 Binary files /dev/null and b/Engines/Linux64/mcbrain/.DS_Store differ diff --git a/Engines/Linux64/mcbrain/.gitignore b/Engines/Linux64/mcbrain/.gitignore new file mode 100644 index 0000000..b5f56bd --- /dev/null +++ b/Engines/Linux64/mcbrain/.gitignore @@ -0,0 +1,24 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +*.pdb +*.tlog +*.log +*.exe +*.obj +*.lastbuildstate +*.ilk +*.idb +*.ipch +*.opendb +*.db +*.suo +*.sqlite +*.json + +# Ignore temporary folders +.vs/ +/executable/Machine Learning/SugarMachineLearning.sml +/executable/Master/Cerebellum_Light_Poly.bin +/executable/Base Master/Cerebellum_Light_Poly.bin diff --git a/Engines/Linux64/mcbrain/.travis.yml b/Engines/Linux64/mcbrain/.travis.yml index 0a214d1..ded29e4 100644 --- a/Engines/Linux64/mcbrain/.travis.yml +++ b/Engines/Linux64/mcbrain/.travis.yml @@ -9,9 +9,9 @@ matrix: addons: apt: sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6', 'g++-6-multilib', 'g++-multilib', 'valgrind', 'expect'] + packages: ['g++-7', 'g++-7-multilib', 'g++-multilib', 'valgrind', 'expect', 'curl'] env: - - COMPILER=g++-6 + - COMPILER=g++-7 - COMP=gcc - os: linux @@ -19,7 +19,7 @@ matrix: addons: apt: sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0'] - packages: ['clang-5.0', 'llvm-5.0-dev', 'g++-multilib', 'valgrind', 'expect'] + packages: ['clang-5.0', 'llvm-5.0-dev', 'g++-multilib', 'valgrind', 'expect', 'curl'] env: - COMPILER=clang++-5.0 - COMP=clang @@ -69,6 +69,6 @@ script: # # Sanitizer # - # Use g++-6 as a proxy for having sanitizers, might need revision as they become available for more recent versions of clang/gcc - - if [[ "$COMPILER" == "g++-6" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=undefined optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-undefined; fi - - if [[ "$COMPILER" == "g++-6" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-thread; fi + # Use g++-7 as a proxy for having sanitizers, might need revision as they become available for more recent versions of clang/gcc + - if [[ "$COMPILER" == "g++-7" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=undefined optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-undefined; fi + - if [[ "$COMPILER" == "g++-7" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-thread; fi diff --git a/Engines/Linux64/mcbrain/AUTHORS b/Engines/Linux64/mcbrain/AUTHORS index 9b91b93..9c25509 100644 --- a/Engines/Linux64/mcbrain/AUTHORS +++ b/Engines/Linux64/mcbrain/AUTHORS @@ -1,98 +1,122 @@ -# Generated with 'git shortlog -sn | cut -c8-', which sorts by commits, manually ordered the first four authors, merged duplicates +# List of authors for Stockfish, updated just after version 9 -Tord Romstad +Tord Romstad (romstad) Marco Costalba (mcostalba) Joona Kiiski (zamar) Gary Linscott (glinscott) -Lucas Braesch (lucasart) -Bill Henry (VoyagerOne) -mstembera -Stéphane Nicolet (Stephane Nicolet, snicolet) -Stefan Geschwentner -Alain SAVARD (Rocky640) -Jörg Oster (Joerg Oster, joergoster) -Reuven Peleg -Chris Caino (Chris Cain, ceebo) -Jean-Francois Romang -homoSapiensSapiens -Leonid Pechenik -Stefano Cardanobile (Stefano80) -Arjun Temurnikar -Uri Blass (uriblass) -jundery -Ajith (ajithcj) -hxim -Ralph Stößer (Ralph Stoesser) -Guenther Demetz -Jonathan Calovski (Mysseno) -Tom Vijlbrief -mbootsector -Daylen Yang -ElbertoOne -Henri Wiechers -loco-loco -Joost VandeVondele (Joost Vandevondele) -Ronald de Man (syzygy) -DU-jdto -David Zar -Eelco de Groot -Jerry Donald -NicklasPersson -Ryan Schmitt + +absimaldata +Ajith Chandy Jose (ajithcj) +Alain Savard (Rocky640) Alexander Kure -Dan Schmidt -H. Felix Wittmann -Jacques -Joseph R. Prostko -Justin Blanchard -Linus Arver -Luca Brivio -Lyudmil Antonov -Rodrigo Exterckötter Tjäder -Ron Britvich -RyanTaker -Vince Negri -erbsenzaehler -Joseph Hellis (jhellis3) -shane31 -Andrew Grant +Ali AlZhrani (Cooffe) +Andrew Grant (AndyGrant) +Andrey Neporada (nepal) Andy Duplain +Aram Tumanian (atumanian) +Arjun Temurnikar Auguste Pop Balint Pfliegel +Ben Koshy (BKSpurgeon) +Bill Henry (VoyagerOne) +braich +Brian Sheppard (SapphireBrand) +Bryan Cross (crossbr) +Bujun Guo (noobpwnftw) +Chris Cain (ceebo) +Dan Schmidt +Daniel Dugovic (ddugovic) Dariusz Orzechowski +David Zar +Daylen Yang (daylen) DiscanX +Eelco de Groot +ElbertoOne +erbsenzaehler Ernesto Gatti +Fabian Beuke (madnight) +Fabian Fichter (ianfab) +fanon +Fauzi Akram Dabat (FauziAkram) +Felix Wittmann +gamander +gguliash +Gian-Carlo Pascutto (gcp) +Gontran Lemaire (gonlem) +Goodkov Vasiliy Aleksandrovich (goodkov) Gregor Cramer +GuardianRM +Günther Demetz (pb00067, pb00068) +Guy Vreuls (gvreuls) +Henri Wiechers Hiraoka Takuya (HiraokaTakuya) +homoSapiensSapiens Hongzhi Cheng -IIvec +Ivan Ivec (IIvec) +Jacques B. (Timshel) +Jan OndruÅ¡ (hxim) +Jarrod Torriero (DU-jdto) +Jean-Francois Romang +Jerry Donald Watson (jerrydonaldwatson) +Jonathan Calovski (Mysseno) +Joost VandeVondele (vondele) +Jörg Oster (joergoster) +Joseph Ellis (jhellis3) +Joseph R. Prostko +jundery +Justin Blanchard Kelly Wilson -Ken T Takusagawa +Ken Takusagawa +kinderchocolate +Kiran Panditrao (Krgp) Kojirion -Krgp -Matt Sullivan -Matthew Lai +Leonardo LjubiÄić (GM) +Leonid Pechenik (lp--) +Linus Arver +loco-loco +Luca Brivio (lucabrivio) +Lucas Braesch (lucasart) +Lyudmil Antonov (lantonov) +Matthew Lai (matthewlai) Matthew Sullivan -Michel Van den Bergh -Niklas Fiekas +Mark Tenzer (31m059) +Michael Byrne (MichaelB7) +Michael Stembera (mstembera) +Michel Van den Bergh (vdbergh) +Miguel Lahoz (miguel-l) +Mikael Bäckman (mbootsector) +Mike Whiteley (protonspring) +Miroslav Fontán (Hexik) +Moez Jellouli (MJZ1977) +Mohammed Li (tthsqe12) +Nathan Rugg (nmrugg) +Nicklas Persson (NicklasPersson) +Niklas Fiekas (niklasf) Oskar Werkelin Ahlin Pablo Vazquez Pascal Romaret +Pasquale Pigazzini (ppigazzini) +Patrick Jansen (mibere) +pellanda +Ralph Stößer (Ralph Stoesser) Raminder Singh +renouve +Reuven Peleg Richard Lloyd +Rodrigo Exterckötter Tjäder +Ron Britvich +Ronald de Man (syzygy1) +Ryan Schmitt Ryan Takker -Thanar2 -absimaldata -atumanian -braich -fanon -gamander -gguliash -kinderchocolate -pellanda -ppigazzini -renouve +Sergei Antonov (saproj) sf-x +shane31 +Stefan Geschwentner (locutus2) +Stefano Cardanobile (Stefano80) +Stéphane Nicolet (snicolet) +Thanar2 thaspel -unknown - +Tom Vijlbrief (tomtor) +Torsten Franz (torfranz) +Uri Blass (uriblass) +Vince Negri diff --git a/Engines/Linux64/mcbrain/McBrain-91_x64_linux b/Engines/Linux64/mcbrain/McBrain-91_x64_linux deleted file mode 100644 index b409cfc..0000000 Binary files a/Engines/Linux64/mcbrain/McBrain-91_x64_linux and /dev/null differ diff --git a/Engines/Linux64/mcbrain/McBrain-v99_x64_linux b/Engines/Linux64/mcbrain/McBrain-v99_x64_linux new file mode 100644 index 0000000..e94a564 Binary files /dev/null and b/Engines/Linux64/mcbrain/McBrain-v99_x64_linux differ diff --git a/Engines/Linux64/mcbrain/Readme.md b/Engines/Linux64/mcbrain/Readme.md index 46f2609..8913595 100644 --- a/Engines/Linux64/mcbrain/Readme.md +++ b/Engines/Linux64/mcbrain/Readme.md @@ -1,33 +1,30 @@ -### Overview +### Overview [![Build Status](https://travis-ci.org/official-stockfish/Stockfish.svg?branch=master)](https://travis-ci.org/official-stockfish/Stockfish) -[![Build Status](https://travis-ci.org/official-stockfish/Stockfish.svg?branch=master)](https://travis-ci.org/official-stockfish/Stockfish) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/official-stockfish/Stockfish?svg=true)](https://ci.appveyor.com/project/mcostalba/stockfish) - -Stockfish is a free UCI chess engine derived from Glaurung 2.1. It is +SugaR is a free UCI chess engine derived from Stockfish. It is not a complete chess program and requires some UCI-compatible GUI (e.g. XBoard with PolyGlot, eboard, Arena, Sigma Chess, Shredder, Chess -Partner or Fritz) in order to be used comfortably. Read the +Partner, Aquarium or Fritz) in order to be used comfortably. Read the documentation for your GUI of choice for information about how to use -Stockfish with it. +SugaR with it. -This version of Stockfish supports up to 512 cores. The engine defaults +This version of SugaR supports up to 128 cores. The engine defaults to one search thread, so it is therefore recommended to inspect the value of the *Threads* UCI parameter, and to make sure it equals the number of CPU cores on your computer. -This version of Stockfish has support for Syzygybases. +This version of SugaR has support for Syzygybases. ### Files -This distribution of Stockfish consists of the following files: +This distribution of SugaR consists of the following files: * Readme.md, the file you are currently reading. * Copying.txt, a text file containing the GNU General Public License. - * src, a subdirectory containing the full source code, including a Makefile - that can be used to compile Stockfish on Unix-like systems. + * source, a subdirectory containing the full source code, including a Makefile + that can be used to compile SugaR on Unix-like systems. ### Syzygybases @@ -84,40 +81,37 @@ the 50-move rule. ### Compiling it yourself -On Unix-like systems, it should be possible to compile Stockfish +On Unix-like systems, it should be possible to compile SugaR directly from the source code with the included Makefile. -Stockfish has support for 32 or 64-bit CPUs, the hardware POPCNT +SugaR has support for 32 or 64-bit CPUs, the hardware POPCNT instruction, big-endian machines such as Power PC, and other platforms. +On Windows-like systems, it should be possible to compile SugaR +directly from the source code with the included Sugar.sln with Visual Studio 15.3 Community +from GUI or with command scenario using Visual Studio 15.3 Community Commands Shell. + In general it is recommended to run `make help` to see a list of make targets with corresponding descriptions. When not using the Makefile to -compile (for instance with Microsoft MSVC) you need to manually -set/unset some switches in the compiler command line; see file *types.h* +compile you need to manually +set/unset some switches in the compiler command line or use MSVC solution and project files provided; see file *types.h* for a quick reference. -### Resource For Understanding the Code Base - -* [Chess Programming Wiki](https://chessprogramming.wikispaces.com) has good overall chess engines explanations -(techniques used here are well explained like hash maps etc), it was -also recommended by the [support team at stockfish.](http://support.stockfishchess.org/discussions/questions/1132-how-to-understand-stockfish-sources) - -* [Here](https://chessprogramming.wikispaces.com/Stockfish) you can find a set of features and techniques used by stockfish and each of them is explained at the wiki, however, it's a generic way rather than focusing on stockfish's own implementation, but it will still help you. - ### Terms of use -Stockfish is free, and distributed under the **GNU General Public License** +SugaR is free, and distributed under the **GNU General Public License** (GPL). Essentially, this means that you are free to do almost exactly what you want with the program, including distributing it among your friends, making it available for download from your web site, selling it (either by itself or as part of some bigger software package), or using it as the starting point for a software project of your own. -The only real limitation is that whenever you distribute Stockfish in +The only real limitation is that whenever you distribute SugaR in some way, you must always include the full source code, or a pointer to where the source code can be found. If you make any changes to the source code, these changes must also be made available under the GPL. For full details, read the copy of the GPL found in the file named *Copying.txt*. + diff --git a/Engines/Linux64/mcbrain/SF-McBrain-v40_x64_linux b/Engines/Linux64/mcbrain/SF-McBrain-v40_x64_linux deleted file mode 100644 index 0979c1e..0000000 Binary files a/Engines/Linux64/mcbrain/SF-McBrain-v40_x64_linux and /dev/null differ diff --git a/Engines/Linux64/mcbrain/appveyor.yml b/Engines/Linux64/mcbrain/appveyor.yml index c711dd6..4b5e9eb 100644 --- a/Engines/Linux64/mcbrain/appveyor.yml +++ b/Engines/Linux64/mcbrain/appveyor.yml @@ -34,19 +34,16 @@ before_build: $src = get-childitem -Path *.cpp -Recurse | select -ExpandProperty FullName $src = $src -join ' ' $src = $src.Replace("\", "/") - # Build CMakeLists.txt $t = 'cmake_minimum_required(VERSION 3.8)', 'project(Stockfish)', 'set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src)', 'set(source_files', $src, ')', 'add_executable(stockfish ${source_files})' - # Write CMakeLists.txt withouth BOM $MyPath = (Get-Item -Path "." -Verbose).FullName + '\CMakeLists.txt' $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False [System.IO.File]::WriteAllLines($MyPath, $t, $Utf8NoBomEncoding) - # Obtain bench reference from git log $b = git log HEAD | sls "\b[Bb]ench[ :]+[0-9]{7}" | select -first 1 $bench = $b -match '\D+(\d+)' | % { $matches[1] } @@ -55,10 +52,8 @@ before_build: If (${env:PLATFORM} -eq 'x64') { $g = $g + ' Win64' } cmake -G "${g}" . Write-Host "Generated files for: " $g - build_script: - cmake --build . --config %CONFIGURATION% -- /verbosity:minimal - before_test: - cd src/%CONFIGURATION% - ps: | @@ -68,4 +63,4 @@ before_test: $r = ($s -match 'Nodes searched \D+(\d+)' | % { $matches[1] }) Write-Host "Engine bench:" $r Write-Host "Reference bench:" $bench - If ($r -ne $bench) { exit 1 } + If ($r -ne $bench) { exit 1 } \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/.DS_Store b/Engines/Linux64/mcbrain/src/.DS_Store index 5008ddf..ef9e3c3 100644 Binary files a/Engines/Linux64/mcbrain/src/.DS_Store and b/Engines/Linux64/mcbrain/src/.DS_Store differ diff --git a/Engines/Linux64/mcbrain/src/.cproject b/Engines/Linux64/mcbrain/src/.cproject new file mode 100644 index 0000000..54a0868 --- /dev/null +++ b/Engines/Linux64/mcbrain/src/.cproject @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Engines/Linux64/mcbrain/src/.depend b/Engines/Linux64/mcbrain/src/.depend new file mode 100644 index 0000000..bd25d9e --- /dev/null +++ b/Engines/Linux64/mcbrain/src/.depend @@ -0,0 +1,52 @@ +benchmark.o: benchmark.cpp position.h bitboard.h types.h +bitbase.o: bitbase.cpp bitboard.h types.h +bitboard.o: bitboard.cpp bitboard.h types.h misc.h +book.o: book.cpp book.h misc.h types.h position.h bitboard.h movegen.h +endgame.o: endgame.cpp bitboard.h types.h endgame.h position.h movegen.h +evaluate.o: evaluate.cpp bitboard.h types.h evaluate.h material.h \ + endgame.h position.h misc.h pawns.h thread.h movepick.h movegen.h \ + search.h thread_win32.h uci.h +main.o: main.cpp bitboard.h types.h position.h search.h misc.h movepick.h \ + movegen.h thread.h material.h endgame.h pawns.h thread_win32.h tt.h \ + uci.h syzygy/tbprobe.h syzygy/../search.h polybook.h +material.o: material.cpp material.h endgame.h position.h bitboard.h \ + types.h misc.h thread.h movepick.h movegen.h pawns.h search.h \ + thread_win32.h +misc.o: misc.cpp misc.h types.h thread.h material.h endgame.h position.h \ + bitboard.h movepick.h movegen.h pawns.h search.h thread_win32.h +movegen.o: movegen.cpp movegen.h types.h position.h bitboard.h +movepick.o: movepick.cpp movepick.h movegen.h types.h position.h \ + bitboard.h +pawns.o: pawns.cpp bitboard.h types.h pawns.h misc.h position.h thread.h \ + material.h endgame.h movepick.h movegen.h search.h thread_win32.h +position.o: position.cpp bitboard.h types.h misc.h movegen.h position.h \ + thread.h material.h endgame.h movepick.h pawns.h search.h thread_win32.h \ + tt.h uci.h syzygy/tbprobe.h syzygy/../search.h +psqt.o: psqt.cpp types.h +search.o: search.cpp book.h misc.h types.h position.h bitboard.h \ + evaluate.h movegen.h movepick.h polybook.h search.h thread.h material.h \ + endgame.h pawns.h thread_win32.h timeman.h tt.h uci.h syzygy/tbprobe.h \ + syzygy/../search.h +thread.o: thread.cpp movegen.h types.h search.h misc.h movepick.h \ + position.h bitboard.h thread.h material.h endgame.h pawns.h \ + thread_win32.h uci.h syzygy/tbprobe.h syzygy/../search.h tt.h +timeman.o: timeman.cpp search.h misc.h types.h movepick.h movegen.h \ + position.h bitboard.h timeman.h thread.h material.h endgame.h pawns.h \ + thread_win32.h uci.h +tt.o: tt.cpp uci.h types.h position.h bitboard.h thread.h material.h \ + endgame.h misc.h movepick.h movegen.h pawns.h search.h thread_win32.h \ + tt.h +uci.o: uci.cpp evaluate.h types.h movegen.h position.h bitboard.h \ + search.h misc.h movepick.h thread.h material.h endgame.h pawns.h \ + thread_win32.h timeman.h tt.h uci.h syzygy/tbprobe.h syzygy/../search.h +ucioption.o: ucioption.cpp misc.h types.h search.h movepick.h movegen.h \ + position.h bitboard.h thread.h material.h endgame.h pawns.h \ + thread_win32.h tt.h uci.h syzygy/tbprobe.h syzygy/../search.h polybook.h +polybook.o: polybook.cpp polybook.h bitboard.h types.h position.h uci.h \ + movegen.h thread.h material.h endgame.h misc.h movepick.h pawns.h \ + search.h thread_win32.h +tbprobe.o: syzygy/tbprobe.cpp syzygy/../bitboard.h syzygy/../types.h \ + syzygy/../movegen.h syzygy/../position.h syzygy/../bitboard.h \ + syzygy/../search.h syzygy/../misc.h syzygy/../movepick.h \ + syzygy/../movegen.h syzygy/../position.h syzygy/../thread_win32.h \ + syzygy/../types.h syzygy/../uci.h syzygy/tbprobe.h diff --git a/Engines/Linux64/mcbrain/src/.project b/Engines/Linux64/mcbrain/src/.project new file mode 100644 index 0000000..1c8747f --- /dev/null +++ b/Engines/Linux64/mcbrain/src/.project @@ -0,0 +1,27 @@ + + + SugaR + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Engines/Linux64/mcbrain/src/Build x64 - Ubuntu Commands.txt b/Engines/Linux64/mcbrain/src/Build x64 - Ubuntu Commands.txt new file mode 100644 index 0000000..5f78025 --- /dev/null +++ b/Engines/Linux64/mcbrain/src/Build x64 - Ubuntu Commands.txt @@ -0,0 +1,5 @@ +make clean +make profile-build ARCH=x86-64 -j14 +strip McBrain + + diff --git a/Engines/Linux64/mcbrain/src/Makefile b/Engines/Linux64/mcbrain/src/Makefile index 8942f03..a2bf194 100644 --- a/Engines/Linux64/mcbrain/src/Makefile +++ b/Engines/Linux64/mcbrain/src/Makefile @@ -1,43 +1,59 @@ -# Stockfish, a UCI chess playing engine derived from Glaurung 2.1 -# Copyright (C) 2004-2008 Tord Romstad (Glaurung author) -# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad -# Copyright (C) 2015-2018 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad -# -# Stockfish is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Stockfish is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - +### ========================================================================== +### Copyright Notice and License Information +### ========================================================================== +# McBrain, a UCI chess playing engine derived from SugaR, Stockfish and Glaurung 2.1 +# Copyright (C) 2004-2008 Tord Romstad (Glaurung Author) +# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) +# Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) +# Copyright (C) 2017-2018 Michael Byrne, Marco Zerbinati, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + +# McBrain is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# McBrain is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . ### ========================================================================== ### Section 1. General Configuration ### ========================================================================== ### Executable name +### McCain bench nodes 4717832 +### McBrain bench nodes 4576991 +VERSION= +#VERSION=maverick +ifeq ($(VERSION),maverick) +CXXFLAGS += -DMaverick ifeq ($(COMP),mingw) -EXE = McBrain-91.exe +EXE = McCain-v2.exe else -EXE = McBrain-91 +EXE = McCain-v2 +endif +else +CXXFLAGS += -DPAWN_SCORES +ifeq ($(COMP),mingw) +EXE = McBrain-v99.exe +else +EXE = McBrain-v99 +endif endif -##### bench nodes: 6045167 ### Installation dir definitions PREFIX = /usr/local BINDIR = $(PREFIX)/bin ### Built-in benchmark for pgo-builds -PGOBENCH = ./$(EXE) bench +PGOBENCH = ./$(EXE) bench 16 1 10 +PGOBENCH2 = ./$(EXE) bench 16 2 8 ### Object files -OBJS = benchmark.o bitbase.o bitboard.o endgame.o evaluate.o main.o \ +OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \ material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \ search.o thread.o timeman.o tt.o uci.o ucioption.o polybook.o syzygy/tbprobe.o @@ -160,6 +176,7 @@ ifeq ($(COMP),gcc) CXXFLAGS += -pedantic -Wextra -Wshadow ifeq ($(ARCH),armv7) + CXXFLAGS += -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -mtune=cortex-a53 ifeq ($(OS),Android) CXXFLAGS += -m$(bits) LDFLAGS += -m$(bits) @@ -172,6 +189,9 @@ ifeq ($(COMP),gcc) ifneq ($(KERNEL),Darwin) LDFLAGS += -Wl,--no-as-needed endif + + gccversion=$(shell gcc --version) + gccmasqueraded=$(findstring clang,$(gccversion)) endif ifeq ($(COMP),mingw) @@ -334,15 +354,24 @@ endif ### needs access to the optimization flags. ifeq ($(optimize),yes) ifeq ($(debug), no) - ifeq ($(comp),$(filter $(comp),gcc clang)) + ifeq ($(comp),clang) CXXFLAGS += -flto LDFLAGS += $(CXXFLAGS) endif + ifeq ($(comp),gcc) + CXXFLAGS += -flto + ifeq ($(gccmasqueraded),) + LDFLAGS += $(CXXFLAGS) -flto=jobserver + else + LDFLAGS += $(CXXFLAGS) + endif + endif + ifeq ($(comp),mingw) ifeq ($(KERNEL),Linux) CXXFLAGS += -flto - LDFLAGS += $(CXXFLAGS) + LDFLAGS += $(CXXFLAGS) -flto=jobserver endif endif endif @@ -362,9 +391,13 @@ endif help: @echo "" - @echo "To compile stockfish, type: " + @echo "To compile McBrain, type: " + @echo "'make ARCH=arch [COMP=compiler] [COMPCXX=cxx]'" + @echo " would be 'build' or 'profile-build'" @echo "" - @echo "make target ARCH=arch [COMP=compiler] [COMPCXX=cxx]" + @echo "To compile McCain, uncomment this line in the makefile: " + @echo "'### VERSION=maverick' by remvoing the 3 #(pound signs)" + @echo "then type: 'make ARCH=arch [COMP=compiler] [COMPCXX=cxx]'" @echo "" @echo "Supported targets:" @echo "" @@ -420,6 +453,7 @@ profile-build: config-sanity objclean profileclean @echo "" @echo "Step 2/4. Running benchmark for pgo-build ..." $(PGOBENCH) > /dev/null + $(PGOBENCH2) > /dev/null @echo "" @echo "Step 3/4. Building optimized executable ..." $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean @@ -427,6 +461,9 @@ profile-build: config-sanity objclean profileclean @echo "" @echo "Step 4/4. Deleting profile data ..." $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean + strip $(EXE) +# cp $(EXE) /Users/michaelbyrne/cluster.mfb +# cp $(EXE) /opt/picochess/engines/armv7l strip: strip $(EXE) @@ -436,13 +473,20 @@ install: -cp $(EXE) $(BINDIR) -strip $(BINDIR)/$(EXE) +both: + VERSION= + ARCH=x86-64-modern + COMP=gcc + target=build + $(MAKE) $(target) + #clean all clean: objclean profileclean @rm -f .depend *~ core # clean binaries and objects objclean: - @rm -f $(EXE) $(EXE).exe *.o ./syzygy/*.o + @rm -f $(EXE) *.o ./syzygy/*.o # clean auxiliary profiling files profileclean: @@ -505,19 +549,19 @@ clang-profile-make: clang-profile-use: llvm-profdata merge -output=stockfish.profdata *.profraw $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ - EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata' \ + EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata -Wno-profile-instr-out-of-date' \ EXTRALDFLAGS='-fprofile-use ' \ all gcc-profile-make: $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ - EXTRACXXFLAGS='-fprofile-generate' \ + EXTRACXXFLAGS='-fprofile-generate -fprofile-correction' \ EXTRALDFLAGS='-lgcov' \ all gcc-profile-use: $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ - EXTRACXXFLAGS='-fprofile-use -fno-peel-loops -fno-tracer' \ + EXTRACXXFLAGS='-fprofile-use -fprofile-correction -fno-peel-loops -fno-tracer' \ EXTRALDFLAGS='-lgcov' \ all @@ -536,4 +580,3 @@ icc-profile-use: -@$(CXX) $(DEPENDFLAGS) -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null -include .depend - diff --git a/Engines/Linux64/mcbrain/src/McBrain-92 b/Engines/Linux64/mcbrain/src/McBrain-92 deleted file mode 100644 index 2033719..0000000 Binary files a/Engines/Linux64/mcbrain/src/McBrain-92 and /dev/null differ diff --git a/Engines/Linux64/mcbrain/src/McBrain-92 - test b/Engines/Linux64/mcbrain/src/McBrain-92 - test deleted file mode 100644 index 9de862a..0000000 Binary files a/Engines/Linux64/mcbrain/src/McBrain-92 - test and /dev/null differ diff --git a/Engines/Linux64/mcbrain/src/McBrain.sln b/Engines/Linux64/mcbrain/src/McBrain.sln new file mode 100644 index 0000000..4b42ecd --- /dev/null +++ b/Engines/Linux64/mcbrain/src/McBrain.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sugar", "Sugar.vcxproj", "{2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release AVX|x64 = Release AVX|x64 + Release AVX|x86 = Release AVX|x86 + Release AVX2|x64 = Release AVX2|x64 + Release AVX2|x86 = Release AVX2|x86 + Release SSE|x64 = Release SSE|x64 + Release SSE|x86 = Release SSE|x86 + Release SSE2|x64 = Release SSE2|x64 + Release SSE2|x86 = Release SSE2|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.ActiveCfg = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Build.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Deploy.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.ActiveCfg = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.Build.0 = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.ActiveCfg = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.Build.0 = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.ActiveCfg = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.Build.0 = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.ActiveCfg = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.Build.0 = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.ActiveCfg = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.Build.0 = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.ActiveCfg = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.Build.0 = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.ActiveCfg = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.Build.0 = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.ActiveCfg = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.Build.0 = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.ActiveCfg = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.Build.0 = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.ActiveCfg = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.Build.0 = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.ActiveCfg = Release|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Engines/Linux64/mcbrain/src/McBrain.vcxproj b/Engines/Linux64/mcbrain/src/McBrain.vcxproj new file mode 100644 index 0000000..a8b3003 --- /dev/null +++ b/Engines/Linux64/mcbrain/src/McBrain.vcxproj @@ -0,0 +1,411 @@ + + + + + Debug + Win32 + + + Release AVX2 + Win32 + + + Release AVX2 + x64 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE + Win32 + + + Release SSE + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C} + Win32Proj + 10.0.10240.0 + + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + v141 + + + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH; + MultiThreadedDebugDLL + Level3 + + + MachineX86 + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + StreamingSIMDExtensions + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + + _WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH + + + + Console + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions2 + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + MultiThreaded + + + + + + + + Fast + true + Speed + AnySuitable + true + true + + + false + UseLinkTimeCodeGeneration + + + + + false + UseLinkTimeCodeGeneration + + + true + Speed + AnySuitable + true + StreamingSIMDExtensions2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/McBrain.vcxproj.filters b/Engines/Linux64/mcbrain/src/McBrain.vcxproj.filters new file mode 100644 index 0000000..859ce91 --- /dev/null +++ b/Engines/Linux64/mcbrain/src/McBrain.vcxproj.filters @@ -0,0 +1,147 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/McBrain.vcxproj.user b/Engines/Linux64/mcbrain/src/McBrain.vcxproj.user new file mode 100644 index 0000000..5b610ed --- /dev/null +++ b/Engines/Linux64/mcbrain/src/McBrain.vcxproj.user @@ -0,0 +1,6 @@ + + + + WindowsLocalDebugger + + \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/McCain.sln b/Engines/Linux64/mcbrain/src/McCain.sln new file mode 100644 index 0000000..4b42ecd --- /dev/null +++ b/Engines/Linux64/mcbrain/src/McCain.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sugar", "Sugar.vcxproj", "{2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release AVX|x64 = Release AVX|x64 + Release AVX|x86 = Release AVX|x86 + Release AVX2|x64 = Release AVX2|x64 + Release AVX2|x86 = Release AVX2|x86 + Release SSE|x64 = Release SSE|x64 + Release SSE|x86 = Release SSE|x86 + Release SSE2|x64 = Release SSE2|x64 + Release SSE2|x86 = Release SSE2|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.ActiveCfg = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Build.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Deploy.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.ActiveCfg = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.Build.0 = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.ActiveCfg = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.Build.0 = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.ActiveCfg = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.Build.0 = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.ActiveCfg = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.Build.0 = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.ActiveCfg = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.Build.0 = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.ActiveCfg = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.Build.0 = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.ActiveCfg = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.Build.0 = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.ActiveCfg = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.Build.0 = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.ActiveCfg = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.Build.0 = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.ActiveCfg = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.Build.0 = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.ActiveCfg = Release|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Engines/Linux64/mcbrain/src/McCain.vcxproj b/Engines/Linux64/mcbrain/src/McCain.vcxproj new file mode 100644 index 0000000..a8b3003 --- /dev/null +++ b/Engines/Linux64/mcbrain/src/McCain.vcxproj @@ -0,0 +1,411 @@ + + + + + Debug + Win32 + + + Release AVX2 + Win32 + + + Release AVX2 + x64 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE + Win32 + + + Release SSE + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C} + Win32Proj + 10.0.10240.0 + + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + v141 + + + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH; + MultiThreadedDebugDLL + Level3 + + + MachineX86 + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + StreamingSIMDExtensions + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + + _WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH + + + + Console + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions2 + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + MultiThreaded + + + + + + + + Fast + true + Speed + AnySuitable + true + true + + + false + UseLinkTimeCodeGeneration + + + + + false + UseLinkTimeCodeGeneration + + + true + Speed + AnySuitable + true + StreamingSIMDExtensions2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/VersionHelpers.h b/Engines/Linux64/mcbrain/src/VersionHelpers.h new file mode 100644 index 0000000..72e930b --- /dev/null +++ b/Engines/Linux64/mcbrain/src/VersionHelpers.h @@ -0,0 +1,211 @@ +#ifndef VERSIONHELPER_H_INCLUDED +#define VERSIONHELPER_H_INCLUDED + +#define VERSIONHELPERAPI inline bool + +#define _WIN32_WINNT_NT4 0x0400 +#define _WIN32_WINNT_WIN2K 0x0500 +#define _WIN32_WINNT_WINXP 0x0501 +#define _WIN32_WINNT_WS03 0x0502 +#define _WIN32_WINNT_WIN6 0x0600 +#define _WIN32_WINNT_VISTA 0x0600 +#define _WIN32_WINNT_WS08 0x0600 +#define _WIN32_WINNT_LONGHORN 0x0600 +#define _WIN32_WINNT_WIN7 0x0601 +#define _WIN32_WINNT_WIN8 0x0602 +#define _WIN32_WINNT_WINBLUE 0x0603 +#define _WIN32_WINNT_WIN10 0x0A00 + +typedef LONG(NTAPI *fnRtlGetVersion)(PRTL_OSVERSIONINFOEXW lpVersionInformation); + +enum eVerShort +{ + WinUnsupported, // Unsupported OS + WinXP, // Windows XP + Win7, // Windows 7 + Win8, // Windows 8 + Win8Point1, // Windows 8.1 + Win10, // Windows 10 + Win10AU, // Windows 10 Anniversary update + Win10CU // Windows 10 Creators update +}; + +struct WinVersion +{ + eVerShort ver = WinUnsupported; + RTL_OSVERSIONINFOEXW native; +}; + +inline WinVersion& WinVer() +{ + static WinVersion g_WinVer; + return g_WinVer; +} + +inline void InitVersion() +{ + auto& g_WinVer = WinVer(); + g_WinVer.native.dwOSVersionInfoSize = sizeof(g_WinVer.native); + auto RtlGetVersion = (fnRtlGetVersion)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetVersion"); + if (RtlGetVersion) + RtlGetVersion(&g_WinVer.native); + + if (g_WinVer.native.dwMajorVersion != 0) + { + auto fullver = (g_WinVer.native.dwMajorVersion << 8) | g_WinVer.native.dwMinorVersion; + switch (fullver) + { + case _WIN32_WINNT_WIN10: + if (g_WinVer.native.dwBuildNumber >= 15063) + g_WinVer.ver = Win10CU; + else if (g_WinVer.native.dwBuildNumber >= 14393) + g_WinVer.ver = Win10AU; + else if (g_WinVer.native.dwBuildNumber >= 10586) + g_WinVer.ver = Win10; + break; + + case _WIN32_WINNT_WINBLUE: + g_WinVer.ver = Win8Point1; + break; + + case _WIN32_WINNT_WIN8: + g_WinVer.ver = Win8; + break; + + case _WIN32_WINNT_WIN7: + g_WinVer.ver = Win7; + break; + + case _WIN32_WINNT_WINXP: + g_WinVer.ver = WinXP; + break; + + default: + g_WinVer.ver = WinUnsupported; + } + } +} + + +VERSIONHELPERAPI +IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor, DWORD dwBuild) +{ + auto& g_WinVer = WinVer(); + if (g_WinVer.native.dwMajorVersion != 0) + { + if (g_WinVer.native.dwMajorVersion > wMajorVersion) + return true; + else if (g_WinVer.native.dwMajorVersion < wMajorVersion) + return false; + + if (g_WinVer.native.dwMinorVersion > wMinorVersion) + return true; + else if (g_WinVer.native.dwMinorVersion < wMinorVersion) + return false; + + if (g_WinVer.native.wServicePackMajor > wServicePackMajor) + return true; + else if (g_WinVer.native.wServicePackMajor < wServicePackMajor) + return false; + + if (g_WinVer.native.dwBuildNumber >= dwBuild) + return true; + } + + return false; +} + +VERSIONHELPERAPI +IsWindowsXPOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP3OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2, 0); +} + +VERSIONHELPERAPI +IsWindows7OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0, 0); +} + +VERSIONHELPERAPI +IsWindows7SP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1, 0); +} + +VERSIONHELPERAPI +IsWindows8OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0, 0); +} + +VERSIONHELPERAPI +IsWindows8Point1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0, 0); +} + +VERSIONHELPERAPI +IsWindows10OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 0); +} + +VERSIONHELPERAPI +IsWindows10AnniversaryOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 14393); +} + +VERSIONHELPERAPI +IsWindows10CreatorsOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 15063); +} + +VERSIONHELPERAPI +IsWindowsServer() +{ + OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0, 0, VER_NT_WORKSTATION, 0 }; + DWORDLONG const dwlConditionMask = VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL); + + return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); +} + +#endif \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/benchmark.cpp b/Engines/Linux64/mcbrain/src/benchmark.cpp index 807f9de..1b792dd 100644 --- a/Engines/Linux64/mcbrain/src/benchmark.cpp +++ b/Engines/Linux64/mcbrain/src/benchmark.cpp @@ -91,13 +91,13 @@ const vector Defaults = { } // namespace /// setup_bench() builds a list of UCI commands to be run by bench. There -/// are five parameters: TT size in MB, number of search threads that +/// are five parameters: TT size in MiB, number of search threads that /// should be used, the limit value spent for each position, a file name /// where to look for positions in FEN format and the type of the limit: /// depth, perft, nodes and movetime (in millisecs). /// /// bench -> search default positions up to depth 13 -/// bench 64 1 15 -> search default positions up to depth 15 (TT = 64MB) +/// bench 64 1 15 -> search default positions up to depth 15 (TT = 64MiB) /// bench 64 4 5000 current movetime -> search current position with 4 threads for 5 sec /// bench 64 1 100000 default nodes -> search default positions for 100K nodes each /// bench 16 1 5 default perft -> run a perft 5 on default positions diff --git a/Engines/Linux64/mcbrain/src/bitboard.cpp b/Engines/Linux64/mcbrain/src/bitboard.cpp index c3e06b1..0d676a5 100644 --- a/Engines/Linux64/mcbrain/src/bitboard.cpp +++ b/Engines/Linux64/mcbrain/src/bitboard.cpp @@ -44,7 +44,7 @@ Bitboard PawnAttacks[COLOR_NB][SQUARE_NB]; Magic RookMagics[SQUARE_NB]; Magic BishopMagics[SQUARE_NB]; -namespace { +namespace { //Niklas Fiekas Bitboard AttackTable[HasPext ? 107648 : 88772] = { 0 }; @@ -231,7 +231,7 @@ void Bitboards::init() { PopCnt16[i] = (uint8_t) popcount16(i); for (Square s = SQ_A1; s <= SQ_H8; ++s) - SquareBB[s] = make_bitboard(s); + SquareBB[s] = (1ULL << s); for (File f = FILE_A; f <= FILE_H; ++f) FileBB[f] = f > FILE_A ? FileBB[f - 1] << 1 : FileABB; @@ -258,7 +258,7 @@ void Bitboards::init() { if (s1 != s2) { SquareDistance[s1][s2] = std::max(distance(s1, s2), distance(s1, s2)); - DistanceRingBB[s1][SquareDistance[s1][s2] - 1] |= s2; + DistanceRingBB[s1][SquareDistance[s1][s2]] |= s2; } int steps[][5] = { {}, { 7, 9 }, { 6, 10, 15, 17 }, {}, {}, {}, { 1, 7, 8, 9 } }; @@ -279,7 +279,7 @@ void Bitboards::init() { } } - Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST }; + Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST }; Direction BishopDirections[] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }; if (HasPext) @@ -348,8 +348,8 @@ namespace { // init_magics() computes all rook and bishop attacks at startup. Magic // bitboards are used to look up attacks of sliding pieces. As a reference see - // chessprogramming.wikispaces.com/Magic+Bitboards. In particular, we use - // precomputed fixed shift magics. + // chessprogramming.wikispaces.com/Magic+Bitboards. In particular, here we + // use the so called "fancy" approach. template void init_magics(MagicInit init[], Magic magics[], Direction directions[]) { diff --git a/Engines/Linux64/mcbrain/src/bitboard.h b/Engines/Linux64/mcbrain/src/bitboard.h index 0e7cabb..0a3816c 100644 --- a/Engines/Linux64/mcbrain/src/bitboard.h +++ b/Engines/Linux64/mcbrain/src/bitboard.h @@ -153,16 +153,6 @@ inline Bitboard file_bb(Square s) { } -/// make_bitboard() returns a bitboard from a list of squares - -constexpr Bitboard make_bitboard() { return 0; } - -template -constexpr Bitboard make_bitboard(Square s, Squares... squares) { - return (1ULL << s) | make_bitboard(squares...); -} - - /// shift() moves a bitboard one step along direction D (mainly for pawns) template @@ -338,6 +328,7 @@ inline Square msb(Bitboard b) { } #else // MSVC, WIN32 +#include inline Square lsb(Bitboard b) { assert(b); diff --git a/Engines/Linux64/mcbrain/src/book.cpp b/Engines/Linux64/mcbrain/src/book.cpp new file mode 100644 index 0000000..644e010 --- /dev/null +++ b/Engines/Linux64/mcbrain/src/book.cpp @@ -0,0 +1,479 @@ +/* + SugaR, a UCI chess playing engine derived from Stockfish + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad + + SugaR is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SugaR is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + The code in this file is based on the opening book code in PolyGlot + by Fabien Letouzey. PolyGlot is available under the GNU General + Public License, and can be downloaded from http://wbec-ridderkerk.nl + */ + +#include +#include + +#include "book.h" +#include "misc.h" +#include "movegen.h" + +using namespace std; + +namespace { + + // A Polyglot book is a series of "entries" of 16 bytes. All integers are + // stored in big-endian format, with the highest byte first (regardless of + // size). The entries are ordered according to the key in ascending order. + struct Entry { + uint64_t key; + uint16_t move; + uint16_t count; + uint32_t learn; + }; + + // Random numbers from PolyGlot, used to compute book hash keys + const union { + Key PolyGlotRandoms[781]; + struct { + Key psq[12][64]; // [piece][square] + Key castling[4]; // [castling flag] + Key enpassant[8]; // [file] + Key turn; + } Zobrist; + } PG = {{ + 0x9D39247E33776D41ULL, 0x2AF7398005AAA5C7ULL, 0x44DB015024623547ULL, + 0x9C15F73E62A76AE2ULL, 0x75834465489C0C89ULL, 0x3290AC3A203001BFULL, + 0x0FBBAD1F61042279ULL, 0xE83A908FF2FB60CAULL, 0x0D7E765D58755C10ULL, + 0x1A083822CEAFE02DULL, 0x9605D5F0E25EC3B0ULL, 0xD021FF5CD13A2ED5ULL, + 0x40BDF15D4A672E32ULL, 0x011355146FD56395ULL, 0x5DB4832046F3D9E5ULL, + 0x239F8B2D7FF719CCULL, 0x05D1A1AE85B49AA1ULL, 0x679F848F6E8FC971ULL, + 0x7449BBFF801FED0BULL, 0x7D11CDB1C3B7ADF0ULL, 0x82C7709E781EB7CCULL, + 0xF3218F1C9510786CULL, 0x331478F3AF51BBE6ULL, 0x4BB38DE5E7219443ULL, + 0xAA649C6EBCFD50FCULL, 0x8DBD98A352AFD40BULL, 0x87D2074B81D79217ULL, + 0x19F3C751D3E92AE1ULL, 0xB4AB30F062B19ABFULL, 0x7B0500AC42047AC4ULL, + 0xC9452CA81A09D85DULL, 0x24AA6C514DA27500ULL, 0x4C9F34427501B447ULL, + 0x14A68FD73C910841ULL, 0xA71B9B83461CBD93ULL, 0x03488B95B0F1850FULL, + 0x637B2B34FF93C040ULL, 0x09D1BC9A3DD90A94ULL, 0x3575668334A1DD3BULL, + 0x735E2B97A4C45A23ULL, 0x18727070F1BD400BULL, 0x1FCBACD259BF02E7ULL, + 0xD310A7C2CE9B6555ULL, 0xBF983FE0FE5D8244ULL, 0x9F74D14F7454A824ULL, + 0x51EBDC4AB9BA3035ULL, 0x5C82C505DB9AB0FAULL, 0xFCF7FE8A3430B241ULL, + 0x3253A729B9BA3DDEULL, 0x8C74C368081B3075ULL, 0xB9BC6C87167C33E7ULL, + 0x7EF48F2B83024E20ULL, 0x11D505D4C351BD7FULL, 0x6568FCA92C76A243ULL, + 0x4DE0B0F40F32A7B8ULL, 0x96D693460CC37E5DULL, 0x42E240CB63689F2FULL, + 0x6D2BDCDAE2919661ULL, 0x42880B0236E4D951ULL, 0x5F0F4A5898171BB6ULL, + 0x39F890F579F92F88ULL, 0x93C5B5F47356388BULL, 0x63DC359D8D231B78ULL, + 0xEC16CA8AEA98AD76ULL, 0x5355F900C2A82DC7ULL, 0x07FB9F855A997142ULL, + 0x5093417AA8A7ED5EULL, 0x7BCBC38DA25A7F3CULL, 0x19FC8A768CF4B6D4ULL, + 0x637A7780DECFC0D9ULL, 0x8249A47AEE0E41F7ULL, 0x79AD695501E7D1E8ULL, + 0x14ACBAF4777D5776ULL, 0xF145B6BECCDEA195ULL, 0xDABF2AC8201752FCULL, + 0x24C3C94DF9C8D3F6ULL, 0xBB6E2924F03912EAULL, 0x0CE26C0B95C980D9ULL, + 0xA49CD132BFBF7CC4ULL, 0xE99D662AF4243939ULL, 0x27E6AD7891165C3FULL, + 0x8535F040B9744FF1ULL, 0x54B3F4FA5F40D873ULL, 0x72B12C32127FED2BULL, + 0xEE954D3C7B411F47ULL, 0x9A85AC909A24EAA1ULL, 0x70AC4CD9F04F21F5ULL, + 0xF9B89D3E99A075C2ULL, 0x87B3E2B2B5C907B1ULL, 0xA366E5B8C54F48B8ULL, + 0xAE4A9346CC3F7CF2ULL, 0x1920C04D47267BBDULL, 0x87BF02C6B49E2AE9ULL, + 0x092237AC237F3859ULL, 0xFF07F64EF8ED14D0ULL, 0x8DE8DCA9F03CC54EULL, + 0x9C1633264DB49C89ULL, 0xB3F22C3D0B0B38EDULL, 0x390E5FB44D01144BULL, + 0x5BFEA5B4712768E9ULL, 0x1E1032911FA78984ULL, 0x9A74ACB964E78CB3ULL, + 0x4F80F7A035DAFB04ULL, 0x6304D09A0B3738C4ULL, 0x2171E64683023A08ULL, + 0x5B9B63EB9CEFF80CULL, 0x506AACF489889342ULL, 0x1881AFC9A3A701D6ULL, + 0x6503080440750644ULL, 0xDFD395339CDBF4A7ULL, 0xEF927DBCF00C20F2ULL, + 0x7B32F7D1E03680ECULL, 0xB9FD7620E7316243ULL, 0x05A7E8A57DB91B77ULL, + 0xB5889C6E15630A75ULL, 0x4A750A09CE9573F7ULL, 0xCF464CEC899A2F8AULL, + 0xF538639CE705B824ULL, 0x3C79A0FF5580EF7FULL, 0xEDE6C87F8477609DULL, + 0x799E81F05BC93F31ULL, 0x86536B8CF3428A8CULL, 0x97D7374C60087B73ULL, + 0xA246637CFF328532ULL, 0x043FCAE60CC0EBA0ULL, 0x920E449535DD359EULL, + 0x70EB093B15B290CCULL, 0x73A1921916591CBDULL, 0x56436C9FE1A1AA8DULL, + 0xEFAC4B70633B8F81ULL, 0xBB215798D45DF7AFULL, 0x45F20042F24F1768ULL, + 0x930F80F4E8EB7462ULL, 0xFF6712FFCFD75EA1ULL, 0xAE623FD67468AA70ULL, + 0xDD2C5BC84BC8D8FCULL, 0x7EED120D54CF2DD9ULL, 0x22FE545401165F1CULL, + 0xC91800E98FB99929ULL, 0x808BD68E6AC10365ULL, 0xDEC468145B7605F6ULL, + 0x1BEDE3A3AEF53302ULL, 0x43539603D6C55602ULL, 0xAA969B5C691CCB7AULL, + 0xA87832D392EFEE56ULL, 0x65942C7B3C7E11AEULL, 0xDED2D633CAD004F6ULL, + 0x21F08570F420E565ULL, 0xB415938D7DA94E3CULL, 0x91B859E59ECB6350ULL, + 0x10CFF333E0ED804AULL, 0x28AED140BE0BB7DDULL, 0xC5CC1D89724FA456ULL, + 0x5648F680F11A2741ULL, 0x2D255069F0B7DAB3ULL, 0x9BC5A38EF729ABD4ULL, + 0xEF2F054308F6A2BCULL, 0xAF2042F5CC5C2858ULL, 0x480412BAB7F5BE2AULL, + 0xAEF3AF4A563DFE43ULL, 0x19AFE59AE451497FULL, 0x52593803DFF1E840ULL, + 0xF4F076E65F2CE6F0ULL, 0x11379625747D5AF3ULL, 0xBCE5D2248682C115ULL, + 0x9DA4243DE836994FULL, 0x066F70B33FE09017ULL, 0x4DC4DE189B671A1CULL, + 0x51039AB7712457C3ULL, 0xC07A3F80C31FB4B4ULL, 0xB46EE9C5E64A6E7CULL, + 0xB3819A42ABE61C87ULL, 0x21A007933A522A20ULL, 0x2DF16F761598AA4FULL, + 0x763C4A1371B368FDULL, 0xF793C46702E086A0ULL, 0xD7288E012AEB8D31ULL, + 0xDE336A2A4BC1C44BULL, 0x0BF692B38D079F23ULL, 0x2C604A7A177326B3ULL, + 0x4850E73E03EB6064ULL, 0xCFC447F1E53C8E1BULL, 0xB05CA3F564268D99ULL, + 0x9AE182C8BC9474E8ULL, 0xA4FC4BD4FC5558CAULL, 0xE755178D58FC4E76ULL, + 0x69B97DB1A4C03DFEULL, 0xF9B5B7C4ACC67C96ULL, 0xFC6A82D64B8655FBULL, + 0x9C684CB6C4D24417ULL, 0x8EC97D2917456ED0ULL, 0x6703DF9D2924E97EULL, + 0xC547F57E42A7444EULL, 0x78E37644E7CAD29EULL, 0xFE9A44E9362F05FAULL, + 0x08BD35CC38336615ULL, 0x9315E5EB3A129ACEULL, 0x94061B871E04DF75ULL, + 0xDF1D9F9D784BA010ULL, 0x3BBA57B68871B59DULL, 0xD2B7ADEEDED1F73FULL, + 0xF7A255D83BC373F8ULL, 0xD7F4F2448C0CEB81ULL, 0xD95BE88CD210FFA7ULL, + 0x336F52F8FF4728E7ULL, 0xA74049DAC312AC71ULL, 0xA2F61BB6E437FDB5ULL, + 0x4F2A5CB07F6A35B3ULL, 0x87D380BDA5BF7859ULL, 0x16B9F7E06C453A21ULL, + 0x7BA2484C8A0FD54EULL, 0xF3A678CAD9A2E38CULL, 0x39B0BF7DDE437BA2ULL, + 0xFCAF55C1BF8A4424ULL, 0x18FCF680573FA594ULL, 0x4C0563B89F495AC3ULL, + 0x40E087931A00930DULL, 0x8CFFA9412EB642C1ULL, 0x68CA39053261169FULL, + 0x7A1EE967D27579E2ULL, 0x9D1D60E5076F5B6FULL, 0x3810E399B6F65BA2ULL, + 0x32095B6D4AB5F9B1ULL, 0x35CAB62109DD038AULL, 0xA90B24499FCFAFB1ULL, + 0x77A225A07CC2C6BDULL, 0x513E5E634C70E331ULL, 0x4361C0CA3F692F12ULL, + 0xD941ACA44B20A45BULL, 0x528F7C8602C5807BULL, 0x52AB92BEB9613989ULL, + 0x9D1DFA2EFC557F73ULL, 0x722FF175F572C348ULL, 0x1D1260A51107FE97ULL, + 0x7A249A57EC0C9BA2ULL, 0x04208FE9E8F7F2D6ULL, 0x5A110C6058B920A0ULL, + 0x0CD9A497658A5698ULL, 0x56FD23C8F9715A4CULL, 0x284C847B9D887AAEULL, + 0x04FEABFBBDB619CBULL, 0x742E1E651C60BA83ULL, 0x9A9632E65904AD3CULL, + 0x881B82A13B51B9E2ULL, 0x506E6744CD974924ULL, 0xB0183DB56FFC6A79ULL, + 0x0ED9B915C66ED37EULL, 0x5E11E86D5873D484ULL, 0xF678647E3519AC6EULL, + 0x1B85D488D0F20CC5ULL, 0xDAB9FE6525D89021ULL, 0x0D151D86ADB73615ULL, + 0xA865A54EDCC0F019ULL, 0x93C42566AEF98FFBULL, 0x99E7AFEABE000731ULL, + 0x48CBFF086DDF285AULL, 0x7F9B6AF1EBF78BAFULL, 0x58627E1A149BBA21ULL, + 0x2CD16E2ABD791E33ULL, 0xD363EFF5F0977996ULL, 0x0CE2A38C344A6EEDULL, + 0x1A804AADB9CFA741ULL, 0x907F30421D78C5DEULL, 0x501F65EDB3034D07ULL, + 0x37624AE5A48FA6E9ULL, 0x957BAF61700CFF4EULL, 0x3A6C27934E31188AULL, + 0xD49503536ABCA345ULL, 0x088E049589C432E0ULL, 0xF943AEE7FEBF21B8ULL, + 0x6C3B8E3E336139D3ULL, 0x364F6FFA464EE52EULL, 0xD60F6DCEDC314222ULL, + 0x56963B0DCA418FC0ULL, 0x16F50EDF91E513AFULL, 0xEF1955914B609F93ULL, + 0x565601C0364E3228ULL, 0xECB53939887E8175ULL, 0xBAC7A9A18531294BULL, + 0xB344C470397BBA52ULL, 0x65D34954DAF3CEBDULL, 0xB4B81B3FA97511E2ULL, + 0xB422061193D6F6A7ULL, 0x071582401C38434DULL, 0x7A13F18BBEDC4FF5ULL, + 0xBC4097B116C524D2ULL, 0x59B97885E2F2EA28ULL, 0x99170A5DC3115544ULL, + 0x6F423357E7C6A9F9ULL, 0x325928EE6E6F8794ULL, 0xD0E4366228B03343ULL, + 0x565C31F7DE89EA27ULL, 0x30F5611484119414ULL, 0xD873DB391292ED4FULL, + 0x7BD94E1D8E17DEBCULL, 0xC7D9F16864A76E94ULL, 0x947AE053EE56E63CULL, + 0xC8C93882F9475F5FULL, 0x3A9BF55BA91F81CAULL, 0xD9A11FBB3D9808E4ULL, + 0x0FD22063EDC29FCAULL, 0xB3F256D8ACA0B0B9ULL, 0xB03031A8B4516E84ULL, + 0x35DD37D5871448AFULL, 0xE9F6082B05542E4EULL, 0xEBFAFA33D7254B59ULL, + 0x9255ABB50D532280ULL, 0xB9AB4CE57F2D34F3ULL, 0x693501D628297551ULL, + 0xC62C58F97DD949BFULL, 0xCD454F8F19C5126AULL, 0xBBE83F4ECC2BDECBULL, + 0xDC842B7E2819E230ULL, 0xBA89142E007503B8ULL, 0xA3BC941D0A5061CBULL, + 0xE9F6760E32CD8021ULL, 0x09C7E552BC76492FULL, 0x852F54934DA55CC9ULL, + 0x8107FCCF064FCF56ULL, 0x098954D51FFF6580ULL, 0x23B70EDB1955C4BFULL, + 0xC330DE426430F69DULL, 0x4715ED43E8A45C0AULL, 0xA8D7E4DAB780A08DULL, + 0x0572B974F03CE0BBULL, 0xB57D2E985E1419C7ULL, 0xE8D9ECBE2CF3D73FULL, + 0x2FE4B17170E59750ULL, 0x11317BA87905E790ULL, 0x7FBF21EC8A1F45ECULL, + 0x1725CABFCB045B00ULL, 0x964E915CD5E2B207ULL, 0x3E2B8BCBF016D66DULL, + 0xBE7444E39328A0ACULL, 0xF85B2B4FBCDE44B7ULL, 0x49353FEA39BA63B1ULL, + 0x1DD01AAFCD53486AULL, 0x1FCA8A92FD719F85ULL, 0xFC7C95D827357AFAULL, + 0x18A6A990C8B35EBDULL, 0xCCCB7005C6B9C28DULL, 0x3BDBB92C43B17F26ULL, + 0xAA70B5B4F89695A2ULL, 0xE94C39A54A98307FULL, 0xB7A0B174CFF6F36EULL, + 0xD4DBA84729AF48ADULL, 0x2E18BC1AD9704A68ULL, 0x2DE0966DAF2F8B1CULL, + 0xB9C11D5B1E43A07EULL, 0x64972D68DEE33360ULL, 0x94628D38D0C20584ULL, + 0xDBC0D2B6AB90A559ULL, 0xD2733C4335C6A72FULL, 0x7E75D99D94A70F4DULL, + 0x6CED1983376FA72BULL, 0x97FCAACBF030BC24ULL, 0x7B77497B32503B12ULL, + 0x8547EDDFB81CCB94ULL, 0x79999CDFF70902CBULL, 0xCFFE1939438E9B24ULL, + 0x829626E3892D95D7ULL, 0x92FAE24291F2B3F1ULL, 0x63E22C147B9C3403ULL, + 0xC678B6D860284A1CULL, 0x5873888850659AE7ULL, 0x0981DCD296A8736DULL, + 0x9F65789A6509A440ULL, 0x9FF38FED72E9052FULL, 0xE479EE5B9930578CULL, + 0xE7F28ECD2D49EECDULL, 0x56C074A581EA17FEULL, 0x5544F7D774B14AEFULL, + 0x7B3F0195FC6F290FULL, 0x12153635B2C0CF57ULL, 0x7F5126DBBA5E0CA7ULL, + 0x7A76956C3EAFB413ULL, 0x3D5774A11D31AB39ULL, 0x8A1B083821F40CB4ULL, + 0x7B4A38E32537DF62ULL, 0x950113646D1D6E03ULL, 0x4DA8979A0041E8A9ULL, + 0x3BC36E078F7515D7ULL, 0x5D0A12F27AD310D1ULL, 0x7F9D1A2E1EBE1327ULL, + 0xDA3A361B1C5157B1ULL, 0xDCDD7D20903D0C25ULL, 0x36833336D068F707ULL, + 0xCE68341F79893389ULL, 0xAB9090168DD05F34ULL, 0x43954B3252DC25E5ULL, + 0xB438C2B67F98E5E9ULL, 0x10DCD78E3851A492ULL, 0xDBC27AB5447822BFULL, + 0x9B3CDB65F82CA382ULL, 0xB67B7896167B4C84ULL, 0xBFCED1B0048EAC50ULL, + 0xA9119B60369FFEBDULL, 0x1FFF7AC80904BF45ULL, 0xAC12FB171817EEE7ULL, + 0xAF08DA9177DDA93DULL, 0x1B0CAB936E65C744ULL, 0xB559EB1D04E5E932ULL, + 0xC37B45B3F8D6F2BAULL, 0xC3A9DC228CAAC9E9ULL, 0xF3B8B6675A6507FFULL, + 0x9FC477DE4ED681DAULL, 0x67378D8ECCEF96CBULL, 0x6DD856D94D259236ULL, + 0xA319CE15B0B4DB31ULL, 0x073973751F12DD5EULL, 0x8A8E849EB32781A5ULL, + 0xE1925C71285279F5ULL, 0x74C04BF1790C0EFEULL, 0x4DDA48153C94938AULL, + 0x9D266D6A1CC0542CULL, 0x7440FB816508C4FEULL, 0x13328503DF48229FULL, + 0xD6BF7BAEE43CAC40ULL, 0x4838D65F6EF6748FULL, 0x1E152328F3318DEAULL, + 0x8F8419A348F296BFULL, 0x72C8834A5957B511ULL, 0xD7A023A73260B45CULL, + 0x94EBC8ABCFB56DAEULL, 0x9FC10D0F989993E0ULL, 0xDE68A2355B93CAE6ULL, + 0xA44CFE79AE538BBEULL, 0x9D1D84FCCE371425ULL, 0x51D2B1AB2DDFB636ULL, + 0x2FD7E4B9E72CD38CULL, 0x65CA5B96B7552210ULL, 0xDD69A0D8AB3B546DULL, + 0x604D51B25FBF70E2ULL, 0x73AA8A564FB7AC9EULL, 0x1A8C1E992B941148ULL, + 0xAAC40A2703D9BEA0ULL, 0x764DBEAE7FA4F3A6ULL, 0x1E99B96E70A9BE8BULL, + 0x2C5E9DEB57EF4743ULL, 0x3A938FEE32D29981ULL, 0x26E6DB8FFDF5ADFEULL, + 0x469356C504EC9F9DULL, 0xC8763C5B08D1908CULL, 0x3F6C6AF859D80055ULL, + 0x7F7CC39420A3A545ULL, 0x9BFB227EBDF4C5CEULL, 0x89039D79D6FC5C5CULL, + 0x8FE88B57305E2AB6ULL, 0xA09E8C8C35AB96DEULL, 0xFA7E393983325753ULL, + 0xD6B6D0ECC617C699ULL, 0xDFEA21EA9E7557E3ULL, 0xB67C1FA481680AF8ULL, + 0xCA1E3785A9E724E5ULL, 0x1CFC8BED0D681639ULL, 0xD18D8549D140CAEAULL, + 0x4ED0FE7E9DC91335ULL, 0xE4DBF0634473F5D2ULL, 0x1761F93A44D5AEFEULL, + 0x53898E4C3910DA55ULL, 0x734DE8181F6EC39AULL, 0x2680B122BAA28D97ULL, + 0x298AF231C85BAFABULL, 0x7983EED3740847D5ULL, 0x66C1A2A1A60CD889ULL, + 0x9E17E49642A3E4C1ULL, 0xEDB454E7BADC0805ULL, 0x50B704CAB602C329ULL, + 0x4CC317FB9CDDD023ULL, 0x66B4835D9EAFEA22ULL, 0x219B97E26FFC81BDULL, + 0x261E4E4C0A333A9DULL, 0x1FE2CCA76517DB90ULL, 0xD7504DFA8816EDBBULL, + 0xB9571FA04DC089C8ULL, 0x1DDC0325259B27DEULL, 0xCF3F4688801EB9AAULL, + 0xF4F5D05C10CAB243ULL, 0x38B6525C21A42B0EULL, 0x36F60E2BA4FA6800ULL, + 0xEB3593803173E0CEULL, 0x9C4CD6257C5A3603ULL, 0xAF0C317D32ADAA8AULL, + 0x258E5A80C7204C4BULL, 0x8B889D624D44885DULL, 0xF4D14597E660F855ULL, + 0xD4347F66EC8941C3ULL, 0xE699ED85B0DFB40DULL, 0x2472F6207C2D0484ULL, + 0xC2A1E7B5B459AEB5ULL, 0xAB4F6451CC1D45ECULL, 0x63767572AE3D6174ULL, + 0xA59E0BD101731A28ULL, 0x116D0016CB948F09ULL, 0x2CF9C8CA052F6E9FULL, + 0x0B090A7560A968E3ULL, 0xABEEDDB2DDE06FF1ULL, 0x58EFC10B06A2068DULL, + 0xC6E57A78FBD986E0ULL, 0x2EAB8CA63CE802D7ULL, 0x14A195640116F336ULL, + 0x7C0828DD624EC390ULL, 0xD74BBE77E6116AC7ULL, 0x804456AF10F5FB53ULL, + 0xEBE9EA2ADF4321C7ULL, 0x03219A39EE587A30ULL, 0x49787FEF17AF9924ULL, + 0xA1E9300CD8520548ULL, 0x5B45E522E4B1B4EFULL, 0xB49C3B3995091A36ULL, + 0xD4490AD526F14431ULL, 0x12A8F216AF9418C2ULL, 0x001F837CC7350524ULL, + 0x1877B51E57A764D5ULL, 0xA2853B80F17F58EEULL, 0x993E1DE72D36D310ULL, + 0xB3598080CE64A656ULL, 0x252F59CF0D9F04BBULL, 0xD23C8E176D113600ULL, + 0x1BDA0492E7E4586EULL, 0x21E0BD5026C619BFULL, 0x3B097ADAF088F94EULL, + 0x8D14DEDB30BE846EULL, 0xF95CFFA23AF5F6F4ULL, 0x3871700761B3F743ULL, + 0xCA672B91E9E4FA16ULL, 0x64C8E531BFF53B55ULL, 0x241260ED4AD1E87DULL, + 0x106C09B972D2E822ULL, 0x7FBA195410E5CA30ULL, 0x7884D9BC6CB569D8ULL, + 0x0647DFEDCD894A29ULL, 0x63573FF03E224774ULL, 0x4FC8E9560F91B123ULL, + 0x1DB956E450275779ULL, 0xB8D91274B9E9D4FBULL, 0xA2EBEE47E2FBFCE1ULL, + 0xD9F1F30CCD97FB09ULL, 0xEFED53D75FD64E6BULL, 0x2E6D02C36017F67FULL, + 0xA9AA4D20DB084E9BULL, 0xB64BE8D8B25396C1ULL, 0x70CB6AF7C2D5BCF0ULL, + 0x98F076A4F7A2322EULL, 0xBF84470805E69B5FULL, 0x94C3251F06F90CF3ULL, + 0x3E003E616A6591E9ULL, 0xB925A6CD0421AFF3ULL, 0x61BDD1307C66E300ULL, + 0xBF8D5108E27E0D48ULL, 0x240AB57A8B888B20ULL, 0xFC87614BAF287E07ULL, + 0xEF02CDD06FFDB432ULL, 0xA1082C0466DF6C0AULL, 0x8215E577001332C8ULL, + 0xD39BB9C3A48DB6CFULL, 0x2738259634305C14ULL, 0x61CF4F94C97DF93DULL, + 0x1B6BACA2AE4E125BULL, 0x758F450C88572E0BULL, 0x959F587D507A8359ULL, + 0xB063E962E045F54DULL, 0x60E8ED72C0DFF5D1ULL, 0x7B64978555326F9FULL, + 0xFD080D236DA814BAULL, 0x8C90FD9B083F4558ULL, 0x106F72FE81E2C590ULL, + 0x7976033A39F7D952ULL, 0xA4EC0132764CA04BULL, 0x733EA705FAE4FA77ULL, + 0xB4D8F77BC3E56167ULL, 0x9E21F4F903B33FD9ULL, 0x9D765E419FB69F6DULL, + 0xD30C088BA61EA5EFULL, 0x5D94337FBFAF7F5BULL, 0x1A4E4822EB4D7A59ULL, + 0x6FFE73E81B637FB3ULL, 0xDDF957BC36D8B9CAULL, 0x64D0E29EEA8838B3ULL, + 0x08DD9BDFD96B9F63ULL, 0x087E79E5A57D1D13ULL, 0xE328E230E3E2B3FBULL, + 0x1C2559E30F0946BEULL, 0x720BF5F26F4D2EAAULL, 0xB0774D261CC609DBULL, + 0x443F64EC5A371195ULL, 0x4112CF68649A260EULL, 0xD813F2FAB7F5C5CAULL, + 0x660D3257380841EEULL, 0x59AC2C7873F910A3ULL, 0xE846963877671A17ULL, + 0x93B633ABFA3469F8ULL, 0xC0C0F5A60EF4CDCFULL, 0xCAF21ECD4377B28CULL, + 0x57277707199B8175ULL, 0x506C11B9D90E8B1DULL, 0xD83CC2687A19255FULL, + 0x4A29C6465A314CD1ULL, 0xED2DF21216235097ULL, 0xB5635C95FF7296E2ULL, + 0x22AF003AB672E811ULL, 0x52E762596BF68235ULL, 0x9AEBA33AC6ECC6B0ULL, + 0x944F6DE09134DFB6ULL, 0x6C47BEC883A7DE39ULL, 0x6AD047C430A12104ULL, + 0xA5B1CFDBA0AB4067ULL, 0x7C45D833AFF07862ULL, 0x5092EF950A16DA0BULL, + 0x9338E69C052B8E7BULL, 0x455A4B4CFE30E3F5ULL, 0x6B02E63195AD0CF8ULL, + 0x6B17B224BAD6BF27ULL, 0xD1E0CCD25BB9C169ULL, 0xDE0C89A556B9AE70ULL, + 0x50065E535A213CF6ULL, 0x9C1169FA2777B874ULL, 0x78EDEFD694AF1EEDULL, + 0x6DC93D9526A50E68ULL, 0xEE97F453F06791EDULL, 0x32AB0EDB696703D3ULL, + 0x3A6853C7E70757A7ULL, 0x31865CED6120F37DULL, 0x67FEF95D92607890ULL, + 0x1F2B1D1F15F6DC9CULL, 0xB69E38A8965C6B65ULL, 0xAA9119FF184CCCF4ULL, + 0xF43C732873F24C13ULL, 0xFB4A3D794A9A80D2ULL, 0x3550C2321FD6109CULL, + 0x371F77E76BB8417EULL, 0x6BFA9AAE5EC05779ULL, 0xCD04F3FF001A4778ULL, + 0xE3273522064480CAULL, 0x9F91508BFFCFC14AULL, 0x049A7F41061A9E60ULL, + 0xFCB6BE43A9F2FE9BULL, 0x08DE8A1C7797DA9BULL, 0x8F9887E6078735A1ULL, + 0xB5B4071DBFC73A66ULL, 0x230E343DFBA08D33ULL, 0x43ED7F5A0FAE657DULL, + 0x3A88A0FBBCB05C63ULL, 0x21874B8B4D2DBC4FULL, 0x1BDEA12E35F6A8C9ULL, + 0x53C065C6C8E63528ULL, 0xE34A1D250E7A8D6BULL, 0xD6B04D3B7651DD7EULL, + 0x5E90277E7CB39E2DULL, 0x2C046F22062DC67DULL, 0xB10BB459132D0A26ULL, + 0x3FA9DDFB67E2F199ULL, 0x0E09B88E1914F7AFULL, 0x10E8B35AF3EEAB37ULL, + 0x9EEDECA8E272B933ULL, 0xD4C718BC4AE8AE5FULL, 0x81536D601170FC20ULL, + 0x91B534F885818A06ULL, 0xEC8177F83F900978ULL, 0x190E714FADA5156EULL, + 0xB592BF39B0364963ULL, 0x89C350C893AE7DC1ULL, 0xAC042E70F8B383F2ULL, + 0xB49B52E587A1EE60ULL, 0xFB152FE3FF26DA89ULL, 0x3E666E6F69AE2C15ULL, + 0x3B544EBE544C19F9ULL, 0xE805A1E290CF2456ULL, 0x24B33C9D7ED25117ULL, + 0xE74733427B72F0C1ULL, 0x0A804D18B7097475ULL, 0x57E3306D881EDB4FULL, + 0x4AE7D6A36EB5DBCBULL, 0x2D8D5432157064C8ULL, 0xD1E649DE1E7F268BULL, + 0x8A328A1CEDFE552CULL, 0x07A3AEC79624C7DAULL, 0x84547DDC3E203C94ULL, + 0x990A98FD5071D263ULL, 0x1A4FF12616EEFC89ULL, 0xF6F7FD1431714200ULL, + 0x30C05B1BA332F41CULL, 0x8D2636B81555A786ULL, 0x46C9FEB55D120902ULL, + 0xCCEC0A73B49C9921ULL, 0x4E9D2827355FC492ULL, 0x19EBB029435DCB0FULL, + 0x4659D2B743848A2CULL, 0x963EF2C96B33BE31ULL, 0x74F85198B05A2E7DULL, + 0x5A0F544DD2B1FB18ULL, 0x03727073C2E134B1ULL, 0xC7F6AA2DE59AEA61ULL, + 0x352787BAA0D7C22FULL, 0x9853EAB63B5E0B35ULL, 0xABBDCDD7ED5C0860ULL, + 0xCF05DAF5AC8D77B0ULL, 0x49CAD48CEBF4A71EULL, 0x7A4C10EC2158C4A6ULL, + 0xD9E92AA246BF719EULL, 0x13AE978D09FE5557ULL, 0x730499AF921549FFULL, + 0x4E4B705B92903BA4ULL, 0xFF577222C14F0A3AULL, 0x55B6344CF97AAFAEULL, + 0xB862225B055B6960ULL, 0xCAC09AFBDDD2CDB4ULL, 0xDAF8E9829FE96B5FULL, + 0xB5FDFC5D3132C498ULL, 0x310CB380DB6F7503ULL, 0xE87FBB46217A360EULL, + 0x2102AE466EBB1148ULL, 0xF8549E1A3AA5E00DULL, 0x07A69AFDCC42261AULL, + 0xC4C118BFE78FEAAEULL, 0xF9F4892ED96BD438ULL, 0x1AF3DBE25D8F45DAULL, + 0xF5B4B0B0D2DEEEB4ULL, 0x962ACEEFA82E1C84ULL, 0x046E3ECAAF453CE9ULL, + 0xF05D129681949A4CULL, 0x964781CE734B3C84ULL, 0x9C2ED44081CE5FBDULL, + 0x522E23F3925E319EULL, 0x177E00F9FC32F791ULL, 0x2BC60A63A6F3B3F2ULL, + 0x222BBFAE61725606ULL, 0x486289DDCC3D6780ULL, 0x7DC7785B8EFDFC80ULL, + 0x8AF38731C02BA980ULL, 0x1FAB64EA29A2DDF7ULL, 0xE4D9429322CD065AULL, + 0x9DA058C67844F20CULL, 0x24C0E332B70019B0ULL, 0x233003B5A6CFE6ADULL, + 0xD586BD01C5C217F6ULL, 0x5E5637885F29BC2BULL, 0x7EBA726D8C94094BULL, + 0x0A56A5F0BFE39272ULL, 0xD79476A84EE20D06ULL, 0x9E4C1269BAA4BF37ULL, + 0x17EFEE45B0DEE640ULL, 0x1D95B0A5FCF90BC6ULL, 0x93CBE0B699C2585DULL, + 0x65FA4F227A2B6D79ULL, 0xD5F9E858292504D5ULL, 0xC2B5A03F71471A6FULL, + 0x59300222B4561E00ULL, 0xCE2F8642CA0712DCULL, 0x7CA9723FBB2E8988ULL, + 0x2785338347F2BA08ULL, 0xC61BB3A141E50E8CULL, 0x150F361DAB9DEC26ULL, + 0x9F6A419D382595F4ULL, 0x64A53DC924FE7AC9ULL, 0x142DE49FFF7A7C3DULL, + 0x0C335248857FA9E7ULL, 0x0A9C32D5EAE45305ULL, 0xE6C42178C4BBB92EULL, + 0x71F1CE2490D20B07ULL, 0xF1BCC3D275AFE51AULL, 0xE728E8C83C334074ULL, + 0x96FBF83A12884624ULL, 0x81A1549FD6573DA5ULL, 0x5FA7867CAF35E149ULL, + 0x56986E2EF3ED091BULL, 0x917F1DD5F8886C61ULL, 0xD20D8C88C8FFE65FULL, + 0x31D71DCE64B2C310ULL, 0xF165B587DF898190ULL, 0xA57E6339DD2CF3A0ULL, + 0x1EF6E6DBB1961EC9ULL, 0x70CC73D90BC26E24ULL, 0xE21A6B35DF0C3AD7ULL, + 0x003A93D8B2806962ULL, 0x1C99DED33CB890A1ULL, 0xCF3145DE0ADD4289ULL, + 0xD0E4427A5514FB72ULL, 0x77C621CC9FB3A483ULL, 0x67A34DAC4356550BULL, + 0xF8D626AAAF278509ULL + }}; + + // polyglot_key() returns the PolyGlot hash key of the given position + Key polyglot_key(const Position& pos) { + + Key key = 0; + Bitboard b = pos.pieces(); + + while (b) + { + Square s = pop_lsb(&b); + Piece pc = pos.piece_on(s); + + // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11 + key ^= PG.Zobrist.psq[2 * (type_of(pc) - 1) + (color_of(pc) == WHITE)][s]; + } + + b = pos.can_castle(ANY_CASTLING); + + while (b) + key ^= PG.Zobrist.castling[pop_lsb(&b)]; + + if (pos.ep_square() != SQ_NONE) + key ^= PG.Zobrist.enpassant[file_of(pos.ep_square())]; + + if (pos.side_to_move() == WHITE) + key ^= PG.Zobrist.turn; + + return key; + } + +} // namespace + +PolyglotBook::PolyglotBook() : rng(now() % 10000) {} + +PolyglotBook::~PolyglotBook() { if (is_open()) close(); } + + +/// operator>>() reads sizeof(T) chars from the file's binary byte stream and +/// converts them into a number of type T. A Polyglot book stores numbers in +/// big-endian format. + +template PolyglotBook& PolyglotBook::operator>>(T& n) { + + n = 0; + for (size_t i = 0; i < sizeof(T); ++i) + n = T((n << 8) + ifstream::get()); + + return *this; +} + +template<> PolyglotBook& PolyglotBook::operator>>(Entry& e) { + return *this >> e.key >> e.move >> e.count >> e.learn; +} + + +/// open() tries to open a book file with the given name after closing any +/// existing one. + +bool PolyglotBook::open(const char* fName) { + + if (is_open()) // Cannot close an already closed file + close(); + + ifstream::open(fName, ifstream::in | ifstream::binary); + + fileName = is_open() ? fName : ""; + ifstream::clear(); // Reset any error flag to allow a retry ifstream::open() + return !fileName.empty(); +} + + +/// probe() tries to find a book move for the given position. If no move is +/// found, it returns MOVE_NONE. If pickBest is true, then it always returns +/// the highest-rated move, otherwise it randomly chooses one based on the +/// move score. + +Move PolyglotBook::probe(const Position& pos, const string& fName, bool pickBest) { + + if (fileName != fName && !open(fName.c_str())) + return MOVE_NONE; + + Entry e; + uint16_t best = 0; + unsigned sum = 0; + Move move = MOVE_NONE; + Key key = polyglot_key(pos); + + seekg(find_first(key) * sizeof(Entry), ios_base::beg); + + while (*this >> e, e.key == key && good()) + { + best = max(best, e.count); + sum += e.count; + + // Choose book move according to its score. If a move has a very high + // score it has a higher probability of being choosen than a move with + // a lower score. Note that first entry is always chosen. + if ( (!pickBest && sum && rng.rand() % sum < e.count) + || (pickBest && e.count == best)) + move = Move(e.move); + } + + if (!move) + return MOVE_NONE; + + // A PolyGlot book move is encoded as follows: + // + // bit 0- 5: destination square (from 0 to 63) + // bit 6-11: origin square (from 0 to 63) + // bit 12-14: promotion piece (from KNIGHT == 1 to QUEEN == 4) + // + // Castling moves follow the "king captures rook" representation. If a book + // move is a promotion, we have to convert it to our representation and in + // all other cases, we can directly compare with a Move after having masked + // out the special Move flags (bit 14-15) that are not supported by PolyGlot. + int pt = (move >> 12) & 7; + if (pt) + move = make(from_sq(move), to_sq(move), PieceType(pt + 1)); + + // Add 'special move' flags and verify it is legal + for (const auto& m : MoveList(pos)) + if (move == (Move(m) ^ Move(type_of(m)))) + return m; + + return MOVE_NONE; +} + + +/// find_first() takes a book key as input, and does a binary search through +/// the book file for the given key. Returns the index of the leftmost book +/// entry with the same key as the input. + +size_t PolyglotBook::find_first(Key key) { + + seekg(0, ios::end); // Move pointer to end, so tellg() gets file's size + + size_t low = 0, mid, high = (size_t)tellg() / sizeof(Entry) - 1; + Entry e; + + assert(low <= high); + + while (low < high && good()) + { + mid = (low + high) / 2; + + assert(mid >= low && mid < high); + + seekg(mid * sizeof(Entry), ios_base::beg); + *this >> e; + + if (key <= e.key) + high = mid; + else + low = mid + 1; + } + + assert(low == high); + + return low; +} diff --git a/Engines/Linux64/mcbrain/src/book.h b/Engines/Linux64/mcbrain/src/book.h new file mode 100644 index 0000000..c88920f --- /dev/null +++ b/Engines/Linux64/mcbrain/src/book.h @@ -0,0 +1,53 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +/* + The code in this file is based on the opening book code in PolyGlot + by Fabien Letouzey. PolyGlot is available under the GNU General + Public License, and can be downloaded from http://wbec-ridderkerk.nl + */ + +#ifndef BOOK_H_INCLUDED +#define BOOK_H_INCLUDED + +#include +#include + +#include "misc.h" +#include "position.h" + +class PolyglotBook : private std::ifstream { +public: + PolyglotBook(); + ~PolyglotBook(); + Move probe(const Position& pos, const std::string& fName, bool pickBest); + +private: + template PolyglotBook& operator>>(T& n); + + bool open(const char* fName); + size_t find_first(Key key); + + PRNG rng; + std::string fileName; +}; + +#endif // #ifndef BOOK_H_INCLUDED diff --git a/Engines/Linux64/mcbrain/src/endgame.cpp b/Engines/Linux64/mcbrain/src/endgame.cpp index 86210af..3455e79 100644 --- a/Engines/Linux64/mcbrain/src/endgame.cpp +++ b/Engines/Linux64/mcbrain/src/endgame.cpp @@ -87,30 +87,6 @@ namespace { } // namespace -/// Endgames members definitions - -Endgames::Endgames() { - - add("KPK"); - add("KNNK"); - add("KBNK"); - add("KRKP"); - add("KRKB"); - add("KRKN"); - add("KQKP"); - add("KQKR"); - - add("KNPK"); - add("KNPKB"); - add("KRPKR"); - add("KRPKB"); - add("KBPKB"); - add("KBPKN"); - add("KBPPKB"); - add("KRPPKRP"); -} - - /// Mate with KX vs K. This function is used to evaluate positions with /// king and plenty of material vs a lone king. It simply gives the /// attacking side a bonus for driving the defending king towards the edge @@ -144,6 +120,28 @@ Value Endgame::operator()(const Position& pos) const { } +/// Mate with KQX vs KX. This is similar to KX vs K. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(pos.non_pawn_material(strongSide) > QueenValueMg + RookValueMg); + assert(pos.non_pawn_material(weakSide) <= RookValueMg); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + + Value result = VALUE_KNOWN_WIN + + pos.non_pawn_material(strongSide) + - pos.non_pawn_material(weakSide) + + PushClose[distance(winnerKSq, loserKSq)] + + PushToCorners[loserKSq]; + + result = std::min(result, VALUE_MATE_IN_MAX_PLY - 1); + + return strongSide == pos.side_to_move() ? result : -result; +} + + /// Mate with KBN vs K. This is similar to KX vs K, but we have to drive the /// defending king towards a corner square of the right color. template<> @@ -215,7 +213,7 @@ Value Endgame::operator()(const Position& pos) const { Value result; // If the stronger side's king is in front of the pawn, it's a win - if (wksq < psq && file_of(wksq) == file_of(psq)) + if (forward_file_bb(WHITE, wksq) & psq) result = RookValueEg - distance(wksq, psq); // If the weaker side's king is too far from the pawn and the rook, diff --git a/Engines/Linux64/mcbrain/src/endgame.h b/Engines/Linux64/mcbrain/src/endgame.h index eec1490..58338cc 100644 --- a/Engines/Linux64/mcbrain/src/endgame.h +++ b/Engines/Linux64/mcbrain/src/endgame.h @@ -39,6 +39,7 @@ enum EndgameCode { EVALUATION_FUNCTIONS, KNNK, // KNN vs K KXK, // Generic "mate lone king" eval + KQXKX, // Big material advantage eval KBNK, // KBN vs K KPK, // KP vs K KRKP, // KR vs KP @@ -65,6 +66,7 @@ enum EndgameCode { /// Endgame functions can be of two types depending on whether they return a /// Value or a ScaleFactor. + template using eg_type = typename std::conditional<(E < SCALING_FUNCTIONS), Value, ScaleFactor>::type; @@ -104,21 +106,40 @@ class Endgames { return std::get::value>(maps); } - template, typename P = Ptr> + template> void add(const std::string& code) { StateInfo st; - map()[Position().set(code, WHITE, &st).material_key()] = P(new Endgame(WHITE)); - map()[Position().set(code, BLACK, &st).material_key()] = P(new Endgame(BLACK)); + map()[Position().set(code, WHITE, &st).material_key()] = Ptr(new Endgame(WHITE)); + map()[Position().set(code, BLACK, &st).material_key()] = Ptr(new Endgame(BLACK)); } std::pair, Map> maps; public: - Endgames(); + Endgames() { + + add("KPK"); + add("KNNK"); + add("KBNK"); + add("KRKP"); + add("KRKB"); + add("KRKN"); + add("KQKP"); + add("KQKR"); + + add("KNPK"); + add("KNPKB"); + add("KRPKR"); + add("KRPKB"); + add("KBPKB"); + add("KBPKN"); + add("KBPPKB"); + add("KRPPKRP"); + } template - EndgameBase* probe(Key key) { + const EndgameBase* probe(Key key) { return map().count(key) ? map()[key].get() : nullptr; } }; diff --git a/Engines/Linux64/mcbrain/src/evaluate.cpp b/Engines/Linux64/mcbrain/src/evaluate.cpp index 6843268..0aa95e1 100644 --- a/Engines/Linux64/mcbrain/src/evaluate.cpp +++ b/Engines/Linux64/mcbrain/src/evaluate.cpp @@ -24,19 +24,27 @@ #include // For std::memset #include #include +#include #include "bitboard.h" #include "evaluate.h" #include "material.h" #include "pawns.h" #include "thread.h" +#include "uci.h" + +//#define PAWN_SCORES namespace Trace { enum Tracing { NO_TRACE, TRACE }; enum Term { // The first 8 entries are reserved for PieceType - MATERIAL = 8, IMBALANCE, MOBILITY, THREAT, PASSED, SPACE, INITIATIVE, TOTAL, TERM_NB + MATERIAL = 8, IMBALANCE, MOBILITY, THREAT, PASSED, SPACE, +#ifdef PAWN_SCORES + CENTER, +#endif + INITIATIVE, TOTAL, TERM_NB }; Score scores[TERM_NB][COLOR_NB]; @@ -80,9 +88,9 @@ namespace { constexpr Bitboard Center = (FileDBB | FileEBB) & (Rank4BB | Rank5BB); constexpr Bitboard KingFlank[FILE_NB] = { - QueenSide, QueenSide, QueenSide, + QueenSide ^ FileDBB, QueenSide, QueenSide, CenterFiles, CenterFiles, - KingSide, KingSide, KingSide + KingSide, KingSide, KingSide ^ FileEBB }; // Threshold for lazy and space evaluation @@ -90,7 +98,7 @@ namespace { constexpr Value SpaceThreshold = Value(12222); // KingAttackWeights[PieceType] contains king attack weights by piece type - constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 78, 56, 45, 11 }; + constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10 }; // Penalties for enemy's safe checks constexpr int QueenSafeCheck = 780; @@ -141,47 +149,81 @@ namespace { S(0, 0), S(0, 24), S(38, 71), S(38, 61), S(0, 38), S(36, 38) }; - // ThreatByKing[on one/on many] contains bonuses for king attacks on - // pawns or pieces which are not pawn-defended. - constexpr Score ThreatByKing[] = { S(3, 65), S(9, 145) }; - // PassedRank[Rank] contains a bonus according to the rank of a passed pawn constexpr Score PassedRank[RANK_NB] = { - S(0, 0), S(5, 7), S(5, 13), S(32, 42), S(70, 70), S(172, 170), S(217, 269) + S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 62), S(163, 167), S(271, 250) }; // PassedFile[File] contains a bonus according to the file of a passed pawn constexpr Score PassedFile[FILE_NB] = { - S( 9, 10), S(2, 10), S(1, -8), S(-20,-12), - S(-20,-12), S(1, -8), S(2, 10), S( 9, 10) + S( -1, 7), S( 0, 9), S(-9, -8), S(-30,-14), + S(-30,-14), S(-9, -8), S( 0, 9), S( -1, 7) }; // PassedDanger[Rank] contains a term to weight the passed score - constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 2, 7, 12, 19 }; + constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 }; + + // Knight Scores Board + constexpr Score KnightScoresBoard[RANK_NB][FILE_NB] = { + { S(-25, -25), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-25, -25) }, + { S(-15, -15), S(- 5, - 5), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(- 5, - 5), S(-15, -15) }, + { S(-10, -10), S(+ 0, + 0), S(+10, +10), S(+10, +10), S(+10, +10), S(+10, +10), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+10, +10), S(+25, +25), S(+25, +25), S(+10, +10), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+20, +20), S(+30, +30), S(+30, +30), S(+20, +20), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+15, +15), S(+20, +20), S(+20, +20), S(+15, +15), S(+ 0, + 0), S(-10, -10) }, + { S(-15, -15), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(-15, -15) }, + { S(-20, -20), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(-20, -20) }, + }; + // Pawn for Knight Scores advantage compensation + constexpr Score PawnScores = S(+ 4, + 6); + // Bishop for Knight Scores advantage compensation + constexpr Score BishopScores = S(+10, +5); + // Rook for Knight Scores advantage compensation + constexpr Score RookScores = S(+15, +30); + // Queen for Knight Scores advantage compensation + constexpr Score QueenScores = S(+20, +60); + + // Pawns Shelter for Knight Scores advantage compensation + constexpr Score PawnShelterCompensationKnightScores = S(+ 10, + 0); // Exact numbers to be determined + +#ifdef PAWN_SCORES + // Pawn Scores Board + constexpr Score PawnScoresBoard[RANK_NB][FILE_NB] = { + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 8, + 0), S(+ 8, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+10, + 0), S(+10, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 6, + 0), S(+ 6, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + }; - // KingProtector[PieceType-2] contains a penalty according to distance from king - constexpr Score KingProtector[] = { S(3, 5), S(4, 3), S(3, 0), S(1, -1) }; + // Undeveloped Piece Penalty + constexpr Score UndevelopedPiecePenalty = S(-20,-10); +#endif // Assorted bonuses and penalties - constexpr Score BishopPawns = S( 3, 5); - constexpr Score CloseEnemies = S( 7, 0); - constexpr Score Connectivity = S( 3, 1); + constexpr Score BishopPawns = S( 3, 7); + constexpr Score CloseEnemies = S( 6, 0); constexpr Score CorneredBishop = S( 50, 50); - constexpr Score Hanging = S( 52, 30); - constexpr Score HinderPassedPawn = S( 8, 1); + constexpr Score Hanging = S( 57, 32); + constexpr Score HinderPassedPawn = S( 8, 0); + constexpr Score KingProtector = S( 6, 6); constexpr Score KnightOnQueen = S( 21, 11); - constexpr Score LongDiagonalBishop = S( 22, 0); + constexpr Score LongDiagonalBishop = S( 46, 0); constexpr Score MinorBehindPawn = S( 16, 0); - constexpr Score Overload = S( 10, 5); - constexpr Score PawnlessFlank = S( 20, 80); - constexpr Score RookOnPawn = S( 8, 24); + constexpr Score Overload = S( 13, 6); + constexpr Score PawnlessFlank = S( 19, 84); + constexpr Score RookOnPawn = S( 10, 30); constexpr Score SliderOnQueen = S( 42, 21); - constexpr Score ThreatByPawnPush = S( 47, 26); + constexpr Score ThreatByKing = S( 23, 76); + constexpr Score ThreatByPawnPush = S( 45, 40); constexpr Score ThreatByRank = S( 16, 3); - constexpr Score ThreatBySafePawn = S(175,168); + constexpr Score ThreatBySafePawn = S(173,102); constexpr Score TrappedRook = S( 92, 0); constexpr Score WeakQueen = S( 50, 10); - constexpr Score WeakUnopposedPawn = S( 5, 25); + constexpr Score WeakUnopposedPawn = S( 5, 29); #undef S @@ -202,6 +244,9 @@ namespace { template Score threats() const; template Score passed() const; template Score space() const; +#ifdef PAWN_SCORES + template Score pawn_center() const; +#endif ScaleFactor scale_factor(Value eg) const; Score initiative(Value eg) const; @@ -282,7 +327,7 @@ namespace { else if (file_of(pos.square(Us)) == FILE_A) kingRing[Us] |= shift(kingRing[Us]); - kingAttackersCount[Them] = popcount(attackedBy[Us][KING] & pe->pawn_attacks(Them)); + kingAttackersCount[Them] = popcount(kingRing[Us] & pe->pawn_attacks(Them)); kingAttacksCount[Them] = kingAttackersWeight[Them] = 0; } else @@ -331,9 +376,6 @@ namespace { mobility[Us] += MobilityBonus[Pt - 2][mob]; - // Penalty if the piece is far from the king - score -= KingProtector[Pt - 2] * distance(s, pos.square(Us)); - if (Pt == BISHOP || Pt == KNIGHT) { // Bonus if piece is on an outpost square or can reach one @@ -344,11 +386,13 @@ namespace { else if (bb &= b & ~pos.pieces(Us)) score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & bb)]; - // Bonus when behind a pawn - if ( relative_rank(Us, s) < RANK_5 - && (pos.pieces(PAWN) & (s + pawn_push(Us)))) + // Knight and Bishop bonus for being right behind a pawn + if (shift(pos.pieces(PAWN)) & s) score += MinorBehindPawn; + // Penalty if the piece is far from the king + score -= KingProtector * distance(s, pos.square(Us)); + if (Pt == BISHOP) { // Penalty according to number of pawns on the same color square as the @@ -359,8 +403,13 @@ namespace { * (1 + popcount(blocked & CenterFiles)); // Bonus for bishop on a long diagonal which can "see" both center squares - if (more_than_one(Center & (attacks_bb(s, pos.pieces(PAWN)) | s))) + if (more_than_one(attacks_bb(s, pos.pieces(PAWN)) & Center)) score += LongDiagonalBishop; + + if (pos.piece_on(s) == make_piece(Us, BISHOP)) + { + score += BishopScores; + } } // An important Chess960 pattern: A cornered bishop blocked by a friendly @@ -376,6 +425,30 @@ namespace { : pos.piece_on(s + d + d) == make_piece(Us, PAWN) ? CorneredBishop * 2 : CorneredBishop; } + + if (Pt == KNIGHT) + { + if (pos.piece_on(s) == make_piece(Us, KNIGHT)) + { + int rank = rank_of(s); + int file = file_of(s); + if (Us == WHITE) + { + score += KnightScoresBoard[rank][file]; + } + else + { + if (Us == BLACK) + { + score += KnightScoresBoard[RANK_NB - 1 -rank][file]; + } + else + { + assert(false); + } + } + } + } } if (Pt == ROOK) @@ -395,6 +468,11 @@ namespace { if ((kf < FILE_E) == (file_of(s) < kf)) score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us)); } + + if (pos.piece_on(s) == make_piece(Us, ROOK)) + { + score += RookScores; + } } if (Pt == QUEEN) @@ -403,6 +481,11 @@ namespace { Bitboard queenPinners; if (pos.slider_blockers(pos.pieces(Them, ROOK, BISHOP), s, queenPinners)) score -= WeakQueen; + + if (pos.piece_on(s) == make_piece(Us, QUEEN)) + { + score += QueenScores; + } } } if (T) @@ -421,11 +504,19 @@ namespace { : AllSquares ^ Rank1BB ^ Rank2BB ^ Rank3BB); const Square ksq = pos.square(Us); - Bitboard weak, b, b1, b2, safe, unsafeChecks, pinned; + Bitboard kingFlank, weak, b, b1, b2, safe, unsafeChecks; // King shelter and enemy pawns storm Score score = pe->king_safety(pos, ksq); + // Find the squares that opponent attacks in our king flank, and the squares + // which are attacked twice in that flank but not defended by our pawns. + kingFlank = KingFlank[file_of(ksq)]; + b1 = attackedBy[Them][ALL_PIECES] & kingFlank & Camp; + b2 = b1 & attackedBy2[Them] & ~attackedBy[Us][PAWN]; + + int tropism = popcount(b1) + popcount(b2); + // Main king safety evaluation if (kingAttackersCount[Them] > 1 - pos.count(Them)) { @@ -473,38 +564,45 @@ namespace { // Unsafe or occupied checking squares will also be considered, as long as // the square is in the attacker's mobility area. unsafeChecks &= mobilityArea[Them]; - pinned = pos.blockers_for_king(Us) & pos.pieces(Us); kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them] - + 102 * kingAttacksCount[Them] - + 191 * popcount(kingRing[Us] & weak) - + 143 * popcount(pinned | unsafeChecks) - - 848 * !pos.count(Them) - - 9 * mg_value(score) / 8 - + 40; + + 69 * kingAttacksCount[Them] + + 185 * popcount(kingRing[Us] & weak) + + 129 * popcount(pos.blockers_for_king(Us) | unsafeChecks) + + 4 * tropism + - 873 * !pos.count(Them) + - 6 * mg_value(score) / 8 + - 30; // Transform the kingDanger units into a Score, and subtract it from the evaluation if (kingDanger > 0) { int mobilityDanger = mg_value(mobility[Them] - mobility[Us]); kingDanger = std::max(0, kingDanger + mobilityDanger); - score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); +#ifdef Maverick + score -= make_score(kingDanger * kingDanger / 3584, kingDanger / 14); +#else + score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); +#endif } } - Bitboard kf = KingFlank[file_of(ksq)]; - // Penalty when our king is on a pawnless flank - if (!(pos.pieces(PAWN) & kf)) + if (!(pos.pieces(PAWN) & kingFlank)) + { score -= PawnlessFlank; + + const Square* pl = pos.squares(Us); + Square s; + + while ((s = *pl++) != SQ_NONE) + { + score += PawnShelterCompensationKnightScores; + } + } - // Find the squares that opponent attacks in our king flank, and the squares - // which are attacked twice in that flank but not defended by our pawns. - b1 = attackedBy[Them][ALL_PIECES] & kf & Camp; - b2 = b1 & attackedBy2[Them] & ~attackedBy[Us][PAWN]; - - // King tropism, to anticipate slow motion attacks on our king - score -= CloseEnemies * (popcount(b1) + popcount(b2)); + // King tropism bonus, to anticipate slow motion attacks on our king + score -= CloseEnemies * tropism; if (T) Trace::add(KING, Us, score); @@ -522,7 +620,7 @@ namespace { constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB); - Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safeThreats; + Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe; Score score = SCORE_ZERO; // Non-pawn enemies @@ -539,6 +637,9 @@ namespace { // Enemies not strongly protected and under our attack weak = pos.pieces(Them) & ~stronglyProtected & attackedBy[Us][ALL_PIECES]; + // Safe or protected squares + safe = ~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]; + // Bonus according to the kind of attacking pieces if (defended | weak) { @@ -549,27 +650,29 @@ namespace { score += ThreatByMinor[type_of(pos.piece_on(s))]; if (type_of(pos.piece_on(s)) != PAWN) score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; } - b = (pos.pieces(Them, QUEEN) | weak) & attackedBy[Us][ROOK]; + b = weak & attackedBy[Us][ROOK]; while (b) { Square s = pop_lsb(&b); score += ThreatByRook[type_of(pos.piece_on(s))]; if (type_of(pos.piece_on(s)) != PAWN) score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; } - b = weak & attackedBy[Us][KING]; - if (b) - score += ThreatByKing[more_than_one(b)]; + if (weak & attackedBy[Us][KING]) + score += ThreatByKing; score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]); - // Bonus for overload (non-pawn enemies attacked and defended exactly once) - b = nonPawnEnemies - & attackedBy[Us][ALL_PIECES] & ~attackedBy2[Us] - & attackedBy[Them][ALL_PIECES] & ~attackedBy2[Them]; + b = weak & nonPawnEnemies & attackedBy[Them][ALL_PIECES]; score += Overload * popcount(b); } @@ -577,48 +680,39 @@ namespace { if (pos.pieces(Us, ROOK, QUEEN)) score += WeakUnopposedPawn * pe->weak_unopposed(Them); - // Our safe or protected pawns - b = pos.pieces(Us, PAWN) - & (~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]); - - safeThreats = pawn_attacks_bb(b) & nonPawnEnemies; - score += ThreatBySafePawn * popcount(safeThreats); - // Find squares where our pawns can push on the next move b = shift(pos.pieces(Us, PAWN)) & ~pos.pieces(); b |= shift(b & TRank3BB) & ~pos.pieces(); - // Keep only the squares which are not completely unsafe - b &= ~attackedBy[Them][PAWN] - & (attackedBy[Us][ALL_PIECES] | ~attackedBy[Them][ALL_PIECES]); + // Keep only the squares which are relatively safe + b &= ~attackedBy[Them][PAWN] & safe; // Bonus for safe pawn threats on the next move - b = pawn_attacks_bb(b) - & pos.pieces(Them) - & ~attackedBy[Us][PAWN]; - + b = pawn_attacks_bb(b) & pos.pieces(Them); score += ThreatByPawnPush * popcount(b); + // Our safe or protected pawns + b = pos.pieces(Us, PAWN) & safe; + + b = pawn_attacks_bb(b) & nonPawnEnemies; + score += ThreatBySafePawn * popcount(b); + // Bonus for threats on the next moves against enemy queen if (pos.count(Them) == 1) { Square s = pos.square(Them); - safeThreats = mobilityArea[Us] & ~stronglyProtected; + safe = mobilityArea[Us] & ~stronglyProtected; b = attackedBy[Us][KNIGHT] & pos.attacks_from(s); - score += KnightOnQueen * popcount(b & safeThreats); + score += KnightOnQueen * popcount(b & safe); b = (attackedBy[Us][BISHOP] & pos.attacks_from(s)) | (attackedBy[Us][ROOK ] & pos.attacks_from(s)); - score += SliderOnQueen * popcount(b & safeThreats & attackedBy2[Us]); + score += SliderOnQueen * popcount(b & safe & attackedBy2[Us]); } - // Connectivity: ensure that knights, bishops, rooks, and queens are protected - b = (pos.pieces(Us) ^ pos.pieces(Us, PAWN, KING)) & attackedBy[Us][ALL_PIECES]; - score += Connectivity * popcount(b); - if (T) Trace::add(THREAT, Us, score); @@ -649,8 +743,8 @@ namespace { assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up))); - bb = forward_file_bb(Us, s) & (attackedBy[Them][ALL_PIECES] | pos.pieces(Them)); - score -= HinderPassedPawn * popcount(bb); + if (forward_file_bb(Us, s) & pos.pieces(Them)) + score -= HinderPassedPawn; int r = relative_rank(Us, s); int w = PassedDanger[r]; @@ -719,6 +813,63 @@ namespace { } +#ifdef PAWN_SCORES + // Pawn Center evaluation + + template template + Score Evaluation::pawn_center() const { + + //constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + + const Square* pl = pos.squares(Us); + + Square s; + Score score = SCORE_ZERO; + + while ((s = *pl++) != SQ_NONE) + { + if (pos.piece_on(s) == make_piece(Us, PAWN)) + { + int rank = rank_of(s); + int file = file_of(s); + if (Us == WHITE) + { + score += PawnScoresBoard[rank][file]; + } + else + { + if (Us == BLACK) + { + score += PawnScoresBoard[RANK_NB - 1 - rank][file]; + } + else + { + assert(false); + } + } + } + } + + // Evaluation of development + + const Square* pld = pos.squares(Us); + + while ((s = *pld++) != SQ_NONE) + { + if (relative_rank(Us, s) == RANK_1) + { + score += UndevelopedPiecePenalty; + } + } + + if (T) + Trace::add(CENTER, Us, score); + + return score; + } +#endif + + // Evaluation::space() computes the space evaluation for a given side. The // space evaluation is a simple bonus based on the number of safe squares // available for minor pieces on the central four files on ranks 2--4. Safe @@ -729,14 +880,14 @@ namespace { template template Score Evaluation::space() const { + if (pos.non_pawn_material() < SpaceThreshold) + return SCORE_ZERO; + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); constexpr Bitboard SpaceMask = Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB) : CenterFiles & (Rank7BB | Rank6BB | Rank5BB); - if (pos.non_pawn_material() < SpaceThreshold) - return SCORE_ZERO; - // Find the available squares for our pieces inside the area defined by SpaceMask Bitboard safe = SpaceMask & ~pos.pieces(Us, PAWN) @@ -769,17 +920,26 @@ namespace { int outflanking = distance(pos.square(WHITE), pos.square(BLACK)) - distance(pos.square(WHITE), pos.square(BLACK)); - bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide) - && (pos.pieces(PAWN) & KingSide); - + bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide) + && (pos.pieces(PAWN) & KingSide); + +#ifdef Maverick + // Compute the initiative bonus for the attacking side + int complexity = 8 * pe->pawn_asymmetry() + + 12 * pos.count() + + 12 * outflanking + + 32 * pawnsOnBothFlanks + + 48 * !pos.non_pawn_material() + - 132; +#else // Compute the initiative bonus for the attacking side - int complexity = 8 * outflanking - + 8 * pe->pawn_asymmetry() + int complexity = 8 * pe->pawn_asymmetry() + 12 * pos.count() - + 16 * pawnsOnBothFlanks + + 12 * outflanking + + 16 * pawnsOnBothFlanks + 48 * !pos.non_pawn_material() - -136 ; - + - 116; +#endif // Now apply the bonus: note that we find the attacking side by extracting // the sign of the endgame value, and that we carefully cap the bonus so // that the endgame score will never change sign after the bonus. @@ -803,20 +963,12 @@ namespace { // If scale is not already specific, scale down the endgame via general heuristics if (sf == SCALE_FACTOR_NORMAL) { - if (pos.opposite_bishops()) - { - // Endgame with opposite-colored bishops and no other pieces is almost a draw - if ( pos.non_pawn_material(WHITE) == BishopValueMg - && pos.non_pawn_material(BLACK) == BishopValueMg) - sf = 31; - - // Endgame with opposite-colored bishops, but also other pieces. Still - // a bit drawish, but not as drawish as with only the two bishops. - else - sf = 46; - } + if ( pos.opposite_bishops() + && pos.non_pawn_material(WHITE) == BishopValueMg + && pos.non_pawn_material(BLACK) == BishopValueMg) + sf = 31; else - sf = std::min(40 + 7 * pos.count(strongSide), sf); + sf = std::min(40 + (pos.opposite_bishops() ? 2 : 7) * pos.count(strongSide), sf); } return ScaleFactor(sf); @@ -849,6 +1001,8 @@ namespace { pe = Pawns::probe(pos); score += pe->pawn_score(WHITE) - pe->pawn_score(BLACK); + score += PawnScores * pos.count(WHITE) - PawnScores * pos.count(BLACK); + // Early exit if score is high Value v = (mg_value(score) + eg_value(score)) / 2; if (abs(v) > LazyThreshold) @@ -865,14 +1019,45 @@ namespace { + pieces() - pieces() + pieces() - pieces(); - score += mobility[WHITE] - mobility[BLACK]; - - score += king< WHITE>() - king< BLACK>() - + threats() - threats() - + passed< WHITE>() - passed< BLACK>() - + space< WHITE>() - space< BLACK>(); - - score += initiative(eg_value(score)); + Value v_Dynamic_test = v; + + constexpr double DYNAMIC_ADVANTAGE_PAWNS_COUNT = 1.0; + constexpr Value DYNAMIC_ADVANTAGE_VALUE = Value(int(DYNAMIC_ADVANTAGE_PAWNS_COUNT * double(PawnValueMg + PawnValueEg) / 2.0)); + constexpr double Dynamic_Scale_Factor_Default = 1.0; + + double king_Dynamic_scale = Dynamic_Scale_Factor_Default; + double passed_Dynamic_scale = Dynamic_Scale_Factor_Default; + + constexpr double Dynamic_Winning_Scale_Factor_Default = 0.05; + constexpr double Alpha = 0.5; + const double Beta = fabs(Dynamic_Winning_Scale_Factor_Default * 2 / (MidgameLimit + EndgameLimit)); + + const double Dynamic_Scale_Factor_Bonus = (-abs(v_Dynamic_test / DYNAMIC_ADVANTAGE_VALUE) + Alpha); + + if (abs(v_Dynamic_test) >= double(PawnValueMg + PawnValueEg) / 2.0) + { + king_Dynamic_scale = Dynamic_Scale_Factor_Default - Dynamic_Scale_Factor_Bonus * Beta; + } + else + { + passed_Dynamic_scale = Dynamic_Scale_Factor_Default + Dynamic_Scale_Factor_Bonus * Beta; + } + + score += mobility[WHITE] - mobility[BLACK]; + Score default_king = king< WHITE>() - king< BLACK>(); + Score score_king = Score(int(double(default_king) * king_Dynamic_scale)); + score += score_king; + score += threats() - threats(); + Score default_passed = passed< WHITE>() - passed< BLACK>(); + Score score_passed = Score(int(double(default_passed) * passed_Dynamic_scale)); + score += score_passed; + score += space< WHITE>() - space< BLACK>(); + score += initiative(eg_value(score)); + + +#ifdef PAWN_SCORES + score += pawn_center() - pawn_center(); +#endif // Interpolate between a middlegame and a (scaled by 'sf') endgame score ScaleFactor sf = scale_factor(eg_value(score)); @@ -929,6 +1114,9 @@ std::string Eval::trace(const Position& pos) { << " Imbalance | " << Term(IMBALANCE) << " Initiative | " << Term(INITIATIVE) << " Pawns | " << Term(PAWN) +#ifdef PAWN_SCORES + << " Pawns Bonus | " << Term(CENTER) +#endif << " Knights | " << Term(KNIGHT) << " Bishops | " << Term(BISHOP) << " Rooks | " << Term(ROOK) diff --git a/Engines/Linux64/mcbrain/src/evaluate.h b/Engines/Linux64/mcbrain/src/evaluate.h index 5008072..976ccec 100644 --- a/Engines/Linux64/mcbrain/src/evaluate.h +++ b/Engines/Linux64/mcbrain/src/evaluate.h @@ -22,7 +22,6 @@ #ifndef EVALUATE_H_INCLUDED #define EVALUATE_H_INCLUDED -#include #include #include "types.h" diff --git a/Engines/Linux64/mcbrain/src/main.cpp b/Engines/Linux64/mcbrain/src/main.cpp index ee0ebe5..e62f857 100644 --- a/Engines/Linux64/mcbrain/src/main.cpp +++ b/Engines/Linux64/mcbrain/src/main.cpp @@ -20,6 +20,12 @@ */ #include +#include +#include +#include +#include +#include +#include #include "bitboard.h" #include "position.h" @@ -36,18 +42,51 @@ namespace PSQT { int main(int argc, char* argv[]) { - std::cout << engine_info() << std::endl; + { +#ifdef _WIN32 + const size_t time_length_const = 100; + char time_local[time_length_const]; + memset(time_local, char(0), time_length_const); + time_t result = time(NULL); + tm tm_local; + errno_t errno_local = localtime_s(&tm_local, &result); + if (errno_local == 0) + { + errno_local = asctime_s(time_local, time_length_const, &tm_local); + if (errno_local == 0) + { + std::cout << time_local; + } + else + { + assert(errno_local != 0); + } + } + else + { + assert(errno_local != 0); + } +#else + std::time_t result = std::time(NULL); + std::cout << std::asctime(std::localtime(&result)); +#endif + } + + std::cout << hardware_info() << std::endl; + std::cout << system_info() << std::endl; + std::cout << engine_info() << std::endl; + std::cout << cores_info() << std::endl; UCI::init(Options); PSQT::init(); Bitboards::init(); Position::init(); Bitbases::init(); - Search::init(); + + Search::init(Options["Clear Search"]); Pawns::init(); polybook.init(Options["BookFile"]); Tablebases::init(Options["SyzygyPath"]); // After Bitboards are set - TT.resize(Options["Hash"]); Threads.set(Options["Threads"]); Search::clear(); // After threads are up diff --git a/Engines/Linux64/mcbrain/src/material.cpp b/Engines/Linux64/mcbrain/src/material.cpp index c5fb9d7..760d671 100644 --- a/Engines/Linux64/mcbrain/src/material.cpp +++ b/Engines/Linux64/mcbrain/src/material.cpp @@ -35,12 +35,12 @@ namespace { constexpr int QuadraticOurs[][PIECE_TYPE_NB] = { // OUR PIECES // pair pawn knight bishop rook queen - {1667 }, // Bishop pair - { 40, 0 }, // Pawn - { 32, 255, -3 }, // Knight OUR PIECES + {1438 }, // Bishop pair + { 40, 38 }, // Pawn + { 32, 255, -62 }, // Knight OUR PIECES { 0, 104, 4, 0 }, // Bishop - { -26, -2, 47, 105, -149 }, // Rook - {-189, 24, 117, 133, -134, -10 } // Queen + { -26, -2, 47, 105, -208 }, // Rook + {-189, 24, 117, 133, -134, -6 } // Queen }; constexpr int QuadraticTheirs[][PIECE_TYPE_NB] = { @@ -56,7 +56,8 @@ namespace { // Endgame evaluation and scaling functions are accessed directly and not through // the function maps because they correspond to more than one material hash key. - Endgame EvaluateKXK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame EvaluateKXK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame EvaluateKQXKX[] = { Endgame(WHITE), Endgame(BLACK) }; Endgame ScaleKBPsK[] = { Endgame(WHITE), Endgame(BLACK) }; Endgame ScaleKQKRPs[] = { Endgame(WHITE), Endgame(BLACK) }; @@ -69,6 +70,14 @@ namespace { && pos.non_pawn_material(us) >= RookValueMg; } + bool is_KQXKX(const Position& pos, Color us) { + return more_than_one(pos.pieces(~us)) + && !pos.count(~us) + && pos.non_pawn_material(~us) <= RookValueMg + && pos.count(us) + && pos.non_pawn_material(us) > QueenValueMg + RookValueMg; + } + bool is_KBPsK(const Position& pos, Color us) { return pos.non_pawn_material(us) == BishopValueMg && pos.count(us) == 1 @@ -78,7 +87,7 @@ namespace { bool is_KQKRPs(const Position& pos, Color us) { return !pos.count(us) && pos.non_pawn_material(us) == QueenValueMg - && pos.count(us) == 1 + && pos.count(us) == 1 && pos.count(~us) == 1 && pos.count(~us) >= 1; } @@ -145,15 +154,22 @@ Entry* probe(const Position& pos) { return e; for (Color c = WHITE; c <= BLACK; ++c) + { if (is_KXK(pos, c)) { e->evaluationFunction = &EvaluateKXK[c]; return e; } + else if (is_KQXKX(pos, c)) + { + e->evaluationFunction = &EvaluateKQXKX[c]; + return e; + } + } // OK, we didn't find any special evaluation function for the current material // configuration. Is there a suitable specialized scaling function? - EndgameBase* sf; + const EndgameBase* sf; if ((sf = pos.this_thread()->endgames.probe(key)) != nullptr) { diff --git a/Engines/Linux64/mcbrain/src/material.h b/Engines/Linux64/mcbrain/src/material.h index 95d6c84..e15f2e0 100644 --- a/Engines/Linux64/mcbrain/src/material.h +++ b/Engines/Linux64/mcbrain/src/material.h @@ -57,9 +57,9 @@ struct Entry { } Key key; - EndgameBase* evaluationFunction; - EndgameBase* scalingFunction[COLOR_NB]; // Could be one for each - // side (e.g. KPKP, KBPsKs) + const EndgameBase* evaluationFunction; + const EndgameBase* scalingFunction[COLOR_NB]; // Could be one for each + // side (e.g. KPKP, KBPsKs) int16_t value; uint8_t factor[COLOR_NB]; Phase gamePhase; diff --git a/Engines/Linux64/mcbrain/src/misc.cpp b/Engines/Linux64/mcbrain/src/misc.cpp index e5f8107..36697c2 100644 --- a/Engines/Linux64/mcbrain/src/misc.cpp +++ b/Engines/Linux64/mcbrain/src/misc.cpp @@ -35,10 +35,12 @@ // the calls at compile time), try to load them at runtime. To do this we need // first to define the corresponding function pointers. extern "C" { -typedef bool(*fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP, +typedef bool(WINAPI *fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD); -typedef bool(*fun2_t)(USHORT, PGROUP_AFFINITY); -typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); +typedef bool(WINAPI *fun2_t)(USHORT, PGROUP_AFFINITY); +typedef bool(WINAPI *fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); + +#include "VersionHelpers.h" } #endif @@ -47,7 +49,7 @@ typedef bool(*fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); #include #include #include - +#include #include "misc.h" #include "thread.h" @@ -57,8 +59,13 @@ namespace { /// Version number. If Version is left empty, then compile date in the format /// DD-MM-YY and show in engine_info. -const string Version = "9.1"; +#ifdef Maverick +const string Version = "the Maverick"; +#else +const string Version = "9.9"; +#endif + /// Our fancy logging facility. The trick here is to replace cin.rdbuf() and /// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We /// can toggle the logging of std::cout and std:cin at runtime whilst preserving @@ -117,9 +124,9 @@ class Logger { } // namespace -/// engine_info() returns the full name of the current Stockfish version. This -/// will be either "Stockfish DD-MM-YY" (where DD-MM-YY is the date when -/// the program was compiled) or "Stockfish ", depending on whether +/// engine_info() returns the full name of the current SugaR version. This +/// will be either "SugaR DD-MM-YY" (where DD-MM-YY is the date when +/// the program was compiled) or "SugaR ", depending on whether /// Version is empty. const string engine_info(bool to_uci) { @@ -127,21 +134,245 @@ const string engine_info(bool to_uci) { const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); string month, day, year; stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008" - +#ifdef Maverick + ss << "McCain-v2 -> " << Version << setfill('0'); +#else ss << "McBrain " << Version << setfill('0'); - +#endif + if (Version.empty()) { date >> month >> day >> year; ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2); } +#ifdef Maverick + ss //<< (Is64Bit ? " 64" : " 32") + //<< (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : "")) + << (to_uci ? "\nid author ": "->") + << "dedicated to John S McCain, an American Hero."; +#else + ss << (Is64Bit ? " 64" : " 32") + << (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : "")) + << (to_uci ? "\nid author ": " by ") + << "M. Byrne and scores of others..."; +#endif + + return ss.str(); +} + +const std::string system_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + InitVersion(); + + if (IsWindowsXPOrGreater()) + { + if (IsWindowsXPSP1OrGreater()) + { + if (IsWindowsXPSP2OrGreater()) + { + if (IsWindowsXPSP3OrGreater()) + { + if (IsWindowsVistaOrGreater()) + { + if (IsWindowsVistaSP1OrGreater()) + { + if (IsWindowsVistaSP2OrGreater()) + { + if (IsWindows7OrGreater()) + { + if (IsWindows7SP1OrGreater()) + { + if (IsWindows8OrGreater()) + { + if (IsWindows8Point1OrGreater()) + { + if (IsWindows10OrGreater()) + { + result << std::string("Windows 10"); + } + else + { + result << std::string("Windows 8.1"); + } + } + else + { + result << std::string("Windows 8"); + } + } + else + { + result << std::string("Windows 7 SP1"); + } + } + else + { + result << std::string("Windows 7"); + } + } + else + { + result << std::string("Vista SP2"); + } + } + else + { + result << std::string("Vista SP1"); + } + } + else + { + result << std::string("Vista"); + } + } + else + { + result << std::string("XP SP3"); + } + } + else + { + result << std::string("XP SP2"); + } + } + else + { + result << std::string("XP SP1"); + } + } + else + { + result << std::string("XP"); + } + } + + if (IsWindowsServer()) + { + result << std::string(" Server "); + } + else + { + result << std::string(" Client "); + } + + result << std::string("Or Greater") << std::endl; + + result << std::endl; + } +#endif + + return result.str(); +} + +const std::string hardware_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + SYSTEM_INFO siSysInfo; + + // Copy the hardware information to the SYSTEM_INFO structure. + + GetSystemInfo(&siSysInfo); + + HKEY hKey = HKEY_LOCAL_MACHINE; + const DWORD Const_Data_Size = 10000; + TCHAR Data[Const_Data_Size]; + + ZeroMemory(Data, Const_Data_Size * sizeof(TCHAR)); + + DWORD buffersize = Const_Data_Size; + + LONG result_registry_functions = ERROR_SUCCESS; + + result_registry_functions = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0\\"), 0, KEY_READ, &hKey); + + if (result_registry_functions == ERROR_SUCCESS) + { + // Query the registry value + result_registry_functions = RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)&Data, &buffersize); + + if (result_registry_functions == ERROR_SUCCESS) + { + // Close the Registry Key + result_registry_functions = RegCloseKey(hKey); + + assert(result_registry_functions == ERROR_SUCCESS); + } + else + { + assert(result_registry_functions == ERROR_SUCCESS); + } + } + else + { + assert(result_registry_functions == ERROR_SUCCESS); + } + + std::string ProcessorName(Data); + + // Display the contents of the SYSTEM_INFO structure. + + result << std::endl; + + result << "Hardware information : " << std::endl; + result << " CPU Brand : " << ProcessorName << std::endl; + //result << " CPU Architecture : " << siSysInfo.wProcessorArchitecture << std::endl; + result << " CPU Core : " << siSysInfo.dwNumberOfProcessors << std::endl; + //result << " Processor type : " << siSysInfo.dwProcessorType << std::endl; + + // Used to convert bytes to MB + const size_t local_1000_000 = 1000 * 1000; + + MEMORYSTATUSEX statex; + + statex.dwLength = sizeof(statex); + + GlobalMemoryStatusEx(&statex); + + result << " Total RAM : " << statex.ullTotalPhys / local_1000_000 << "MB" << std::endl; + + result << std::endl; + } +#endif + + return result.str(); +} + +const std::string cores_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + SYSTEM_INFO siSysInfo; + + // Copy the hardware information to the SYSTEM_INFO structure. + + GetSystemInfo(&siSysInfo); + + result << std::endl; + + DWORD n = DWORD(std::thread::hardware_concurrency()); + result << "Test running " << n << " Cores\n"; + + DWORD local_mask = siSysInfo.dwActiveProcessorMask; + + for (DWORD core_counter = 0; core_counter DEPTH_ZERO); @@ -74,8 +74,8 @@ MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHist /// MovePicker constructor for quiescence search MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh, - const CapturePieceToHistory* cph, Square rs) - : pos(p), mainHistory(mh), captureHistory(cph), recaptureSquare(rs), depth(d) { + const CapturePieceToHistory* cph, const PieceToHistory** ch, Square rs) + : pos(p), mainHistory(mh), captureHistory(cph), continuationHistory(ch), recaptureSquare(rs), depth(d) { assert(d <= DEPTH_ZERO); @@ -112,13 +112,13 @@ void MovePicker::score() { for (auto& m : *this) if (Type == CAPTURES) m.value = PieceValue[MG][pos.piece_on(to_sq(m))] - + (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 16; + + (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 8; else if (Type == QUIETS) m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] - + (*contHistory[0])[pos.moved_piece(m)][to_sq(m)] - + (*contHistory[1])[pos.moved_piece(m)][to_sq(m)] - + (*contHistory[3])[pos.moved_piece(m)][to_sq(m)]; + + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)] + + (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)] + + (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]; else // Type == EVASIONS { @@ -126,7 +126,9 @@ void MovePicker::score() { m.value = PieceValue[MG][pos.piece_on(to_sq(m))] - Value(type_of(pos.moved_piece(m))); else - m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] - (1 << 28); + m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] + + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)] + - (1 << 28); } } diff --git a/Engines/Linux64/mcbrain/src/movepick.h b/Engines/Linux64/mcbrain/src/movepick.h index ea9ea26..377874a 100644 --- a/Engines/Linux64/mcbrain/src/movepick.h +++ b/Engines/Linux64/mcbrain/src/movepick.h @@ -37,18 +37,16 @@ template class StatsEntry { - static const bool IsInt = std::is_integral::value; - typedef typename std::conditional::type TT; - T entry; public: - T* get() { return &entry; } void operator=(const T& v) { entry = v; } - operator TT() const { return entry; } + T* operator&() { return &entry; } + T* operator->() { return &entry; } + operator const T&() const { return entry; } void operator<<(int bonus) { - assert(abs(bonus) <= D); // Ensure range is [-D, D] + assert(abs(bonus) <= D); // Ensure range is [-D, D] static_assert(D <= std::numeric_limits::max(), "D overflows T"); entry += bonus - entry * abs(bonus) / D; @@ -65,18 +63,21 @@ class StatsEntry { template struct Stats : public std::array, Size> { - T* get() { return this->at(0).get(); } + typedef Stats stats; void fill(const T& v) { - T* p = get(); - std::fill(p, p + sizeof(*this) / sizeof(*p), v); + + // For standard-layout 'this' points to first struct member + assert(std::is_standard_layout::value); + + typedef StatsEntry entry; + entry* p = reinterpret_cast(this); + std::fill(p, p + sizeof(*this) / sizeof(entry), v); } }; template -struct Stats : public std::array, Size> { - T* get() { return this->at(0).get(); } -}; +struct Stats : public std::array, Size> {}; /// In stats table, D=0 means that the template parameter is not used enum StatsParams { NOT_USED = 0 }; @@ -86,14 +87,14 @@ enum StatsParams { NOT_USED = 0 }; /// unsuccessful during the current search, and is used for reduction and move /// ordering decisions. It uses 2 tables (one for each color) indexed by /// the move's from and to squares, see chessprogramming.wikispaces.com/Butterfly+Boards -typedef Stats ButterflyHistory; +typedef Stats ButterflyHistory; /// CounterMoveHistory stores counter moves indexed by [piece][to] of the previous /// move, see chessprogramming.wikispaces.com/Countermove+Heuristic typedef Stats CounterMoveHistory; /// CapturePieceToHistory is addressed by a move's [piece][to][captured piece type] -typedef Stats CapturePieceToHistory; +typedef Stats CapturePieceToHistory; /// PieceToHistory is like ButterflyHistory but is addressed by a move's [piece][to] typedef Stats PieceToHistory; @@ -118,10 +119,16 @@ class MovePicker { MovePicker(const MovePicker&) = delete; MovePicker& operator=(const MovePicker&) = delete; MovePicker(const Position&, Move, Value, const CapturePieceToHistory*); - MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, Square); - MovePicker(const Position&, Move, Depth, const ButterflyHistory*, const CapturePieceToHistory*, const PieceToHistory**, Move, Move*); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Square); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Move, + Move*); Move next_move(bool skipQuiets = false); - bool is_refutation(Move m) const { return m == refutations[0] || m == refutations[1] || m == refutations[2]; } private: template Move select(Pred); @@ -132,7 +139,7 @@ class MovePicker { const Position& pos; const ButterflyHistory* mainHistory; const CapturePieceToHistory* captureHistory; - const PieceToHistory** contHistory; + const PieceToHistory** continuationHistory; Move ttMove; ExtMove refutations[3], *cur, *endMoves, *endBadCaptures; int stage; diff --git a/Engines/Linux64/mcbrain/src/pawns.cpp b/Engines/Linux64/mcbrain/src/pawns.cpp index a92df0a..bce5d3a 100644 --- a/Engines/Linux64/mcbrain/src/pawns.cpp +++ b/Engines/Linux64/mcbrain/src/pawns.cpp @@ -27,54 +27,58 @@ #include "position.h" #include "thread.h" +//#define PAWN_SCORES //not inclued in McCain + namespace { #define V Value #define S(mg, eg) make_score(mg, eg) - // Isolated pawn penalty - constexpr Score Isolated = S(13, 18); + // Pawn penalties + constexpr Score Isolated = S( 5, 15); + constexpr Score Backward = S( 9, 24); + constexpr Score Doubled = S(11, 56); + + +#ifdef PAWN_SCORES + // Pawn Scores Isolated in Rank 3 + constexpr Score PawnScoresIsolatedRank3 = S(- 5, + 0); - // Backward pawn penalty - constexpr Score Backward = S(24, 12); + // Pawn Scores Connected Passed + constexpr Score PawnScoresConnectedPassed = S(-16, +16); + constexpr Score KingSafetyCompensationPawnScoresConnectedPassed = S(- 5, + 0); + // Protected Passed Pawn + constexpr Score ProtectedPassedPawn = S(+ 5, + 5); + constexpr Score RemotePassedPawn = S(+ 4, + 4); + +#endif // Connected pawn bonus by opposed, phalanx, #support and rank Score Connected[2][2][3][RANK_NB]; - // Doubled pawn penalty - constexpr Score Doubled = S(18, 38); - // Strength of pawn shelter for our king by [distance from edge][rank]. // RANK_1 = 0 is used for files where we have no pawn, or pawn is behind our king. constexpr Value ShelterStrength[int(FILE_NB) / 2][RANK_NB] = { - { V( -9), V(64), V(77), V( 44), V( 4), V( -1), V(-11) }, - { V(-15), V(83), V(51), V(-10), V( 1), V(-10), V(-28) }, - { V(-18), V(84), V(27), V(-12), V(21), V( -7), V(-36) }, - { V( 12), V(79), V(25), V( 19), V( 9), V( -6), V(-33) } + { V( -6), V( 81), V( 93), V( 58), V( 39), V( 18), V( 25) }, + { V(-43), V( 61), V( 35), V(-49), V(-29), V(-11), V( -63) }, + { V(-10), V( 75), V( 23), V( -2), V( 32), V( 3), V( -45) }, + { V(-39), V(-13), V(-29), V(-52), V(-48), V(-67), V(-166) } }; - // Danger of enemy pawns moving toward our king by [type][distance from edge][rank]. - // For the unopposed and unblocked cases, RANK_1 = 0 is used when opponent has - // no pawn on the given file, or their pawn is behind our king. - constexpr Value StormDanger[][4][RANK_NB] = { - { { V( 0), V(-290), V(-274), V(57), V(41) }, // BlockedByKing - { V( 0), V( 60), V( 144), V(39), V(13) }, - { V( 0), V( 65), V( 141), V(41), V(34) }, - { V( 0), V( 53), V( 127), V(56), V(14) } }, - { { V( 4), V( 73), V( 132), V(46), V(31) }, // Unopposed - { V( 1), V( 64), V( 143), V(26), V(13) }, - { V( 1), V( 47), V( 110), V(44), V(24) }, - { V( 0), V( 72), V( 127), V(50), V(31) } }, - { { V( 0), V( 0), V( 19), V(23), V( 1) }, // BlockedByPawn - { V( 0), V( 0), V( 88), V(27), V( 2) }, - { V( 0), V( 0), V( 101), V(16), V( 1) }, - { V( 0), V( 0), V( 111), V(22), V(15) } }, - { { V(22), V( 45), V( 104), V(62), V( 6) }, // Unblocked - { V(31), V( 30), V( 99), V(39), V(19) }, - { V(23), V( 29), V( 96), V(41), V(15) }, - { V(21), V( 23), V( 116), V(41), V(15) } } + // Danger of enemy pawns moving toward our king by [distance from edge][rank]. + // RANK_1 = 0 is used for files where the enemy has no pawn, or their pawn + // is behind our king. + constexpr Value UnblockedStorm[int(FILE_NB) / 2][RANK_NB] = { + { V( 89), V(107), V(123), V(93), V(57), V( 45), V( 51) }, + { V( 44), V(-18), V(123), V(46), V(39), V( -7), V( 23) }, + { V( 4), V( 52), V(162), V(37), V( 7), V(-14), V( -2) }, + { V(-10), V(-14), V( 90), V(15), V( 2), V( -7), V(-16) } }; + // Danger of blocked enemy pawns storming our king, by rank + constexpr Value BlockedStorm[RANK_NB] = + { V(0), V(0), V(66), V(6), V(5), V(1), V(15) }; + #undef S #undef V @@ -121,29 +125,16 @@ namespace { phalanx = neighbours & rank_bb(s); supported = neighbours & rank_bb(s - Up); - // A pawn is backward when it is behind all pawns of the same color on the - // adjacent files and cannot be safely advanced. - if (!neighbours || lever || relative_rank(Us, s) >= RANK_5) - backward = false; - else - { - // Find the backmost rank with neighbours or stoppers - b = rank_bb(backmost_sq(Us, neighbours | stoppers)); - - // The pawn is backward when it cannot safely progress to that rank: - // either there is a stopper in the way on this rank, or there is a - // stopper on adjacent file which controls the way to that rank. - backward = (b | shift(b & adjacent_files_bb(f))) & stoppers; - - assert(!(backward && (forward_ranks_bb(Them, s + Up) & neighbours))); - } + // A pawn is backward when it is behind all pawns of the same color + // on the adjacent files and cannot be safely advanced. + backward = !(ourPawns & pawn_attack_span(Them, s + Up)) + && (stoppers & (leverPush | (s + Up))); // Passed pawns will be properly scored in evaluation because we need // full attack info to evaluate them. Include also not passed pawns // which could become passed after one or two pawn pushes when are // not attacked more times than defended. if ( !(stoppers ^ lever ^ leverPush) - && !(ourPawns & forward_file_bb(Us, s)) && popcount(supported) >= popcount(lever) - 1 && popcount(phalanx) >= popcount(leverPush)) e->passedPawns[Us] |= s; @@ -162,18 +153,170 @@ namespace { score += Connected[opposed][bool(phalanx)][popcount(supported)][relative_rank(Us, s)]; else if (!neighbours) - score -= Isolated, e->weakUnopposed[Us] += !opposed; - - else if (backward) - score -= Backward, e->weakUnopposed[Us] += !opposed; - - if (doubled && !supported) - score -= Doubled; - } - - return score; - } - + { + score -= Isolated, e->weakUnopposed[Us] += !opposed; + +#ifdef PAWN_SCORES + if (relative_rank(Us, s) == RANK_3) + { + score += PawnScoresIsolatedRank3; + } +#endif + } + + else if (backward) + score -= Backward, e->weakUnopposed[Us] += !opposed; + + + if (doubled && !supported) + score -= Doubled; + +#ifdef PAWN_SCORES + bool protected_passed_pawn = false; + + bool passed1 = bool(passed_pawn_mask(Us, s) & ourPawns); + + //File fp1 = file_of(s); + Rank rp1 = rank_of(s); + + File fp0 = f; + File fp2 = f; + + if (fp0 > FILE_A) + { + fp0 = File(fp0 - 1); + } + + if (f < FILE_H) + { + fp2 = File(fp2 + 1); + } + + Rank rpp = rp1; + + if (Us == WHITE) + { + if (rpp > RANK_2) + { + rpp = Rank(rpp - 1); + } + } + else + { + if (rpp < RANK_7) + { + rpp = Rank(rpp + 1); + } + } + + if (rpp != rp1) + { + if (fp0 != f) + { + protected_passed_pawn = make_piece(Us, PAWN) == pos.piece_on(make_square(fp0, rpp)); + } + + if (fp2 != f) + { + protected_passed_pawn = protected_passed_pawn || (make_piece(Us, PAWN) == pos.piece_on(make_square(fp2, rpp))); + } + + if (passed1 && protected_passed_pawn) + { + score += ProtectedPassedPawn; + } + } + + if (passed1) + { + bool passed_in_flang = (f < FILE_C) || (f > FILE_F); + + if (passed_in_flang) + { + score += RemotePassedPawn; + } + } +#endif + } + +#ifdef PAWN_SCORES + const Square* pl_1 = pos.squares(Us); + + // Loop through all pawns of the current color and score each pawn + while ((s = *pl_1++) != SQ_NONE) + { + assert(pos.piece_on(s) == make_piece(Us, PAWN)); + + File f = file_of(s); + + File f0 = f; + File f2 = f; + + if (f0 > FILE_A) + { + f0 = File(f0 - 1); + } + + if (f < FILE_H) + { + f2 = File(f2 + 1); + } + + bool passed1 = bool(passed_pawn_mask(Us, s) & ourPawns); + + if (f0 != f) + { + bool passed0 = false; + + if (passed1) + { + for (Rank r0 = RANK_2; r0 <= RANK_7; r0 = Rank(r0 + 1)) + { + Square s0 = make_square(f0, r0); + + if (pos.piece_on(s0) == make_piece(Us, PAWN)) + { + passed0 = e->passedPawns[Us] & s0; + + if (passed0) + { + break; + } + } + } + + if (passed0 && passed1) + { + score += PawnScoresConnectedPassed; + + Square UsKingSquare = SQ_A1; + + Piece UsKing = make_piece(Us, KING); + + while (pos.piece_on(UsKingSquare) != UsKing) + { + UsKingSquare = Square(UsKingSquare + 1); + + assert(UsKingSquare != SQUARE_NB); + } + + File UsKingFile = file_of(UsKingSquare); + //Rank UsKingRank = rank_of(UsKingSquare); + + bool connected_passed_defend_king = (UsKingFile >= f0 && UsKingFile <= f2); + + if (connected_passed_defend_king) + { + score += KingSafetyCompensationPawnScoresConnectedPassed; + } + } + } + } + } +#endif + + return score; + } } // namespace namespace Pawns { @@ -184,7 +327,7 @@ namespace Pawns { void init() { - static constexpr int Seed[RANK_NB] = { 0, 13, 24, 18, 76, 100, 175, 330 }; + static constexpr int Seed[RANK_NB] = { 0, 13, 24, 18, 65, 100, 175, 330 }; for (int opposed = 0; opposed <= 1; ++opposed) for (int phalanx = 0; phalanx <= 1; ++phalanx) @@ -229,32 +372,36 @@ Entry* probe(const Position& pos) { template Value Entry::evaluate_shelter(const Position& pos, Square ksq) { - enum { BlockedByKing, Unopposed, BlockedByPawn, Unblocked }; constexpr Color Them = (Us == WHITE ? BLACK : WHITE); constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH); + constexpr Bitboard BlockRanks = (Us == WHITE ? Rank1BB | Rank2BB : Rank8BB | Rank7BB); - Bitboard b = pos.pieces(PAWN) & (forward_ranks_bb(Us, ksq) | rank_bb(ksq)); + Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq); Bitboard ourPawns = b & pos.pieces(Us); Bitboard theirPawns = b & pos.pieces(Them); - - Value safety = (ourPawns & file_bb(ksq)) ? Value(5) : Value(-5); +#ifdef Maverick + Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ? + Value(448) : Value(6); +#else + Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ? + Value(374) : Value(5); +#endif File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq))); for (File f = File(center - 1); f <= File(center + 1); ++f) { - b = ourPawns & file_bb(f); - Rank rkUs = b ? relative_rank(Us, backmost_sq(Us, b)) : RANK_1; + if (more_than_one(theirPawns & FileBB[f])) safety -= Value( 18); + + b = ourPawns & file_bb(f); + int ourRank = b ? relative_rank(Us, backmost_sq(Us, b)) : 0; b = theirPawns & file_bb(f); - Rank rkThem = b ? relative_rank(Us, frontmost_sq(Them, b)) : RANK_1; + int theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : 0; int d = std::min(f, ~f); - safety += ShelterStrength[d][rkUs] - - StormDanger - [(shift(b) & ksq) ? BlockedByKing : - rkUs == RANK_1 ? Unopposed : - rkThem == (rkUs + 1) ? BlockedByPawn : Unblocked] - [d][rkThem]; + safety += ShelterStrength[d][ourRank]; + safety -= (ourRank && (ourRank == theirRank - 1)) ? BlockedStorm[theirRank] + : UnblockedStorm[d][theirRank]; } return safety; @@ -273,7 +420,7 @@ Score Entry::do_king_safety(const Position& pos, Square ksq) { Bitboard pawns = pos.pieces(Us, PAWN); if (pawns) - while (!(DistanceRingBB[ksq][minKingPawnDistance++] & pawns)) {} + while (!(DistanceRingBB[ksq][++minKingPawnDistance] & pawns)) {} Value bonus = evaluate_shelter(pos, ksq); diff --git a/Engines/Linux64/mcbrain/src/polybook.cpp b/Engines/Linux64/mcbrain/src/polybook.cpp index 9aaacb4..6d27fb5 100644 --- a/Engines/Linux64/mcbrain/src/polybook.cpp +++ b/Engines/Linux64/mcbrain/src/polybook.cpp @@ -21,7 +21,7 @@ // polybook.cpp was written by Thomas Ziproth /* BrainFish, a UCI chess playing engine derived from Stockfish -Copyright (C) 2016-2017 Thomas Zipproth +Copyright (C) 2016-2018 Thomas Zipproth BrainFish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,8 +33,8 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #include "polybook.h" @@ -353,17 +353,25 @@ PolyBook::~PolyBook() void PolyBook::init(const std::string& bookfile) { if (bookfile.length() == 0) return; - const char *fnam = bookfile.c_str(); + const char *file_name = bookfile.c_str(); - if (strcmp(fnam, "") == 0) + if (strcmp(file_name, "") == 0) { enabled = false; return; } - FILE *fpt = fopen(fnam, "rb"); +#ifdef _WIN32 + FILE *fpt; + errno_t errno_local = fopen_s(&fpt, file_name, "rb"); + if (fpt == NULL || errno_local != 0) + { + assert(errno_local != 0); +#else + FILE *fpt = fopen(file_name, "rb"); if (fpt == NULL) { +#endif sync_cout << "info string Could not open " << bookfile << sync_endl; enabled = false; return; diff --git a/Engines/Linux64/mcbrain/src/polybook.h b/Engines/Linux64/mcbrain/src/polybook.h index 8696eda..8c0d11a 100644 --- a/Engines/Linux64/mcbrain/src/polybook.h +++ b/Engines/Linux64/mcbrain/src/polybook.h @@ -34,8 +34,8 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program. If not, see . + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ #ifndef POLYBOOK_H_INCLUDED diff --git a/Engines/Linux64/mcbrain/src/position.cpp b/Engines/Linux64/mcbrain/src/position.cpp index 67a9f00..2c10df8 100644 --- a/Engines/Linux64/mcbrain/src/position.cpp +++ b/Engines/Linux64/mcbrain/src/position.cpp @@ -37,10 +37,6 @@ using std::string; -namespace PSQT { - extern Score psq[PIECE_NB][SQUARE_NB]; -} - namespace Zobrist { Key psq[PIECE_NB][SQUARE_NB]; @@ -131,11 +127,17 @@ std::ostream& operator<<(std::ostream& os, const Position& pos) { } -// Marcel Kervinck's algorithm for Deep Blue’s "upcoming repetition" / "no progress" detectors -Key cuckoo[0x2000]; // Cuckoo table with Zobrist hashes of valid reversible moves -int16_t cuckooMove[0x2000]; // The move for cuckoo[i] -#define H1(h)( (h) &0x1fff) // First hash function for indexing the cuckoo table -#define H2(h)(((h)>>16)&0x1fff) // Second hash function +// Marcel van Kervinck's cuckoo algorithm for fast detection of "upcoming repetition" +// situations. Description of the algorithm in the following paper: +// https://marcelk.net/2013-04-06/paper/upcoming-rep-v2.pdf + +// First and second hash functions for indexing the cuckoo tables +inline int H1(Key h) { return h & 0x1fff; } +inline int H2(Key h) { return (h >> 16) & 0x1fff; } + +// Cuckoo tables with Zobrist hashes of valid reversible moves, and the moves themselves +Key cuckoo[8192]; +Move cuckooMove[8192]; /// Position::init() initializes at startup the various arrays used to compute @@ -166,30 +168,29 @@ void Position::init() { Zobrist::side = rng.rand(); Zobrist::noPawns = rng.rand(); - int num = 0; + // Prepare the cuckoo tables + std::memset(cuckoo, 0, sizeof(cuckoo)); + std::memset(cuckooMove, 0, sizeof(cuckooMove)); + int count = 0; for (Piece pc : Pieces) - { for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) - { - Bitboard b = PseudoAttacks[type_of(pc)][s1] & ~(SquareBB[s1]-1); - while (b) - { - Square s2 = pop_lsb(&b); - int16_t move16 = make_move(s1, s2); - Key moveKey = Zobrist::psq[pc][s1] ^ Zobrist::psq[pc][s2] ^ Zobrist::side; - unsigned int i = H1(moveKey); - while(true) - { // Insert in cuckoo table - std::swap(cuckoo[i], moveKey); - std::swap(cuckooMove[i], move16); - if (moveKey == 0) break; // Arrived at empty; slot so we are done for this move - i = (i == H1(moveKey)) ? H2(moveKey) : H1(moveKey); // Push victim to alternative slot - } - num++; - } - } - } - assert(num == 3668); + for (Square s2 = Square(s1 + 1); s2 <= SQ_H8; ++s2) + if (PseudoAttacks[type_of(pc)][s1] & s2) + { + Move move = make_move(s1, s2); + Key key = Zobrist::psq[pc][s1] ^ Zobrist::psq[pc][s2] ^ Zobrist::side; + int i = H1(key); + while (true) + { + std::swap(cuckoo[i], key); + std::swap(cuckooMove[i], move); + if (move == 0) // Arrived at empty slot ? + break; + i = (i == H1(key)) ? H2(key) : H1(key); // Push victim to alternative slot + } + count++; + } + assert(count == 3668); } @@ -379,7 +380,6 @@ void Position::set_state(StateInfo* si) const { si->key = si->materialKey = 0; si->pawnKey = Zobrist::noPawns; si->nonPawnMaterial[WHITE] = si->nonPawnMaterial[BLACK] = VALUE_ZERO; - si->psq = SCORE_ZERO; si->checkersBB = attackers_to(square(sideToMove)) & pieces(~sideToMove); set_check_info(si); @@ -389,7 +389,6 @@ void Position::set_state(StateInfo* si) const { Square s = pop_lsb(&b); Piece pc = piece_on(s); si->key ^= Zobrist::psq[pc][s]; - si->psq += PSQT::psq[pc][s]; } if (si->epSquare != SQ_NONE) @@ -750,7 +749,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { Square rfrom, rto; do_castling(us, from, to, rfrom, rto); - st->psq += PSQT::psq[captured][rto] - PSQT::psq[captured][rfrom]; k ^= Zobrist::psq[captured][rfrom] ^ Zobrist::psq[captured][rto]; captured = NO_PIECE; } @@ -789,9 +787,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { st->materialKey ^= Zobrist::psq[captured][pieceCount[captured]]; prefetch(thisThread->materialTable[st->materialKey]); - // Update incremental scores - st->psq -= PSQT::psq[captured][capsq]; - // Reset rule 50 counter st->rule50 = 0; } @@ -845,9 +840,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion]-1] ^ Zobrist::psq[pc][pieceCount[pc]]; - // Update incremental score - st->psq += PSQT::psq[promotion][to] - PSQT::psq[pc][to]; - // Update material st->nonPawnMaterial[us] += PieceValue[MG][promotion]; } @@ -860,9 +852,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { st->rule50 = 0; } - // Update incremental scores - st->psq += PSQT::psq[pc][to] - PSQT::psq[pc][from]; - // Set capture piece st->capturedPiece = captured; @@ -1144,10 +1133,11 @@ bool Position::is_draw(int ply) const { bool Position::has_repeated() const { StateInfo* stc = st; - while (true) { - int i = 4, e = std::min(stc->rule50, stc->pliesFromNull); + while (true) + { + int i = 4, end = std::min(stc->rule50, stc->pliesFromNull); - if (e < i) + if (end < i) return false; StateInfo* stp = st->previous->previous; @@ -1159,7 +1149,7 @@ bool Position::has_repeated() const { return true; i += 2; - } while (i <= e); + } while (i <= end); stc = stc->previous; } @@ -1167,10 +1157,12 @@ bool Position::has_repeated() const { /// Position::has_game_cycle() tests if the position has a move which draws by repetition, -/// or an earlier position has a move that directly reaches this one. +/// or an earlier position has a move that directly reaches the current position. bool Position::has_game_cycle(int ply) const { + int j; + int end = std::min(st->rule50, st->pliesFromNull); if (end < 3) @@ -1178,36 +1170,39 @@ bool Position::has_game_cycle(int ply) const { Key originalKey = st->key; StateInfo* stp = st->previous; - Key progressKey = stp->key ^ Zobrist::side; for (int i = 3; i <= end; i += 2) { - stp = stp->previous; - progressKey ^= stp->key ^ Zobrist::side; - stp = stp->previous; - // "originalKey ==" detects upcoming repetition, "progressKey ==" detects no-progress - if (originalKey == (progressKey ^ stp->key) || progressKey == Zobrist::side) + stp = stp->previous->previous; + + Key moveKey = originalKey ^ stp->key; + if ( (j = H1(moveKey), cuckoo[j] == moveKey) + || (j = H2(moveKey), cuckoo[j] == moveKey)) { - Key moveKey = originalKey ^ stp->key; - unsigned int j = H1(moveKey); - if (cuckoo[j] == moveKey || (j = H2(moveKey), cuckoo[j] == moveKey)) + Move move = cuckooMove[j]; + Square s1 = from_sq(move); + Square s2 = to_sq(move); + + if (!(between_bb(s1, s2) & pieces())) { - Move m = Move(cuckooMove[j]); - if (!(between_bb(from_sq(m), to_sq(m)) & pieces())) { - if (ply > i) - return true; - // For repetitions before or at the root, require one more. - StateInfo* next_stp = stp; - for (int k = i+2; k <= end; k += 2) - { - next_stp = next_stp->previous->previous; - if (next_stp->key == stp->key) - return true; - } + // In the cuckoo table, both moves Rc1c5 and Rc5c1 are stored in the same + // location. We select the legal one by reversing the move variable if necessary. + if (empty(s1)) + move = make_move(s2, s1); + + if (ply > i) + return true; + + // For repetitions before or at the root, require one more + StateInfo* next_stp = stp; + for (int k = i + 2; k <= end; k += 2) + { + next_stp = next_stp->previous->previous; + if (next_stp->key == stp->key) + return true; } } } - progressKey ^= stp->key; } return false; } diff --git a/Engines/Linux64/mcbrain/src/position.h b/Engines/Linux64/mcbrain/src/position.h index 63ba265..b7e3a7a 100644 --- a/Engines/Linux64/mcbrain/src/position.h +++ b/Engines/Linux64/mcbrain/src/position.h @@ -44,7 +44,6 @@ struct StateInfo { int castlingRights; int rule50; int pliesFromNull; - Score psq; Square epSquare; // Not copied when making a move (will be recomputed anyhow) @@ -124,6 +123,7 @@ class Position { bool capture_or_promotion(Move m) const; bool gives_check(Move m) const; bool advanced_pawn_push(Move m) const; + bool promotion_pawn_push(Move m) const; Piece moved_piece(Move m) const; Piece captured_piece() const; @@ -189,11 +189,16 @@ class Position { Bitboard castlingPath[CASTLING_RIGHT_NB]; int gamePly; Color sideToMove; + Score psq; Thread* thisThread; StateInfo* st; bool chess960; }; +namespace PSQT { + extern Score psq[PIECE_NB][SQUARE_NB]; +} + extern std::ostream& operator<<(std::ostream& os, const Position& pos); inline Color Position::side_to_move() const { @@ -314,6 +319,10 @@ inline bool Position::advanced_pawn_push(Move m) const { return type_of(moved_piece(m)) == PAWN && relative_rank(sideToMove, from_sq(m)) > RANK_4; } +inline bool Position::promotion_pawn_push(Move m) const { + return type_of(moved_piece(m)) == PAWN + && relative_rank(sideToMove, to_sq(m)) == RANK_8; +}//MichaelB7 inline Key Position::key() const { return st->key; @@ -328,7 +337,7 @@ inline Key Position::material_key() const { } inline Score Position::psq_score() const { - return st->psq; + return psq; } inline Value Position::non_pawn_material(Color c) const { @@ -385,6 +394,7 @@ inline void Position::put_piece(Piece pc, Square s) { index[s] = pieceCount[pc]++; pieceList[pc][index[s]] = s; pieceCount[make_piece(color_of(pc), ALL_PIECES)]++; + psq += PSQT::psq[pc][s]; } inline void Position::remove_piece(Piece pc, Square s) { @@ -402,20 +412,22 @@ inline void Position::remove_piece(Piece pc, Square s) { pieceList[pc][index[lastSquare]] = lastSquare; pieceList[pc][pieceCount[pc]] = SQ_NONE; pieceCount[make_piece(color_of(pc), ALL_PIECES)]--; + psq -= PSQT::psq[pc][s]; } inline void Position::move_piece(Piece pc, Square from, Square to) { // index[from] is not updated and becomes stale. This works as long as index[] // is accessed just by known occupied squares. - Bitboard from_to_bb = SquareBB[from] ^ SquareBB[to]; - byTypeBB[ALL_PIECES] ^= from_to_bb; - byTypeBB[type_of(pc)] ^= from_to_bb; - byColorBB[color_of(pc)] ^= from_to_bb; + Bitboard fromTo = SquareBB[from] ^ SquareBB[to]; + byTypeBB[ALL_PIECES] ^= fromTo; + byTypeBB[type_of(pc)] ^= fromTo; + byColorBB[color_of(pc)] ^= fromTo; board[from] = NO_PIECE; board[to] = pc; index[to] = index[from]; pieceList[pc][index[to]] = to; + psq += PSQT::psq[pc][to] - PSQT::psq[pc][from]; } inline void Position::do_move(Move m, StateInfo& newSt) { diff --git a/Engines/Linux64/mcbrain/src/psqt.cpp b/Engines/Linux64/mcbrain/src/psqt.cpp index 3799dc6..c51e594 100644 --- a/Engines/Linux64/mcbrain/src/psqt.cpp +++ b/Engines/Linux64/mcbrain/src/psqt.cpp @@ -58,14 +58,14 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-195,-109), S(-67,-89), S(-42,-50), S(-29,-13) } }, { // Bishop - { S(-44,-58), S(-13,-31), S(-25,-37), S(-34,-19) }, - { S(-20,-34), S( 20, -9), S( 12,-14), S( 1, 4) }, - { S( -9,-23), S( 27, 0), S( 21, -3), S( 11, 16) }, - { S(-11,-26), S( 28, -3), S( 21, -5), S( 10, 16) }, - { S(-11,-26), S( 27, -4), S( 16, -7), S( 9, 14) }, - { S(-17,-24), S( 16, -2), S( 12, 0), S( 2, 13) }, - { S(-23,-34), S( 17,-10), S( 6,-12), S( -2, 6) }, - { S(-35,-55), S(-11,-32), S(-19,-36), S(-29,-17) } + { S(-64,-58), S(-13,-31), S(-25,-37), S(-34,-19) }, + { S(-20,-34), S( 0, -9), S( 12,-14), S( 1, 4) }, + { S( -9,-23), S( 27, 0), S( 1, -3), S( 11, 16) }, + { S(-11,-26), S( 28, -3), S( 21, -5), S( 32, 16) }, + { S(-11,-26), S( 27, -4), S( 16, -7), S( 31, 14) }, + { S(-17,-24), S( 16, -2), S( -8, 0), S( 2, 13) }, + { S(-23,-34), S( -3,-10), S( 6,-12), S( -2, 6) }, + { S(-55,-55), S(-11,-32), S(-19,-36), S(-29,-17) } }, { // Rook { S(-25, 0), S(-16, 0), S(-16, 0), S(-9, 0) }, @@ -88,14 +88,14 @@ constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { { S(-1,-74), S(-4,-55), S(-1,-43), S( 0,-30) } }, { // King - { S(267, 0), S(320, 48), S(270, 75), S(195, 84) }, - { S(264, 43), S(304, 92), S(238,143), S(180,132) }, - { S(200, 83), S(245,138), S(176,167), S(110,165) }, - { S(177,106), S(185,169), S(148,169), S(110,179) }, - { S(149,108), S(177,163), S(115,200), S( 66,203) }, - { S(118, 95), S(159,155), S( 84,176), S( 41,174) }, - { S( 87, 50), S(128, 99), S( 63,122), S( 20,139) }, - { S( 63, 9), S( 88, 55), S( 47, 80), S( 0, 90) } + { S(272, 0), S(325, 41), S(273, 80), S(190, 93) }, + { S(277, 57), S(305, 98), S(241,138), S(183,131) }, + { S(198, 86), S(253,138), S(168,165), S(120,173) }, + { S(169,103), S(191,152), S(136,168), S(108,169) }, + { S(145, 98), S(176,166), S(112,197), S(69, 194) }, + { S(122, 87), S(159,164), S(85, 174), S(36, 189) }, + { S(87, 40), S(120, 99), S(64, 128), S(25, 141) }, + { S(64, 5), S(87, 60), S(49, 75), S(0, 75) } } }; diff --git a/Engines/Linux64/mcbrain/src/search.cpp b/Engines/Linux64/mcbrain/src/search.cpp index cbdca6c..895952e 100644 --- a/Engines/Linux64/mcbrain/src/search.cpp +++ b/Engines/Linux64/mcbrain/src/search.cpp @@ -26,14 +26,14 @@ #include //for sleep //MichaelB7 #include #include -#include // ELO MichaelB7 - +#include +#include "book.h" #include "evaluate.h" #include "misc.h" #include "movegen.h" #include "movepick.h" -#include "polybook.h" // Cerebellum #include "position.h" +#include "polybook.h" #include "search.h" #include "thread.h" #include "timeman.h" @@ -70,33 +70,23 @@ namespace { constexpr int SkipPhase[] = { 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7 }; // Razor and futility margins - constexpr int RazorMargin[] = {0, 590, 604}; + constexpr int RazorMargin = 600; Value futility_margin(Depth d, bool improving) { return Value((175 - 50 * improving) * d / ONE_PLY); } - // Margin for pruning capturing moves: almost linear in depth - constexpr int CapturePruneMargin[] = { 0, - 1 * PawnValueEg * 1055 / 1000, - 2 * PawnValueEg * 1042 / 1000, - 3 * PawnValueEg * 963 / 1000, - 4 * PawnValueEg * 1038 / 1000, - 5 * PawnValueEg * 950 / 1000, - 6 * PawnValueEg * 930 / 1000 - }; - // Futility and reductions lookup tables, initialized at startup int FutilityMoveCounts[2][16]; // [improving][depth] - int Reductions[2][2][128][96]; // [pv][improving][depth][moveNumber] //MichaelB7 + int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber] template Depth reduction(bool i, Depth d, int mn) { - return Reductions[PvNode][i][std::min(d / ONE_PLY, 127)][std::min(mn, 95)] * ONE_PLY; //MichaelB7 + return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY; } // History and stats update bonus, based on depth int stat_bonus(Depth depth) { int d = depth / ONE_PLY; - return d > 17 ? 0 : 32 * d * d + 64 * d - 64; + return d > 17 ? 0 : 29 * d * d + 138 * d - 134; } // Skill structure is used to implement strength limit @@ -109,13 +99,14 @@ namespace { int level; Move best = MOVE_NONE; }; - - int tactical; - - bool bookEnabled, bruteForce, limitStrength, noNULL; + + bool doNull, doLMR, cleanSearch, limitStrength, bookEnabled, bruteForce, minOutput; + Depth maxLMR; + + int tactical, variety; template - Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode, bool skipEarlyPruning); + Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode); template Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth = DEPTH_ZERO); @@ -126,6 +117,7 @@ namespace { void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus); void update_quiet_stats(const Position& pos, Stack* ss, Move move, Move* quiets, int quietsCnt, int bonus); void update_capture_stats(const Position& pos, Move move, Move* captures, int captureCnt, int bonus); + bool PV_is_draw(Position& pos); inline bool gives_check(const Position& pos, Move move) { Color us = pos.side_to_move(); @@ -165,13 +157,14 @@ namespace { /// Search::init() is called at startup to initialize various lookup tables -void Search::init() { +void Search::init(bool OptioncleanSearch) { + cleanSearch = OptioncleanSearch; for (int imp = 0; imp <= 1; ++imp) - for (int d = 1; d < 128; ++d) // MichaelB7 - for (int mc = 1; mc < 96; ++mc) // MichaelB7 + for (int d = 1; d < 64; ++d) + for (int mc = 1; mc < 64; ++mc) { - double r = log(d) * log(mc) / 2; // SF used "2" years ago + double r = log(d) * log(mc) / 1.95; Reductions[NonPV][imp][d][mc] = int(std::round(r)); Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - 1, 0); @@ -192,6 +185,10 @@ void Search::init() { /// Search::clear() resets search state to its initial value void Search::clear() { +//Hash + if (Options["NeverClearHash"]) + return; +//end_Hash Threads.main()->wait_for_search_finished(); @@ -212,17 +209,30 @@ void MainThread::search() { sync_cout << "\nNodes searched: " << nodes << "\n" << sync_endl; return; } - - bruteForce = Options["BruteForce"]; - limitStrength = Options["UCI_LimitStrength"]; - noNULL = Options["No_Null_Moves"]; - tactical = Options["Tactical"]; - bookEnabled = Options["Book_Enabled"]; + static PolyglotBook book; // Defined static to initialize the PRNG only once + limitStrength = Options["UCI_LimitStrength"]; + int uci_elo = (Options["UCI_ELO"]); + + + bookEnabled = Options["Book_Enabled"]; Color us = rootPos.side_to_move(); Time.init(Limits, us, rootPos.game_ply()); +//Hash + if (!Limits.infinite) TT.new_search(); - + else + TT.infinite_search(); +//end_hash + + // Read search options + bruteForce = Options["BruteForce"]; + doNull = Options["NullMove"]; + doLMR = Options["LMR"]; + maxLMR = Options["MaxLMReduction"] * ONE_PLY; + tactical = Options["ICCF Analysis"]; + variety = Options["Variety"]; + if (rootMoves.empty()) { rootMoves.emplace_back(MOVE_NONE); @@ -231,7 +241,17 @@ void MainThread::search() { << sync_endl; } else - { + { + if (bool(Options["OwnBook"]) && !Limits.infinite && !Limits.mate) + { + Move bookMove = book.probe(rootPos, Options["Book File"], Options["Best Book Line"]); + + if (bookMove && std::count(rootMoves.begin(), rootMoves.end(), bookMove)) + { + std::swap(rootMoves[0], *std::find(rootMoves.begin(), rootMoves.end(), bookMove)); + goto finalize; + } + } Move bookMove = MOVE_NONE; if (!Limits.infinite && !Limits.mate) @@ -244,9 +264,9 @@ void MainThread::search() { } else { + if (limitStrength) { - int uci_elo = (Options["UCI_ELO"]); std::mt19937 gen(now()); std::uniform_int_distribution dis(-33, 33); int rand = dis(gen); @@ -258,6 +278,10 @@ void MainThread::search() { Limits.nodes *= Time.optimum()/1000 ; std::this_thread::sleep_for (std::chrono::seconds(Time.optimum()/1000) * (1 - Limits.nodes/724000)); } + + + + for (Thread* th : Threads) if (th != this) th->start_searching(); @@ -266,6 +290,7 @@ void MainThread::search() { } } +finalize: // When we reach the maximum depth, we can arrive here without a raise of // Threads.stop. However, if we are pondering or in an infinite search, // the UCI protocol states that we shouldn't print the best move before the @@ -292,20 +317,35 @@ void MainThread::search() { // Check if there are threads with a better score than main thread Thread* bestThread = this; - if ( Options["MultiPV"] == 1 + if ( int(Options["MultiPV"]) == 1 && !Limits.depth - && !Skill(Options["Skill Level"]).enabled() + && !Skill(int(Options["Skill Level"])).enabled() && rootMoves[0].pv[0] != MOVE_NONE) { - for (Thread* th : Threads) + std::map votes; + Value minScore = this->rootMoves[0].score; + + // Find out minimum score and reset votes for moves which can be voted + for (Thread* th: Threads) { - Depth depthDiff = th->completedDepth - bestThread->completedDepth; - Value scoreDiff = th->rootMoves[0].score - bestThread->rootMoves[0].score; + minScore = std::min(minScore, th->rootMoves[0].score); + votes[th->rootMoves[0].pv[0]] = 0; + } + + // Vote according to score and depth + for (Thread* th : Threads) + votes[th->rootMoves[0].pv[0]] += int(th->rootMoves[0].score - minScore) + + int(th->completedDepth); - // Select the thread with the best score, always if it is a mate - if ( scoreDiff > 0 - && (depthDiff >= 0 || th->rootMoves[0].score >= VALUE_MATE_IN_MAX_PLY)) + // Select best thread + int bestVote = votes[this->rootMoves[0].pv[0]]; + for (Thread* th : Threads) + { + if (votes[th->rootMoves[0].pv[0]] > bestVote) + { + bestVote = votes[th->rootMoves[0].pv[0]]; bestThread = th; + } } } @@ -331,28 +371,33 @@ void MainThread::search() { void Thread::search() { Stack stack[MAX_PLY+7], *ss = stack+4; // To reference from (ss-4) to (ss+2) - Value bestValue, alpha, beta, delta1, delta2; + Value bestValue, alpha, beta, delta; Move lastBestMove = MOVE_NONE; Depth lastBestMoveDepth = DEPTH_ZERO; MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); double timeReduction = 1.0; Color us = rootPos.side_to_move(); + bool failedLow; std::memset(ss-4, 0, 7 * sizeof(Stack)); for (int i = 4; i > 0; i--) - (ss-i)->contHistory = this->contHistory[NO_PIECE][0].get(); // Use as sentinel + (ss-i)->continuationHistory = &this->continuationHistory[NO_PIECE][0]; // Use as sentinel + + if (cleanSearch) + Search::clear(); - bestValue = delta1 = delta2 = alpha = -VALUE_INFINITE; + bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; if (mainThread) - mainThread->bestMoveChanges = 0, mainThread->failedLow = false; + mainThread->bestMoveChanges = 0, failedLow = false; size_t multiPV = Options["MultiPV"]; - Skill skill(Options["Skill Level"]); - if (tactical) multiPV = pow(2, tactical); - + int local_int = Options["Skill Level"]; + Skill skill(local_int); + if (tactical) multiPV = size_t(pow(2, tactical)); + // When playing with strength handicap enable MultiPV search that we will // use behind the scenes to retrieve a set of possible moves. if (skill.enabled()) @@ -363,7 +408,7 @@ void Thread::search() { int ct = int(Options["Contempt"]) * PawnValueEg / 100; // From centipawns // In analysis mode, adjust contempt in accordance with user preference - if (Limits.infinite || Options["UCI_AnalyseMode"]) + if (Limits.infinite || bool(Options["UCI_AnalyseMode"])) ct = Options["Analysis Contempt"] == "Off" ? 0 : Options["Analysis Contempt"] == "Both" ? ct : Options["Analysis Contempt"] == "White" && us == BLACK ? -ct @@ -373,45 +418,42 @@ void Thread::search() { // In evaluate.cpp the evaluation is from the white point of view contempt = (us == WHITE ? make_score(ct, ct / 2) : -make_score(ct, ct / 2)); + pvDraw = false; - // UCI options specify 256 as the max MultiPv option - int consecutiveEarlyExits[257] = {0}; // Iterative deepening loop until requested to stop or the target depth is reached while ( (rootDepth += ONE_PLY) < DEPTH_MAX + && rootDepth <= MAX_PLY-1 && !Threads.stop && !(Limits.depth && mainThread && rootDepth / ONE_PLY > Limits.depth)) { - // Distribute search depths across the threads - if (idx) - { - int i = (idx - 1) % 20; - if (idx == Threads.size() - 1 && !ss->excludedMove && rootDepth < 14 * ONE_PLY && rootMoves.size() > 1 && rootPos.see_ge(rootMoves[0].pv[0], VALUE_ZERO + 1)) - ss->excludedMove = rootMoves[0].pv[0]; //lazy_or_stubborn by pb00068 - else - if (((rootDepth / ONE_PLY + rootPos.game_ply() + SkipPhase[i]) / SkipSize[i]) % 2) - continue; - } + // Distribute search depths across the helper threads + if (idx > 0) + { + int i = (idx - 1) % 20; + if (((rootDepth / ONE_PLY + SkipPhase[i]) / SkipSize[i]) % 2) + continue; // Retry with an incremented rootDepth + } // Age out PV variability metric if (mainThread) - mainThread->bestMoveChanges *= 0.517, mainThread->failedLow = false; + mainThread->bestMoveChanges *= 0.517, failedLow = false; // Save the last iteration's scores before first PV line is searched and // all the move scores except the (new) PV are set to -VALUE_INFINITE. for (RootMove& rm : rootMoves) rm.previousScore = rm.score; - size_t PVFirst = 0; - PVLast = 0; + size_t pvFirst = 0; + pvLast = 0; // MultiPV loop. We perform a full root search for each PV line - for (PVIdx = 0; PVIdx < multiPV && !Threads.stop; ++PVIdx) + for (pvIdx = 0; pvIdx < multiPV && !Threads.stop; ++pvIdx) { - if (PVIdx == PVLast) + if (pvIdx == pvLast) { - PVFirst = PVLast; - for (PVLast++; PVLast < rootMoves.size(); PVLast++) - if (rootMoves[PVLast].TBRank != rootMoves[PVFirst].TBRank) + pvFirst = pvLast; + for (pvLast++; pvLast < rootMoves.size(); pvLast++) + if (rootMoves[pvLast].tbRank != rootMoves[pvFirst].tbRank) break; } @@ -421,14 +463,13 @@ void Thread::search() { // Reset aspiration window starting size if (rootDepth >= 5 * ONE_PLY) { - Value prevScore = rootMoves[PVIdx].previousScore; - delta1 = (prevScore < 0) ? Value(int(8.0 + 0.1 * abs(prevScore))) : Value(18); - delta2 = (prevScore > 0) ? Value(int(8.0 + 0.1 * abs(prevScore))) : Value(18); - alpha = std::max(prevScore - delta1,-VALUE_INFINITE); - beta = std::min(prevScore + delta2, VALUE_INFINITE); + Value previousScore = rootMoves[pvIdx].previousScore; + delta = Value(18); + alpha = std::max(previousScore - delta,-VALUE_INFINITE); + beta = std::min(previousScore + delta, VALUE_INFINITE); // Adjust contempt based on root move's previousScore (dynamic contempt) - int dct = ct + (ct ? 88 * prevScore / (abs(prevScore) + 200) : 0); + int dct = ct + 88 * previousScore / (abs(previousScore) + 200); contempt = (us == WHITE ? make_score(dct, dct / 2) : -make_score(dct, dct / 2)); @@ -439,7 +480,7 @@ void Thread::search() { // high/low anymore. while (true) { - bestValue = ::search(rootPos, ss, alpha, beta, rootDepth, false, false); + bestValue = ::search(rootPos, ss, alpha, beta, rootDepth, false); // Bring the best move to the front. It is critical that sorting // is done with a stable algorithm because all the values but the @@ -447,7 +488,7 @@ void Thread::search() { // and we want to keep the same order for all the moves except the // new PV that goes to the front. Note that in case of MultiPV // search the already searched PV lines are preserved. - std::stable_sort(rootMoves.begin() + PVIdx, rootMoves.begin() + PVLast); + std::stable_sort(rootMoves.begin() + pvIdx, rootMoves.begin() + pvLast); // If search has been stopped, we break immediately. Sorting is // safe because RootMoves is still valid, although it refers to @@ -455,6 +496,9 @@ void Thread::search() { if (Threads.stop) break; + // record if the PV is draw + pvDraw = ::PV_is_draw(rootPos); + // When failing high/low give some update (without cluttering // the UI) before a re-search. if ( mainThread @@ -468,33 +512,29 @@ void Thread::search() { if (bestValue <= alpha) { beta = (alpha + beta) / 2; - alpha = std::max(bestValue - delta1, -VALUE_INFINITE); + alpha = std::max(bestValue - delta, -VALUE_INFINITE); if (mainThread) { - mainThread->failedLow = true; + failedLow = true; Threads.stopOnPonderhit = false; } } else if (bestValue >= beta) - beta = std::min(bestValue + delta2, VALUE_INFINITE); //Ivan Ivec + beta = std::min(bestValue + delta, VALUE_INFINITE); else - { - delta1 += delta1 / 4 + 5; //Ivan Ivec - delta2 += delta2 / 4 + 5; //Ivan Ivec - - assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); - - consecutiveEarlyExits[PVIdx] = (bestValue >= beta) ? consecutiveEarlyExits[PVIdx] + 1 : 0; break; - } + + delta += delta / 4 + 5; + + assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); } // Sort the PV lines searched so far and update the GUI - std::stable_sort(rootMoves.begin() + PVFirst, rootMoves.begin() + PVIdx + 1); + std::stable_sort(rootMoves.begin() + pvFirst, rootMoves.begin() + pvIdx + 1); if ( mainThread - && (Threads.stop || PVIdx + 1 == multiPV || Time.elapsed() > 3000)) + && (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000)) sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; } @@ -531,7 +571,7 @@ void Thread::search() { && !Threads.stop && !Threads.stopOnPonderhit) { - const int F[] = { mainThread->failedLow, + const int F[] = { failedLow, bestValue - mainThread->previousScore }; int improvingFactor = std::max(246, std::min(832, 306 + 119 * F[0] - 6 * F[1])); @@ -577,15 +617,27 @@ namespace { // search<>() is the main search function for both PV and non-PV nodes template - Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode, bool skipEarlyPruning) { - - // Use quiescence search when needed - if (depth < ONE_PLY) - return qsearch(pos, ss, alpha, beta); + Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode) { constexpr bool PvNode = NT == PV; const bool rootNode = PvNode && ss->ply == 0; + // Check if we have an upcoming move which draws by repetition, or + // if the opponent had an alternative move earlier to this position. + if ( pos.rule50_count() >= 3 + && alpha < VALUE_DRAW + && !rootNode + && pos.has_game_cycle(ss->ply)) + { + alpha = VALUE_DRAW; + if (alpha >= beta) + return alpha; + } + + // Dive into quiescence search when the depth reaches zero + if (depth < ONE_PLY) + return qsearch(pos, ss, alpha, beta); + assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE); assert(PvNode || (alpha == beta - 1)); assert(DEPTH_ZERO < depth && depth < DEPTH_MAX); @@ -598,7 +650,7 @@ namespace { Key posKey; Move ttMove, move, excludedMove, bestMove; Depth extension, newDepth; - Value bestValue, value, ttValue, eval, maxValue; + Value bestValue, value, ttValue, eval, maxValue, pureStaticEval; bool ttHit, inCheck, givesCheck, improving; bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact; Piece movedPiece; @@ -607,6 +659,7 @@ namespace { // Step 1. Initialize node Thread* thisThread = pos.this_thread(); inCheck = pos.checkers(); + Color us = pos.side_to_move(); moveCount = captureCount = quietCount = ss->moveCount = 0; bestValue = -VALUE_INFINITE; maxValue = VALUE_INFINITE; @@ -625,7 +678,8 @@ namespace { if ( Threads.stop.load(std::memory_order_relaxed) || pos.is_draw(ss->ply) || ss->ply >= MAX_PLY) - return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) : VALUE_DRAW; + return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) - 10 * ((ss-1)->statScore > 0) + : VALUE_DRAW; // Step 3. Mate distance pruning. Even if we mate at the next move our score // would be at best mate_in(ss->ply+1), but if alpha is already bigger because @@ -637,23 +691,13 @@ namespace { beta = std::min(mate_in(ss->ply+1), beta); if (alpha >= beta) return alpha; - - // Check for a move which draws by repetition, or an alternative earlier move to this position - if ( pos.rule50_count() >= 3 - && alpha < VALUE_DRAW - && pos.has_game_cycle(ss->ply)) - { - alpha = VALUE_DRAW; - if (alpha >= beta) - return alpha; - } } assert(0 <= ss->ply && ss->ply < MAX_PLY); (ss+1)->ply = ss->ply + 1; ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE; - ss->contHistory = thisThread->contHistory[NO_PIECE][0].get(); + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; Square prevSq = to_sq((ss-1)->currentMove); @@ -671,11 +715,12 @@ namespace { posKey = pos.key() ^ Key(excludedMove << 16); // Isn't a very good hash tte = TT.probe(posKey, ttHit); ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; - ttMove = rootNode ? thisThread->rootMoves[thisThread->PVIdx].pv[0] + ttMove = rootNode ? thisThread->rootMoves[thisThread->pvIdx].pv[0] : ttHit ? tte->move() : MOVE_NONE; // At non-PV nodes we check for an early TT cutoff if ( !PvNode + && !thisThread->pvDraw && ttHit && tte->depth() >= depth && ttValue != VALUE_NONE // Possible in case of TT access race @@ -698,7 +743,7 @@ namespace { else if (!pos.capture_or_promotion(ttMove)) { int penalty = -stat_bonus(depth); - thisThread->mainHistory[pos.side_to_move()][from_to(ttMove)] << penalty; + thisThread->mainHistory[us][from_to(ttMove)] << penalty; update_continuation_histories(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty); } } @@ -736,7 +781,7 @@ namespace { { tte->save(posKey, value_to_tt(value, ss->ply), b, std::min(DEPTH_MAX - ONE_PLY, depth + 6 * ONE_PLY), - MOVE_NONE, VALUE_NONE, TT.generation()); + MOVE_NONE, VALUE_NONE); return value; } @@ -752,18 +797,19 @@ namespace { } } - // Step 6. Evaluate the position statically + // Step 6. Static evaluation of the position if (inCheck) { - ss->staticEval = eval = VALUE_NONE; + ss->staticEval = eval = pureStaticEval = VALUE_NONE; improving = false; - goto moves_loop; + goto moves_loop; // Skip early pruning when in check } else if (ttHit) { // Never assume anything on values stored in TT - if ((ss->staticEval = eval = tte->eval()) == VALUE_NONE) - eval = ss->staticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval = tte->eval(); + if (eval == VALUE_NONE) + ss->staticEval = eval = pureStaticEval = evaluate(pos); // Can ttValue be used as a better position evaluation? if ( ttValue != VALUE_NONE @@ -772,59 +818,60 @@ namespace { } else { - ss->staticEval = eval = - (ss-1)->currentMove != MOVE_NULL ? evaluate(pos) - : -(ss-1)->staticEval + 2 * Eval::Tempo; + if ((ss-1)->currentMove != MOVE_NULL) + { + int p = (ss-1)->statScore; + int bonus = p > 0 ? (-p - 2500) / 512 : + p < 0 ? (-p + 2500) / 512 : 0; - tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, - ss->staticEval, TT.generation()); - } + pureStaticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval + bonus; + } + else + ss->staticEval = eval = pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo; - improving = ss->staticEval >= (ss-2)->staticEval - ||(ss-2)->staticEval == VALUE_NONE; + tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval); + } - if (skipEarlyPruning || !pos.non_pawn_material(pos.side_to_move())) - goto moves_loop; + // Step 7. Razoring (~2 Elo) + if ( !bruteForce && depth < 2 * ONE_PLY + && eval <= alpha - RazorMargin) + return qsearch(pos, ss, alpha, beta); - // Step 7. Razoring (skipped when in check), 2 Elo - if ( !bruteForce && !PvNode - && depth < 3 * ONE_PLY - && eval <= alpha - RazorMargin[depth / ONE_PLY]) - { - Value ralpha = alpha - (depth >= 2 * ONE_PLY) * RazorMargin[depth / ONE_PLY]; - Value v = qsearch(pos, ss, ralpha, ralpha+1); - if (depth < 2 * ONE_PLY || v <= ralpha) - return v; - } + improving = ss->staticEval >= (ss-2)->staticEval + || (ss-2)->staticEval == VALUE_NONE; - // Step 8. Futility pruning: child node (skipped when in check), 30 Elo + // Step 8. Futility pruning: child node (~30 Elo) if ( !bruteForce && !rootNode && depth < 7 * ONE_PLY && eval - futility_margin(depth, improving) >= beta && eval < VALUE_KNOWN_WIN) // Do not return unproven wins return eval; - // Step 9. Null move search with verification search, 40 Elo - if ( !noNULL && !PvNode + // Step 9. Null move search with verification search (~40 Elo) + if ( doNull + && !PvNode + && (ss-1)->currentMove != MOVE_NULL + && (ss-1)->statScore < 23200 && eval >= beta - && ss->staticEval >= beta - int(320 * log(depth / ONE_PLY)) + 500 // Ivan Ivec - && (((ss-2)->currentMove != MOVE_NULL) || (ss-2)->staticEval >= beta - 36 * depth / ONE_PLY + 225)// MichaeB7 - && thisThread->selDepth + 3 > thisThread->rootDepth / ONE_PLY // idea from Corchess/IIvec - && pos.non_pawn_material(pos.side_to_move()) > BishopValueMg //Ivam Ivec - && (ss->ply >= thisThread->nmp_ply || ss->ply % 2 != thisThread->nmp_odd) - && !(MoveList(pos).size() < 4)) //MichaelB7 + && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225 + && !excludedMove + && thisThread->selDepth + 3 > thisThread->rootDepth / ONE_PLY // idea from Corchess/IIvec + && pos.non_pawn_material(us) + && (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor) + && !(MoveList(pos).size() == 1)) //MichaelB7 { assert(eval - beta >= 0); // Null move dynamic reduction based on depth and value - Depth R = (int(2.6 * log(depth / ONE_PLY)) + std::min((eval - beta) / Value(170), 3)) * ONE_PLY; //Ivan Ivec + Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY; ss->currentMove = MOVE_NULL; - ss->contHistory = thisThread->contHistory[NO_PIECE][0].get(); + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; pos.do_null_move(st); - Value nullValue = -search(pos, ss+1, -beta, -beta+1, depth-R, !cutNode, true); + Value nullValue = -search(pos, ss+1, -beta, -beta+1, depth-R, !cutNode); pos.undo_null_move(); @@ -834,44 +881,44 @@ namespace { if (nullValue >= VALUE_MATE_IN_MAX_PLY) nullValue = beta; - if (abs(beta) < VALUE_KNOWN_WIN && (depth < 12 * ONE_PLY || thisThread->nmp_ply)) + if (thisThread->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 12 * ONE_PLY)) return nullValue; - // Do verification search at high depths. Disable null move pruning - // for side to move for the first part of the remaining search tree. - thisThread->nmp_ply = ss->ply + 3 * (depth-R) / 4; - thisThread->nmp_odd = ss->ply % 2; + assert(!thisThread->nmpMinPly); // Recursive verification is not allowed + + // Do verification search at high depths, with null move pruning disabled + // for us, until ply exceeds nmpMinPly. + thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / 4; + thisThread->nmpColor = us; - Value v = search(pos, ss, beta-1, beta, depth-R, false, true); + Value v = search(pos, ss, beta-1, beta, depth-R, false); - thisThread->nmp_odd = thisThread->nmp_ply = 0; + thisThread->nmpMinPly = 0; if (v >= beta) return nullValue; } } - // Step 10. ProbCut (skipped when in check), 10 Elo + // Step 10. ProbCut (~10 Elo) // If we have a good enough capture and a reduced search returns a value // much above beta, we can (almost) safely prune the previous move. if ( !PvNode && depth >= 5 * ONE_PLY && abs(beta) < VALUE_MATE_IN_MAX_PLY) { - assert(is_ok((ss-1)->currentMove)); - Value rbeta = std::min(beta + 216 - 48 * improving, VALUE_INFINITE); MovePicker mp(pos, ttMove, rbeta - ss->staticEval, &thisThread->captureHistory); int probCutCount = 0; while ( (move = mp.next_move()) != MOVE_NONE && probCutCount < 3) - if (pos.legal(move)) + if (move != excludedMove && pos.legal(move)) { probCutCount++; ss->currentMove = move; - ss->contHistory = thisThread->contHistory[pos.moved_piece(move)][to_sq(move)].get(); + ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; assert(depth >= 5 * ONE_PLY); @@ -882,7 +929,7 @@ namespace { // If the qsearch held perform the regular search if (value >= rbeta) - value = -search(pos, ss+1, -rbeta, -rbeta+1, depth - 4 * ONE_PLY, !cutNode, false); + value = -search(pos, ss+1, -rbeta, -rbeta+1, depth - 4 * ONE_PLY, !cutNode); pos.undo_move(move); @@ -891,13 +938,11 @@ namespace { } } - // Step 11. Internal iterative deepening (skipped when in check) , 2 Elo) - if ( depth >= 6 * ONE_PLY - && !ttMove - && (PvNode || ss->staticEval + 128 >= beta)) + // Step 11. Internal iterative deepening (~2 Elo) + if ( depth >= 8 * ONE_PLY + && !ttMove) { - Depth d = 3 * depth / 4 - 2 * ONE_PLY; - search(pos, ss, alpha, beta, d, cutNode, true); + search(pos, ss, alpha, beta, depth - 7 * ONE_PLY, cutNode); tte = TT.probe(posKey, ttHit); ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; @@ -906,10 +951,14 @@ namespace { moves_loop: // When in check, search starts from here - const PieceToHistory* contHist[] = { (ss-1)->contHistory, (ss-2)->contHistory, nullptr, (ss-4)->contHistory }; + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq]; - MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, &thisThread->captureHistory, contHist, countermove, ss->killers); + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, + countermove, + ss->killers); value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc skipQuiets = false; @@ -929,16 +978,16 @@ namespace { // Move List. As a consequence any illegal move is also skipped. In MultiPV // mode we also skip PV moves which have been already searched and those // of lower "TB rank" if we are in a TB root position. - if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->PVIdx, - thisThread->rootMoves.begin() + thisThread->PVLast, move)) + if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->pvIdx, + thisThread->rootMoves.begin() + thisThread->pvLast, move)) continue; ss->moveCount = ++moveCount; - if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) + if (!minOutput && rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) sync_cout << "info depth " << depth / ONE_PLY << " currmove " << UCI::move(move, pos.is_chess960()) - << " currmovenumber " << moveCount + thisThread->PVIdx << sync_endl; + << " currmovenumber " << moveCount + thisThread->pvIdx << sync_endl; if (PvNode) (ss+1)->pv = nullptr; @@ -950,7 +999,7 @@ namespace { moveCountPruning = depth < 16 * ONE_PLY && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY]; - // Step 13. Extensions, 70 Elo + // Step 13. Extensions (~70 Elo) // Singular extension search (~60 Elo). If all moves but one fail low on a // search of (alpha-s, beta-s), and just one fails high on (alpha, beta), @@ -968,39 +1017,33 @@ namespace { { Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE); ss->excludedMove = move; - value = search(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode, true); + value = search(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode); ss->excludedMove = MOVE_NONE; if (value < rBeta) extension = ONE_PLY; } - - else if (!moveCountPruning) - { - if ( givesCheck - && (pos.see_ge(move) || PvNode )) - extension = ONE_PLY; - - else if ( PvNode - && depth < 12 * ONE_PLY - && (( givesCheck || pos.advanced_pawn_push(move)))) - extension = ONE_PLY; - } + else if ( (givesCheck // Check extension (~2 Elo) + && !moveCountPruning + && pos.see_ge(move)) + || (pos.promotion_pawn_push(move) + && !moveCountPruning)) + extension = ONE_PLY; + // Calculate new depth for this move newDepth = depth - ONE_PLY + extension; - // Step 14. Pruning at shallow depth, 170 Elo + // Step 14. Pruning at shallow depth (~170 Elo) if ( !rootNode - && pos.non_pawn_material(pos.side_to_move()) + && pos.non_pawn_material(us) && bestValue > VALUE_MATED_IN_MAX_PLY) { if ( !captureOrPromotion && !givesCheck && (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= Value(5000))) { - // Move count based pruning - if (moveCountPruning - && !mp.is_refutation(move)) + // Move count based pruning (~30 Elo) + if (moveCountPruning) { skipQuiets = true; continue; @@ -1009,26 +1052,24 @@ namespace { // Reduced depth of the next LMR search int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY; - // Countermoves based pruning, 20 Elo - if ( lmrDepth < 3 + // Countermoves based pruning (~20 Elo) + if ( lmrDepth < 3 + ((ss-1)->statScore > 0) && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold) continue; - // Futility pruning: parent node, 2 Elo + // Futility pruning: parent node (~2 Elo) if ( lmrDepth < 7 && !inCheck && ss->staticEval + 256 + 200 * lmrDepth <= alpha) continue; - // Prune moves with negative SEE, 10 Elo - if ( lmrDepth < 8 - && !pos.see_ge(move, Value(-35 * lmrDepth * lmrDepth))) + // Prune moves with negative SEE (~10 Elo) + if (!pos.see_ge(move, Value(-29 * lmrDepth * lmrDepth))) continue; } - else if ( depth < 7 * ONE_PLY // 20 Elo - && !extension - && !pos.see_ge(move, -Value(CapturePruneMargin[depth / ONE_PLY]))) + else if ( !extension // (~20 Elo) + && !pos.see_ge(move, -PawnValueEg * (depth / ONE_PLY))) continue; } @@ -1047,67 +1088,68 @@ namespace { // Update the current move (this must be done after singular extension search) ss->currentMove = move; - ss->contHistory = thisThread->contHistory[movedPiece][to_sq(move)].get(); + ss->continuationHistory = &thisThread->continuationHistory[movedPiece][to_sq(move)]; // Step 15. Make the move pos.do_move(move, st, givesCheck); // Step 16. Reduced depth search (LMR). If the move fails high it will be // re-searched at full depth. - if ( depth >= 3 * ONE_PLY + if ( doLMR + && depth >= 3 * ONE_PLY && moveCount > 1 - && (!captureOrPromotion || moveCountPruning) - && !(PvNode && abs(alpha) > VALUE_KNOWN_WIN)) + && (!captureOrPromotion || moveCountPruning)) { Depth r = reduction(improving, depth, moveCount); - if (captureOrPromotion) // 5 Elo - r -= r ? ONE_PLY : DEPTH_ZERO; - else - { - // Decrease reduction if opponent's move count is high , 5 Elo - if ((ss-1)->moveCount > 15) - r -= ONE_PLY; + // Decrease reduction if opponent's move count is high (~10 Elo) + if ((ss-1)->moveCount > 15) + r -= ONE_PLY; - // Decrease reduction for exact PV nodes., 0 Elo) + if (!captureOrPromotion) + { + // Decrease reduction for exact PV nodes (~0 Elo) if (pvExact) r -= ONE_PLY; - // Increase reduction if ttMove is a capture ,0 Elo + // Increase reduction if ttMove is a capture (~0 Elo) if (ttCapture) r += ONE_PLY; - // Increase reduction for cut nodes, 5 Elo + // Increase reduction for cut nodes (~5 Elo) if (cutNode) r += 2 * ONE_PLY; // Decrease reduction for moves that escape a capture. Filter out // castling moves, because they are coded as "king captures rook" and - // hence break make_move , 5 Elo + // hence break make_move(). (~5 Elo) else if ( type_of(move) == NORMAL && !pos.see_ge(make_move(to_sq(move), from_sq(move)))) r -= 2 * ONE_PLY; - ss->statScore = thisThread->mainHistory[~pos.side_to_move()][from_to(move)] + ss->statScore = thisThread->mainHistory[us][from_to(move)] + (*contHist[0])[movedPiece][to_sq(move)] + (*contHist[1])[movedPiece][to_sq(move)] + (*contHist[3])[movedPiece][to_sq(move)] - 4000; - // Decrease/increase reduction by comparing opponent's stat score, 10 Elo + // Decrease/increase reduction by comparing opponent's stat score (~10 Elo) if (ss->statScore >= 0 && (ss-1)->statScore < 0) r -= ONE_PLY; else if ((ss-1)->statScore >= 0 && ss->statScore < 0) r += ONE_PLY; - // Decrease/increase reduction for moves with a good/bad history, 30 Elo - r = std::max(DEPTH_ZERO, (r / ONE_PLY - ss->statScore / 20000) * ONE_PLY); + // Decrease/increase reduction for moves with a good/bad history (~30 Elo) + r -= ss->statScore / 20000 * ONE_PLY; } + + // Set maximum reduction + r = std::min(r, maxLMR); + + Depth d = std::max(newDepth - std::max(r, DEPTH_ZERO), ONE_PLY); - Depth d = std::max(newDepth - r, ONE_PLY); - - value = -search(pos, ss+1, -(alpha+1), -alpha, d, true, false); + value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); doFullDepthSearch = (value > alpha && d != newDepth); } @@ -1116,7 +1158,7 @@ namespace { // Step 17. Full depth search when LMR is skipped or fails high if (doFullDepthSearch) - value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode, false); + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); // For PV nodes only, do a full PV search on the first move or after a fail // high (in the latter case search only if value < beta), otherwise let the @@ -1126,7 +1168,7 @@ namespace { (ss+1)->pv = pv; (ss+1)->pv[0] = MOVE_NONE; - value = -search(pos, ss+1, -beta, -alpha, newDepth, false, false); + value = -search(pos, ss+1, -beta, -alpha, newDepth, false); } // Step 18. Undo move @@ -1187,7 +1229,7 @@ namespace { else { assert(value >= beta); // Fail high - ss->statScore = std::max(ss->statScore, 0); + ss->statScore = 0; break; } } @@ -1225,16 +1267,17 @@ namespace { { // Quiet best move: update move sorting heuristics if (!pos.capture_or_promotion(bestMove)) - update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, stat_bonus(depth)); - else - update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth)); + update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, + stat_bonus(depth + (bestValue > beta + PawnValueMg ? ONE_PLY : DEPTH_ZERO))); + + update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY)); // Extra penalty for a quiet TT move in previous ply when it gets refuted if ((ss-1)->moveCount == 1 && !pos.captured_piece()) update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY)); } // Bonus for prior countermove that caused the fail low - else if ( depth >= 3 * ONE_PLY + else if ( (depth >= 3 * ONE_PLY || PvNode) && !pos.captured_piece() && is_ok((ss-1)->currentMove)) update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth)); @@ -1246,7 +1289,7 @@ namespace { tte->save(posKey, value_to_tt(bestValue, ss->ply), bestValue >= beta ? BOUND_LOWER : PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, - depth, bestMove, ss->staticEval, TT.generation()); + depth, bestMove, pureStaticEval); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); @@ -1283,8 +1326,10 @@ namespace { ss->pv[0] = MOVE_NONE; } + Thread* thisThread = pos.this_thread(); (ss+1)->ply = ss->ply + 1; ss->currentMove = bestMove = MOVE_NONE; + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; inCheck = pos.checkers(); moveCount = 0; @@ -1293,16 +1338,6 @@ namespace { || ss->ply >= MAX_PLY) return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) : VALUE_DRAW; - // Check for a move which draws by repetition, or an alternative earlier move to this position - if ( pos.rule50_count() >= 3 - && alpha < VALUE_DRAW - && pos.has_game_cycle(ss->ply)) - { - alpha = VALUE_DRAW; - if (alpha >= beta) - return alpha; - } - assert(0 <= ss->ply && ss->ply < MAX_PLY); // Decide whether or not to include checks: this fixes also the type of @@ -1320,8 +1355,8 @@ namespace { && ttHit && tte->depth() >= ttDepth && ttValue != VALUE_NONE // Only in case of TT access race - && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) - : (tte->bound() & BOUND_UPPER))) + && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) + : (tte->bound() & BOUND_UPPER))) return ttValue; // Evaluate the position statically @@ -1339,7 +1374,7 @@ namespace { ss->staticEval = bestValue = evaluate(pos); // Can ttValue be used as a better position evaluation? - if ( ttValue != VALUE_NONE + if ( ttValue != VALUE_NONE && (tte->bound() & (ttValue > bestValue ? BOUND_LOWER : BOUND_UPPER))) bestValue = ttValue; } @@ -1353,7 +1388,7 @@ namespace { { if (!ttHit) tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, - DEPTH_NONE, MOVE_NONE, ss->staticEval, TT.generation()); + DEPTH_NONE, MOVE_NONE, ss->staticEval); return bestValue; } @@ -1364,11 +1399,16 @@ namespace { futilityBase = bestValue + 128; } + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; + // Initialize a MovePicker object for the current position, and prepare // to search the moves. Because the depth is <= 0 here, only captures, // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will // be generated. - MovePicker mp(pos, ttMove, depth, &pos.this_thread()->mainHistory, &pos.this_thread()->captureHistory, to_sq((ss-1)->currentMove)); + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, + to_sq((ss-1)->currentMove)); // Loop through the moves until no moves remain or a beta cutoff occurs while ((move = mp.next_move()) != MOVE_NONE) @@ -1424,6 +1464,7 @@ namespace { } ss->currentMove = move; + ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; // Make and search the move pos.do_move(move, st, givesCheck); @@ -1450,13 +1491,16 @@ namespace { else // Fail high { tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER, - ttDepth, move, ss->staticEval, TT.generation()); + ttDepth, move, ss->staticEval); return value; } } } } + + if (variety && (bestValue + (variety * PawnValueEg / 100) >= 0 )) + bestValue += rand() % (variety + 1); // All legal moves have been searched. A special case: If we're in check // and no legal moves were found, it is checkmate. @@ -1465,7 +1509,7 @@ namespace { tte->save(posKey, value_to_tt(bestValue, ss->ply), PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, - ttDepth, bestMove, ss->staticEval, TT.generation()); + ttDepth, bestMove, ss->staticEval); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); @@ -1515,7 +1559,7 @@ namespace { for (int i : {1, 2, 4}) if (is_ok((ss-i)->currentMove)) - (*(ss-i)->contHistory)[pc][to] << bonus; + (*(ss-i)->continuationHistory)[pc][to] << bonus; } @@ -1527,7 +1571,9 @@ namespace { CapturePieceToHistory& captureHistory = pos.this_thread()->captureHistory; Piece moved_piece = pos.moved_piece(move); PieceType captured = type_of(pos.piece_on(to_sq(move))); - captureHistory[moved_piece][to_sq(move)][captured] << bonus; + + if (pos.capture_or_promotion(move)) + captureHistory[moved_piece][to_sq(move)][captured] << bonus; // Decrease all the other played capture moves for (int i = 0; i < captureCnt; ++i) @@ -1602,6 +1648,23 @@ namespace { return best; } + // is the PV leading to a draw position ? + bool PV_is_draw(Position& pos) { + auto& pv = pos.this_thread()->rootMoves[0].pv; + StateInfo st[MAX_PLY]; + + for (size_t i = 0; i < pv.size(); i++) + pos.do_move(pv[i], st[i]); + + bool isDraw = pos.is_draw(pv.size()); + + for (size_t i = pv.size(); i > 0; i--) + pos.undo_move(pv[i-1]); + + return isDraw; + } + + } // namespace /// MainThread::check_time() is used to print debug info and, more importantly, @@ -1643,23 +1706,16 @@ void MainThread::check_time() { string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { std::stringstream ss; - int temp = 0; TimePoint elapsed = Time.elapsed() + 1; const RootMoves& rootMoves = pos.this_thread()->rootMoves; - size_t PVIdx = pos.this_thread()->PVIdx; + size_t pvIdx = pos.this_thread()->pvIdx; size_t multiPV = std::min((size_t)Options["MultiPV"], rootMoves.size()); uint64_t nodesSearched = Threads.nodes_searched(); uint64_t tbHits = Threads.tb_hits() + (TB::RootInTB ? rootMoves.size() : 0); - - if (tactical) - { - temp = multiPV; - multiPV = 1; - } for (size_t i = 0; i < multiPV; ++i) { - bool updated = (i <= PVIdx && rootMoves[i].score != -VALUE_INFINITE); + bool updated = (i <= pvIdx && rootMoves[i].score != -VALUE_INFINITE); if (depth == ONE_PLY && !updated) continue; @@ -1668,7 +1724,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { Value v = updated ? rootMoves[i].score : rootMoves[i].previousScore; bool tb = TB::RootInTB && abs(v) < VALUE_MATE - MAX_PLY; - v = tb ? rootMoves[i].TBScore : v; + v = tb ? rootMoves[i].tbScore : v; if (ss.rdbuf()->in_avail()) // Not at first line ss << "\n"; @@ -1679,7 +1735,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { << " multipv " << i + 1 << " score " << UCI::value(v); - if (!tb && i == PVIdx) + if (!tb && i == pvIdx) ss << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : ""); ss << " nodes " << nodesSearched @@ -1695,7 +1751,7 @@ string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { for (Move m : rootMoves[i].pv) ss << " " << UCI::move(m, pos.is_chess960()); } - if (tactical) multiPV = temp; + return ss.str(); } @@ -1762,16 +1818,16 @@ void Tablebases::rank_root_moves(Position& pos, Search::RootMoves& rootMoves) { { // Sort moves according to TB rank std::sort(rootMoves.begin(), rootMoves.end(), - [](const RootMove &a, const RootMove &b) { return a.TBRank > b.TBRank; } ); + [](const RootMove &a, const RootMove &b) { return a.tbRank > b.tbRank; } ); // Probe during search only if DTZ is not available and we are winning - if (dtz_available || rootMoves[0].TBScore <= VALUE_DRAW) + if (dtz_available || rootMoves[0].tbScore <= VALUE_DRAW) Cardinality = 0; } else { // Assign the same rank to all moves for (auto& m : rootMoves) - m.TBRank = 0; + m.tbRank = 0; } } diff --git a/Engines/Linux64/mcbrain/src/search.h b/Engines/Linux64/mcbrain/src/search.h index 5508001..7faa36c 100644 --- a/Engines/Linux64/mcbrain/src/search.h +++ b/Engines/Linux64/mcbrain/src/search.h @@ -29,7 +29,6 @@ #include "types.h" class Position; - namespace Search { /// Threshold used for countermoves based pruning @@ -42,7 +41,7 @@ constexpr int CounterMovePruneThreshold = 0; struct Stack { Move* pv; - PieceToHistory* contHistory; + PieceToHistory* continuationHistory; int ply; Move currentMove; Move excludedMove; @@ -70,8 +69,8 @@ struct RootMove { Value score = -VALUE_INFINITE; Value previousScore = -VALUE_INFINITE; int selDepth = 0; - int TBRank; - Value TBScore; + int tbRank; + Value tbScore; std::vector pv; }; @@ -101,7 +100,7 @@ struct LimitsType { extern LimitsType Limits; -void init(); +void init(bool OptioncleanSearch); void clear(); } // namespace Search diff --git a/Engines/Linux64/mcbrain/src/stockfish-current b/Engines/Linux64/mcbrain/src/stockfish-current deleted file mode 100644 index 6be8e6d..0000000 Binary files a/Engines/Linux64/mcbrain/src/stockfish-current and /dev/null differ diff --git a/Engines/Linux64/mcbrain/src/syzygy/.DS_Store b/Engines/Linux64/mcbrain/src/syzygy/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Engines/Linux64/mcbrain/src/syzygy/.DS_Store differ diff --git a/Engines/Linux64/mcbrain/src/syzygy/tbprobe.cpp b/Engines/Linux64/mcbrain/src/syzygy/tbprobe.cpp index fbd5c6d..dfcb33f 100644 --- a/Engines/Linux64/mcbrain/src/syzygy/tbprobe.cpp +++ b/Engines/Linux64/mcbrain/src/syzygy/tbprobe.cpp @@ -1,21 +1,23 @@ /* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (c) 2013 Ronald de Man - Copyright (C) 2016-2018 Marco Costalba, Lucas Braesch - - Stockfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Stockfish is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ #include #include @@ -55,13 +57,13 @@ int Tablebases::MaxCardinality; namespace { -constexpr int TBPIECES = 6; // Max number of supported pieces +constexpr int TBPIECES = 7; // Max number of supported pieces enum { BigEndian, LittleEndian }; enum TBType { KEY, WDL, DTZ }; // Used as template parameter // Each table has a set of flags: all of them refer to DTZ tables, the last one to WDL tables -enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, SingleValue = 128 }; +enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, Wide = 16, SingleValue = 128 }; inline WDLScore operator-(WDLScore d) { return WDLScore(-int(d)); } inline Square operator^=(Square& s, int i) { return s = Square(int(s) ^ i); } @@ -75,8 +77,8 @@ int MapA1D1D4[SQUARE_NB]; int MapKK[10][SQUARE_NB]; // [MapA1D1D4][SQUARE_NB] int Binomial[6][SQUARE_NB]; // [k][n] k elements from a set of n elements -int LeadPawnIdx[5][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] -int LeadPawnsSize[5][4]; // [leadPawnsCnt][FILE_A..FILE_D] +int LeadPawnIdx[6][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] +int LeadPawnsSize[6][4]; // [leadPawnsCnt][FILE_A..FILE_D] // Comparison function to sort leading pawns in ascending MapPawns[] order bool pawns_comp(Square i, Square j) { return MapPawns[i] < MapPawns[j]; } @@ -144,16 +146,15 @@ static_assert(sizeof(SparseEntry) == 6, "SparseEntry must be 6 bytes"); typedef uint16_t Sym; // Huffman symbol struct LR { - enum Side { Left, Right, Value }; + enum Side { Left, Right }; uint8_t lr[3]; // The first 12 bits is the left-hand symbol, the second 12 // bits is the right-hand symbol. If symbol has length 1, - // then the first byte is the stored value. + // then the left-hand symbol is the stored value. template Sym get() { return S == Left ? ((lr[1] & 0xF) << 8) | lr[0] : - S == Right ? (lr[2] << 4) | (lr[1] >> 4) : - S == Value ? lr[0] : (assert(false), Sym(-1)); + S == Right ? (lr[2] << 4) | (lr[1] >> 4) : (assert(false), Sym(-1)); } }; @@ -385,22 +386,35 @@ class TBTables { typedef std::tuple*, TBTable*> Entry; - static const int Size = 1 << 12; // 4K table, indexed by key's 12 lsb + static constexpr int Size = 1 << 12; // 4K table, indexed by key's 12 lsb + static constexpr int Overflow = 1; // Number of elements allowed to map to the last bucket - Entry hashTable[Size]; + Entry hashTable[Size + Overflow]; std::deque> wdlTable; std::deque> dtzTable; void insert(Key key, TBTable* wdl, TBTable* dtz) { - Entry* entry = &hashTable[(uint32_t)key & (Size - 1)]; + uint32_t homeBucket = (uint32_t)key & (Size - 1); + Entry entry = std::make_tuple(key, wdl, dtz); // Ensure last element is empty to avoid overflow when looking up - for ( ; entry - hashTable < Size - 1; ++entry) - if (std::get(*entry) == key || !std::get(*entry)) { - *entry = std::make_tuple(key, wdl, dtz); + for (uint32_t bucket = homeBucket; bucket < Size + Overflow - 1; ++bucket) { + Key otherKey = std::get(hashTable[bucket]); + if (otherKey == key || !std::get(hashTable[bucket])) { + hashTable[bucket] = entry; return; } + + // Robin Hood hashing: If we've probed for longer than this element, + // insert here and search for a new spot for the other element instead. + uint32_t otherHomeBucket = (uint32_t)otherKey & (Size - 1); + if (otherHomeBucket > homeBucket) { + swap(entry, hashTable[bucket]); + key = otherKey; + homeBucket = otherHomeBucket; + } + } std::cerr << "TB hash table size too low!" << std::endl; exit(1); } @@ -512,7 +526,7 @@ int decompress_pairs(PairsData* d, uint64_t idx) { offset -= d->blockLength[block++] + 1; // Finally, we find the start address of our block of canonical Huffman symbols - uint32_t* ptr = (uint32_t*)(d->data + block * d->sizeofBlock); + uint32_t* ptr = (uint32_t*)(d->data + ((uint64_t)block * d->sizeofBlock)); // Read the first 64 bits in our block, this is a (truncated) sequence of // unknown number of symbols of unknown length but we know the first one @@ -575,7 +589,7 @@ int decompress_pairs(PairsData* d, uint64_t idx) { } } - return d->btree[sym].get(); + return d->btree[sym].get(); } bool check_dtz_stm(TBTable*, int, File) { return true; } @@ -601,8 +615,12 @@ int map_score(TBTable* entry, File f, int value, WDLScore wdl) { uint8_t* map = entry->map; uint16_t* idx = entry->get(0, f)->map_idx; - if (flags & TBFlag::Mapped) - value = map[idx[WDLMap[wdl + 2]] + value]; + if (flags & TBFlag::Mapped) { + if (flags & TBFlag::Wide) + value = ((uint16_t *)map)[idx[WDLMap[wdl + 2]] + value]; + else + value = map[idx[WDLMap[wdl + 2]] + value]; + } // DTZ tables store distance to zero in number of moves or plies. We // want to return plies, so we have convert to plies when needed. @@ -973,7 +991,7 @@ uint8_t* set_sizes(PairsData* d, uint8_t* data) { d->symlen.resize(number(data)); data += sizeof(uint16_t); d->btree = (LR*)data; - // The comrpession scheme used is "Recursive Pairing", that replaces the most + // The compression scheme used is "Recursive Pairing", that replaces the most // frequent adjacent pair of symbols in the source message by a new symbol, // reevaluating the frequencies of all of the symbol pairs with respect to // the extended alphabet, and then repeating the process. @@ -994,11 +1012,22 @@ uint8_t* set_dtz_map(TBTable& e, uint8_t* data, File maxFile) { e.map = data; for (File f = FILE_A; f <= maxFile; ++f) { - if (e.get(0, f)->flags & TBFlag::Mapped) - for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x - e.get(0, f)->map_idx[i] = (uint16_t)(data - e.map + 1); - data += *data + 1; + auto flags = e.get(0, f)->flags; + if (flags & TBFlag::Mapped) { + if (flags & TBFlag::Wide) { + data += (uintptr_t)data & 1; // Word alignment, we may have a mixed table + for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x + e.get(0, f)->map_idx[i] = (uint16_t)((uint16_t *)data - (uint16_t *)e.map + 1); + data += 2 * number(data) + 2; + } } + else { + for (int i = 0; i < 4; ++i) { + e.get(0, f)->map_idx[i] = (uint16_t)(data - e.map + 1); + data += *data + 1; + } + } + } } return data += (uintptr_t)data & 1; // Word alignment @@ -1131,11 +1160,11 @@ Ret probe_table(const Position& pos, ProbeState* result, WDLScore wdl = WDLDraw) // All of this means that during probing, the engine must look at captures and probe // their results and must probe the position itself. The "best" result of these // probes is the correct result for the position. -// DTZ table don't store values when a following move is a zeroing winning move +// DTZ tables do not store values when a following move is a zeroing winning move // (winning capture or winning pawn move). Also DTZ store wrong values for positions // where the best move is an ep-move (even if losing). So in all these cases set // the state to ZEROING_BEST_MOVE. -template +template WDLScore search(Position& pos, ProbeState* result) { WDLScore value, bestValue = WDLLoss; @@ -1153,7 +1182,7 @@ WDLScore search(Position& pos, ProbeState* result) { moveCount++; pos.do_move(move, st); - value = -search(pos, result); + value = -search(pos, result); pos.undo_move(move); if (*result == FAIL) @@ -1274,9 +1303,9 @@ void Tablebases::init(const std::string& paths) { // among pawns with same file, the one with lowest rank. int availableSquares = 47; // Available squares when lead pawn is in a2 - // Init the tables for the encoding of leading pawns group: with 6-men TB we - // can have up to 4 leading pawns (KPPPPK). - for (int leadPawnsCnt = 1; leadPawnsCnt <= 4; ++leadPawnsCnt) + // Init the tables for the encoding of leading pawns group: with 7-men TB we + // can have up to 5 leading pawns (KPPPPPK). + for (int leadPawnsCnt = 1; leadPawnsCnt <= 5; ++leadPawnsCnt) for (File f = FILE_A; f <= FILE_D; ++f) { // Restart the index at every file because TB table is splitted @@ -1320,11 +1349,22 @@ void Tablebases::init(const std::string& paths) { for (PieceType p3 = PAWN; p3 <= p2; ++p3) { TBTables.add({KING, p1, p2, p3, KING}); - for (PieceType p4 = PAWN; p4 <= p3; ++p4) + for (PieceType p4 = PAWN; p4 <= p3; ++p4) { TBTables.add({KING, p1, p2, p3, p4, KING}); - for (PieceType p4 = PAWN; p4 < KING; ++p4) + for (PieceType p5 = PAWN; p5 <= p4; ++p5) + TBTables.add({KING, p1, p2, p3, p4, p5, KING}); + + for (PieceType p5 = PAWN; p5 < KING; ++p5) + TBTables.add({KING, p1, p2, p3, p4, KING, p5}); + } + + for (PieceType p4 = PAWN; p4 < KING; ++p4) { TBTables.add({KING, p1, p2, p3, KING, p4}); + + for (PieceType p5 = PAWN; p5 <= p4; ++p5) + TBTables.add({KING, p1, p2, p3, KING, p4, p5}); + } } for (PieceType p3 = PAWN; p3 <= p1; ++p3) @@ -1347,7 +1387,7 @@ void Tablebases::init(const std::string& paths) { WDLScore Tablebases::probe_wdl(Position& pos, ProbeState* result) { *result = OK; - return search(pos, result); + return search(pos, result); } // Probe the DTZ table for a particular position. @@ -1412,7 +1452,7 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result) { // otherwise we will get the dtz of the next move sequence. Search the // position after the move to get the score sign (because even in a // winning position we could make a losing capture or going for a draw). - dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) + dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) : -probe_dtz(pos, result); // If the move mates, force minDTZ to 1 @@ -1491,12 +1531,12 @@ bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves) { int r = dtz > 0 ? (dtz + cnt50 <= 99 && !rep ? 1000 : 1000 - (dtz + cnt50)) : dtz < 0 ? (-dtz * 2 + cnt50 < 100 ? -1000 : -1000 + (-dtz + cnt50)) : 0; - m.TBRank = r; + m.tbRank = r; // Determine the score to be displayed for this move. Assign at least // 1 cp to cursed wins and let it grow to 49 cp as the positions gets // closer to a real win. - m.TBScore = r >= bound ? VALUE_MATE - MAX_PLY - 1 + m.tbScore = r >= bound ? VALUE_MATE - MAX_PLY - 1 : r > 0 ? Value((std::max( 3, r - 800) * int(PawnValueEg)) / 200) : r == 0 ? VALUE_DRAW : r > -bound ? Value((std::min(-3, r + 800) * int(PawnValueEg)) / 200) @@ -1532,12 +1572,12 @@ bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves) { if (result == FAIL) return false; - m.TBRank = WDL_to_rank[wdl + 2]; + m.tbRank = WDL_to_rank[wdl + 2]; if (!rule50) wdl = wdl > WDLDraw ? WDLWin : wdl < WDLDraw ? WDLLoss : WDLDraw; - m.TBScore = WDL_to_value[wdl + 2]; + m.tbScore = WDL_to_value[wdl + 2]; } return true; diff --git a/Engines/Linux64/mcbrain/src/syzygy/tbprobe.h b/Engines/Linux64/mcbrain/src/syzygy/tbprobe.h index 572265b..3fcb3d8 100644 --- a/Engines/Linux64/mcbrain/src/syzygy/tbprobe.h +++ b/Engines/Linux64/mcbrain/src/syzygy/tbprobe.h @@ -1,21 +1,23 @@ /* - Stockfish, a UCI chess playing engine derived from Glaurung 2.1 - Copyright (c) 2013 Ronald de Man - Copyright (C) 2016-2018 Marco Costalba, Lucas Braesch - - Stockfish is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Stockfish is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ #ifndef TBPROBE_H #define TBPROBE_H diff --git a/Engines/Linux64/mcbrain/src/syzygy/tbprobe.o b/Engines/Linux64/mcbrain/src/syzygy/tbprobe.o new file mode 100644 index 0000000..992b27f Binary files /dev/null and b/Engines/Linux64/mcbrain/src/syzygy/tbprobe.o differ diff --git a/Engines/Linux64/mcbrain/src/thread.cpp b/Engines/Linux64/mcbrain/src/thread.cpp index a4a152a..a72e91e 100644 --- a/Engines/Linux64/mcbrain/src/thread.cpp +++ b/Engines/Linux64/mcbrain/src/thread.cpp @@ -27,6 +27,7 @@ #include "thread.h" #include "uci.h" #include "syzygy/tbprobe.h" +#include "tt.h" ThreadPool Threads; // Global object @@ -61,11 +62,11 @@ void Thread::clear() { mainHistory.fill(0); captureHistory.fill(0); - for (auto& to : contHistory) + for (auto& to : continuationHistory) for (auto& h : to) - h.get()->fill(0); + h->fill(0); - contHistory[NO_PIECE][0].get()->fill(Search::CounterMovePruneThreshold - 1); + continuationHistory[NO_PIECE][0]->fill(Search::CounterMovePruneThreshold - 1); } /// Thread::start_searching() wakes up the thread that will start the search @@ -98,7 +99,7 @@ void Thread::idle_loop() { // some Windows NUMA hardware, for instance in fishtest. To make it simple, // just check if running threads are below a threshold, in this case all this // NUMA machinery is not needed. - if (Options["Threads"] >= 8) + if (int(Options["Threads"]) >= 8) WinProcGroup::bindThisThread(idx); while (true) @@ -118,7 +119,7 @@ void Thread::idle_loop() { } /// ThreadPool::set() creates/destroys threads to match the requested number. -/// Created and launched threads wil go immediately to sleep in idle_loop. +/// Created and launched threads will go immediately to sleep in idle_loop. /// Upon resizing, threads are recreated to allow for binding if necessary. void ThreadPool::set(size_t requested) { @@ -137,6 +138,9 @@ void ThreadPool::set(size_t requested) { push_back(new Thread(size())); clear(); } + + // Reallocate the hash with the new threadpool size + TT.resize(Options["Hash"]); } /// ThreadPool::clear() sets threadPool data to initial values. @@ -188,7 +192,7 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states, for (Thread* th : *this) { - th->nodes = th->tbHits = th->nmp_ply = th->nmp_odd = 0; + th->nodes = th->tbHits = th->nmpMinPly = 0; th->rootDepth = th->completedDepth = DEPTH_ZERO; th->rootMoves = rootMoves; th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th); diff --git a/Engines/Linux64/mcbrain/src/thread.h b/Engines/Linux64/mcbrain/src/thread.h index fcbfc9b..505dd27 100644 --- a/Engines/Linux64/mcbrain/src/thread.h +++ b/Engines/Linux64/mcbrain/src/thread.h @@ -61,8 +61,9 @@ class Thread { Pawns::Table pawnsTable; Material::Table materialTable; Endgames endgames; - size_t PVIdx, PVLast; - int selDepth, nmp_ply, nmp_odd; + size_t pvIdx, pvLast; + int selDepth, nmpMinPly; + Color nmpColor; std::atomic nodes, tbHits; Position rootPos; @@ -71,8 +72,9 @@ class Thread { CounterMoveHistory counterMoves; ButterflyHistory mainHistory; CapturePieceToHistory captureHistory; - ContinuationHistory contHistory; + ContinuationHistory continuationHistory; Score contempt; + bool pvDraw; }; @@ -85,7 +87,6 @@ struct MainThread : public Thread { void search() override; void check_time(); - bool failedLow; double bestMoveChanges, previousTimeReduction; Value previousScore; int callsCnt; diff --git a/Engines/Linux64/mcbrain/src/tt.cpp b/Engines/Linux64/mcbrain/src/tt.cpp index 1aed0f3..7408ea8 100644 --- a/Engines/Linux64/mcbrain/src/tt.cpp +++ b/Engines/Linux64/mcbrain/src/tt.cpp @@ -21,11 +21,126 @@ #include // For std::memset #include - +#include +#include +#include "uci.h" +using std::string; +#include +#include +#include +#include +#include +#include "position.h" +#include "thread.h" #include "bitboard.h" #include "tt.h" +#include "misc.h" +#include "tt.h" +#include "uci.h" + +#ifdef _WIN32 + +#include +#undef max +#undef min + +#endif + +//https://stackoverflow.com/questions/236129/most-elegant-way-to-split-a-string +template +void split(const std::string &s, char delim, Out result) { + std::stringstream ss; + ss.str(s); + std::string item; + while (std::getline(ss, item, delim)) { + *(result++) = item; + } +} + +std::vector split(const std::string &s, char delim) { + std::vector elems; + split(s, delim, std::back_inserter(elems)); + return elems; +} TranspositionTable TT; // Our global transposition table +#ifdef _WIN32 +int use_large_pages = -1; +int got_privileges = -1; +#endif + +#ifdef _WIN32 +bool Get_LockMemory_Privileges() +{ + HANDLE TH, PROC7; + TOKEN_PRIVILEGES tp; + bool ret = false; + + PROC7 = GetCurrentProcess(); + if (OpenProcessToken(PROC7, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &TH)) + { + if (LookupPrivilegeValue(NULL, TEXT("SeLockMemoryPrivilege"), &tp.Privileges[0].Luid)) + { + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + if (AdjustTokenPrivileges(TH, FALSE, &tp, 0, NULL, 0)) + { + if (GetLastError() != ERROR_NOT_ALL_ASSIGNED) + ret = true; + } + } + CloseHandle(TH); + } + return ret; +} + + +void Try_Get_LockMemory_Privileges() +{ + use_large_pages = 0; + + if (bool(Options["Large Pages"]) == false) + return; + + if (got_privileges == -1) + { + if (Get_LockMemory_Privileges() == true) + got_privileges = 1; + else + { + sync_cout << "No Privilege for Large Pages" << sync_endl; + got_privileges = 0; + } + } + + if (got_privileges == 0) + return; + + use_large_pages = 1; +} +#endif + +/// TTEntry::save saves a TTEntry +void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) { + + assert(d / ONE_PLY * ONE_PLY == d); + + // Preserve any existing move for the same position + if (m || (k >> 48) != key16) + move16 = (uint16_t)m; + + // Overwrite less valuable entries + if ( (k >> 48) != key16 + || d / ONE_PLY > depth8 - 4 + || b == BOUND_EXACT) + { + key16 = (uint16_t)(k >> 48); + value16 = (int16_t)v; + eval16 = (int16_t)ev; + genBound8 = (uint8_t)(TT.generation8 | b); + depth8 = (int8_t)(d / ONE_PLY); + } +} /// TranspositionTable::resize() sets the size of the transposition table, @@ -34,37 +149,460 @@ TranspositionTable TT; // Our global transposition table void TranspositionTable::resize(size_t mbSize) { + if (mbSize == 0) + mbSize = mbSize_last_used; + + if (mbSize == 0) + return; + + mbSize_last_used = mbSize; + +#ifdef _WIN32 + Try_Get_LockMemory_Privileges(); +#endif + size_t newClusterCount = mbSize * 1024 * 1024 / sizeof(Cluster); if (newClusterCount == clusterCount) - return; + { +#ifdef _WIN32 + if ((use_large_pages == 1) && (large_pages_used)) + return; + if ((use_large_pages == 0) && (large_pages_used == false)) +#endif + return; + } clusterCount = newClusterCount; + +#ifdef _WIN32 + if (use_large_pages < 1) +#endif + { + if (mem != NULL) + { +#ifdef _WIN32 + if (large_pages_used) + VirtualFree(mem, 0, MEM_RELEASE); + else +#endif + free(mem); + } - free(mem); - mem = malloc(clusterCount * sizeof(Cluster) + CacheLineSize - 1); + size_t memsize = clusterCount * sizeof(Cluster) + CacheLineSize - 1; + mem = calloc(memsize, 1); +#ifdef _WIN32 + large_pages_used = false; +#endif + } +#ifdef _WIN32 + else + { + if (mem != NULL) + { + if (large_pages_used) + VirtualFree(mem, 0, MEM_RELEASE); + else + free(mem); + } + + size_t memsize = clusterCount * sizeof(Cluster); + mem = VirtualAlloc(NULL, memsize, MEM_LARGE_PAGES | MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (mem == NULL) + { + std::cerr << "Failed to allocate " << mbSize + << "MB Large Page Memory for transposition table, switching to default" << std::endl; + + use_large_pages = 0; + memsize = clusterCount * sizeof(Cluster) + CacheLineSize - 1; + mem = malloc(memsize); + large_pages_used = false; + } + else + { + sync_cout << "info string LargePages " << (memsize >> 20) << " MiB" << sync_endl; + large_pages_used = true; + } + + } +#endif if (!mem) { std::cerr << "Failed to allocate " << mbSize - << "MB for transposition table." << std::endl; + << "MiB for transposition table." << std::endl; exit(EXIT_FAILURE); } table = (Cluster*)((uintptr_t(mem) + CacheLineSize - 1) & ~(CacheLineSize - 1)); - clear(); } -/// TranspositionTable::clear() overwrites the entire transposition table -/// with zeros. It is called whenever the table is resized, or when the -/// user asks the program to clear the table (from the UCI interface). +/// TranspositionTable::clear() initializes the entire transposition table to zero, +// in a multi-threaded way. void TranspositionTable::clear() { - std::memset(table, 0, clusterCount * sizeof(Cluster)); + std::vector threads; + + for (size_t idx = 0; idx < size_t(Options["Threads"]); idx++) + { + threads.push_back(std::thread([this, idx]() { + + // Thread binding gives faster search on systems with a first-touch policy + if (int(Options["Threads"]) >= 8) + WinProcGroup::bindThisThread(idx); + + // Each thread will zero its part of the hash table + const size_t stride = clusterCount / size_t(Options["Threads"]), + start = stride * idx, + len = idx != size_t(Options["Threads"]) - 1 ? + stride : clusterCount - start; + + std::memset(&table[start], 0, len * sizeof(Cluster)); + })); + } + + for (std::thread& th: threads) + th.join(); +} + +void TranspositionTable::set_hash_file_name(const std::string& fname) { hashfilename = fname; } + +bool TranspositionTable::save() { + std::ofstream b_stream(hashfilename, + std::fstream::out | std::fstream::binary); + if (b_stream) + { + //b_stream.write(reinterpret_cast(table), clusterCount * sizeof(Cluster)); + for (unsigned long long i = 0; i < clusterCount * sizeof(Cluster); i += (1 << 30)) { //1GB +#ifndef __min + #define __min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + unsigned long long j = __min((1 << 30), (clusterCount * sizeof(Cluster)) - i); + b_stream.write(reinterpret_cast(table) + i, j); + } + return (b_stream.good()); + } + return false; +} + +void TranspositionTable::load() { + //file size: https://stackoverflow.com/questions/2409504/using-c-filestreams-fstream-how-can-you-determine-the-size-of-a-file + std::ifstream file; + file.open(hashfilename, std::ios::in | std::ios::binary); + file.ignore(std::numeric_limits::max()); + std::streamsize size = file.gcount(); + file.clear(); // Since ignore will have set eof. + resize(size_t(size / 1024 / 1024)); + file.seekg(0, std::ios::beg); + file.read(reinterpret_cast(table), clusterCount * sizeof(Cluster)); +} + +enum { SAN_MOVE_NORMAL, SAN_PAWN_CAPTURE }; + +//taken from stockfish-TCEC6-PA_GTB +template inline Move test_move(Position &pos, Square fromsquare, Square tosquare, PieceType promotion) +{ + Move move; + + if (MoveType == SAN_MOVE_NORMAL) { + if (promotion != NO_PIECE_TYPE) { + move = make(fromsquare, tosquare, promotion); + } + else { + move = make(fromsquare, tosquare); + } + } + else if (MoveType == SAN_PAWN_CAPTURE) { + if (pos.ep_square() == tosquare) { + move = make(fromsquare, tosquare); + } + else { + if (promotion != NO_PIECE_TYPE) { + move = make(fromsquare, tosquare, promotion); + } + else { + move = make(fromsquare, tosquare); + } + } + } + //if (pos.pseudo_legal(move) && pos.legal(move, pos.pinned_pieces(pos.side_to_move()))) { + if (pos.pseudo_legal(move) && pos.legal(move)) { +#ifdef SAN_DEBUG + sync_cout << "found a move: " << move_to_uci(move, false) << sync_endl; +#endif + return move; + } + else { +#ifdef SAN_DEBUG + sync_cout << "invalid move: " << move_to_uci(move, false) << sync_endl; +#endif + return MOVE_NONE; // invalid; + } + return MOVE_NONE; +} + +//taken from stockfish-TCEC6-PA_GTB +Move san_to_move(Position& pos, std::string& str) +{ + std::string uci = str; + PieceType promotion = NO_PIECE_TYPE; + bool castles = false; + bool capture = false; + Move move = MOVE_NONE; + + size_t idx = uci.find_first_of("+#"); + if (idx != std::string::npos) { + uci.erase(idx); // erase to end of the string + } + idx = uci.find_first_of("="); + if (idx != std::string::npos) { + char promo = uci.at(idx); + switch (promo) { + case 'Q': promotion = QUEEN; break; + case 'R': promotion = ROOK; break; + case 'B': promotion = BISHOP; break; + case 'N': promotion = KNIGHT; break; + default: return MOVE_NONE; // invalid + } + uci.erase(idx); + } + else { // check the last char, is it QRBN? + char promo2 = uci.at(uci.size() - 1); + switch (promo2) { + case 'Q': promotion = QUEEN; break; + case 'R': promotion = ROOK; break; + case 'B': promotion = BISHOP; break; + case 'N': promotion = KNIGHT; break; + default:; // nixda + } + if (promotion != NO_PIECE_TYPE) + uci.erase(uci.size() - 1); + } + idx = uci.find_first_of("x"); + if (idx != std::string::npos) { + capture = true; + uci.erase(idx, 1); + } + + char piece = str.at(0); + PieceType piecetype; + std::string thepiece; + + switch (piece) { + case 'N': piecetype = KNIGHT; break; + case 'B': piecetype = BISHOP; break; + case 'R': piecetype = ROOK; break; + case 'Q': piecetype = QUEEN; break; + case 'K': piecetype = KING; break; + case '0': + case 'O': + castles = true; piecetype = NO_PIECE_TYPE; break; + default: piecetype = PAWN; + } + + if (castles) { // chess 960? + if (uci == "0-0" || uci == "O-O") { + if (pos.side_to_move() == WHITE) { + move = make(SQ_E1, SQ_H1); + } + else { + move = make(SQ_E8, SQ_H8); + } + } + else if (uci == "0-0-0" || uci == "O-O-O") { + if (pos.side_to_move() == WHITE) { + move = make(SQ_E1, SQ_A1); + } + else { + move = make(SQ_E8, SQ_A8); + } + } + if (pos.pseudo_legal(move) && pos.legal(move)) { + return move; + } + return MOVE_NONE; // invalid + } + + // normal move or promotion + int torank = uci.at(uci.size() - 1) - '1'; + int tofile = uci.at(uci.size() - 2) - 'a'; + int disambig_r = -1; + int disambig_f = -1; + if (piecetype != PAWN && piecetype != KING && uci.size() > 3) { + char ambig = uci.at(uci.size() - 3); + if (ambig >= 'a' && ambig <= 'h') { + disambig_f = ambig - 'a'; + } + else if (ambig >= '1' && ambig <= '8') { + disambig_r = ambig - '1'; + } + else { + return MOVE_NONE; // invalid; + } + } + + Square tosquare = Square((torank * 8) + tofile); + const Square *pl; + int piececount; + + switch (piecetype) { + case PAWN: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case KNIGHT: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case BISHOP: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case ROOK: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case QUEEN: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case KING: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + default: + return MOVE_NONE; // invalid + } + + if (piececount == 1) { + if (piecetype != PAWN || !capture) { + move = test_move(pos, *pl, tosquare, promotion); + } + else { + move = test_move(pos, *pl, tosquare, promotion); + } + if (move != MOVE_NONE) { + return move; + } + else { + return MOVE_NONE; + } + } + else if (piececount > 1) { + Square s; + while ((s = *pl++) != SQ_NONE) { + Square ss = SQ_NONE; + if (disambig_r >= 0 || disambig_f >= 0) { + if (disambig_r >= 0 && rank_of(s) == Rank(disambig_r)) { + ss = s; + } + else if (disambig_f >= 0 && file_of(s) == File(disambig_f)) { + ss = s; + } + } + else { + ss = s; + } + if (ss != SQ_NONE) { + if (piecetype != PAWN || !capture) { + move = test_move(pos, ss, tosquare, promotion); + } + else { + move = test_move(pos, ss, tosquare, promotion); + } + if (move != MOVE_NONE) { + return move; + } + else { + ; // don't return, we just need to keep trying + } + } + } + } + return MOVE_NONE; } +//taken from stockfish-TCEC6-PA_GTB +Value uci_to_score(std::string &str) +{ + Value uci = (Value)atoi(str.c_str()); + Value v = VALUE_NONE; + + if (uci > 32000) { + v = VALUE_MATE - (32767 - uci); + } + else if (uci < -32000) { + v = -VALUE_MATE + (32767 + uci); + } + else { + v = uci * int(PawnValueMg) / 100; + } + return v; +} + +void TranspositionTable::load_epd_to_hash() { + std::string line; + std::ifstream myfile(hashfilename); + Position pos; + Move bm; + int ce; + int depth; + generation8 = 4; //for storing the positions + + if (myfile.is_open()) + { + while (getline(myfile, line)) + { + std::vector x = split(line, ';'); + + //extract and set position + std::size_t i = x[0].find("acd"); //depth searched. Is after the fen string + StateListPtr states(new std::deque(1)); + sync_cout << x[0].substr(0, i) << sync_endl; + pos.set(x[0].substr(0, i), Options["UCI_Chess960"], &states->back(), Threads.main()); + + //depth + depth = std::stoi(x[0].substr(i + 4)); + sync_cout << depth << sync_endl; + + bm = MOVE_NONE; + ce = -1000000; + + for (std::vector::size_type j = 1; j <= x.size(); j++) { + if (bm == MOVE_NONE) { + i = x[j].find("bm "); + if (i == 1) { + sync_cout << x[j].substr(i + 3) << sync_endl; + std::string stri = x[j].substr(i + 3); + bm = san_to_move(pos, stri); + if (bm != MOVE_NONE) + sync_cout << "move ok" << sync_endl; + continue; + } + } + if (ce == -1000000) { + i = x[j].find("ce "); + if (i == 1) { + std::string stri = x[j].substr(i + 3); + ce = uci_to_score(stri); + sync_cout << "ce " << ce << sync_endl; + continue; + } + } + } + + TTEntry* tte; + bool ttHit; + tte = TT.probe(pos.key(), ttHit); + + tte->save(pos.key(), (Value)ce, BOUND_EXACT, (Depth)depth, + bm, VALUE_NONE); + } + myfile.close(); + } +} /// TranspositionTable::probe() looks up the current position in the transposition /// table. It returns true and a pointer to the TTEntry if the position is found. @@ -78,7 +616,7 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { TTEntry* const tte = first_entry(key); const uint16_t key16 = key >> 48; // Use the high 16 bits as key inside the cluster - for (int i = 0; i < ClusterSize; ++i) + for (size_t i = 0; i < ClusterSize; ++i) if (!tte[i].key16 || tte[i].key16 == key16) { if ((tte[i].genBound8 & 0xFC) != generation8 && tte[i].key16) @@ -89,7 +627,7 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { // Find an entry to be replaced according to the replacement strategy TTEntry* replace = tte; - for (int i = 1; i < ClusterSize; ++i) + for (size_t i = 1; i < ClusterSize; ++i) // Due to our packed storage format for generation and its cyclic // nature we add 259 (256 is the modulus plus 3 to keep the lowest // two bound bits from affecting the result) to calculate the entry @@ -108,10 +646,10 @@ TTEntry* TranspositionTable::probe(const Key key, bool& found) const { int TranspositionTable::hashfull() const { int cnt = 0; - for (int i = 0; i < 1000 / ClusterSize; i++) + for (size_t i = 0; i < 1000 / ClusterSize; i++) { const TTEntry* tte = &table[i].entry[0]; - for (int j = 0; j < ClusterSize; j++) + for (size_t j = 0; j < ClusterSize; j++) if ((tte[j].genBound8 & 0xFC) == generation8) cnt++; } diff --git a/Engines/Linux64/mcbrain/src/tt.h b/Engines/Linux64/mcbrain/src/tt.h index c8bebc3..6fdf90f 100644 --- a/Engines/Linux64/mcbrain/src/tt.h +++ b/Engines/Linux64/mcbrain/src/tt.h @@ -42,28 +42,7 @@ struct TTEntry { Value eval() const { return (Value)eval16; } Depth depth() const { return (Depth)(depth8 * int(ONE_PLY)); } Bound bound() const { return (Bound)(genBound8 & 0x3); } - - void save(Key k, Value v, Bound b, Depth d, Move m, Value ev, uint8_t g) { - - assert(d / ONE_PLY * ONE_PLY == d); - - // Preserve any existing move for the same position - if (m || (k >> 48) != key16) - move16 = (uint16_t)m; - - // Don't overwrite more valuable entries - if ( (k >> 48) != key16 - || d / ONE_PLY > depth8 - 4 - /* || g != (genBound8 & 0xFC) // Matching non-zero keys are already refreshed by probe() */ - || b == BOUND_EXACT) - { - key16 = (uint16_t)(k >> 48); - value16 = (int16_t)v; - eval16 = (int16_t)ev; - genBound8 = (uint8_t)(g | b); - depth8 = (int8_t)(d / ONE_PLY); - } - } + void save(Key k, Value v, Bound b, Depth d, Move m, Value ev); private: friend class TranspositionTable; @@ -86,8 +65,8 @@ struct TTEntry { class TranspositionTable { - static constexpr int CacheLineSize = 64; - static constexpr int ClusterSize = 3; + static constexpr size_t CacheLineSize = 64; + static constexpr size_t ClusterSize = 3; struct Cluster { TTEntry entry[ClusterSize]; @@ -97,13 +76,20 @@ class TranspositionTable { static_assert(CacheLineSize % sizeof(Cluster) == 0, "Cluster size incorrect"); public: - ~TranspositionTable() { free(mem); } + TranspositionTable() { mbSize_last_used = 0; mbSize_last_used = 0; } + ~TranspositionTable() {} void new_search() { generation8 += 4; } // Lower 2 bits are used by Bound + void infinite_search() { generation8 = 4; } uint8_t generation() const { return generation8; } TTEntry* probe(const Key key, bool& found) const; int hashfull() const; void resize(size_t mbSize); void clear(); + void set_hash_file_name(const std::string& fname); + bool save(); + void load(); + void load_epd_to_hash(); + std::string hashfilename = "hash.hsh"; // The 32 lowest order bits of the key are used to get the index of the cluster TTEntry* first_entry(const Key key) const { @@ -111,6 +97,14 @@ class TranspositionTable { } private: + friend struct TTEntry; + + size_t mbSize_last_used; + +#ifdef _WIN32 + bool large_pages_used; +#endif + size_t clusterCount; Cluster* table; void* mem; diff --git a/Engines/Linux64/mcbrain/src/types.h b/Engines/Linux64/mcbrain/src/types.h index 1105b4b..a659037 100644 --- a/Engines/Linux64/mcbrain/src/types.h +++ b/Engines/Linux64/mcbrain/src/types.h @@ -171,7 +171,27 @@ enum Bound { BOUND_LOWER, BOUND_EXACT = BOUND_UPPER | BOUND_LOWER }; - +#ifdef Maverick //MichaelB7 +enum Value : int { + VALUE_ZERO = 0, + VALUE_DRAW = 0, + VALUE_KNOWN_WIN = 10000, + VALUE_MATE = 32000, + VALUE_INFINITE = 32001, + VALUE_NONE = 32002, + + VALUE_MATE_IN_MAX_PLY = VALUE_MATE - 2 * MAX_PLY, + VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + 2 * MAX_PLY, + + PawnValueMg = 142*10/11, PawnValueEg = 207*10/11, + KnightValueMg = 784*9/10, KnightValueEg = 868*9/10, + BishopValueMg = 828*9/10, BishopValueEg = 916*9/10, + RookValueMg = 1286*8/9, RookValueEg = 1378*8/9, + QueenValueMg = 2547*7/8, QueenValueEg = 2698*7/8, + + MidgameLimit = 15258, EndgameLimit = 3915 +}; +#else enum Value : int { VALUE_ZERO = 0, VALUE_DRAW = 0, @@ -183,15 +203,15 @@ enum Value : int { VALUE_MATE_IN_MAX_PLY = VALUE_MATE - 2 * MAX_PLY, VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + 2 * MAX_PLY, - PawnValueMg = 171, PawnValueEg = 240, - KnightValueMg = 764, KnightValueEg = 848, - BishopValueMg = 826, BishopValueEg = 891, - RookValueMg = 1282, RookValueEg = 1373, - QueenValueMg = 2500, QueenValueEg = 2670, + PawnValueMg = 142, PawnValueEg = 207, + KnightValueMg = 784, KnightValueEg = 868, + BishopValueMg = 828, BishopValueEg = 916, + RookValueMg = 1286, RookValueEg = 1378, + QueenValueMg = 2547, QueenValueEg = 2698, MidgameLimit = 15258, EndgameLimit = 3915 }; - +#endif enum PieceType { NO_PIECE_TYPE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING, ALL_PIECES = 0, @@ -325,10 +345,10 @@ inline Value& operator+=(Value& v, int i) { return v = v + i; } inline Value& operator-=(Value& v, int i) { return v = v - i; } /// Additional operators to add a Direction to a Square -inline Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); } -inline Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); } -inline Square& operator+=(Square &s, Direction d) { return s = s + d; } -inline Square& operator-=(Square &s, Direction d) { return s = s - d; } +constexpr Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); } +constexpr Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); } +inline Square& operator+=(Square& s, Direction d) { return s = s + d; } +inline Square& operator-=(Square& s, Direction d) { return s = s - d; } /// Only declared but not defined. We don't want to multiply two scores due to /// a very high risk of overflow. So user should explicitly convert to integer. @@ -346,7 +366,7 @@ inline Score operator*(Score s, int i) { assert(eg_value(result) == (i * eg_value(s))); assert(mg_value(result) == (i * mg_value(s))); - assert((i == 0) || (result / i) == s ); + assert((i == 0) || (result / i) == s); return result; } @@ -449,7 +469,7 @@ constexpr PieceType promotion_type(Move m) { return PieceType(((m >> 12) & 3) + KNIGHT); } -inline Move make_move(Square from, Square to) { +constexpr Move make_move(Square from, Square to) { return Move((from << 6) + to); } diff --git a/Engines/Linux64/mcbrain/src/tzbook.cpp b/Engines/Linux64/mcbrain/src/tzbook.cpp deleted file mode 100644 index 4052256..0000000 --- a/Engines/Linux64/mcbrain/src/tzbook.cpp +++ /dev/null @@ -1,221 +0,0 @@ -#include "tzbook.h" -#include "uci.h" -#include "movegen.h" -#include "thread.h" -#include -#include "misc.h" -#include - -TZBook tzbook; // global TZBook - -using namespace std; - -int qsort_compare_int(const void* a, const void* b) -{ - const int int_a = *((const int*)a); - const int int_b = *((const int*)b); - - if (int_a == int_b) return 0; - else if (int_a < int_b) return -1; - else return 1; -} - -TZBook::TZBook() -{ - keycount = 0; - book_move2_probability = 0; - last_position = 0; - akt_position = 0; - last_anz_pieces = 0; - akt_anz_pieces = 0; - search_counter = 0; - tzhash2 = NULL; - do_search = true; - enabled = false; -} - -TZBook::~TZBook() -{ -} - - -void TZBook::init(const std::string& path) -{ - if (path.length() == 0) return; - - const char *p = path.c_str(); - if (strcmp(p, "") == 0) - return; - - FILE *fpt = fopen(p, "rb"); - if (fpt == NULL) - { - sync_cout << "info string Could not open " << path << sync_endl; - return; - } - - if (tzhash2 != NULL) - { - free(tzhash2); - tzhash2 = NULL; - } - - fseek(fpt, 0L, SEEK_END); - int filesize = ftell(fpt); - fseek(fpt, 0L, SEEK_SET); - - keycount = filesize / 8; - tzhash2 = new TZHash2[keycount]; - - fread(tzhash2, 1, filesize, fpt); - fclose(fpt); - - sync_cout << "info string Book loaded: " << path << sync_endl; - - srand((int)time(NULL)); - enabled = true; -} - - -void TZBook::set_book_move2_probability(int book_move2_prob) -{ - book_move2_probability = book_move2_prob; -} - - -Move TZBook::probe2(Position& pos) -{ - Move m = MOVE_NONE; - if (!enabled) return m; - - akt_position = pos.pieces(); - akt_anz_pieces = popcount(akt_position); - - if (do_search == false) - { - Bitboard b = akt_position ^ last_position; - int n2 = popcount(b); - - if (n2 > 4) do_search = true; - if (akt_anz_pieces > last_anz_pieces) do_search = true; - if (akt_anz_pieces < last_anz_pieces - 2) do_search = true; - } - - last_position = akt_position; - last_anz_pieces = akt_anz_pieces; - - if (do_search) - { - TZHash2 *tz = probe2(pos.key()); - if (tz == NULL) - { - search_counter++; - if (search_counter > 2) - { - do_search = false; - search_counter = 0; - } - } - else - { - if (pos.is_draw(64)) - m = get_move_from_draw_position(pos, tz); - else - m = get_move(pos, tz); - } - } - - return m; -} - - -TZHash2 *TZBook::probe2(Key key) -{ - uint32_t key1 = key >> 32; - unsigned short key2 = key >> 16 & 0xFFFF; - - int start = 0; - int end = keycount; - - for (;;) - { - int mid = (end + start) / 2; - - if (tzhash2[mid].key1 < key1) - start = mid; - else - { - if (tzhash2[mid].key1 > key1) - end = mid; - else - { - start = max(mid - 4, 0); - end = min(mid + 4, keycount); - } - } - - if (end - start < 9) - break; - } - - for (int i = start; i < end; i++) - if ((key1 == tzhash2[i].key1) && (key2 == tzhash2[i].key2)) - return &(tzhash2[i]); - - return NULL; -} - -Move TZBook::movenumber_to_move(Position& pos, int n) -{ - const ExtMove *m = MoveList(pos).begin(); - size_t size = MoveList(pos).size(); - Move *mv = new Move[size]; - for (unsigned int i = 0; i < size; i++) - mv[i] = m[i].move; - - qsort(mv, size, sizeof(mv[0]), qsort_compare_int); - - return mv[n]; -} - -bool TZBook::check_draw(Move m, Position& pos) -{ - StateInfo st; - - pos.do_move(m, st, pos.gives_check(m)); - bool draw = pos.is_draw(64); - pos.undo_move(m); - - return draw; -} - - -Move TZBook::get_move_from_draw_position(Position& pos, TZHash2 *tz) -{ - Move m = movenumber_to_move(pos, tz->move_number); - if (!check_draw(m, pos)) - return m; - - if (tz->move_number2 == 255) - return m; - - m = movenumber_to_move(pos, tz->move_number2); - if (!check_draw(m, pos)) - return m; - - return MOVE_NONE; -} - - -Move TZBook::get_move(Position& pos, TZHash2 *tz) -{ - Move m1 = movenumber_to_move(pos, tz->move_number); - if ((book_move2_probability == 0) || (tz->move_number2 == 255)) - return m1; - - Move m2 = movenumber_to_move(pos, tz->move_number2); - if ((book_move2_probability == 100) || (rand() % 100 < book_move2_probability)) - return m2; - - return m1; -} \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/tzbook.h b/Engines/Linux64/mcbrain/src/tzbook.h deleted file mode 100644 index 744618a..0000000 --- a/Engines/Linux64/mcbrain/src/tzbook.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef TZBOOK_H_INCLUDED -#define TZBOOK_H_INCLUDED - -#include "bitboard.h" -#include "position.h" -#include "string.h" - -struct TZHash2 -{ - uint32_t key1; - uint16_t key2; - unsigned char move_number; - unsigned char move_number2; -}; - -class TZBook -{ - public: - - Bitboard last_position; - Bitboard akt_position; - int last_anz_pieces; - int akt_anz_pieces; - int search_counter; - - bool enabled, do_search; - int book_move2_probability; - - TZBook(); - ~TZBook(); - - void init(const std::string& path); - void set_book_move2_probability(int book_move2_prob); - - Move probe2(Position& pos); - TZHash2 *probe2(Key key); - -private: - - int keycount; - TZHash2 *tzhash2; - bool check_draw(Move m, Position& pos); - Move get_move_from_draw_position(Position& pos, TZHash2 *tz); - Move get_move(Position& pos, TZHash2 *tz); - Move movenumber_to_move(Position& pos, int n); -}; - -extern TZBook tzbook; - -#endif // #ifndef TZBOOK_H_INCLUDED \ No newline at end of file diff --git a/Engines/Linux64/mcbrain/src/uci.cpp b/Engines/Linux64/mcbrain/src/uci.cpp index 75512a4..b21e97c 100644 --- a/Engines/Linux64/mcbrain/src/uci.cpp +++ b/Engines/Linux64/mcbrain/src/uci.cpp @@ -273,13 +273,13 @@ void UCI::loop(int argc, char* argv[]) { else if (token == "position") { position(pos, is, states); - if (Options["Clean_Search"] == true) + if (Options["Clear Search"]) Search::clear(); } else if (token == "p") { position(pos, is, states); - if (Options["Clean_Search"] == true) + if (Options["Clear Search"]) Search::clear(); } else if (token == "ucinewgame") Search::clear(); diff --git a/Engines/Linux64/mcbrain/src/uci.h b/Engines/Linux64/mcbrain/src/uci.h index 93764d5..ebed83a 100644 --- a/Engines/Linux64/mcbrain/src/uci.h +++ b/Engines/Linux64/mcbrain/src/uci.h @@ -50,14 +50,22 @@ class Option { Option(OnChange = nullptr); Option(bool v, OnChange = nullptr); Option(const char* v, OnChange = nullptr); - Option(double v, int minv, int maxv, OnChange = nullptr); - Option(const char* v, const char *cur, OnChange = nullptr); + Option(const char* v, const char* cur, OnChange = nullptr); + template Option(T v, T minv, T maxv, OnChange f = nullptr) : type("spin"), min(minv), max(maxv), on_change(f) + { + defaultValue = currentValue = std::to_string(v); + } Option& operator=(const std::string&); void operator<<(const Option&); - operator double() const; + template operator T() const + { + assert(type == "spin" || type == "check"); + return (type == "spin" ? T(stof(currentValue)): type == "check" ? (currentValue == "true") : T(0)); + } + operator std::string() const; - bool operator==(const char*); + bool operator==(const char*) const; private: friend std::ostream& operator<<(std::ostream&, const OptionsMap&); diff --git a/Engines/Linux64/mcbrain/src/ucioption.cpp b/Engines/Linux64/mcbrain/src/ucioption.cpp index ba66e63..ede37b9 100644 --- a/Engines/Linux64/mcbrain/src/ucioption.cpp +++ b/Engines/Linux64/mcbrain/src/ucioption.cpp @@ -22,14 +22,18 @@ #include #include #include +//Hash +#include +//end_Hash +#include #include "misc.h" -#include "polybook.h" #include "search.h" #include "thread.h" #include "tt.h" #include "uci.h" #include "syzygy/tbprobe.h" +#include "polybook.h" using std::string; @@ -40,15 +44,21 @@ namespace UCI { /// 'On change' actions, triggered by an option's value change void on_clear_hash(const Option&) { Search::clear(); } void on_hash_size(const Option& o) { TT.resize(o); } +void on_large_pages(const Option& o) { TT.resize(o); } // warning is ok, will be removed void on_logger(const Option& o) { start_logger(o); } void on_threads(const Option& o) { Threads.set(o); } void on_tb_path(const Option& o) { Tablebases::init(o); } - +//Hash +void on_HashFile(const Option& o) { TT.set_hash_file_name(o); } +void SaveHashtoFile(const Option&) { TT.save(); } +void LoadHashfromFile(const Option&) { TT.load(); } +void LoadEpdToHash(const Option&) { TT.load_epd_to_hash(); } +//end_Hash + void on_book_file(const Option& o) { polybook.init(o); } void on_best_book_move(const Option& o) { polybook.set_best_book_move(o); } void on_book_depth(const Option& o) { polybook.set_book_depth(o); } - /// Our case insensitive less() function as required by UCI protocol bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const { @@ -64,40 +74,56 @@ void init(OptionsMap& o) { // at most 2^32 clusters. constexpr int MaxHashMB = Is64Bit ? 131072 : 2048; - o["Debug Log File"] << Option("", on_logger); - o["Contempt"] << Option(12, -150, 150); - o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Off"); - o["UCI_AnalyseMode"] << Option(false); - o["Threads"] << Option(1, 1, 512, on_threads); - o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); - o["Clear_Hash"] << Option(on_clear_hash); - o["Clean_Search"] << Option(false); + unsigned n = std::thread::hardware_concurrency(); + if (!n) n = 1; - o["Tactical"] << Option(0, 0, 8); + o["Threads"] << Option(n, unsigned(1), unsigned(512), on_threads); + o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); + o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Both"); + o["UCI_Chess960"] << Option(false); o["Ponder"] << Option(false); + o["OwnBook"] << Option(false); + o["Book File"] << Option("book.bin"); + o["Best Book Move"] << Option(false); + + o["Contempt"] << Option(21, -150, 150); o["MultiPV"] << Option(1, 1, 256); - o["BruteForce"] << Option(false); + o["Variety"] << Option (0, 0, 20); + o["Clear Search"] << Option(false); + o["Large Pages"] << Option(false, on_large_pages); + o["Minimal_Output"] << Option(false); o["FastPlay"] << Option(false); - o["No_Null_Moves"] << Option(false); + o["BruteForce"] << Option(false); + o["NullMove"] << Option(true); + o["LMR"] << Option(true); + o["MaxLMReduction"] << Option(10, 0, 20); o["UCI_LimitStrength"] << Option(false); - o["UCI_ELO"] << Option(1500, 1500, 2800); + o["ICCF Analysis"] << Option(0, 0, 8); + o["Skill Level"] << Option(20, 0, 20); o["Move Overhead"] << Option(30, 0, 5000); o["Minimum Thinking Time"] << Option(20, 0, 5000); o["Slow Mover"] << Option(84, 10, 1000); o["nodestime"] << Option(0, 0, 10000); - o["UCI_Chess960"] << Option(false); + + o["Clear_Hash"] << Option(on_clear_hash); + o["SaveHashtoFile"] << Option(SaveHashtoFile); + o["LoadHashfromFile"] << Option(LoadHashfromFile); + o["LoadEpdToHash"] << Option(LoadEpdToHash); + o["NeverClearHash"] << Option(false); + o["HashFile"] << Option("hash.hsh", on_HashFile); o["UCI_AnalyseMode"] << Option(false); o["SyzygyPath"] << Option("", on_tb_path); o["SyzygyProbeDepth"] << Option(1, 1, 100); o["Syzygy50MoveRule"] << Option(true); - o["SyzygyProbeLimit"] << Option(6, 0, 6); + o["SyzygyProbeLimit"] << Option(7, 0, 7); + + o["Cerebellum Options"] << Option(true); o["Book_Enabled"] << Option(true); o["BookFile"] << Option("", on_book_file); o["BestBookMove"] << Option(true, on_best_book_move); - o["BookDepth"] << Option(255, 1, 255, on_book_depth); - o["Debug Log File"] << Option("", on_logger); + o["Debug Log File"] << Option("", on_logger); } @@ -129,6 +155,10 @@ std::ostream& operator<<(std::ostream& os, const OptionsMap& om) { /// Option class constructors and conversion operators +Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f) +{ + defaultValue = v; currentValue = cur; +} Option::Option(const char* v, OnChange f) : type("string"), min(0), max(0), on_change(f) { defaultValue = currentValue = v; } @@ -139,23 +169,12 @@ Option::Option(bool v, OnChange f) : type("check"), min(0), max(0), on_change(f) Option::Option(OnChange f) : type("button"), min(0), max(0), on_change(f) {} -Option::Option(double v, int minv, int maxv, OnChange f) : type("spin"), min(minv), max(maxv), on_change(f) -{ defaultValue = currentValue = std::to_string(v); } - -Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f) -{ defaultValue = v; currentValue = cur; } - -Option::operator double() const { - assert(type == "check" || type == "spin"); - return (type == "spin" ? stof(currentValue) : currentValue == "true"); -} - Option::operator std::string() const { assert(type == "string"); return currentValue; } -bool Option::operator==(const char* s) { +bool Option::operator==(const char* s) const { assert(type == "combo"); return !CaseInsensitiveLess()(currentValue, s) && !CaseInsensitiveLess()(s, currentValue); diff --git a/Engines/Windows/_tools/LCEngine2.pyd b/Engines/Windows/_tools/LCEngine2.pyd new file mode 100644 index 0000000..6de7f2f Binary files /dev/null and b/Engines/Windows/_tools/LCEngine2.pyd differ diff --git a/Engines/Windows/_tools/LCEngineV1.pyd b/Engines/Windows/_tools/LCEngineV1.pyd deleted file mode 100644 index 89a8a82..0000000 Binary files a/Engines/Windows/_tools/LCEngineV1.pyd and /dev/null differ diff --git a/Engines/Windows/alaric/Alaric.log b/Engines/Windows/alaric/Alaric.log deleted file mode 100644 index 06f930a..0000000 --- a/Engines/Windows/alaric/Alaric.log +++ /dev/null @@ -1,9 +0,0 @@ -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -book_open(): can't open file 'GS_Alaric_3.book': No such file or directory -Total session time 0:23:21 -Total session time 0:22:19 diff --git a/Engines/Windows/mcbrain/.DS_Store b/Engines/Windows/mcbrain/.DS_Store new file mode 100644 index 0000000..f2a08a1 Binary files /dev/null and b/Engines/Windows/mcbrain/.DS_Store differ diff --git a/Engines/Windows/mcbrain/.gitignore b/Engines/Windows/mcbrain/.gitignore new file mode 100644 index 0000000..b5f56bd --- /dev/null +++ b/Engines/Windows/mcbrain/.gitignore @@ -0,0 +1,24 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +*.pdb +*.tlog +*.log +*.exe +*.obj +*.lastbuildstate +*.ilk +*.idb +*.ipch +*.opendb +*.db +*.suo +*.sqlite +*.json + +# Ignore temporary folders +.vs/ +/executable/Machine Learning/SugarMachineLearning.sml +/executable/Master/Cerebellum_Light_Poly.bin +/executable/Base Master/Cerebellum_Light_Poly.bin diff --git a/Engines/Windows/mcbrain/.travis.yml b/Engines/Windows/mcbrain/.travis.yml index 0a214d1..ded29e4 100644 --- a/Engines/Windows/mcbrain/.travis.yml +++ b/Engines/Windows/mcbrain/.travis.yml @@ -9,9 +9,9 @@ matrix: addons: apt: sources: ['ubuntu-toolchain-r-test'] - packages: ['g++-6', 'g++-6-multilib', 'g++-multilib', 'valgrind', 'expect'] + packages: ['g++-7', 'g++-7-multilib', 'g++-multilib', 'valgrind', 'expect', 'curl'] env: - - COMPILER=g++-6 + - COMPILER=g++-7 - COMP=gcc - os: linux @@ -19,7 +19,7 @@ matrix: addons: apt: sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0'] - packages: ['clang-5.0', 'llvm-5.0-dev', 'g++-multilib', 'valgrind', 'expect'] + packages: ['clang-5.0', 'llvm-5.0-dev', 'g++-multilib', 'valgrind', 'expect', 'curl'] env: - COMPILER=clang++-5.0 - COMP=clang @@ -69,6 +69,6 @@ script: # # Sanitizer # - # Use g++-6 as a proxy for having sanitizers, might need revision as they become available for more recent versions of clang/gcc - - if [[ "$COMPILER" == "g++-6" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=undefined optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-undefined; fi - - if [[ "$COMPILER" == "g++-6" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-thread; fi + # Use g++-7 as a proxy for having sanitizers, might need revision as they become available for more recent versions of clang/gcc + - if [[ "$COMPILER" == "g++-7" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=undefined optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-undefined; fi + - if [[ "$COMPILER" == "g++-7" ]]; then make clean && make -j2 ARCH=x86-64 sanitize=thread optimize=no debug=yes build > /dev/null && ../tests/instrumented.sh --sanitizer-thread; fi diff --git a/Engines/Windows/mcbrain/AUTHORS b/Engines/Windows/mcbrain/AUTHORS index 9b91b93..9c25509 100644 --- a/Engines/Windows/mcbrain/AUTHORS +++ b/Engines/Windows/mcbrain/AUTHORS @@ -1,98 +1,122 @@ -# Generated with 'git shortlog -sn | cut -c8-', which sorts by commits, manually ordered the first four authors, merged duplicates +# List of authors for Stockfish, updated just after version 9 -Tord Romstad +Tord Romstad (romstad) Marco Costalba (mcostalba) Joona Kiiski (zamar) Gary Linscott (glinscott) -Lucas Braesch (lucasart) -Bill Henry (VoyagerOne) -mstembera -Stéphane Nicolet (Stephane Nicolet, snicolet) -Stefan Geschwentner -Alain SAVARD (Rocky640) -Jörg Oster (Joerg Oster, joergoster) -Reuven Peleg -Chris Caino (Chris Cain, ceebo) -Jean-Francois Romang -homoSapiensSapiens -Leonid Pechenik -Stefano Cardanobile (Stefano80) -Arjun Temurnikar -Uri Blass (uriblass) -jundery -Ajith (ajithcj) -hxim -Ralph Stößer (Ralph Stoesser) -Guenther Demetz -Jonathan Calovski (Mysseno) -Tom Vijlbrief -mbootsector -Daylen Yang -ElbertoOne -Henri Wiechers -loco-loco -Joost VandeVondele (Joost Vandevondele) -Ronald de Man (syzygy) -DU-jdto -David Zar -Eelco de Groot -Jerry Donald -NicklasPersson -Ryan Schmitt + +absimaldata +Ajith Chandy Jose (ajithcj) +Alain Savard (Rocky640) Alexander Kure -Dan Schmidt -H. Felix Wittmann -Jacques -Joseph R. Prostko -Justin Blanchard -Linus Arver -Luca Brivio -Lyudmil Antonov -Rodrigo Exterckötter Tjäder -Ron Britvich -RyanTaker -Vince Negri -erbsenzaehler -Joseph Hellis (jhellis3) -shane31 -Andrew Grant +Ali AlZhrani (Cooffe) +Andrew Grant (AndyGrant) +Andrey Neporada (nepal) Andy Duplain +Aram Tumanian (atumanian) +Arjun Temurnikar Auguste Pop Balint Pfliegel +Ben Koshy (BKSpurgeon) +Bill Henry (VoyagerOne) +braich +Brian Sheppard (SapphireBrand) +Bryan Cross (crossbr) +Bujun Guo (noobpwnftw) +Chris Cain (ceebo) +Dan Schmidt +Daniel Dugovic (ddugovic) Dariusz Orzechowski +David Zar +Daylen Yang (daylen) DiscanX +Eelco de Groot +ElbertoOne +erbsenzaehler Ernesto Gatti +Fabian Beuke (madnight) +Fabian Fichter (ianfab) +fanon +Fauzi Akram Dabat (FauziAkram) +Felix Wittmann +gamander +gguliash +Gian-Carlo Pascutto (gcp) +Gontran Lemaire (gonlem) +Goodkov Vasiliy Aleksandrovich (goodkov) Gregor Cramer +GuardianRM +Günther Demetz (pb00067, pb00068) +Guy Vreuls (gvreuls) +Henri Wiechers Hiraoka Takuya (HiraokaTakuya) +homoSapiensSapiens Hongzhi Cheng -IIvec +Ivan Ivec (IIvec) +Jacques B. (Timshel) +Jan OndruÅ¡ (hxim) +Jarrod Torriero (DU-jdto) +Jean-Francois Romang +Jerry Donald Watson (jerrydonaldwatson) +Jonathan Calovski (Mysseno) +Joost VandeVondele (vondele) +Jörg Oster (joergoster) +Joseph Ellis (jhellis3) +Joseph R. Prostko +jundery +Justin Blanchard Kelly Wilson -Ken T Takusagawa +Ken Takusagawa +kinderchocolate +Kiran Panditrao (Krgp) Kojirion -Krgp -Matt Sullivan -Matthew Lai +Leonardo LjubiÄić (GM) +Leonid Pechenik (lp--) +Linus Arver +loco-loco +Luca Brivio (lucabrivio) +Lucas Braesch (lucasart) +Lyudmil Antonov (lantonov) +Matthew Lai (matthewlai) Matthew Sullivan -Michel Van den Bergh -Niklas Fiekas +Mark Tenzer (31m059) +Michael Byrne (MichaelB7) +Michael Stembera (mstembera) +Michel Van den Bergh (vdbergh) +Miguel Lahoz (miguel-l) +Mikael Bäckman (mbootsector) +Mike Whiteley (protonspring) +Miroslav Fontán (Hexik) +Moez Jellouli (MJZ1977) +Mohammed Li (tthsqe12) +Nathan Rugg (nmrugg) +Nicklas Persson (NicklasPersson) +Niklas Fiekas (niklasf) Oskar Werkelin Ahlin Pablo Vazquez Pascal Romaret +Pasquale Pigazzini (ppigazzini) +Patrick Jansen (mibere) +pellanda +Ralph Stößer (Ralph Stoesser) Raminder Singh +renouve +Reuven Peleg Richard Lloyd +Rodrigo Exterckötter Tjäder +Ron Britvich +Ronald de Man (syzygy1) +Ryan Schmitt Ryan Takker -Thanar2 -absimaldata -atumanian -braich -fanon -gamander -gguliash -kinderchocolate -pellanda -ppigazzini -renouve +Sergei Antonov (saproj) sf-x +shane31 +Stefan Geschwentner (locutus2) +Stefano Cardanobile (Stefano80) +Stéphane Nicolet (snicolet) +Thanar2 thaspel -unknown - +Tom Vijlbrief (tomtor) +Torsten Franz (torfranz) +Uri Blass (uriblass) +Vince Negri diff --git a/Engines/Windows/mcbrain/McBrain-91_x32_old.exe b/Engines/Windows/mcbrain/McBrain-91_x32_old.exe deleted file mode 100644 index e70bbea..0000000 Binary files a/Engines/Windows/mcbrain/McBrain-91_x32_old.exe and /dev/null differ diff --git a/Engines/Windows/mcbrain/McBrain-91_x64_bmi2.exe b/Engines/Windows/mcbrain/McBrain-91_x64_bmi2.exe deleted file mode 100644 index b1f8203..0000000 Binary files a/Engines/Windows/mcbrain/McBrain-91_x64_bmi2.exe and /dev/null differ diff --git a/Engines/Windows/mcbrain/Readme.md b/Engines/Windows/mcbrain/Readme.md index 46f2609..8913595 100644 --- a/Engines/Windows/mcbrain/Readme.md +++ b/Engines/Windows/mcbrain/Readme.md @@ -1,33 +1,30 @@ -### Overview +### Overview [![Build Status](https://travis-ci.org/official-stockfish/Stockfish.svg?branch=master)](https://travis-ci.org/official-stockfish/Stockfish) -[![Build Status](https://travis-ci.org/official-stockfish/Stockfish.svg?branch=master)](https://travis-ci.org/official-stockfish/Stockfish) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/official-stockfish/Stockfish?svg=true)](https://ci.appveyor.com/project/mcostalba/stockfish) - -Stockfish is a free UCI chess engine derived from Glaurung 2.1. It is +SugaR is a free UCI chess engine derived from Stockfish. It is not a complete chess program and requires some UCI-compatible GUI (e.g. XBoard with PolyGlot, eboard, Arena, Sigma Chess, Shredder, Chess -Partner or Fritz) in order to be used comfortably. Read the +Partner, Aquarium or Fritz) in order to be used comfortably. Read the documentation for your GUI of choice for information about how to use -Stockfish with it. +SugaR with it. -This version of Stockfish supports up to 512 cores. The engine defaults +This version of SugaR supports up to 128 cores. The engine defaults to one search thread, so it is therefore recommended to inspect the value of the *Threads* UCI parameter, and to make sure it equals the number of CPU cores on your computer. -This version of Stockfish has support for Syzygybases. +This version of SugaR has support for Syzygybases. ### Files -This distribution of Stockfish consists of the following files: +This distribution of SugaR consists of the following files: * Readme.md, the file you are currently reading. * Copying.txt, a text file containing the GNU General Public License. - * src, a subdirectory containing the full source code, including a Makefile - that can be used to compile Stockfish on Unix-like systems. + * source, a subdirectory containing the full source code, including a Makefile + that can be used to compile SugaR on Unix-like systems. ### Syzygybases @@ -84,40 +81,37 @@ the 50-move rule. ### Compiling it yourself -On Unix-like systems, it should be possible to compile Stockfish +On Unix-like systems, it should be possible to compile SugaR directly from the source code with the included Makefile. -Stockfish has support for 32 or 64-bit CPUs, the hardware POPCNT +SugaR has support for 32 or 64-bit CPUs, the hardware POPCNT instruction, big-endian machines such as Power PC, and other platforms. +On Windows-like systems, it should be possible to compile SugaR +directly from the source code with the included Sugar.sln with Visual Studio 15.3 Community +from GUI or with command scenario using Visual Studio 15.3 Community Commands Shell. + In general it is recommended to run `make help` to see a list of make targets with corresponding descriptions. When not using the Makefile to -compile (for instance with Microsoft MSVC) you need to manually -set/unset some switches in the compiler command line; see file *types.h* +compile you need to manually +set/unset some switches in the compiler command line or use MSVC solution and project files provided; see file *types.h* for a quick reference. -### Resource For Understanding the Code Base - -* [Chess Programming Wiki](https://chessprogramming.wikispaces.com) has good overall chess engines explanations -(techniques used here are well explained like hash maps etc), it was -also recommended by the [support team at stockfish.](http://support.stockfishchess.org/discussions/questions/1132-how-to-understand-stockfish-sources) - -* [Here](https://chessprogramming.wikispaces.com/Stockfish) you can find a set of features and techniques used by stockfish and each of them is explained at the wiki, however, it's a generic way rather than focusing on stockfish's own implementation, but it will still help you. - ### Terms of use -Stockfish is free, and distributed under the **GNU General Public License** +SugaR is free, and distributed under the **GNU General Public License** (GPL). Essentially, this means that you are free to do almost exactly what you want with the program, including distributing it among your friends, making it available for download from your web site, selling it (either by itself or as part of some bigger software package), or using it as the starting point for a software project of your own. -The only real limitation is that whenever you distribute Stockfish in +The only real limitation is that whenever you distribute SugaR in some way, you must always include the full source code, or a pointer to where the source code can be found. If you make any changes to the source code, these changes must also be made available under the GPL. For full details, read the copy of the GPL found in the file named *Copying.txt*. + diff --git a/Engines/Windows/mcbrain/appveyor.yml b/Engines/Windows/mcbrain/appveyor.yml index c711dd6..4b5e9eb 100644 --- a/Engines/Windows/mcbrain/appveyor.yml +++ b/Engines/Windows/mcbrain/appveyor.yml @@ -34,19 +34,16 @@ before_build: $src = get-childitem -Path *.cpp -Recurse | select -ExpandProperty FullName $src = $src -join ' ' $src = $src.Replace("\", "/") - # Build CMakeLists.txt $t = 'cmake_minimum_required(VERSION 3.8)', 'project(Stockfish)', 'set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src)', 'set(source_files', $src, ')', 'add_executable(stockfish ${source_files})' - # Write CMakeLists.txt withouth BOM $MyPath = (Get-Item -Path "." -Verbose).FullName + '\CMakeLists.txt' $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False [System.IO.File]::WriteAllLines($MyPath, $t, $Utf8NoBomEncoding) - # Obtain bench reference from git log $b = git log HEAD | sls "\b[Bb]ench[ :]+[0-9]{7}" | select -first 1 $bench = $b -match '\D+(\d+)' | % { $matches[1] } @@ -55,10 +52,8 @@ before_build: If (${env:PLATFORM} -eq 'x64') { $g = $g + ' Win64' } cmake -G "${g}" . Write-Host "Generated files for: " $g - build_script: - cmake --build . --config %CONFIGURATION% -- /verbosity:minimal - before_test: - cd src/%CONFIGURATION% - ps: | @@ -68,4 +63,4 @@ before_test: $r = ($s -match 'Nodes searched \D+(\d+)' | % { $matches[1] }) Write-Host "Engine bench:" $r Write-Host "Reference bench:" $bench - If ($r -ne $bench) { exit 1 } + If ($r -ne $bench) { exit 1 } \ No newline at end of file diff --git a/Engines/Windows/mcbrain/src/.DS_Store b/Engines/Windows/mcbrain/src/.DS_Store new file mode 100644 index 0000000..ef9e3c3 Binary files /dev/null and b/Engines/Windows/mcbrain/src/.DS_Store differ diff --git a/Engines/Windows/mcbrain/src/.cproject b/Engines/Windows/mcbrain/src/.cproject new file mode 100644 index 0000000..54a0868 --- /dev/null +++ b/Engines/Windows/mcbrain/src/.cproject @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Engines/Windows/mcbrain/src/.depend b/Engines/Windows/mcbrain/src/.depend new file mode 100644 index 0000000..bd25d9e --- /dev/null +++ b/Engines/Windows/mcbrain/src/.depend @@ -0,0 +1,52 @@ +benchmark.o: benchmark.cpp position.h bitboard.h types.h +bitbase.o: bitbase.cpp bitboard.h types.h +bitboard.o: bitboard.cpp bitboard.h types.h misc.h +book.o: book.cpp book.h misc.h types.h position.h bitboard.h movegen.h +endgame.o: endgame.cpp bitboard.h types.h endgame.h position.h movegen.h +evaluate.o: evaluate.cpp bitboard.h types.h evaluate.h material.h \ + endgame.h position.h misc.h pawns.h thread.h movepick.h movegen.h \ + search.h thread_win32.h uci.h +main.o: main.cpp bitboard.h types.h position.h search.h misc.h movepick.h \ + movegen.h thread.h material.h endgame.h pawns.h thread_win32.h tt.h \ + uci.h syzygy/tbprobe.h syzygy/../search.h polybook.h +material.o: material.cpp material.h endgame.h position.h bitboard.h \ + types.h misc.h thread.h movepick.h movegen.h pawns.h search.h \ + thread_win32.h +misc.o: misc.cpp misc.h types.h thread.h material.h endgame.h position.h \ + bitboard.h movepick.h movegen.h pawns.h search.h thread_win32.h +movegen.o: movegen.cpp movegen.h types.h position.h bitboard.h +movepick.o: movepick.cpp movepick.h movegen.h types.h position.h \ + bitboard.h +pawns.o: pawns.cpp bitboard.h types.h pawns.h misc.h position.h thread.h \ + material.h endgame.h movepick.h movegen.h search.h thread_win32.h +position.o: position.cpp bitboard.h types.h misc.h movegen.h position.h \ + thread.h material.h endgame.h movepick.h pawns.h search.h thread_win32.h \ + tt.h uci.h syzygy/tbprobe.h syzygy/../search.h +psqt.o: psqt.cpp types.h +search.o: search.cpp book.h misc.h types.h position.h bitboard.h \ + evaluate.h movegen.h movepick.h polybook.h search.h thread.h material.h \ + endgame.h pawns.h thread_win32.h timeman.h tt.h uci.h syzygy/tbprobe.h \ + syzygy/../search.h +thread.o: thread.cpp movegen.h types.h search.h misc.h movepick.h \ + position.h bitboard.h thread.h material.h endgame.h pawns.h \ + thread_win32.h uci.h syzygy/tbprobe.h syzygy/../search.h tt.h +timeman.o: timeman.cpp search.h misc.h types.h movepick.h movegen.h \ + position.h bitboard.h timeman.h thread.h material.h endgame.h pawns.h \ + thread_win32.h uci.h +tt.o: tt.cpp uci.h types.h position.h bitboard.h thread.h material.h \ + endgame.h misc.h movepick.h movegen.h pawns.h search.h thread_win32.h \ + tt.h +uci.o: uci.cpp evaluate.h types.h movegen.h position.h bitboard.h \ + search.h misc.h movepick.h thread.h material.h endgame.h pawns.h \ + thread_win32.h timeman.h tt.h uci.h syzygy/tbprobe.h syzygy/../search.h +ucioption.o: ucioption.cpp misc.h types.h search.h movepick.h movegen.h \ + position.h bitboard.h thread.h material.h endgame.h pawns.h \ + thread_win32.h tt.h uci.h syzygy/tbprobe.h syzygy/../search.h polybook.h +polybook.o: polybook.cpp polybook.h bitboard.h types.h position.h uci.h \ + movegen.h thread.h material.h endgame.h misc.h movepick.h pawns.h \ + search.h thread_win32.h +tbprobe.o: syzygy/tbprobe.cpp syzygy/../bitboard.h syzygy/../types.h \ + syzygy/../movegen.h syzygy/../position.h syzygy/../bitboard.h \ + syzygy/../search.h syzygy/../misc.h syzygy/../movepick.h \ + syzygy/../movegen.h syzygy/../position.h syzygy/../thread_win32.h \ + syzygy/../types.h syzygy/../uci.h syzygy/tbprobe.h diff --git a/Engines/Windows/mcbrain/src/.project b/Engines/Windows/mcbrain/src/.project new file mode 100644 index 0000000..1c8747f --- /dev/null +++ b/Engines/Windows/mcbrain/src/.project @@ -0,0 +1,27 @@ + + + SugaR + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Engines/Windows/mcbrain/src/Build x64 - Ubuntu Commands.txt b/Engines/Windows/mcbrain/src/Build x64 - Ubuntu Commands.txt new file mode 100644 index 0000000..5f78025 --- /dev/null +++ b/Engines/Windows/mcbrain/src/Build x64 - Ubuntu Commands.txt @@ -0,0 +1,5 @@ +make clean +make profile-build ARCH=x86-64 -j14 +strip McBrain + + diff --git a/Engines/Windows/mcbrain/src/Makefile b/Engines/Windows/mcbrain/src/Makefile new file mode 100644 index 0000000..a2bf194 --- /dev/null +++ b/Engines/Windows/mcbrain/src/Makefile @@ -0,0 +1,582 @@ +### ========================================================================== +### Copyright Notice and License Information +### ========================================================================== +# McBrain, a UCI chess playing engine derived from SugaR, Stockfish and Glaurung 2.1 +# Copyright (C) 2004-2008 Tord Romstad (Glaurung Author) +# Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) +# Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) +# Copyright (C) 2017-2018 Michael Byrne, Marco Zerbinati, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + +# McBrain is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# McBrain is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +### ========================================================================== +### Section 1. General Configuration +### ========================================================================== + +### Executable name +### McCain bench nodes 4717832 +### McBrain bench nodes 4576991 +VERSION= +#VERSION=maverick +ifeq ($(VERSION),maverick) +CXXFLAGS += -DMaverick +ifeq ($(COMP),mingw) +EXE = McCain-v2.exe +else +EXE = McCain-v2 +endif +else +CXXFLAGS += -DPAWN_SCORES +ifeq ($(COMP),mingw) +EXE = McBrain-v99.exe +else +EXE = McBrain-v99 +endif +endif + +### Installation dir definitions +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin + +### Built-in benchmark for pgo-builds +PGOBENCH = ./$(EXE) bench 16 1 10 +PGOBENCH2 = ./$(EXE) bench 16 2 8 + +### Object files +OBJS = benchmark.o bitbase.o bitboard.o book.o endgame.o evaluate.o main.o \ + material.o misc.o movegen.o movepick.o pawns.o position.o psqt.o \ + search.o thread.o timeman.o tt.o uci.o ucioption.o polybook.o syzygy/tbprobe.o + +### Establish the operating system name +KERNEL = $(shell uname -s) +ifeq ($(KERNEL),Linux) + OS = $(shell uname -o) +endif + +### ========================================================================== +### Section 2. High-level Configuration +### ========================================================================== +# +# flag --- Comp switch --- Description +# ---------------------------------------------------------------------------- +# +# debug = yes/no --- -DNDEBUG --- Enable/Disable debug mode +# sanitize = undefined/thread/no (-fsanitize ) +# --- ( undefined ) --- enable undefined behavior checks +# --- ( thread ) --- enable threading error checks +# optimize = yes/no --- (-O3/-fast etc.) --- Enable/Disable optimizations +# arch = (name) --- (-arch) --- Target architecture +# bits = 64/32 --- -DIS_64BIT --- 64-/32-bit operating system +# prefetch = yes/no --- -DUSE_PREFETCH --- Use prefetch asm-instruction +# popcnt = yes/no --- -DUSE_POPCNT --- Use popcnt asm-instruction +# sse = yes/no --- -msse --- Use Intel Streaming SIMD Extensions +# pext = yes/no --- -DUSE_PEXT --- Use pext x86_64 asm-instruction +# +# Note that Makefile is space sensitive, so when adding new architectures +# or modifying existing flags, you have to make sure there are no extra spaces +# at the end of the line for flag values. + +### 2.1. General and architecture defaults +optimize = yes +debug = no +sanitize = no +bits = 32 +prefetch = no +popcnt = no +sse = no +pext = no + +### 2.2 Architecture specific + +ifeq ($(ARCH),general-32) + arch = any +endif + +ifeq ($(ARCH),x86-32-old) + arch = i386 +endif + +ifeq ($(ARCH),x86-32) + arch = i386 + prefetch = yes + sse = yes +endif + +ifeq ($(ARCH),general-64) + arch = any + bits = 64 +endif + +ifeq ($(ARCH),x86-64) + arch = x86_64 + bits = 64 + prefetch = yes + sse = yes +endif + +ifeq ($(ARCH),x86-64-modern) + arch = x86_64 + bits = 64 + prefetch = yes + popcnt = yes + sse = yes +endif + +ifeq ($(ARCH),x86-64-bmi2) + arch = x86_64 + bits = 64 + prefetch = yes + popcnt = yes + sse = yes + pext = yes +endif + +ifeq ($(ARCH),armv7) + arch = armv7 + prefetch = yes +endif + +ifeq ($(ARCH),ppc-32) + arch = ppc +endif + +ifeq ($(ARCH),ppc-64) + arch = ppc64 + bits = 64 +endif + + +### ========================================================================== +### Section 3. Low-level configuration +### ========================================================================== + +### 3.1 Selecting compiler (default = gcc) + +CXXFLAGS += -Wall -Wcast-qual -fno-exceptions -std=c++11 $(EXTRACXXFLAGS) +DEPENDFLAGS += -std=c++11 +LDFLAGS += $(EXTRALDFLAGS) + +ifeq ($(COMP),) + COMP=gcc +endif + +ifeq ($(COMP),gcc) + comp=gcc + CXX=g++ + CXXFLAGS += -pedantic -Wextra -Wshadow + + ifeq ($(ARCH),armv7) + CXXFLAGS += -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mneon-for-64bits -mtune=cortex-a53 + ifeq ($(OS),Android) + CXXFLAGS += -m$(bits) + LDFLAGS += -m$(bits) + endif + else + CXXFLAGS += -m$(bits) + LDFLAGS += -m$(bits) + endif + + ifneq ($(KERNEL),Darwin) + LDFLAGS += -Wl,--no-as-needed + endif + + gccversion=$(shell gcc --version) + gccmasqueraded=$(findstring clang,$(gccversion)) +endif + +ifeq ($(COMP),mingw) + comp=mingw + + ifeq ($(KERNEL),Linux) + ifeq ($(bits),64) + ifeq ($(shell which x86_64-w64-mingw32-c++-posix),) + CXX=x86_64-w64-mingw32-c++ + else + CXX=x86_64-w64-mingw32-c++-posix + endif + else + ifeq ($(shell which i686-w64-mingw32-c++-posix),) + CXX=i686-w64-mingw32-c++ + else + CXX=i686-w64-mingw32-c++-posix + endif + endif + else + CXX=g++ + endif + + CXXFLAGS += -Wextra -Wshadow + LDFLAGS += -static +endif + +ifeq ($(COMP),icc) + comp=icc + CXX=icpc + CXXFLAGS += -diag-disable 1476,10120 -Wcheck -Wabi -Wdeprecated -strict-ansi +endif + +ifeq ($(COMP),clang) + comp=clang + CXX=clang++ + CXXFLAGS += -pedantic -Wextra -Wshadow + + ifneq ($(KERNEL),Darwin) + ifneq ($(KERNEL),OpenBSD) + LDFLAGS += -latomic + endif + endif + + ifeq ($(ARCH),armv7) + ifeq ($(OS),Android) + CXXFLAGS += -m$(bits) + LDFLAGS += -m$(bits) + endif + else + CXXFLAGS += -m$(bits) + LDFLAGS += -m$(bits) + endif +endif + +ifeq ($(comp),icc) + profile_make = icc-profile-make + profile_use = icc-profile-use +else +ifeq ($(comp),clang) + profile_make = clang-profile-make + profile_use = clang-profile-use +else + profile_make = gcc-profile-make + profile_use = gcc-profile-use +endif +endif + +ifeq ($(KERNEL),Darwin) + CXXFLAGS += -arch $(arch) -mmacosx-version-min=10.9 + LDFLAGS += -arch $(arch) -mmacosx-version-min=10.9 +endif + +### Travis CI script uses COMPILER to overwrite CXX +ifdef COMPILER + COMPCXX=$(COMPILER) +endif + +### Allow overwriting CXX from command line +ifdef COMPCXX + CXX=$(COMPCXX) +endif + +### On mingw use Windows threads, otherwise POSIX +ifneq ($(comp),mingw) + # On Android Bionic's C library comes with its own pthread implementation bundled in + ifneq ($(OS),Android) + # Haiku has pthreads in its libroot, so only link it in on other platforms + ifneq ($(KERNEL),Haiku) + LDFLAGS += -lpthread + endif + endif +endif + +### 3.2.1 Debugging +ifeq ($(debug),no) + CXXFLAGS += -DNDEBUG +else + CXXFLAGS += -g +endif + +### 3.2.2 Debugging with undefined behavior sanitizers +ifneq ($(sanitize),no) + CXXFLAGS += -g3 -fsanitize=$(sanitize) -fuse-ld=gold + LDFLAGS += -fsanitize=$(sanitize) -fuse-ld=gold +endif + +### 3.3 Optimization +ifeq ($(optimize),yes) + + CXXFLAGS += -O3 + + ifeq ($(comp),gcc) + ifeq ($(OS), Android) + CXXFLAGS += -fno-gcse -mthumb -march=armv7-a -mfloat-abi=softfp + endif + endif + + ifeq ($(comp),$(filter $(comp),gcc clang icc)) + ifeq ($(KERNEL),Darwin) + CXXFLAGS += -mdynamic-no-pic + endif + endif +endif + +### 3.4 Bits +ifeq ($(bits),64) + CXXFLAGS += -DIS_64BIT +endif + +### 3.5 prefetch +ifeq ($(prefetch),yes) + ifeq ($(sse),yes) + CXXFLAGS += -msse + DEPENDFLAGS += -msse + endif +else + CXXFLAGS += -DNO_PREFETCH +endif + +### 3.6 popcnt +ifeq ($(popcnt),yes) + ifeq ($(comp),icc) + CXXFLAGS += -msse3 -DUSE_POPCNT + else + CXXFLAGS += -msse3 -mpopcnt -DUSE_POPCNT + endif +endif + +### 3.7 pext +ifeq ($(pext),yes) + CXXFLAGS += -DUSE_PEXT + ifeq ($(comp),$(filter $(comp),gcc clang mingw)) + CXXFLAGS += -mbmi2 + endif +endif + +### 3.8 Link Time Optimization, it works since gcc 4.5 but not on mingw under Windows. +### This is a mix of compile and link time options because the lto link phase +### needs access to the optimization flags. +ifeq ($(optimize),yes) +ifeq ($(debug), no) + ifeq ($(comp),clang) + CXXFLAGS += -flto + LDFLAGS += $(CXXFLAGS) + endif + + ifeq ($(comp),gcc) + CXXFLAGS += -flto + ifeq ($(gccmasqueraded),) + LDFLAGS += $(CXXFLAGS) -flto=jobserver + else + LDFLAGS += $(CXXFLAGS) + endif + endif + + ifeq ($(comp),mingw) + ifeq ($(KERNEL),Linux) + CXXFLAGS += -flto + LDFLAGS += $(CXXFLAGS) -flto=jobserver + endif + endif +endif +endif + +### 3.9 Android 5 can only run position independent executables. Note that this +### breaks Android 4.0 and earlier. +ifeq ($(OS), Android) + CXXFLAGS += -fPIE + LDFLAGS += -fPIE -pie +endif + + +### ========================================================================== +### Section 4. Public targets +### ========================================================================== + +help: + @echo "" + @echo "To compile McBrain, type: " + @echo "'make ARCH=arch [COMP=compiler] [COMPCXX=cxx]'" + @echo " would be 'build' or 'profile-build'" + @echo "" + @echo "To compile McCain, uncomment this line in the makefile: " + @echo "'### VERSION=maverick' by remvoing the 3 #(pound signs)" + @echo "then type: 'make ARCH=arch [COMP=compiler] [COMPCXX=cxx]'" + @echo "" + @echo "Supported targets:" + @echo "" + @echo "build > Standard build" + @echo "profile-build > PGO build" + @echo "strip > Strip executable" + @echo "install > Install executable" + @echo "clean > Clean up" + @echo "" + @echo "Supported archs:" + @echo "" + @echo "x86-64 > x86 64-bit" + @echo "x86-64-modern > x86 64-bit with popcnt support" + @echo "x86-64-bmi2 > x86 64-bit with pext support" + @echo "x86-32 > x86 32-bit with SSE support" + @echo "x86-32-old > x86 32-bit fall back for old hardware" + @echo "ppc-64 > PPC 64-bit" + @echo "ppc-32 > PPC 32-bit" + @echo "armv7 > ARMv7 32-bit" + @echo "general-64 > unspecified 64-bit" + @echo "general-32 > unspecified 32-bit" + @echo "" + @echo "Supported compilers:" + @echo "" + @echo "gcc > Gnu compiler (default)" + @echo "mingw > Gnu compiler with MinGW under Windows" + @echo "clang > LLVM Clang compiler" + @echo "icc > Intel compiler" + @echo "" + @echo "Simple examples. If you don't know what to do, you likely want to run: " + @echo "" + @echo "make build ARCH=x86-64 (This is for 64-bit systems)" + @echo "make build ARCH=x86-32 (This is for 32-bit systems)" + @echo "" + @echo "Advanced examples, for experienced users: " + @echo "" + @echo "make build ARCH=x86-64 COMP=clang" + @echo "make profile-build ARCH=x86-64-modern COMP=gcc COMPCXX=g++-4.8" + @echo "" + + +.PHONY: help build profile-build strip install clean objclean profileclean help \ + config-sanity icc-profile-use icc-profile-make gcc-profile-use gcc-profile-make \ + clang-profile-use clang-profile-make + +build: config-sanity + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) all + +profile-build: config-sanity objclean profileclean + @echo "" + @echo "Step 1/4. Building instrumented executable ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_make) + @echo "" + @echo "Step 2/4. Running benchmark for pgo-build ..." + $(PGOBENCH) > /dev/null + $(PGOBENCH2) > /dev/null + @echo "" + @echo "Step 3/4. Building optimized executable ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) objclean + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) $(profile_use) + @echo "" + @echo "Step 4/4. Deleting profile data ..." + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) profileclean + strip $(EXE) +# cp $(EXE) /Users/michaelbyrne/cluster.mfb +# cp $(EXE) /opt/picochess/engines/armv7l + +strip: + strip $(EXE) + +install: + -mkdir -p -m 755 $(BINDIR) + -cp $(EXE) $(BINDIR) + -strip $(BINDIR)/$(EXE) + +both: + VERSION= + ARCH=x86-64-modern + COMP=gcc + target=build + $(MAKE) $(target) + +#clean all +clean: objclean profileclean + @rm -f .depend *~ core + +# clean binaries and objects +objclean: + @rm -f $(EXE) *.o ./syzygy/*.o + +# clean auxiliary profiling files +profileclean: + @rm -rf profdir + @rm -f bench.txt *.gcda ./syzygy/*.gcda *.gcno ./syzygy/*.gcno + @rm -f stockfish.profdata *.profraw + +default: + help + +### ========================================================================== +### Section 5. Private targets +### ========================================================================== + +all: $(EXE) .depend + +config-sanity: + @echo "" + @echo "Config:" + @echo "debug: '$(debug)'" + @echo "sanitize: '$(sanitize)'" + @echo "optimize: '$(optimize)'" + @echo "arch: '$(arch)'" + @echo "bits: '$(bits)'" + @echo "kernel: '$(KERNEL)'" + @echo "os: '$(OS)'" + @echo "prefetch: '$(prefetch)'" + @echo "popcnt: '$(popcnt)'" + @echo "sse: '$(sse)'" + @echo "pext: '$(pext)'" + @echo "" + @echo "Flags:" + @echo "CXX: $(CXX)" + @echo "CXXFLAGS: $(CXXFLAGS)" + @echo "LDFLAGS: $(LDFLAGS)" + @echo "" + @echo "Testing config sanity. If this fails, try 'make help' ..." + @echo "" + @test "$(debug)" = "yes" || test "$(debug)" = "no" + @test "$(sanitize)" = "undefined" || test "$(sanitize)" = "thread" || test "$(sanitize)" = "no" + @test "$(optimize)" = "yes" || test "$(optimize)" = "no" + @test "$(arch)" = "any" || test "$(arch)" = "x86_64" || test "$(arch)" = "i386" || \ + test "$(arch)" = "ppc64" || test "$(arch)" = "ppc" || test "$(arch)" = "armv7" + @test "$(bits)" = "32" || test "$(bits)" = "64" + @test "$(prefetch)" = "yes" || test "$(prefetch)" = "no" + @test "$(popcnt)" = "yes" || test "$(popcnt)" = "no" + @test "$(sse)" = "yes" || test "$(sse)" = "no" + @test "$(pext)" = "yes" || test "$(pext)" = "no" + @test "$(comp)" = "gcc" || test "$(comp)" = "icc" || test "$(comp)" = "mingw" || test "$(comp)" = "clang" + +$(EXE): $(OBJS) + $(CXX) -o $@ $(OBJS) $(LDFLAGS) + +clang-profile-make: + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS='-fprofile-instr-generate ' \ + EXTRALDFLAGS=' -fprofile-instr-generate' \ + all + +clang-profile-use: + llvm-profdata merge -output=stockfish.profdata *.profraw + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS='-fprofile-instr-use=stockfish.profdata -Wno-profile-instr-out-of-date' \ + EXTRALDFLAGS='-fprofile-use ' \ + all + +gcc-profile-make: + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS='-fprofile-generate -fprofile-correction' \ + EXTRALDFLAGS='-lgcov' \ + all + +gcc-profile-use: + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS='-fprofile-use -fprofile-correction -fno-peel-loops -fno-tracer' \ + EXTRALDFLAGS='-lgcov' \ + all + +icc-profile-make: + @mkdir -p profdir + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS='-prof-gen=srcpos -prof_dir ./profdir' \ + all + +icc-profile-use: + $(MAKE) ARCH=$(ARCH) COMP=$(COMP) \ + EXTRACXXFLAGS='-prof_use -prof_dir ./profdir' \ + all + +.depend: + -@$(CXX) $(DEPENDFLAGS) -MM $(OBJS:.o=.cpp) > $@ 2> /dev/null + +-include .depend diff --git a/Engines/Windows/mcbrain/src/McBrain.sln b/Engines/Windows/mcbrain/src/McBrain.sln new file mode 100644 index 0000000..4b42ecd --- /dev/null +++ b/Engines/Windows/mcbrain/src/McBrain.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sugar", "Sugar.vcxproj", "{2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release AVX|x64 = Release AVX|x64 + Release AVX|x86 = Release AVX|x86 + Release AVX2|x64 = Release AVX2|x64 + Release AVX2|x86 = Release AVX2|x86 + Release SSE|x64 = Release SSE|x64 + Release SSE|x86 = Release SSE|x86 + Release SSE2|x64 = Release SSE2|x64 + Release SSE2|x86 = Release SSE2|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.ActiveCfg = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Build.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Deploy.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.ActiveCfg = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.Build.0 = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.ActiveCfg = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.Build.0 = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.ActiveCfg = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.Build.0 = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.ActiveCfg = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.Build.0 = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.ActiveCfg = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.Build.0 = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.ActiveCfg = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.Build.0 = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.ActiveCfg = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.Build.0 = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.ActiveCfg = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.Build.0 = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.ActiveCfg = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.Build.0 = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.ActiveCfg = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.Build.0 = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.ActiveCfg = Release|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Engines/Windows/mcbrain/src/McBrain.vcxproj b/Engines/Windows/mcbrain/src/McBrain.vcxproj new file mode 100644 index 0000000..a8b3003 --- /dev/null +++ b/Engines/Windows/mcbrain/src/McBrain.vcxproj @@ -0,0 +1,411 @@ + + + + + Debug + Win32 + + + Release AVX2 + Win32 + + + Release AVX2 + x64 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE + Win32 + + + Release SSE + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C} + Win32Proj + 10.0.10240.0 + + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + v141 + + + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH; + MultiThreadedDebugDLL + Level3 + + + MachineX86 + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + StreamingSIMDExtensions + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + + _WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH + + + + Console + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions2 + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + MultiThreaded + + + + + + + + Fast + true + Speed + AnySuitable + true + true + + + false + UseLinkTimeCodeGeneration + + + + + false + UseLinkTimeCodeGeneration + + + true + Speed + AnySuitable + true + StreamingSIMDExtensions2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engines/Windows/mcbrain/src/McBrain.vcxproj.filters b/Engines/Windows/mcbrain/src/McBrain.vcxproj.filters new file mode 100644 index 0000000..859ce91 --- /dev/null +++ b/Engines/Windows/mcbrain/src/McBrain.vcxproj.filters @@ -0,0 +1,147 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/Engines/Windows/mcbrain/src/McBrain.vcxproj.user b/Engines/Windows/mcbrain/src/McBrain.vcxproj.user new file mode 100644 index 0000000..5b610ed --- /dev/null +++ b/Engines/Windows/mcbrain/src/McBrain.vcxproj.user @@ -0,0 +1,6 @@ + + + + WindowsLocalDebugger + + \ No newline at end of file diff --git a/Engines/Windows/mcbrain/src/McCain.sln b/Engines/Windows/mcbrain/src/McCain.sln new file mode 100644 index 0000000..4b42ecd --- /dev/null +++ b/Engines/Windows/mcbrain/src/McCain.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Sugar", "Sugar.vcxproj", "{2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release AVX|x64 = Release AVX|x64 + Release AVX|x86 = Release AVX|x86 + Release AVX2|x64 = Release AVX2|x64 + Release AVX2|x86 = Release AVX2|x86 + Release SSE|x64 = Release SSE|x64 + Release SSE|x86 = Release SSE|x86 + Release SSE2|x64 = Release SSE2|x64 + Release SSE2|x86 = Release SSE2|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.ActiveCfg = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Build.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x64.Deploy.0 = Debug|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.ActiveCfg = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Debug|x86.Build.0 = Debug|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.ActiveCfg = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x64.Build.0 = Release AVX|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.ActiveCfg = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX|x86.Build.0 = Release AVX|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.ActiveCfg = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x64.Build.0 = Release AVX2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.ActiveCfg = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release AVX2|x86.Build.0 = Release AVX2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.ActiveCfg = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x64.Build.0 = Release SSE|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.ActiveCfg = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE|x86.Build.0 = Release SSE|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.ActiveCfg = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x64.Build.0 = Release SSE2|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.ActiveCfg = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release SSE2|x86.Build.0 = Release SSE2|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.ActiveCfg = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x64.Build.0 = Release|x64 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.ActiveCfg = Release|Win32 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Engines/Windows/mcbrain/src/McCain.vcxproj b/Engines/Windows/mcbrain/src/McCain.vcxproj new file mode 100644 index 0000000..a8b3003 --- /dev/null +++ b/Engines/Windows/mcbrain/src/McCain.vcxproj @@ -0,0 +1,411 @@ + + + + + Debug + Win32 + + + Release AVX2 + Win32 + + + Release AVX2 + x64 + + + Release AVX + Win32 + + + Release AVX + x64 + + + Release SSE2 + Win32 + + + Release SSE2 + x64 + + + Release SSE + Win32 + + + Release SSE + x64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2EC0B847-72BD-4BD8-86E4-134DDF1FC85C} + Win32Proj + 10.0.10240.0 + + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + true + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + Application + false + v141 + + + v141 + + + v141 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH; + MultiThreadedDebugDLL + Level3 + + + MachineX86 + Console + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreadedDLL + Level3 + true + Speed + AnySuitable + true + StreamingSIMDExtensions + + + MachineX86 + false + Console + true + UseLinkTimeCodeGeneration + + + + + + _WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);DNO_PREFETCH + + + + Console + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions2 + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + AdvancedVectorExtensions + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + + _WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions);DNDEBUG;DNO_PREFETCH + MultiThreaded + Fast + true + Speed + AnySuitable + true + true + + + + Console + false + UseLinkTimeCodeGeneration + + + + + MultiThreaded + + + + + + + + Fast + true + Speed + AnySuitable + true + true + + + false + UseLinkTimeCodeGeneration + + + + + false + UseLinkTimeCodeGeneration + + + true + Speed + AnySuitable + true + StreamingSIMDExtensions2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Engines/Windows/mcbrain/src/VersionHelpers.h b/Engines/Windows/mcbrain/src/VersionHelpers.h new file mode 100644 index 0000000..72e930b --- /dev/null +++ b/Engines/Windows/mcbrain/src/VersionHelpers.h @@ -0,0 +1,211 @@ +#ifndef VERSIONHELPER_H_INCLUDED +#define VERSIONHELPER_H_INCLUDED + +#define VERSIONHELPERAPI inline bool + +#define _WIN32_WINNT_NT4 0x0400 +#define _WIN32_WINNT_WIN2K 0x0500 +#define _WIN32_WINNT_WINXP 0x0501 +#define _WIN32_WINNT_WS03 0x0502 +#define _WIN32_WINNT_WIN6 0x0600 +#define _WIN32_WINNT_VISTA 0x0600 +#define _WIN32_WINNT_WS08 0x0600 +#define _WIN32_WINNT_LONGHORN 0x0600 +#define _WIN32_WINNT_WIN7 0x0601 +#define _WIN32_WINNT_WIN8 0x0602 +#define _WIN32_WINNT_WINBLUE 0x0603 +#define _WIN32_WINNT_WIN10 0x0A00 + +typedef LONG(NTAPI *fnRtlGetVersion)(PRTL_OSVERSIONINFOEXW lpVersionInformation); + +enum eVerShort +{ + WinUnsupported, // Unsupported OS + WinXP, // Windows XP + Win7, // Windows 7 + Win8, // Windows 8 + Win8Point1, // Windows 8.1 + Win10, // Windows 10 + Win10AU, // Windows 10 Anniversary update + Win10CU // Windows 10 Creators update +}; + +struct WinVersion +{ + eVerShort ver = WinUnsupported; + RTL_OSVERSIONINFOEXW native; +}; + +inline WinVersion& WinVer() +{ + static WinVersion g_WinVer; + return g_WinVer; +} + +inline void InitVersion() +{ + auto& g_WinVer = WinVer(); + g_WinVer.native.dwOSVersionInfoSize = sizeof(g_WinVer.native); + auto RtlGetVersion = (fnRtlGetVersion)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "RtlGetVersion"); + if (RtlGetVersion) + RtlGetVersion(&g_WinVer.native); + + if (g_WinVer.native.dwMajorVersion != 0) + { + auto fullver = (g_WinVer.native.dwMajorVersion << 8) | g_WinVer.native.dwMinorVersion; + switch (fullver) + { + case _WIN32_WINNT_WIN10: + if (g_WinVer.native.dwBuildNumber >= 15063) + g_WinVer.ver = Win10CU; + else if (g_WinVer.native.dwBuildNumber >= 14393) + g_WinVer.ver = Win10AU; + else if (g_WinVer.native.dwBuildNumber >= 10586) + g_WinVer.ver = Win10; + break; + + case _WIN32_WINNT_WINBLUE: + g_WinVer.ver = Win8Point1; + break; + + case _WIN32_WINNT_WIN8: + g_WinVer.ver = Win8; + break; + + case _WIN32_WINNT_WIN7: + g_WinVer.ver = Win7; + break; + + case _WIN32_WINNT_WINXP: + g_WinVer.ver = WinXP; + break; + + default: + g_WinVer.ver = WinUnsupported; + } + } +} + + +VERSIONHELPERAPI +IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor, DWORD dwBuild) +{ + auto& g_WinVer = WinVer(); + if (g_WinVer.native.dwMajorVersion != 0) + { + if (g_WinVer.native.dwMajorVersion > wMajorVersion) + return true; + else if (g_WinVer.native.dwMajorVersion < wMajorVersion) + return false; + + if (g_WinVer.native.dwMinorVersion > wMinorVersion) + return true; + else if (g_WinVer.native.dwMinorVersion < wMinorVersion) + return false; + + if (g_WinVer.native.wServicePackMajor > wServicePackMajor) + return true; + else if (g_WinVer.native.wServicePackMajor < wServicePackMajor) + return false; + + if (g_WinVer.native.dwBuildNumber >= dwBuild) + return true; + } + + return false; +} + +VERSIONHELPERAPI +IsWindowsXPOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2, 0); +} + +VERSIONHELPERAPI +IsWindowsXPSP3OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1, 0); +} + +VERSIONHELPERAPI +IsWindowsVistaSP2OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2, 0); +} + +VERSIONHELPERAPI +IsWindows7OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0, 0); +} + +VERSIONHELPERAPI +IsWindows7SP1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1, 0); +} + +VERSIONHELPERAPI +IsWindows8OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0, 0); +} + +VERSIONHELPERAPI +IsWindows8Point1OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0, 0); +} + +VERSIONHELPERAPI +IsWindows10OrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 0); +} + +VERSIONHELPERAPI +IsWindows10AnniversaryOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 14393); +} + +VERSIONHELPERAPI +IsWindows10CreatorsOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN10), LOBYTE(_WIN32_WINNT_WIN10), 0, 15063); +} + +VERSIONHELPERAPI +IsWindowsServer() +{ + OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0,{ 0 }, 0, 0, 0, VER_NT_WORKSTATION, 0 }; + DWORDLONG const dwlConditionMask = VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL); + + return !VerifyVersionInfoW(&osvi, VER_PRODUCT_TYPE, dwlConditionMask); +} + +#endif \ No newline at end of file diff --git a/Engines/Windows/mcbrain/src/benchmark.cpp b/Engines/Windows/mcbrain/src/benchmark.cpp new file mode 100644 index 0000000..1b792dd --- /dev/null +++ b/Engines/Windows/mcbrain/src/benchmark.cpp @@ -0,0 +1,157 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "position.h" + +using namespace std; + +namespace { + +const vector Defaults = { + "setoption name UCI_Chess960 value false", + "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1", + "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 10", + "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - - 0 11", + "4rrk1/pp1n3p/3q2pQ/2p1pb2/2PP4/2P3N1/P2B2PP/4RRK1 b - - 7 19", + "rq3rk1/ppp2ppp/1bnpb3/3N2B1/3NP3/7P/PPPQ1PP1/2KR3R w - - 7 14 moves d4e6", + "r1bq1r1k/1pp1n1pp/1p1p4/4p2Q/4Pp2/1BNP4/PPP2PPP/3R1RK1 w - - 2 14 moves g2g4", + "r3r1k1/2p2ppp/p1p1bn2/8/1q2P3/2NPQN2/PPP3PP/R4RK1 b - - 2 15", + "r1bbk1nr/pp3p1p/2n5/1N4p1/2Np1B2/8/PPP2PPP/2KR1B1R w kq - 0 13", + "r1bq1rk1/ppp1nppp/4n3/3p3Q/3P4/1BP1B3/PP1N2PP/R4RK1 w - - 1 16", + "4r1k1/r1q2ppp/ppp2n2/4P3/5Rb1/1N1BQ3/PPP3PP/R5K1 w - - 1 17", + "2rqkb1r/ppp2p2/2npb1p1/1N1Nn2p/2P1PP2/8/PP2B1PP/R1BQK2R b KQ - 0 11", + "r1bq1r1k/b1p1npp1/p2p3p/1p6/3PP3/1B2NN2/PP3PPP/R2Q1RK1 w - - 1 16", + "3r1rk1/p5pp/bpp1pp2/8/q1PP1P2/b3P3/P2NQRPP/1R2B1K1 b - - 6 22", + "r1q2rk1/2p1bppp/2Pp4/p6b/Q1PNp3/4B3/PP1R1PPP/2K4R w - - 2 18", + "4k2r/1pb2ppp/1p2p3/1R1p4/3P4/2r1PN2/P4PPP/1R4K1 b - - 3 22", + "3q2k1/pb3p1p/4pbp1/2r5/PpN2N2/1P2P2P/5PP1/Q2R2K1 b - - 4 26", + "6k1/6p1/6Pp/ppp5/3pn2P/1P3K2/1PP2P2/3N4 b - - 0 1", + "3b4/5kp1/1p1p1p1p/pP1PpP1P/P1P1P3/3KN3/8/8 w - - 0 1", + "2K5/p7/7P/5pR1/8/5k2/r7/8 w - - 0 1 moves g5g6 f3e3 g6g5 e3f3", + "8/6pk/1p6/8/PP3p1p/5P2/4KP1q/3Q4 w - - 0 1", + "7k/3p2pp/4q3/8/4Q3/5Kp1/P6b/8 w - - 0 1", + "8/2p5/8/2kPKp1p/2p4P/2P5/3P4/8 w - - 0 1", + "8/1p3pp1/7p/5P1P/2k3P1/8/2K2P2/8 w - - 0 1", + "8/pp2r1k1/2p1p3/3pP2p/1P1P1P1P/P5KR/8/8 w - - 0 1", + "8/3p4/p1bk3p/Pp6/1Kp1PpPp/2P2P1P/2P5/5B2 b - - 0 1", + "5k2/7R/4P2p/5K2/p1r2P1p/8/8/8 b - - 0 1", + "6k1/6p1/P6p/r1N5/5p2/7P/1b3PP1/4R1K1 w - - 0 1", + "1r3k2/4q3/2Pp3b/3Bp3/2Q2p2/1p1P2P1/1P2KP2/3N4 w - - 0 1", + "6k1/4pp1p/3p2p1/P1pPb3/R7/1r2P1PP/3B1P2/6K1 w - - 0 1", + "8/3p3B/5p2/5P2/p7/PP5b/k7/6K1 w - - 0 1", + + // 5-man positions + "8/8/8/8/5kp1/P7/8/1K1N4 w - - 0 1", // Kc2 - mate + "8/8/8/5N2/8/p7/8/2NK3k w - - 0 1", // Na2 - mate + "8/3k4/8/8/8/4B3/4KB2/2B5 w - - 0 1", // draw + + // 6-man positions + "8/8/1P6/5pr1/8/4R3/7k/2K5 w - - 0 1", // Re5 - mate + "8/2p4P/8/kr6/6R1/8/8/1K6 w - - 0 1", // Ka2 - mate + "8/8/3P3k/8/1p6/8/1P6/1K3n2 b - - 0 1", // Nd2 - draw + + // 7-man positions + "8/R7/2q5/8/6k1/8/1P5p/K6R w - - 0 124", // Draw + + // Mate and stalemate positions + "6k1/3b3r/1p1p4/p1n2p2/1PPNpP1q/P3Q1p1/1R1RB1P1/5K2 b - - 0 1", + "r2r1n2/pp2bk2/2p1p2p/3q4/3PN1QP/2P3R1/P4PP1/5RK1 w - - 0 1", + "8/8/8/8/8/6k1/6p1/6K1 w - -", + "7k/7P/6K1/8/3B4/8/8/8 b - -", + + // Chess 960 + "setoption name UCI_Chess960 value true", + "bbqnnrkr/pppppppp/8/8/8/8/PPPPPPPP/BBQNNRKR w KQkq - 0 1 moves g2g3 d7d5 d2d4 c8h3 c1g5 e8d6 g5e7 f7f6", + "setoption name UCI_Chess960 value false" +}; + +} // namespace + +/// setup_bench() builds a list of UCI commands to be run by bench. There +/// are five parameters: TT size in MiB, number of search threads that +/// should be used, the limit value spent for each position, a file name +/// where to look for positions in FEN format and the type of the limit: +/// depth, perft, nodes and movetime (in millisecs). +/// +/// bench -> search default positions up to depth 13 +/// bench 64 1 15 -> search default positions up to depth 15 (TT = 64MiB) +/// bench 64 4 5000 current movetime -> search current position with 4 threads for 5 sec +/// bench 64 1 100000 default nodes -> search default positions for 100K nodes each +/// bench 16 1 5 default perft -> run a perft 5 on default positions + +vector setup_bench(const Position& current, istream& is) { + + vector fens, list; + string go, token; + + // Assign default values to missing arguments + string ttSize = (is >> token) ? token : "16"; + string threads = (is >> token) ? token : "1"; + string limit = (is >> token) ? token : "13"; + string fenFile = (is >> token) ? token : "default"; + string limitType = (is >> token) ? token : "depth"; + + go = "go " + limitType + " " + limit; + + if (fenFile == "default") + fens = Defaults; + + else if (fenFile == "current") + fens.push_back(current.fen()); + + else + { + string fen; + ifstream file(fenFile); + + if (!file.is_open()) + { + cerr << "Unable to open file " << fenFile << endl; + exit(EXIT_FAILURE); + } + + while (getline(file, fen)) + if (!fen.empty()) + fens.push_back(fen); + + file.close(); + } + + list.emplace_back("ucinewgame"); + list.emplace_back("setoption name Threads value " + threads); + list.emplace_back("setoption name Hash value " + ttSize); + + for (const string& fen : fens) + if (fen.find("setoption") != string::npos) + list.emplace_back(fen); + else + { + list.emplace_back("position fen " + fen); + list.emplace_back(go); + } + + return list; +} diff --git a/Engines/Windows/mcbrain/src/bitbase.cpp b/Engines/Windows/mcbrain/src/bitbase.cpp new file mode 100644 index 0000000..23d3b6b --- /dev/null +++ b/Engines/Windows/mcbrain/src/bitbase.cpp @@ -0,0 +1,181 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "bitboard.h" +#include "types.h" + +namespace { + + // There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7 + constexpr unsigned MAX_INDEX = 2*24*64*64; // stm * psq * wksq * bksq = 196608 + + // Each uint32_t stores results of 32 positions, one per bit + uint32_t KPKBitbase[MAX_INDEX / 32]; + + // A KPK bitbase index is an integer in [0, IndexMax] range + // + // Information is mapped in a way that minimizes the number of iterations: + // + // bit 0- 5: white king square (from SQ_A1 to SQ_H8) + // bit 6-11: black king square (from SQ_A1 to SQ_H8) + // bit 12: side to move (WHITE or BLACK) + // bit 13-14: white pawn file (from FILE_A to FILE_D) + // bit 15-17: white pawn RANK_7 - rank (from RANK_7 - RANK_7 to RANK_7 - RANK_2) + unsigned index(Color us, Square bksq, Square wksq, Square psq) { + return wksq | (bksq << 6) | (us << 12) | (file_of(psq) << 13) | ((RANK_7 - rank_of(psq)) << 15); + } + + enum Result { + INVALID = 0, + UNKNOWN = 1, + DRAW = 2, + WIN = 4 + }; + + Result& operator|=(Result& r, Result v) { return r = Result(r | v); } + + struct KPKPosition { + KPKPosition() = default; + explicit KPKPosition(unsigned idx); + operator Result() const { return result; } + Result classify(const std::vector& db) + { return us == WHITE ? classify(db) : classify(db); } + + template Result classify(const std::vector& db); + + Color us; + Square ksq[COLOR_NB], psq; + Result result; + }; + +} // namespace + + +bool Bitbases::probe(Square wksq, Square wpsq, Square bksq, Color us) { + + assert(file_of(wpsq) <= FILE_D); + + unsigned idx = index(us, bksq, wksq, wpsq); + return KPKBitbase[idx / 32] & (1 << (idx & 0x1F)); +} + + +void Bitbases::init() { + + std::vector db(MAX_INDEX); + unsigned idx, repeat = 1; + + // Initialize db with known win / draw positions + for (idx = 0; idx < MAX_INDEX; ++idx) + db[idx] = KPKPosition(idx); + + // Iterate through the positions until none of the unknown positions can be + // changed to either wins or draws (15 cycles needed). + while (repeat) + for (repeat = idx = 0; idx < MAX_INDEX; ++idx) + repeat |= (db[idx] == UNKNOWN && db[idx].classify(db) != UNKNOWN); + + // Map 32 results into one KPKBitbase[] entry + for (idx = 0; idx < MAX_INDEX; ++idx) + if (db[idx] == WIN) + KPKBitbase[idx / 32] |= 1 << (idx & 0x1F); +} + + +namespace { + + KPKPosition::KPKPosition(unsigned idx) { + + ksq[WHITE] = Square((idx >> 0) & 0x3F); + ksq[BLACK] = Square((idx >> 6) & 0x3F); + us = Color ((idx >> 12) & 0x01); + psq = make_square(File((idx >> 13) & 0x3), Rank(RANK_7 - ((idx >> 15) & 0x7))); + + // Check if two pieces are on the same square or if a king can be captured + if ( distance(ksq[WHITE], ksq[BLACK]) <= 1 + || ksq[WHITE] == psq + || ksq[BLACK] == psq + || (us == WHITE && (PawnAttacks[WHITE][psq] & ksq[BLACK]))) + result = INVALID; + + // Immediate win if a pawn can be promoted without getting captured + else if ( us == WHITE + && rank_of(psq) == RANK_7 + && ksq[us] != psq + NORTH + && ( distance(ksq[~us], psq + NORTH) > 1 + || (PseudoAttacks[KING][ksq[us]] & (psq + NORTH)))) + result = WIN; + + // Immediate draw if it is a stalemate or a king captures undefended pawn + else if ( us == BLACK + && ( !(PseudoAttacks[KING][ksq[us]] & ~(PseudoAttacks[KING][ksq[~us]] | PawnAttacks[~us][psq])) + || (PseudoAttacks[KING][ksq[us]] & psq & ~PseudoAttacks[KING][ksq[~us]]))) + result = DRAW; + + // Position will be classified later + else + result = UNKNOWN; + } + + template + Result KPKPosition::classify(const std::vector& db) { + + // White to move: If one move leads to a position classified as WIN, the result + // of the current position is WIN. If all moves lead to positions classified + // as DRAW, the current position is classified as DRAW, otherwise the current + // position is classified as UNKNOWN. + // + // Black to move: If one move leads to a position classified as DRAW, the result + // of the current position is DRAW. If all moves lead to positions classified + // as WIN, the position is classified as WIN, otherwise the current position is + // classified as UNKNOWN. + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Result Good = (Us == WHITE ? WIN : DRAW); + constexpr Result Bad = (Us == WHITE ? DRAW : WIN); + + Result r = INVALID; + Bitboard b = PseudoAttacks[KING][ksq[Us]]; + + while (b) + r |= Us == WHITE ? db[index(Them, ksq[Them] , pop_lsb(&b), psq)] + : db[index(Them, pop_lsb(&b), ksq[Them] , psq)]; + + if (Us == WHITE) + { + if (rank_of(psq) < RANK_7) // Single push + r |= db[index(Them, ksq[Them], ksq[Us], psq + NORTH)]; + + if ( rank_of(psq) == RANK_2 // Double push + && psq + NORTH != ksq[Us] + && psq + NORTH != ksq[Them]) + r |= db[index(Them, ksq[Them], ksq[Us], psq + NORTH + NORTH)]; + } + + return result = r & Good ? Good : r & UNKNOWN ? UNKNOWN : Bad; + } + +} // namespace diff --git a/Engines/Windows/mcbrain/src/bitboard.cpp b/Engines/Windows/mcbrain/src/bitboard.cpp new file mode 100644 index 0000000..0d676a5 --- /dev/null +++ b/Engines/Windows/mcbrain/src/bitboard.cpp @@ -0,0 +1,374 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include + +#include "bitboard.h" +#include "misc.h" + +uint8_t PopCnt16[1 << 16]; +int SquareDistance[SQUARE_NB][SQUARE_NB]; + +Bitboard SquareBB[SQUARE_NB]; +Bitboard FileBB[FILE_NB]; +Bitboard RankBB[RANK_NB]; +Bitboard AdjacentFilesBB[FILE_NB]; +Bitboard ForwardRanksBB[COLOR_NB][RANK_NB]; +Bitboard BetweenBB[SQUARE_NB][SQUARE_NB]; +Bitboard LineBB[SQUARE_NB][SQUARE_NB]; +Bitboard DistanceRingBB[SQUARE_NB][8]; +Bitboard ForwardFileBB[COLOR_NB][SQUARE_NB]; +Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB]; +Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB]; +Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; +Bitboard PawnAttacks[COLOR_NB][SQUARE_NB]; + +Magic RookMagics[SQUARE_NB]; +Magic BishopMagics[SQUARE_NB]; + +namespace { //Niklas Fiekas + + Bitboard AttackTable[HasPext ? 107648 : 88772] = { 0 }; + + struct MagicInit { + Bitboard magic; + unsigned offset; + }; + + MagicInit BishopMagicInit[SQUARE_NB] = { + { 0x007fbfbfbfbfbfffu, 5378 }, + { 0x0000a060401007fcu, 4093 }, + { 0x0001004008020000u, 4314 }, + { 0x0000806004000000u, 6587 }, + { 0x0000100400000000u, 6491 }, + { 0x000021c100b20000u, 6330 }, + { 0x0000040041008000u, 5609 }, + { 0x00000fb0203fff80u, 22236 }, + { 0x0000040100401004u, 6106 }, + { 0x0000020080200802u, 5625 }, + { 0x0000004010202000u, 16785 }, + { 0x0000008060040000u, 16817 }, + { 0x0000004402000000u, 6842 }, + { 0x0000000801008000u, 7003 }, + { 0x000007efe0bfff80u, 4197 }, + { 0x0000000820820020u, 7356 }, + { 0x0000400080808080u, 4602 }, + { 0x00021f0100400808u, 4538 }, + { 0x00018000c06f3fffu, 29531 }, + { 0x0000258200801000u, 45393 }, + { 0x0000240080840000u, 12420 }, + { 0x000018000c03fff8u, 15763 }, + { 0x00000a5840208020u, 5050 }, + { 0x0000020008208020u, 4346 }, + { 0x0000804000810100u, 6074 }, + { 0x0001011900802008u, 7866 }, + { 0x0000804000810100u, 32139 }, + { 0x000100403c0403ffu, 57673 }, + { 0x00078402a8802000u, 55365 }, + { 0x0000101000804400u, 15818 }, + { 0x0000080800104100u, 5562 }, + { 0x00004004c0082008u, 6390 }, + { 0x0001010120008020u, 7930 }, + { 0x000080809a004010u, 13329 }, + { 0x0007fefe08810010u, 7170 }, + { 0x0003ff0f833fc080u, 27267 }, + { 0x007fe08019003042u, 53787 }, + { 0x003fffefea003000u, 5097 }, + { 0x0000101010002080u, 6643 }, + { 0x0000802005080804u, 6138 }, + { 0x0000808080a80040u, 7418 }, + { 0x0000104100200040u, 7898 }, + { 0x0003ffdf7f833fc0u, 42012 }, + { 0x0000008840450020u, 57350 }, + { 0x00007ffc80180030u, 22813 }, + { 0x007fffdd80140028u, 56693 }, + { 0x00020080200a0004u, 5818 }, + { 0x0000101010100020u, 7098 }, + { 0x0007ffdfc1805000u, 4451 }, + { 0x0003ffefe0c02200u, 4709 }, + { 0x0000000820806000u, 4794 }, + { 0x0000000008403000u, 13364 }, + { 0x0000000100202000u, 4570 }, + { 0x0000004040802000u, 4282 }, + { 0x0004010040100400u, 14964 }, + { 0x00006020601803f4u, 4026 }, + { 0x0003ffdfdfc28048u, 4826 }, + { 0x0000000820820020u, 7354 }, + { 0x0000000008208060u, 4848 }, + { 0x0000000000808020u, 15946 }, + { 0x0000000001002020u, 14932 }, + { 0x0000000401002008u, 16588 }, + { 0x0000004040404040u, 6905 }, + { 0x007fff9fdf7ff813u, 16076 } + }; + + MagicInit RookMagicInit[SQUARE_NB] = { + { 0x00280077ffebfffeu, 26304 }, + { 0x2004010201097fffu, 35520 }, + { 0x0010020010053fffu, 38592 }, + { 0x0040040008004002u, 8026 }, + { 0x7fd00441ffffd003u, 22196 }, + { 0x4020008887dffffeu, 80870 }, + { 0x004000888847ffffu, 76747 }, + { 0x006800fbff75fffdu, 30400 }, + { 0x000028010113ffffu, 11115 }, + { 0x0020040201fcffffu, 18205 }, + { 0x007fe80042ffffe8u, 53577 }, + { 0x00001800217fffe8u, 62724 }, + { 0x00001800073fffe8u, 34282 }, + { 0x00001800e05fffe8u, 29196 }, + { 0x00001800602fffe8u, 23806 }, + { 0x000030002fffffa0u, 49481 }, + { 0x00300018010bffffu, 2410 }, + { 0x0003000c0085fffbu, 36498 }, + { 0x0004000802010008u, 24478 }, + { 0x0004002020020004u, 10074 }, + { 0x0001002002002001u, 79315 }, + { 0x0001001000801040u, 51779 }, + { 0x0000004040008001u, 13586 }, + { 0x0000006800cdfff4u, 19323 }, + { 0x0040200010080010u, 70612 }, + { 0x0000080010040010u, 83652 }, + { 0x0004010008020008u, 63110 }, + { 0x0000040020200200u, 34496 }, + { 0x0002008010100100u, 84966 }, + { 0x0000008020010020u, 54341 }, + { 0x0000008020200040u, 60421 }, + { 0x0000820020004020u, 86402 }, + { 0x00fffd1800300030u, 50245 }, + { 0x007fff7fbfd40020u, 76622 }, + { 0x003fffbd00180018u, 84676 }, + { 0x001fffde80180018u, 78757 }, + { 0x000fffe0bfe80018u, 37346 }, + { 0x0001000080202001u, 370 }, + { 0x0003fffbff980180u, 42182 }, + { 0x0001fffdff9000e0u, 45385 }, + { 0x00fffefeebffd800u, 61659 }, + { 0x007ffff7ffc01400u, 12790 }, + { 0x003fffbfe4ffe800u, 16762 }, + { 0x001ffff01fc03000u, 0 }, + { 0x000fffe7f8bfe800u, 38380 }, + { 0x0007ffdfdf3ff808u, 11098 }, + { 0x0003fff85fffa804u, 21803 }, + { 0x0001fffd75ffa802u, 39189 }, + { 0x00ffffd7ffebffd8u, 58628 }, + { 0x007fff75ff7fbfd8u, 44116 }, + { 0x003fff863fbf7fd8u, 78357 }, + { 0x001fffbfdfd7ffd8u, 44481 }, + { 0x000ffff810280028u, 64134 }, + { 0x0007ffd7f7feffd8u, 41759 }, + { 0x0003fffc0c480048u, 1394 }, + { 0x0001ffffafd7ffd8u, 40910 }, + { 0x00ffffe4ffdfa3bau, 66516 }, + { 0x007fffef7ff3d3dau, 3897 }, + { 0x003fffbfdfeff7fau, 3930 }, + { 0x001fffeff7fbfc22u, 72934 }, + { 0x0000020408001001u, 72662 }, + { 0x0007fffeffff77fdu, 56325 }, + { 0x0003ffffbf7dfeecu, 66501 }, + { 0x0001ffff9dffa333u, 14826 } + }; + + Bitboard relevant_occupancies(Direction directions[], Square s); + + template + void init_magics(MagicInit init[], Magic magics[], Direction directions[]); + + // popcount16() counts the non-zero bits using SWAR-Popcount algorithm + + unsigned popcount16(unsigned u) { + u -= (u >> 1) & 0x5555U; + u = ((u >> 2) & 0x3333U) + (u & 0x3333U); + u = ((u >> 4) + u) & 0x0F0FU; + return (u * 0x0101U) >> 8; + } +} + + +/// Bitboards::pretty() returns an ASCII representation of a bitboard suitable +/// to be printed to standard output. Useful for debugging. + +const std::string Bitboards::pretty(Bitboard b) { + + std::string s = "+---+---+---+---+---+---+---+---+\n"; + + for (Rank r = RANK_8; r >= RANK_1; --r) + { + for (File f = FILE_A; f <= FILE_H; ++f) + s += b & make_square(f, r) ? "| X " : "| "; + + s += "|\n+---+---+---+---+---+---+---+---+\n"; + } + + return s; +} + + +/// Bitboards::init() initializes various bitboard tables. It is called at +/// startup and relies on global objects to be already zero-initialized. + +void Bitboards::init() { + + for (unsigned i = 0; i < (1 << 16); ++i) + PopCnt16[i] = (uint8_t) popcount16(i); + + for (Square s = SQ_A1; s <= SQ_H8; ++s) + SquareBB[s] = (1ULL << s); + + for (File f = FILE_A; f <= FILE_H; ++f) + FileBB[f] = f > FILE_A ? FileBB[f - 1] << 1 : FileABB; + + for (Rank r = RANK_1; r <= RANK_8; ++r) + RankBB[r] = r > RANK_1 ? RankBB[r - 1] << 8 : Rank1BB; + + for (File f = FILE_A; f <= FILE_H; ++f) + AdjacentFilesBB[f] = (f > FILE_A ? FileBB[f - 1] : 0) | (f < FILE_H ? FileBB[f + 1] : 0); + + for (Rank r = RANK_1; r < RANK_8; ++r) + ForwardRanksBB[WHITE][r] = ~(ForwardRanksBB[BLACK][r + 1] = ForwardRanksBB[BLACK][r] | RankBB[r]); + + for (Color c = WHITE; c <= BLACK; ++c) + for (Square s = SQ_A1; s <= SQ_H8; ++s) + { + ForwardFileBB [c][s] = ForwardRanksBB[c][rank_of(s)] & FileBB[file_of(s)]; + PawnAttackSpan[c][s] = ForwardRanksBB[c][rank_of(s)] & AdjacentFilesBB[file_of(s)]; + PassedPawnMask[c][s] = ForwardFileBB [c][s] | PawnAttackSpan[c][s]; + } + + for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) + for (Square s2 = SQ_A1; s2 <= SQ_H8; ++s2) + if (s1 != s2) + { + SquareDistance[s1][s2] = std::max(distance(s1, s2), distance(s1, s2)); + DistanceRingBB[s1][SquareDistance[s1][s2]] |= s2; + } + + int steps[][5] = { {}, { 7, 9 }, { 6, 10, 15, 17 }, {}, {}, {}, { 1, 7, 8, 9 } }; + + for (Color c = WHITE; c <= BLACK; ++c) + for (PieceType pt : { PAWN, KNIGHT, KING }) + for (Square s = SQ_A1; s <= SQ_H8; ++s) + for (int i = 0; steps[pt][i]; ++i) + { + Square to = s + Direction(c == WHITE ? steps[pt][i] : -steps[pt][i]); + + if (is_ok(to) && distance(s, to) < 3) + { + if (pt == PAWN) + PawnAttacks[c][s] |= to; + else + PseudoAttacks[pt][s] |= to; + } + } + + Direction RookDirections[] = { NORTH, EAST, SOUTH, WEST }; + Direction BishopDirections[] = { NORTH_EAST, SOUTH_EAST, SOUTH_WEST, NORTH_WEST }; + + if (HasPext) + { + unsigned offset = 0; + + for (Square s = SQ_A1; s <= SQ_H8; ++s) + { + RookMagicInit[s].offset = offset; + offset += 1 << popcount(relevant_occupancies(RookDirections, s)); + } + + for (Square s = SQ_A1; s <= SQ_H8; ++s) + { + BishopMagicInit[s].offset = offset; + offset += 1 << popcount(relevant_occupancies(BishopDirections, s)); + } + } + + init_magics(RookMagicInit, RookMagics, RookDirections); + init_magics(BishopMagicInit, BishopMagics, BishopDirections); + + for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) + { + PseudoAttacks[QUEEN][s1] = PseudoAttacks[BISHOP][s1] = attacks_bb(s1, 0); + PseudoAttacks[QUEEN][s1] |= PseudoAttacks[ ROOK][s1] = attacks_bb< ROOK>(s1, 0); + + for (PieceType pt : { BISHOP, ROOK }) + for (Square s2 = SQ_A1; s2 <= SQ_H8; ++s2) + { + if (!(PseudoAttacks[pt][s1] & s2)) + continue; + + LineBB[s1][s2] = (attacks_bb(pt, s1, 0) & attacks_bb(pt, s2, 0)) | s1 | s2; + BetweenBB[s1][s2] = attacks_bb(pt, s1, SquareBB[s2]) & attacks_bb(pt, s2, SquareBB[s1]); + } + } +} + + +namespace { + + Bitboard sliding_attack(Direction directions[], Square sq, Bitboard occupied) { + + Bitboard attack = 0; + + for (int i = 0; i < 4; ++i) + for (Square s = sq + directions[i]; + is_ok(s) && distance(s, s - directions[i]) == 1; + s += directions[i]) + { + attack |= s; + + if (occupied & s) + break; + } + + return attack; + } + + Bitboard relevant_occupancies(Direction directions[], Square s) { + + Bitboard edges = ((Rank1BB | Rank8BB) & ~rank_bb(s)) | ((FileABB | FileHBB) & ~file_bb(s)); + return sliding_attack(directions, s, 0) & ~edges; + } + + // init_magics() computes all rook and bishop attacks at startup. Magic + // bitboards are used to look up attacks of sliding pieces. As a reference see + // chessprogramming.wikispaces.com/Magic+Bitboards. In particular, here we + // use the so called "fancy" approach. + + template + void init_magics(MagicInit init[], Magic magics[], Direction directions[]) { + + for (Square s = SQ_A1; s <= SQ_H8; ++s) + { + Magic& m = magics[s]; + m.magic = init[s].magic; + m.mask = relevant_occupancies(directions, s); + m.attacks = AttackTable + init[s].offset; + + Bitboard b = 0; + do { + unsigned idx = m.index(b); + Bitboard attack = sliding_attack(directions, s, b); + assert(!m.attacks[idx] || m.attacks[idx] == attack); + m.attacks[idx] = attack; + b = (b - m.mask) & m.mask; + } while (b); + } + } +} diff --git a/Engines/Windows/mcbrain/src/bitboard.h b/Engines/Windows/mcbrain/src/bitboard.h new file mode 100644 index 0000000..0a3816c --- /dev/null +++ b/Engines/Windows/mcbrain/src/bitboard.h @@ -0,0 +1,383 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef BITBOARD_H_INCLUDED +#define BITBOARD_H_INCLUDED + +#include + +#include "types.h" + +namespace Bitbases { + +void init(); +bool probe(Square wksq, Square wpsq, Square bksq, Color us); + +} + +namespace Bitboards { + +void init(); +const std::string pretty(Bitboard b); + +} + +constexpr Bitboard AllSquares = ~Bitboard(0); +constexpr Bitboard DarkSquares = 0xAA55AA55AA55AA55ULL; + +constexpr Bitboard FileABB = 0x0101010101010101ULL; +constexpr Bitboard FileBBB = FileABB << 1; +constexpr Bitboard FileCBB = FileABB << 2; +constexpr Bitboard FileDBB = FileABB << 3; +constexpr Bitboard FileEBB = FileABB << 4; +constexpr Bitboard FileFBB = FileABB << 5; +constexpr Bitboard FileGBB = FileABB << 6; +constexpr Bitboard FileHBB = FileABB << 7; + +constexpr Bitboard Rank1BB = 0xFF; +constexpr Bitboard Rank2BB = Rank1BB << (8 * 1); +constexpr Bitboard Rank3BB = Rank1BB << (8 * 2); +constexpr Bitboard Rank4BB = Rank1BB << (8 * 3); +constexpr Bitboard Rank5BB = Rank1BB << (8 * 4); +constexpr Bitboard Rank6BB = Rank1BB << (8 * 5); +constexpr Bitboard Rank7BB = Rank1BB << (8 * 6); +constexpr Bitboard Rank8BB = Rank1BB << (8 * 7); + +extern int SquareDistance[SQUARE_NB][SQUARE_NB]; + +extern Bitboard SquareBB[SQUARE_NB]; +extern Bitboard FileBB[FILE_NB]; +extern Bitboard RankBB[RANK_NB]; +extern Bitboard AdjacentFilesBB[FILE_NB]; +extern Bitboard ForwardRanksBB[COLOR_NB][RANK_NB]; +extern Bitboard BetweenBB[SQUARE_NB][SQUARE_NB]; +extern Bitboard LineBB[SQUARE_NB][SQUARE_NB]; +extern Bitboard DistanceRingBB[SQUARE_NB][8]; +extern Bitboard ForwardFileBB[COLOR_NB][SQUARE_NB]; +extern Bitboard PassedPawnMask[COLOR_NB][SQUARE_NB]; +extern Bitboard PawnAttackSpan[COLOR_NB][SQUARE_NB]; +extern Bitboard PseudoAttacks[PIECE_TYPE_NB][SQUARE_NB]; +extern Bitboard PawnAttacks[COLOR_NB][SQUARE_NB]; + + +/// Magic holds all magic bitboards relevant data for a single square +struct Magic { + Bitboard mask; + Bitboard magic; + Bitboard* attacks; + + // Compute the attack's index using the 'magic bitboards' approach + template + unsigned index(Bitboard occupied) const { + + if (HasPext) + return unsigned(pext(occupied, mask)); + + unsigned shift = 64 - (Pt == ROOK ? 12 : 9); + + return unsigned(((occupied & mask) * magic) >> shift); + } +}; + +extern Magic RookMagics[SQUARE_NB]; +extern Magic BishopMagics[SQUARE_NB]; + + +/// Overloads of bitwise operators between a Bitboard and a Square for testing +/// whether a given bit is set in a bitboard, and for setting and clearing bits. + +inline Bitboard operator&(Bitboard b, Square s) { + assert(s >= SQ_A1 && s <= SQ_H8); + return b & SquareBB[s]; +} + +inline Bitboard operator|(Bitboard b, Square s) { + assert(s >= SQ_A1 && s <= SQ_H8); + return b | SquareBB[s]; +} + +inline Bitboard operator^(Bitboard b, Square s) { + assert(s >= SQ_A1 && s <= SQ_H8); + return b ^ SquareBB[s]; +} + +inline Bitboard& operator|=(Bitboard& b, Square s) { + assert(s >= SQ_A1 && s <= SQ_H8); + return b |= SquareBB[s]; +} + +inline Bitboard& operator^=(Bitboard& b, Square s) { + assert(s >= SQ_A1 && s <= SQ_H8); + return b ^= SquareBB[s]; +} + +constexpr bool more_than_one(Bitboard b) { + return b & (b - 1); +} + +/// rank_bb() and file_bb() return a bitboard representing all the squares on +/// the given file or rank. + +inline Bitboard rank_bb(Rank r) { + return RankBB[r]; +} + +inline Bitboard rank_bb(Square s) { + return RankBB[rank_of(s)]; +} + +inline Bitboard file_bb(File f) { + return FileBB[f]; +} + +inline Bitboard file_bb(Square s) { + return FileBB[file_of(s)]; +} + + +/// shift() moves a bitboard one step along direction D (mainly for pawns) + +template +constexpr Bitboard shift(Bitboard b) { + return D == NORTH ? b << 8 : D == SOUTH ? b >> 8 + : D == EAST ? (b & ~FileHBB) << 1 : D == WEST ? (b & ~FileABB) >> 1 + : D == NORTH_EAST ? (b & ~FileHBB) << 9 : D == NORTH_WEST ? (b & ~FileABB) << 7 + : D == SOUTH_EAST ? (b & ~FileHBB) >> 7 : D == SOUTH_WEST ? (b & ~FileABB) >> 9 + : 0; +} + + +/// pawn_attacks_bb() returns the pawn attacks for the given color from the +/// squares in the given bitboard. + +template +constexpr Bitboard pawn_attacks_bb(Bitboard b) { + return C == WHITE ? shift(b) | shift(b) + : shift(b) | shift(b); +} + + +/// adjacent_files_bb() returns a bitboard representing all the squares on the +/// adjacent files of the given one. + +inline Bitboard adjacent_files_bb(File f) { + return AdjacentFilesBB[f]; +} + + +/// between_bb() returns a bitboard representing all the squares between the two +/// given ones. For instance, between_bb(SQ_C4, SQ_F7) returns a bitboard with +/// the bits for square d5 and e6 set. If s1 and s2 are not on the same rank, file +/// or diagonal, 0 is returned. + +inline Bitboard between_bb(Square s1, Square s2) { + return BetweenBB[s1][s2]; +} + + +/// forward_ranks_bb() returns a bitboard representing the squares on all the ranks +/// in front of the given one, from the point of view of the given color. For instance, +/// forward_ranks_bb(BLACK, SQ_D3) will return the 16 squares on ranks 1 and 2. + +inline Bitboard forward_ranks_bb(Color c, Square s) { + return ForwardRanksBB[c][rank_of(s)]; +} + + +/// forward_file_bb() returns a bitboard representing all the squares along the line +/// in front of the given one, from the point of view of the given color: +/// ForwardFileBB[c][s] = forward_ranks_bb(c, s) & file_bb(s) + +inline Bitboard forward_file_bb(Color c, Square s) { + return ForwardFileBB[c][s]; +} + + +/// pawn_attack_span() returns a bitboard representing all the squares that can be +/// attacked by a pawn of the given color when it moves along its file, starting +/// from the given square: +/// PawnAttackSpan[c][s] = forward_ranks_bb(c, s) & adjacent_files_bb(file_of(s)); + +inline Bitboard pawn_attack_span(Color c, Square s) { + return PawnAttackSpan[c][s]; +} + + +/// passed_pawn_mask() returns a bitboard mask which can be used to test if a +/// pawn of the given color and on the given square is a passed pawn: +/// PassedPawnMask[c][s] = pawn_attack_span(c, s) | forward_file_bb(c, s) + +inline Bitboard passed_pawn_mask(Color c, Square s) { + return PassedPawnMask[c][s]; +} + + +/// aligned() returns true if the squares s1, s2 and s3 are aligned either on a +/// straight or on a diagonal line. + +inline bool aligned(Square s1, Square s2, Square s3) { + return LineBB[s1][s2] & s3; +} + + +/// distance() functions return the distance between x and y, defined as the +/// number of steps for a king in x to reach y. Works with squares, ranks, files. + +template inline int distance(T x, T y) { return x < y ? y - x : x - y; } +template<> inline int distance(Square x, Square y) { return SquareDistance[x][y]; } + +template inline int distance(T2 x, T2 y); +template<> inline int distance(Square x, Square y) { return distance(file_of(x), file_of(y)); } +template<> inline int distance(Square x, Square y) { return distance(rank_of(x), rank_of(y)); } + + +/// attacks_bb() returns a bitboard representing all the squares attacked by a +/// piece of type Pt (bishop or rook) placed on 's'. + +template +inline Bitboard attacks_bb(Square s, Bitboard occupied) { + + const Magic& m = Pt == ROOK ? RookMagics[s] : BishopMagics[s]; + return m.attacks[m.index(occupied)]; +} + +inline Bitboard attacks_bb(PieceType pt, Square s, Bitboard occupied) { + + assert(pt != PAWN); + + switch (pt) + { + case BISHOP: return attacks_bb(s, occupied); + case ROOK : return attacks_bb< ROOK>(s, occupied); + case QUEEN : return attacks_bb(s, occupied) | attacks_bb(s, occupied); + default : return PseudoAttacks[pt][s]; + } +} + + +/// popcount() counts the number of non-zero bits in a bitboard + +inline int popcount(Bitboard b) { + +#ifndef USE_POPCNT + + extern uint8_t PopCnt16[1 << 16]; + union { Bitboard bb; uint16_t u[4]; } v = { b }; + return PopCnt16[v.u[0]] + PopCnt16[v.u[1]] + PopCnt16[v.u[2]] + PopCnt16[v.u[3]]; + +#elif defined(_MSC_VER) || defined(__INTEL_COMPILER) + + return (int)_mm_popcnt_u64(b); + +#else // Assumed gcc or compatible compiler + + return __builtin_popcountll(b); + +#endif +} + + +/// lsb() and msb() return the least/most significant bit in a non-zero bitboard + +#if defined(__GNUC__) // GCC, Clang, ICC + +inline Square lsb(Bitboard b) { + assert(b); + return Square(__builtin_ctzll(b)); +} + +inline Square msb(Bitboard b) { + assert(b); + return Square(63 ^ __builtin_clzll(b)); +} + +#elif defined(_MSC_VER) // MSVC + +#ifdef _WIN64 // MSVC, WIN64 + +inline Square lsb(Bitboard b) { + assert(b); + unsigned long idx; + _BitScanForward64(&idx, b); + return (Square) idx; +} + +inline Square msb(Bitboard b) { + assert(b); + unsigned long idx; + _BitScanReverse64(&idx, b); + return (Square) idx; +} + +#else // MSVC, WIN32 +#include + +inline Square lsb(Bitboard b) { + assert(b); + unsigned long idx; + + if (b & 0xffffffff) { + _BitScanForward(&idx, int32_t(b)); + return Square(idx); + } else { + _BitScanForward(&idx, int32_t(b >> 32)); + return Square(idx + 32); + } +} + +inline Square msb(Bitboard b) { + assert(b); + unsigned long idx; + + if (b >> 32) { + _BitScanReverse(&idx, int32_t(b >> 32)); + return Square(idx + 32); + } else { + _BitScanReverse(&idx, int32_t(b)); + return Square(idx); + } +} + +#endif + +#else // Compiler is neither GCC nor MSVC compatible + +#error "Compiler not supported." + +#endif + + +/// pop_lsb() finds and clears the least significant bit in a non-zero bitboard + +inline Square pop_lsb(Bitboard* b) { + const Square s = lsb(*b); + *b &= *b - 1; + return s; +} + + +/// frontmost_sq() and backmost_sq() return the square corresponding to the +/// most/least advanced bit relative to the given color. + +inline Square frontmost_sq(Color c, Bitboard b) { return c == WHITE ? msb(b) : lsb(b); } +inline Square backmost_sq(Color c, Bitboard b) { return c == WHITE ? lsb(b) : msb(b); } + +#endif // #ifndef BITBOARD_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/book.cpp b/Engines/Windows/mcbrain/src/book.cpp new file mode 100644 index 0000000..644e010 --- /dev/null +++ b/Engines/Windows/mcbrain/src/book.cpp @@ -0,0 +1,479 @@ +/* + SugaR, a UCI chess playing engine derived from Stockfish + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2015-2017 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad + + SugaR is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + SugaR is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/* + The code in this file is based on the opening book code in PolyGlot + by Fabien Letouzey. PolyGlot is available under the GNU General + Public License, and can be downloaded from http://wbec-ridderkerk.nl + */ + +#include +#include + +#include "book.h" +#include "misc.h" +#include "movegen.h" + +using namespace std; + +namespace { + + // A Polyglot book is a series of "entries" of 16 bytes. All integers are + // stored in big-endian format, with the highest byte first (regardless of + // size). The entries are ordered according to the key in ascending order. + struct Entry { + uint64_t key; + uint16_t move; + uint16_t count; + uint32_t learn; + }; + + // Random numbers from PolyGlot, used to compute book hash keys + const union { + Key PolyGlotRandoms[781]; + struct { + Key psq[12][64]; // [piece][square] + Key castling[4]; // [castling flag] + Key enpassant[8]; // [file] + Key turn; + } Zobrist; + } PG = {{ + 0x9D39247E33776D41ULL, 0x2AF7398005AAA5C7ULL, 0x44DB015024623547ULL, + 0x9C15F73E62A76AE2ULL, 0x75834465489C0C89ULL, 0x3290AC3A203001BFULL, + 0x0FBBAD1F61042279ULL, 0xE83A908FF2FB60CAULL, 0x0D7E765D58755C10ULL, + 0x1A083822CEAFE02DULL, 0x9605D5F0E25EC3B0ULL, 0xD021FF5CD13A2ED5ULL, + 0x40BDF15D4A672E32ULL, 0x011355146FD56395ULL, 0x5DB4832046F3D9E5ULL, + 0x239F8B2D7FF719CCULL, 0x05D1A1AE85B49AA1ULL, 0x679F848F6E8FC971ULL, + 0x7449BBFF801FED0BULL, 0x7D11CDB1C3B7ADF0ULL, 0x82C7709E781EB7CCULL, + 0xF3218F1C9510786CULL, 0x331478F3AF51BBE6ULL, 0x4BB38DE5E7219443ULL, + 0xAA649C6EBCFD50FCULL, 0x8DBD98A352AFD40BULL, 0x87D2074B81D79217ULL, + 0x19F3C751D3E92AE1ULL, 0xB4AB30F062B19ABFULL, 0x7B0500AC42047AC4ULL, + 0xC9452CA81A09D85DULL, 0x24AA6C514DA27500ULL, 0x4C9F34427501B447ULL, + 0x14A68FD73C910841ULL, 0xA71B9B83461CBD93ULL, 0x03488B95B0F1850FULL, + 0x637B2B34FF93C040ULL, 0x09D1BC9A3DD90A94ULL, 0x3575668334A1DD3BULL, + 0x735E2B97A4C45A23ULL, 0x18727070F1BD400BULL, 0x1FCBACD259BF02E7ULL, + 0xD310A7C2CE9B6555ULL, 0xBF983FE0FE5D8244ULL, 0x9F74D14F7454A824ULL, + 0x51EBDC4AB9BA3035ULL, 0x5C82C505DB9AB0FAULL, 0xFCF7FE8A3430B241ULL, + 0x3253A729B9BA3DDEULL, 0x8C74C368081B3075ULL, 0xB9BC6C87167C33E7ULL, + 0x7EF48F2B83024E20ULL, 0x11D505D4C351BD7FULL, 0x6568FCA92C76A243ULL, + 0x4DE0B0F40F32A7B8ULL, 0x96D693460CC37E5DULL, 0x42E240CB63689F2FULL, + 0x6D2BDCDAE2919661ULL, 0x42880B0236E4D951ULL, 0x5F0F4A5898171BB6ULL, + 0x39F890F579F92F88ULL, 0x93C5B5F47356388BULL, 0x63DC359D8D231B78ULL, + 0xEC16CA8AEA98AD76ULL, 0x5355F900C2A82DC7ULL, 0x07FB9F855A997142ULL, + 0x5093417AA8A7ED5EULL, 0x7BCBC38DA25A7F3CULL, 0x19FC8A768CF4B6D4ULL, + 0x637A7780DECFC0D9ULL, 0x8249A47AEE0E41F7ULL, 0x79AD695501E7D1E8ULL, + 0x14ACBAF4777D5776ULL, 0xF145B6BECCDEA195ULL, 0xDABF2AC8201752FCULL, + 0x24C3C94DF9C8D3F6ULL, 0xBB6E2924F03912EAULL, 0x0CE26C0B95C980D9ULL, + 0xA49CD132BFBF7CC4ULL, 0xE99D662AF4243939ULL, 0x27E6AD7891165C3FULL, + 0x8535F040B9744FF1ULL, 0x54B3F4FA5F40D873ULL, 0x72B12C32127FED2BULL, + 0xEE954D3C7B411F47ULL, 0x9A85AC909A24EAA1ULL, 0x70AC4CD9F04F21F5ULL, + 0xF9B89D3E99A075C2ULL, 0x87B3E2B2B5C907B1ULL, 0xA366E5B8C54F48B8ULL, + 0xAE4A9346CC3F7CF2ULL, 0x1920C04D47267BBDULL, 0x87BF02C6B49E2AE9ULL, + 0x092237AC237F3859ULL, 0xFF07F64EF8ED14D0ULL, 0x8DE8DCA9F03CC54EULL, + 0x9C1633264DB49C89ULL, 0xB3F22C3D0B0B38EDULL, 0x390E5FB44D01144BULL, + 0x5BFEA5B4712768E9ULL, 0x1E1032911FA78984ULL, 0x9A74ACB964E78CB3ULL, + 0x4F80F7A035DAFB04ULL, 0x6304D09A0B3738C4ULL, 0x2171E64683023A08ULL, + 0x5B9B63EB9CEFF80CULL, 0x506AACF489889342ULL, 0x1881AFC9A3A701D6ULL, + 0x6503080440750644ULL, 0xDFD395339CDBF4A7ULL, 0xEF927DBCF00C20F2ULL, + 0x7B32F7D1E03680ECULL, 0xB9FD7620E7316243ULL, 0x05A7E8A57DB91B77ULL, + 0xB5889C6E15630A75ULL, 0x4A750A09CE9573F7ULL, 0xCF464CEC899A2F8AULL, + 0xF538639CE705B824ULL, 0x3C79A0FF5580EF7FULL, 0xEDE6C87F8477609DULL, + 0x799E81F05BC93F31ULL, 0x86536B8CF3428A8CULL, 0x97D7374C60087B73ULL, + 0xA246637CFF328532ULL, 0x043FCAE60CC0EBA0ULL, 0x920E449535DD359EULL, + 0x70EB093B15B290CCULL, 0x73A1921916591CBDULL, 0x56436C9FE1A1AA8DULL, + 0xEFAC4B70633B8F81ULL, 0xBB215798D45DF7AFULL, 0x45F20042F24F1768ULL, + 0x930F80F4E8EB7462ULL, 0xFF6712FFCFD75EA1ULL, 0xAE623FD67468AA70ULL, + 0xDD2C5BC84BC8D8FCULL, 0x7EED120D54CF2DD9ULL, 0x22FE545401165F1CULL, + 0xC91800E98FB99929ULL, 0x808BD68E6AC10365ULL, 0xDEC468145B7605F6ULL, + 0x1BEDE3A3AEF53302ULL, 0x43539603D6C55602ULL, 0xAA969B5C691CCB7AULL, + 0xA87832D392EFEE56ULL, 0x65942C7B3C7E11AEULL, 0xDED2D633CAD004F6ULL, + 0x21F08570F420E565ULL, 0xB415938D7DA94E3CULL, 0x91B859E59ECB6350ULL, + 0x10CFF333E0ED804AULL, 0x28AED140BE0BB7DDULL, 0xC5CC1D89724FA456ULL, + 0x5648F680F11A2741ULL, 0x2D255069F0B7DAB3ULL, 0x9BC5A38EF729ABD4ULL, + 0xEF2F054308F6A2BCULL, 0xAF2042F5CC5C2858ULL, 0x480412BAB7F5BE2AULL, + 0xAEF3AF4A563DFE43ULL, 0x19AFE59AE451497FULL, 0x52593803DFF1E840ULL, + 0xF4F076E65F2CE6F0ULL, 0x11379625747D5AF3ULL, 0xBCE5D2248682C115ULL, + 0x9DA4243DE836994FULL, 0x066F70B33FE09017ULL, 0x4DC4DE189B671A1CULL, + 0x51039AB7712457C3ULL, 0xC07A3F80C31FB4B4ULL, 0xB46EE9C5E64A6E7CULL, + 0xB3819A42ABE61C87ULL, 0x21A007933A522A20ULL, 0x2DF16F761598AA4FULL, + 0x763C4A1371B368FDULL, 0xF793C46702E086A0ULL, 0xD7288E012AEB8D31ULL, + 0xDE336A2A4BC1C44BULL, 0x0BF692B38D079F23ULL, 0x2C604A7A177326B3ULL, + 0x4850E73E03EB6064ULL, 0xCFC447F1E53C8E1BULL, 0xB05CA3F564268D99ULL, + 0x9AE182C8BC9474E8ULL, 0xA4FC4BD4FC5558CAULL, 0xE755178D58FC4E76ULL, + 0x69B97DB1A4C03DFEULL, 0xF9B5B7C4ACC67C96ULL, 0xFC6A82D64B8655FBULL, + 0x9C684CB6C4D24417ULL, 0x8EC97D2917456ED0ULL, 0x6703DF9D2924E97EULL, + 0xC547F57E42A7444EULL, 0x78E37644E7CAD29EULL, 0xFE9A44E9362F05FAULL, + 0x08BD35CC38336615ULL, 0x9315E5EB3A129ACEULL, 0x94061B871E04DF75ULL, + 0xDF1D9F9D784BA010ULL, 0x3BBA57B68871B59DULL, 0xD2B7ADEEDED1F73FULL, + 0xF7A255D83BC373F8ULL, 0xD7F4F2448C0CEB81ULL, 0xD95BE88CD210FFA7ULL, + 0x336F52F8FF4728E7ULL, 0xA74049DAC312AC71ULL, 0xA2F61BB6E437FDB5ULL, + 0x4F2A5CB07F6A35B3ULL, 0x87D380BDA5BF7859ULL, 0x16B9F7E06C453A21ULL, + 0x7BA2484C8A0FD54EULL, 0xF3A678CAD9A2E38CULL, 0x39B0BF7DDE437BA2ULL, + 0xFCAF55C1BF8A4424ULL, 0x18FCF680573FA594ULL, 0x4C0563B89F495AC3ULL, + 0x40E087931A00930DULL, 0x8CFFA9412EB642C1ULL, 0x68CA39053261169FULL, + 0x7A1EE967D27579E2ULL, 0x9D1D60E5076F5B6FULL, 0x3810E399B6F65BA2ULL, + 0x32095B6D4AB5F9B1ULL, 0x35CAB62109DD038AULL, 0xA90B24499FCFAFB1ULL, + 0x77A225A07CC2C6BDULL, 0x513E5E634C70E331ULL, 0x4361C0CA3F692F12ULL, + 0xD941ACA44B20A45BULL, 0x528F7C8602C5807BULL, 0x52AB92BEB9613989ULL, + 0x9D1DFA2EFC557F73ULL, 0x722FF175F572C348ULL, 0x1D1260A51107FE97ULL, + 0x7A249A57EC0C9BA2ULL, 0x04208FE9E8F7F2D6ULL, 0x5A110C6058B920A0ULL, + 0x0CD9A497658A5698ULL, 0x56FD23C8F9715A4CULL, 0x284C847B9D887AAEULL, + 0x04FEABFBBDB619CBULL, 0x742E1E651C60BA83ULL, 0x9A9632E65904AD3CULL, + 0x881B82A13B51B9E2ULL, 0x506E6744CD974924ULL, 0xB0183DB56FFC6A79ULL, + 0x0ED9B915C66ED37EULL, 0x5E11E86D5873D484ULL, 0xF678647E3519AC6EULL, + 0x1B85D488D0F20CC5ULL, 0xDAB9FE6525D89021ULL, 0x0D151D86ADB73615ULL, + 0xA865A54EDCC0F019ULL, 0x93C42566AEF98FFBULL, 0x99E7AFEABE000731ULL, + 0x48CBFF086DDF285AULL, 0x7F9B6AF1EBF78BAFULL, 0x58627E1A149BBA21ULL, + 0x2CD16E2ABD791E33ULL, 0xD363EFF5F0977996ULL, 0x0CE2A38C344A6EEDULL, + 0x1A804AADB9CFA741ULL, 0x907F30421D78C5DEULL, 0x501F65EDB3034D07ULL, + 0x37624AE5A48FA6E9ULL, 0x957BAF61700CFF4EULL, 0x3A6C27934E31188AULL, + 0xD49503536ABCA345ULL, 0x088E049589C432E0ULL, 0xF943AEE7FEBF21B8ULL, + 0x6C3B8E3E336139D3ULL, 0x364F6FFA464EE52EULL, 0xD60F6DCEDC314222ULL, + 0x56963B0DCA418FC0ULL, 0x16F50EDF91E513AFULL, 0xEF1955914B609F93ULL, + 0x565601C0364E3228ULL, 0xECB53939887E8175ULL, 0xBAC7A9A18531294BULL, + 0xB344C470397BBA52ULL, 0x65D34954DAF3CEBDULL, 0xB4B81B3FA97511E2ULL, + 0xB422061193D6F6A7ULL, 0x071582401C38434DULL, 0x7A13F18BBEDC4FF5ULL, + 0xBC4097B116C524D2ULL, 0x59B97885E2F2EA28ULL, 0x99170A5DC3115544ULL, + 0x6F423357E7C6A9F9ULL, 0x325928EE6E6F8794ULL, 0xD0E4366228B03343ULL, + 0x565C31F7DE89EA27ULL, 0x30F5611484119414ULL, 0xD873DB391292ED4FULL, + 0x7BD94E1D8E17DEBCULL, 0xC7D9F16864A76E94ULL, 0x947AE053EE56E63CULL, + 0xC8C93882F9475F5FULL, 0x3A9BF55BA91F81CAULL, 0xD9A11FBB3D9808E4ULL, + 0x0FD22063EDC29FCAULL, 0xB3F256D8ACA0B0B9ULL, 0xB03031A8B4516E84ULL, + 0x35DD37D5871448AFULL, 0xE9F6082B05542E4EULL, 0xEBFAFA33D7254B59ULL, + 0x9255ABB50D532280ULL, 0xB9AB4CE57F2D34F3ULL, 0x693501D628297551ULL, + 0xC62C58F97DD949BFULL, 0xCD454F8F19C5126AULL, 0xBBE83F4ECC2BDECBULL, + 0xDC842B7E2819E230ULL, 0xBA89142E007503B8ULL, 0xA3BC941D0A5061CBULL, + 0xE9F6760E32CD8021ULL, 0x09C7E552BC76492FULL, 0x852F54934DA55CC9ULL, + 0x8107FCCF064FCF56ULL, 0x098954D51FFF6580ULL, 0x23B70EDB1955C4BFULL, + 0xC330DE426430F69DULL, 0x4715ED43E8A45C0AULL, 0xA8D7E4DAB780A08DULL, + 0x0572B974F03CE0BBULL, 0xB57D2E985E1419C7ULL, 0xE8D9ECBE2CF3D73FULL, + 0x2FE4B17170E59750ULL, 0x11317BA87905E790ULL, 0x7FBF21EC8A1F45ECULL, + 0x1725CABFCB045B00ULL, 0x964E915CD5E2B207ULL, 0x3E2B8BCBF016D66DULL, + 0xBE7444E39328A0ACULL, 0xF85B2B4FBCDE44B7ULL, 0x49353FEA39BA63B1ULL, + 0x1DD01AAFCD53486AULL, 0x1FCA8A92FD719F85ULL, 0xFC7C95D827357AFAULL, + 0x18A6A990C8B35EBDULL, 0xCCCB7005C6B9C28DULL, 0x3BDBB92C43B17F26ULL, + 0xAA70B5B4F89695A2ULL, 0xE94C39A54A98307FULL, 0xB7A0B174CFF6F36EULL, + 0xD4DBA84729AF48ADULL, 0x2E18BC1AD9704A68ULL, 0x2DE0966DAF2F8B1CULL, + 0xB9C11D5B1E43A07EULL, 0x64972D68DEE33360ULL, 0x94628D38D0C20584ULL, + 0xDBC0D2B6AB90A559ULL, 0xD2733C4335C6A72FULL, 0x7E75D99D94A70F4DULL, + 0x6CED1983376FA72BULL, 0x97FCAACBF030BC24ULL, 0x7B77497B32503B12ULL, + 0x8547EDDFB81CCB94ULL, 0x79999CDFF70902CBULL, 0xCFFE1939438E9B24ULL, + 0x829626E3892D95D7ULL, 0x92FAE24291F2B3F1ULL, 0x63E22C147B9C3403ULL, + 0xC678B6D860284A1CULL, 0x5873888850659AE7ULL, 0x0981DCD296A8736DULL, + 0x9F65789A6509A440ULL, 0x9FF38FED72E9052FULL, 0xE479EE5B9930578CULL, + 0xE7F28ECD2D49EECDULL, 0x56C074A581EA17FEULL, 0x5544F7D774B14AEFULL, + 0x7B3F0195FC6F290FULL, 0x12153635B2C0CF57ULL, 0x7F5126DBBA5E0CA7ULL, + 0x7A76956C3EAFB413ULL, 0x3D5774A11D31AB39ULL, 0x8A1B083821F40CB4ULL, + 0x7B4A38E32537DF62ULL, 0x950113646D1D6E03ULL, 0x4DA8979A0041E8A9ULL, + 0x3BC36E078F7515D7ULL, 0x5D0A12F27AD310D1ULL, 0x7F9D1A2E1EBE1327ULL, + 0xDA3A361B1C5157B1ULL, 0xDCDD7D20903D0C25ULL, 0x36833336D068F707ULL, + 0xCE68341F79893389ULL, 0xAB9090168DD05F34ULL, 0x43954B3252DC25E5ULL, + 0xB438C2B67F98E5E9ULL, 0x10DCD78E3851A492ULL, 0xDBC27AB5447822BFULL, + 0x9B3CDB65F82CA382ULL, 0xB67B7896167B4C84ULL, 0xBFCED1B0048EAC50ULL, + 0xA9119B60369FFEBDULL, 0x1FFF7AC80904BF45ULL, 0xAC12FB171817EEE7ULL, + 0xAF08DA9177DDA93DULL, 0x1B0CAB936E65C744ULL, 0xB559EB1D04E5E932ULL, + 0xC37B45B3F8D6F2BAULL, 0xC3A9DC228CAAC9E9ULL, 0xF3B8B6675A6507FFULL, + 0x9FC477DE4ED681DAULL, 0x67378D8ECCEF96CBULL, 0x6DD856D94D259236ULL, + 0xA319CE15B0B4DB31ULL, 0x073973751F12DD5EULL, 0x8A8E849EB32781A5ULL, + 0xE1925C71285279F5ULL, 0x74C04BF1790C0EFEULL, 0x4DDA48153C94938AULL, + 0x9D266D6A1CC0542CULL, 0x7440FB816508C4FEULL, 0x13328503DF48229FULL, + 0xD6BF7BAEE43CAC40ULL, 0x4838D65F6EF6748FULL, 0x1E152328F3318DEAULL, + 0x8F8419A348F296BFULL, 0x72C8834A5957B511ULL, 0xD7A023A73260B45CULL, + 0x94EBC8ABCFB56DAEULL, 0x9FC10D0F989993E0ULL, 0xDE68A2355B93CAE6ULL, + 0xA44CFE79AE538BBEULL, 0x9D1D84FCCE371425ULL, 0x51D2B1AB2DDFB636ULL, + 0x2FD7E4B9E72CD38CULL, 0x65CA5B96B7552210ULL, 0xDD69A0D8AB3B546DULL, + 0x604D51B25FBF70E2ULL, 0x73AA8A564FB7AC9EULL, 0x1A8C1E992B941148ULL, + 0xAAC40A2703D9BEA0ULL, 0x764DBEAE7FA4F3A6ULL, 0x1E99B96E70A9BE8BULL, + 0x2C5E9DEB57EF4743ULL, 0x3A938FEE32D29981ULL, 0x26E6DB8FFDF5ADFEULL, + 0x469356C504EC9F9DULL, 0xC8763C5B08D1908CULL, 0x3F6C6AF859D80055ULL, + 0x7F7CC39420A3A545ULL, 0x9BFB227EBDF4C5CEULL, 0x89039D79D6FC5C5CULL, + 0x8FE88B57305E2AB6ULL, 0xA09E8C8C35AB96DEULL, 0xFA7E393983325753ULL, + 0xD6B6D0ECC617C699ULL, 0xDFEA21EA9E7557E3ULL, 0xB67C1FA481680AF8ULL, + 0xCA1E3785A9E724E5ULL, 0x1CFC8BED0D681639ULL, 0xD18D8549D140CAEAULL, + 0x4ED0FE7E9DC91335ULL, 0xE4DBF0634473F5D2ULL, 0x1761F93A44D5AEFEULL, + 0x53898E4C3910DA55ULL, 0x734DE8181F6EC39AULL, 0x2680B122BAA28D97ULL, + 0x298AF231C85BAFABULL, 0x7983EED3740847D5ULL, 0x66C1A2A1A60CD889ULL, + 0x9E17E49642A3E4C1ULL, 0xEDB454E7BADC0805ULL, 0x50B704CAB602C329ULL, + 0x4CC317FB9CDDD023ULL, 0x66B4835D9EAFEA22ULL, 0x219B97E26FFC81BDULL, + 0x261E4E4C0A333A9DULL, 0x1FE2CCA76517DB90ULL, 0xD7504DFA8816EDBBULL, + 0xB9571FA04DC089C8ULL, 0x1DDC0325259B27DEULL, 0xCF3F4688801EB9AAULL, + 0xF4F5D05C10CAB243ULL, 0x38B6525C21A42B0EULL, 0x36F60E2BA4FA6800ULL, + 0xEB3593803173E0CEULL, 0x9C4CD6257C5A3603ULL, 0xAF0C317D32ADAA8AULL, + 0x258E5A80C7204C4BULL, 0x8B889D624D44885DULL, 0xF4D14597E660F855ULL, + 0xD4347F66EC8941C3ULL, 0xE699ED85B0DFB40DULL, 0x2472F6207C2D0484ULL, + 0xC2A1E7B5B459AEB5ULL, 0xAB4F6451CC1D45ECULL, 0x63767572AE3D6174ULL, + 0xA59E0BD101731A28ULL, 0x116D0016CB948F09ULL, 0x2CF9C8CA052F6E9FULL, + 0x0B090A7560A968E3ULL, 0xABEEDDB2DDE06FF1ULL, 0x58EFC10B06A2068DULL, + 0xC6E57A78FBD986E0ULL, 0x2EAB8CA63CE802D7ULL, 0x14A195640116F336ULL, + 0x7C0828DD624EC390ULL, 0xD74BBE77E6116AC7ULL, 0x804456AF10F5FB53ULL, + 0xEBE9EA2ADF4321C7ULL, 0x03219A39EE587A30ULL, 0x49787FEF17AF9924ULL, + 0xA1E9300CD8520548ULL, 0x5B45E522E4B1B4EFULL, 0xB49C3B3995091A36ULL, + 0xD4490AD526F14431ULL, 0x12A8F216AF9418C2ULL, 0x001F837CC7350524ULL, + 0x1877B51E57A764D5ULL, 0xA2853B80F17F58EEULL, 0x993E1DE72D36D310ULL, + 0xB3598080CE64A656ULL, 0x252F59CF0D9F04BBULL, 0xD23C8E176D113600ULL, + 0x1BDA0492E7E4586EULL, 0x21E0BD5026C619BFULL, 0x3B097ADAF088F94EULL, + 0x8D14DEDB30BE846EULL, 0xF95CFFA23AF5F6F4ULL, 0x3871700761B3F743ULL, + 0xCA672B91E9E4FA16ULL, 0x64C8E531BFF53B55ULL, 0x241260ED4AD1E87DULL, + 0x106C09B972D2E822ULL, 0x7FBA195410E5CA30ULL, 0x7884D9BC6CB569D8ULL, + 0x0647DFEDCD894A29ULL, 0x63573FF03E224774ULL, 0x4FC8E9560F91B123ULL, + 0x1DB956E450275779ULL, 0xB8D91274B9E9D4FBULL, 0xA2EBEE47E2FBFCE1ULL, + 0xD9F1F30CCD97FB09ULL, 0xEFED53D75FD64E6BULL, 0x2E6D02C36017F67FULL, + 0xA9AA4D20DB084E9BULL, 0xB64BE8D8B25396C1ULL, 0x70CB6AF7C2D5BCF0ULL, + 0x98F076A4F7A2322EULL, 0xBF84470805E69B5FULL, 0x94C3251F06F90CF3ULL, + 0x3E003E616A6591E9ULL, 0xB925A6CD0421AFF3ULL, 0x61BDD1307C66E300ULL, + 0xBF8D5108E27E0D48ULL, 0x240AB57A8B888B20ULL, 0xFC87614BAF287E07ULL, + 0xEF02CDD06FFDB432ULL, 0xA1082C0466DF6C0AULL, 0x8215E577001332C8ULL, + 0xD39BB9C3A48DB6CFULL, 0x2738259634305C14ULL, 0x61CF4F94C97DF93DULL, + 0x1B6BACA2AE4E125BULL, 0x758F450C88572E0BULL, 0x959F587D507A8359ULL, + 0xB063E962E045F54DULL, 0x60E8ED72C0DFF5D1ULL, 0x7B64978555326F9FULL, + 0xFD080D236DA814BAULL, 0x8C90FD9B083F4558ULL, 0x106F72FE81E2C590ULL, + 0x7976033A39F7D952ULL, 0xA4EC0132764CA04BULL, 0x733EA705FAE4FA77ULL, + 0xB4D8F77BC3E56167ULL, 0x9E21F4F903B33FD9ULL, 0x9D765E419FB69F6DULL, + 0xD30C088BA61EA5EFULL, 0x5D94337FBFAF7F5BULL, 0x1A4E4822EB4D7A59ULL, + 0x6FFE73E81B637FB3ULL, 0xDDF957BC36D8B9CAULL, 0x64D0E29EEA8838B3ULL, + 0x08DD9BDFD96B9F63ULL, 0x087E79E5A57D1D13ULL, 0xE328E230E3E2B3FBULL, + 0x1C2559E30F0946BEULL, 0x720BF5F26F4D2EAAULL, 0xB0774D261CC609DBULL, + 0x443F64EC5A371195ULL, 0x4112CF68649A260EULL, 0xD813F2FAB7F5C5CAULL, + 0x660D3257380841EEULL, 0x59AC2C7873F910A3ULL, 0xE846963877671A17ULL, + 0x93B633ABFA3469F8ULL, 0xC0C0F5A60EF4CDCFULL, 0xCAF21ECD4377B28CULL, + 0x57277707199B8175ULL, 0x506C11B9D90E8B1DULL, 0xD83CC2687A19255FULL, + 0x4A29C6465A314CD1ULL, 0xED2DF21216235097ULL, 0xB5635C95FF7296E2ULL, + 0x22AF003AB672E811ULL, 0x52E762596BF68235ULL, 0x9AEBA33AC6ECC6B0ULL, + 0x944F6DE09134DFB6ULL, 0x6C47BEC883A7DE39ULL, 0x6AD047C430A12104ULL, + 0xA5B1CFDBA0AB4067ULL, 0x7C45D833AFF07862ULL, 0x5092EF950A16DA0BULL, + 0x9338E69C052B8E7BULL, 0x455A4B4CFE30E3F5ULL, 0x6B02E63195AD0CF8ULL, + 0x6B17B224BAD6BF27ULL, 0xD1E0CCD25BB9C169ULL, 0xDE0C89A556B9AE70ULL, + 0x50065E535A213CF6ULL, 0x9C1169FA2777B874ULL, 0x78EDEFD694AF1EEDULL, + 0x6DC93D9526A50E68ULL, 0xEE97F453F06791EDULL, 0x32AB0EDB696703D3ULL, + 0x3A6853C7E70757A7ULL, 0x31865CED6120F37DULL, 0x67FEF95D92607890ULL, + 0x1F2B1D1F15F6DC9CULL, 0xB69E38A8965C6B65ULL, 0xAA9119FF184CCCF4ULL, + 0xF43C732873F24C13ULL, 0xFB4A3D794A9A80D2ULL, 0x3550C2321FD6109CULL, + 0x371F77E76BB8417EULL, 0x6BFA9AAE5EC05779ULL, 0xCD04F3FF001A4778ULL, + 0xE3273522064480CAULL, 0x9F91508BFFCFC14AULL, 0x049A7F41061A9E60ULL, + 0xFCB6BE43A9F2FE9BULL, 0x08DE8A1C7797DA9BULL, 0x8F9887E6078735A1ULL, + 0xB5B4071DBFC73A66ULL, 0x230E343DFBA08D33ULL, 0x43ED7F5A0FAE657DULL, + 0x3A88A0FBBCB05C63ULL, 0x21874B8B4D2DBC4FULL, 0x1BDEA12E35F6A8C9ULL, + 0x53C065C6C8E63528ULL, 0xE34A1D250E7A8D6BULL, 0xD6B04D3B7651DD7EULL, + 0x5E90277E7CB39E2DULL, 0x2C046F22062DC67DULL, 0xB10BB459132D0A26ULL, + 0x3FA9DDFB67E2F199ULL, 0x0E09B88E1914F7AFULL, 0x10E8B35AF3EEAB37ULL, + 0x9EEDECA8E272B933ULL, 0xD4C718BC4AE8AE5FULL, 0x81536D601170FC20ULL, + 0x91B534F885818A06ULL, 0xEC8177F83F900978ULL, 0x190E714FADA5156EULL, + 0xB592BF39B0364963ULL, 0x89C350C893AE7DC1ULL, 0xAC042E70F8B383F2ULL, + 0xB49B52E587A1EE60ULL, 0xFB152FE3FF26DA89ULL, 0x3E666E6F69AE2C15ULL, + 0x3B544EBE544C19F9ULL, 0xE805A1E290CF2456ULL, 0x24B33C9D7ED25117ULL, + 0xE74733427B72F0C1ULL, 0x0A804D18B7097475ULL, 0x57E3306D881EDB4FULL, + 0x4AE7D6A36EB5DBCBULL, 0x2D8D5432157064C8ULL, 0xD1E649DE1E7F268BULL, + 0x8A328A1CEDFE552CULL, 0x07A3AEC79624C7DAULL, 0x84547DDC3E203C94ULL, + 0x990A98FD5071D263ULL, 0x1A4FF12616EEFC89ULL, 0xF6F7FD1431714200ULL, + 0x30C05B1BA332F41CULL, 0x8D2636B81555A786ULL, 0x46C9FEB55D120902ULL, + 0xCCEC0A73B49C9921ULL, 0x4E9D2827355FC492ULL, 0x19EBB029435DCB0FULL, + 0x4659D2B743848A2CULL, 0x963EF2C96B33BE31ULL, 0x74F85198B05A2E7DULL, + 0x5A0F544DD2B1FB18ULL, 0x03727073C2E134B1ULL, 0xC7F6AA2DE59AEA61ULL, + 0x352787BAA0D7C22FULL, 0x9853EAB63B5E0B35ULL, 0xABBDCDD7ED5C0860ULL, + 0xCF05DAF5AC8D77B0ULL, 0x49CAD48CEBF4A71EULL, 0x7A4C10EC2158C4A6ULL, + 0xD9E92AA246BF719EULL, 0x13AE978D09FE5557ULL, 0x730499AF921549FFULL, + 0x4E4B705B92903BA4ULL, 0xFF577222C14F0A3AULL, 0x55B6344CF97AAFAEULL, + 0xB862225B055B6960ULL, 0xCAC09AFBDDD2CDB4ULL, 0xDAF8E9829FE96B5FULL, + 0xB5FDFC5D3132C498ULL, 0x310CB380DB6F7503ULL, 0xE87FBB46217A360EULL, + 0x2102AE466EBB1148ULL, 0xF8549E1A3AA5E00DULL, 0x07A69AFDCC42261AULL, + 0xC4C118BFE78FEAAEULL, 0xF9F4892ED96BD438ULL, 0x1AF3DBE25D8F45DAULL, + 0xF5B4B0B0D2DEEEB4ULL, 0x962ACEEFA82E1C84ULL, 0x046E3ECAAF453CE9ULL, + 0xF05D129681949A4CULL, 0x964781CE734B3C84ULL, 0x9C2ED44081CE5FBDULL, + 0x522E23F3925E319EULL, 0x177E00F9FC32F791ULL, 0x2BC60A63A6F3B3F2ULL, + 0x222BBFAE61725606ULL, 0x486289DDCC3D6780ULL, 0x7DC7785B8EFDFC80ULL, + 0x8AF38731C02BA980ULL, 0x1FAB64EA29A2DDF7ULL, 0xE4D9429322CD065AULL, + 0x9DA058C67844F20CULL, 0x24C0E332B70019B0ULL, 0x233003B5A6CFE6ADULL, + 0xD586BD01C5C217F6ULL, 0x5E5637885F29BC2BULL, 0x7EBA726D8C94094BULL, + 0x0A56A5F0BFE39272ULL, 0xD79476A84EE20D06ULL, 0x9E4C1269BAA4BF37ULL, + 0x17EFEE45B0DEE640ULL, 0x1D95B0A5FCF90BC6ULL, 0x93CBE0B699C2585DULL, + 0x65FA4F227A2B6D79ULL, 0xD5F9E858292504D5ULL, 0xC2B5A03F71471A6FULL, + 0x59300222B4561E00ULL, 0xCE2F8642CA0712DCULL, 0x7CA9723FBB2E8988ULL, + 0x2785338347F2BA08ULL, 0xC61BB3A141E50E8CULL, 0x150F361DAB9DEC26ULL, + 0x9F6A419D382595F4ULL, 0x64A53DC924FE7AC9ULL, 0x142DE49FFF7A7C3DULL, + 0x0C335248857FA9E7ULL, 0x0A9C32D5EAE45305ULL, 0xE6C42178C4BBB92EULL, + 0x71F1CE2490D20B07ULL, 0xF1BCC3D275AFE51AULL, 0xE728E8C83C334074ULL, + 0x96FBF83A12884624ULL, 0x81A1549FD6573DA5ULL, 0x5FA7867CAF35E149ULL, + 0x56986E2EF3ED091BULL, 0x917F1DD5F8886C61ULL, 0xD20D8C88C8FFE65FULL, + 0x31D71DCE64B2C310ULL, 0xF165B587DF898190ULL, 0xA57E6339DD2CF3A0ULL, + 0x1EF6E6DBB1961EC9ULL, 0x70CC73D90BC26E24ULL, 0xE21A6B35DF0C3AD7ULL, + 0x003A93D8B2806962ULL, 0x1C99DED33CB890A1ULL, 0xCF3145DE0ADD4289ULL, + 0xD0E4427A5514FB72ULL, 0x77C621CC9FB3A483ULL, 0x67A34DAC4356550BULL, + 0xF8D626AAAF278509ULL + }}; + + // polyglot_key() returns the PolyGlot hash key of the given position + Key polyglot_key(const Position& pos) { + + Key key = 0; + Bitboard b = pos.pieces(); + + while (b) + { + Square s = pop_lsb(&b); + Piece pc = pos.piece_on(s); + + // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11 + key ^= PG.Zobrist.psq[2 * (type_of(pc) - 1) + (color_of(pc) == WHITE)][s]; + } + + b = pos.can_castle(ANY_CASTLING); + + while (b) + key ^= PG.Zobrist.castling[pop_lsb(&b)]; + + if (pos.ep_square() != SQ_NONE) + key ^= PG.Zobrist.enpassant[file_of(pos.ep_square())]; + + if (pos.side_to_move() == WHITE) + key ^= PG.Zobrist.turn; + + return key; + } + +} // namespace + +PolyglotBook::PolyglotBook() : rng(now() % 10000) {} + +PolyglotBook::~PolyglotBook() { if (is_open()) close(); } + + +/// operator>>() reads sizeof(T) chars from the file's binary byte stream and +/// converts them into a number of type T. A Polyglot book stores numbers in +/// big-endian format. + +template PolyglotBook& PolyglotBook::operator>>(T& n) { + + n = 0; + for (size_t i = 0; i < sizeof(T); ++i) + n = T((n << 8) + ifstream::get()); + + return *this; +} + +template<> PolyglotBook& PolyglotBook::operator>>(Entry& e) { + return *this >> e.key >> e.move >> e.count >> e.learn; +} + + +/// open() tries to open a book file with the given name after closing any +/// existing one. + +bool PolyglotBook::open(const char* fName) { + + if (is_open()) // Cannot close an already closed file + close(); + + ifstream::open(fName, ifstream::in | ifstream::binary); + + fileName = is_open() ? fName : ""; + ifstream::clear(); // Reset any error flag to allow a retry ifstream::open() + return !fileName.empty(); +} + + +/// probe() tries to find a book move for the given position. If no move is +/// found, it returns MOVE_NONE. If pickBest is true, then it always returns +/// the highest-rated move, otherwise it randomly chooses one based on the +/// move score. + +Move PolyglotBook::probe(const Position& pos, const string& fName, bool pickBest) { + + if (fileName != fName && !open(fName.c_str())) + return MOVE_NONE; + + Entry e; + uint16_t best = 0; + unsigned sum = 0; + Move move = MOVE_NONE; + Key key = polyglot_key(pos); + + seekg(find_first(key) * sizeof(Entry), ios_base::beg); + + while (*this >> e, e.key == key && good()) + { + best = max(best, e.count); + sum += e.count; + + // Choose book move according to its score. If a move has a very high + // score it has a higher probability of being choosen than a move with + // a lower score. Note that first entry is always chosen. + if ( (!pickBest && sum && rng.rand() % sum < e.count) + || (pickBest && e.count == best)) + move = Move(e.move); + } + + if (!move) + return MOVE_NONE; + + // A PolyGlot book move is encoded as follows: + // + // bit 0- 5: destination square (from 0 to 63) + // bit 6-11: origin square (from 0 to 63) + // bit 12-14: promotion piece (from KNIGHT == 1 to QUEEN == 4) + // + // Castling moves follow the "king captures rook" representation. If a book + // move is a promotion, we have to convert it to our representation and in + // all other cases, we can directly compare with a Move after having masked + // out the special Move flags (bit 14-15) that are not supported by PolyGlot. + int pt = (move >> 12) & 7; + if (pt) + move = make(from_sq(move), to_sq(move), PieceType(pt + 1)); + + // Add 'special move' flags and verify it is legal + for (const auto& m : MoveList(pos)) + if (move == (Move(m) ^ Move(type_of(m)))) + return m; + + return MOVE_NONE; +} + + +/// find_first() takes a book key as input, and does a binary search through +/// the book file for the given key. Returns the index of the leftmost book +/// entry with the same key as the input. + +size_t PolyglotBook::find_first(Key key) { + + seekg(0, ios::end); // Move pointer to end, so tellg() gets file's size + + size_t low = 0, mid, high = (size_t)tellg() / sizeof(Entry) - 1; + Entry e; + + assert(low <= high); + + while (low < high && good()) + { + mid = (low + high) / 2; + + assert(mid >= low && mid < high); + + seekg(mid * sizeof(Entry), ios_base::beg); + *this >> e; + + if (key <= e.key) + high = mid; + else + low = mid + 1; + } + + assert(low == high); + + return low; +} diff --git a/Engines/Windows/mcbrain/src/book.h b/Engines/Windows/mcbrain/src/book.h new file mode 100644 index 0000000..c88920f --- /dev/null +++ b/Engines/Windows/mcbrain/src/book.h @@ -0,0 +1,53 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +/* + The code in this file is based on the opening book code in PolyGlot + by Fabien Letouzey. PolyGlot is available under the GNU General + Public License, and can be downloaded from http://wbec-ridderkerk.nl + */ + +#ifndef BOOK_H_INCLUDED +#define BOOK_H_INCLUDED + +#include +#include + +#include "misc.h" +#include "position.h" + +class PolyglotBook : private std::ifstream { +public: + PolyglotBook(); + ~PolyglotBook(); + Move probe(const Position& pos, const std::string& fName, bool pickBest); + +private: + template PolyglotBook& operator>>(T& n); + + bool open(const char* fName); + size_t find_first(Key key); + + PRNG rng; + std::string fileName; +}; + +#endif // #ifndef BOOK_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/endgame.cpp b/Engines/Windows/mcbrain/src/endgame.cpp new file mode 100644 index 0000000..3455e79 --- /dev/null +++ b/Engines/Windows/mcbrain/src/endgame.cpp @@ -0,0 +1,794 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include + +#include "bitboard.h" +#include "endgame.h" +#include "movegen.h" + +using std::string; + +namespace { + + // Table used to drive the king towards the edge of the board + // in KX vs K and KQ vs KR endgames. + constexpr int PushToEdges[SQUARE_NB] = { + 100, 90, 80, 70, 70, 80, 90, 100, + 90, 70, 60, 50, 50, 60, 70, 90, + 80, 60, 40, 30, 30, 40, 60, 80, + 70, 50, 30, 20, 20, 30, 50, 70, + 70, 50, 30, 20, 20, 30, 50, 70, + 80, 60, 40, 30, 30, 40, 60, 80, + 90, 70, 60, 50, 50, 60, 70, 90, + 100, 90, 80, 70, 70, 80, 90, 100 + }; + + // Table used to drive the king towards a corner square of the + // right color in KBN vs K endgames. + constexpr int PushToCorners[SQUARE_NB] = { + 200, 190, 180, 170, 160, 150, 140, 130, + 190, 180, 170, 160, 150, 140, 130, 140, + 180, 170, 155, 140, 140, 125, 140, 150, + 170, 160, 140, 120, 110, 140, 150, 160, + 160, 150, 140, 110, 120, 140, 160, 170, + 150, 140, 125, 140, 140, 155, 170, 180, + 140, 130, 140, 150, 160, 170, 180, 190, + 130, 140, 150, 160, 170, 180, 190, 200 + }; + + // Tables used to drive a piece towards or away from another piece + constexpr int PushClose[8] = { 0, 0, 100, 80, 60, 40, 20, 10 }; + constexpr int PushAway [8] = { 0, 5, 20, 40, 60, 80, 90, 100 }; + + // Pawn Rank based scaling factors used in KRPPKRP endgame + constexpr int KRPPKRPScaleFactors[RANK_NB] = { 0, 9, 10, 14, 21, 44, 0, 0 }; + +#ifndef NDEBUG + bool verify_material(const Position& pos, Color c, Value npm, int pawnsCnt) { + return pos.non_pawn_material(c) == npm && pos.count(c) == pawnsCnt; + } +#endif + + // Map the square as if strongSide is white and strongSide's only pawn + // is on the left half of the board. + Square normalize(const Position& pos, Color strongSide, Square sq) { + + assert(pos.count(strongSide) == 1); + + if (file_of(pos.square(strongSide)) >= FILE_E) + sq = Square(sq ^ 7); // Mirror SQ_H1 -> SQ_A1 + + if (strongSide == BLACK) + sq = ~sq; + + return sq; + } + +} // namespace + + +/// Mate with KX vs K. This function is used to evaluate positions with +/// king and plenty of material vs a lone king. It simply gives the +/// attacking side a bonus for driving the defending king towards the edge +/// of the board, and for keeping the distance between the two kings small. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, weakSide, VALUE_ZERO, 0)); + assert(!pos.checkers()); // Eval is never called when in check + + // Stalemate detection with lone king + if (pos.side_to_move() == weakSide && !MoveList(pos).size()) + return VALUE_DRAW; + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + + Value result = pos.non_pawn_material(strongSide) + + pos.count(strongSide) * PawnValueEg + + PushToEdges[loserKSq] + + PushClose[distance(winnerKSq, loserKSq)]; + + if ( pos.count(strongSide) + || pos.count(strongSide) + ||(pos.count(strongSide) && pos.count(strongSide)) + || ( (pos.pieces(strongSide, BISHOP) & ~DarkSquares) + && (pos.pieces(strongSide, BISHOP) & DarkSquares))) + result = std::min(result + VALUE_KNOWN_WIN, VALUE_MATE_IN_MAX_PLY - 1); + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// Mate with KQX vs KX. This is similar to KX vs K. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(pos.non_pawn_material(strongSide) > QueenValueMg + RookValueMg); + assert(pos.non_pawn_material(weakSide) <= RookValueMg); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + + Value result = VALUE_KNOWN_WIN + + pos.non_pawn_material(strongSide) + - pos.non_pawn_material(weakSide) + + PushClose[distance(winnerKSq, loserKSq)] + + PushToCorners[loserKSq]; + + result = std::min(result, VALUE_MATE_IN_MAX_PLY - 1); + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// Mate with KBN vs K. This is similar to KX vs K, but we have to drive the +/// defending king towards a corner square of the right color. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, KnightValueMg + BishopValueMg, 0)); + assert(verify_material(pos, weakSide, VALUE_ZERO, 0)); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + Square bishopSq = pos.square(strongSide); + + // kbnk_mate_table() tries to drive toward corners A1 or H8. If we have a + // bishop that cannot reach the above squares, we flip the kings in order + // to drive the enemy toward corners A8 or H1. + if (opposite_colors(bishopSq, SQ_A1)) + { + winnerKSq = ~winnerKSq; + loserKSq = ~loserKSq; + } + + Value result = VALUE_KNOWN_WIN + + PushClose[distance(winnerKSq, loserKSq)] + + PushToCorners[loserKSq]; + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// KP vs K. This endgame is evaluated with the help of a bitbase. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, VALUE_ZERO, 1)); + assert(verify_material(pos, weakSide, VALUE_ZERO, 0)); + + // Assume strongSide is white and the pawn is on files A-D + Square wksq = normalize(pos, strongSide, pos.square(strongSide)); + Square bksq = normalize(pos, strongSide, pos.square(weakSide)); + Square psq = normalize(pos, strongSide, pos.square(strongSide)); + + Color us = strongSide == pos.side_to_move() ? WHITE : BLACK; + + if (!Bitbases::probe(wksq, psq, bksq, us)) + return VALUE_DRAW; + + Value result = VALUE_KNOWN_WIN + PawnValueEg + Value(rank_of(psq)); + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// KR vs KP. This is a somewhat tricky endgame to evaluate precisely without +/// a bitbase. The function below returns drawish scores when the pawn is +/// far advanced with support of the king, while the attacking king is far +/// away. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, RookValueMg, 0)); + assert(verify_material(pos, weakSide, VALUE_ZERO, 1)); + + Square wksq = relative_square(strongSide, pos.square(strongSide)); + Square bksq = relative_square(strongSide, pos.square(weakSide)); + Square rsq = relative_square(strongSide, pos.square(strongSide)); + Square psq = relative_square(strongSide, pos.square(weakSide)); + + Square queeningSq = make_square(file_of(psq), RANK_1); + Value result; + + // If the stronger side's king is in front of the pawn, it's a win + if (forward_file_bb(WHITE, wksq) & psq) + result = RookValueEg - distance(wksq, psq); + + // If the weaker side's king is too far from the pawn and the rook, + // it's a win. + else if ( distance(bksq, psq) >= 3 + (pos.side_to_move() == weakSide) + && distance(bksq, rsq) >= 3) + result = RookValueEg - distance(wksq, psq); + + // If the pawn is far advanced and supported by the defending king, + // the position is drawish + else if ( rank_of(bksq) <= RANK_3 + && distance(bksq, psq) == 1 + && rank_of(wksq) >= RANK_4 + && distance(wksq, psq) > 2 + (pos.side_to_move() == strongSide)) + result = Value(80) - 8 * distance(wksq, psq); + + else + result = Value(200) - 8 * ( distance(wksq, psq + SOUTH) + - distance(bksq, psq + SOUTH) + - distance(psq, queeningSq)); + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// KR vs KB. This is very simple, and always returns drawish scores. The +/// score is slightly bigger when the defending king is close to the edge. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, RookValueMg, 0)); + assert(verify_material(pos, weakSide, BishopValueMg, 0)); + + Value result = Value(PushToEdges[pos.square(weakSide)]); + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// KR vs KN. The attacking side has slightly better winning chances than +/// in KR vs KB, particularly if the king and the knight are far apart. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, RookValueMg, 0)); + assert(verify_material(pos, weakSide, KnightValueMg, 0)); + + Square bksq = pos.square(weakSide); + Square bnsq = pos.square(weakSide); + Value result = Value(PushToEdges[bksq] + PushAway[distance(bksq, bnsq)]); + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// KQ vs KP. In general, this is a win for the stronger side, but there are a +/// few important exceptions. A pawn on 7th rank and on the A,C,F or H files +/// with a king positioned next to it can be a draw, so in that case, we only +/// use the distance between the kings. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, QueenValueMg, 0)); + assert(verify_material(pos, weakSide, VALUE_ZERO, 1)); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + Square pawnSq = pos.square(weakSide); + + Value result = Value(PushClose[distance(winnerKSq, loserKSq)]); + + if ( relative_rank(weakSide, pawnSq) != RANK_7 + || distance(loserKSq, pawnSq) != 1 + || !((FileABB | FileCBB | FileFBB | FileHBB) & pawnSq)) + result += QueenValueEg - PawnValueEg; + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// KQ vs KR. This is almost identical to KX vs K: We give the attacking +/// king a bonus for having the kings close together, and for forcing the +/// defending king towards the edge. If we also take care to avoid null move for +/// the defending side in the search, this is usually sufficient to win KQ vs KR. +template<> +Value Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, QueenValueMg, 0)); + assert(verify_material(pos, weakSide, RookValueMg, 0)); + + Square winnerKSq = pos.square(strongSide); + Square loserKSq = pos.square(weakSide); + + Value result = QueenValueEg + - RookValueEg + + PushToEdges[loserKSq] + + PushClose[distance(winnerKSq, loserKSq)]; + + return strongSide == pos.side_to_move() ? result : -result; +} + + +/// Some cases of trivial draws +template<> Value Endgame::operator()(const Position&) const { return VALUE_DRAW; } + + +/// KB and one or more pawns vs K. It checks for draws with rook pawns and +/// a bishop of the wrong color. If such a draw is detected, SCALE_FACTOR_DRAW +/// is returned. If not, the return value is SCALE_FACTOR_NONE, i.e. no scaling +/// will be used. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(pos.non_pawn_material(strongSide) == BishopValueMg); + assert(pos.count(strongSide) >= 1); + + // No assertions about the material of weakSide, because we want draws to + // be detected even when the weaker side has some pawns. + + Bitboard pawns = pos.pieces(strongSide, PAWN); + File pawnsFile = file_of(lsb(pawns)); + + // All pawns are on a single rook file? + if ( (pawnsFile == FILE_A || pawnsFile == FILE_H) + && !(pawns & ~file_bb(pawnsFile))) + { + Square bishopSq = pos.square(strongSide); + Square queeningSq = relative_square(strongSide, make_square(pawnsFile, RANK_8)); + Square kingSq = pos.square(weakSide); + + if ( opposite_colors(queeningSq, bishopSq) + && distance(queeningSq, kingSq) <= 1) + return SCALE_FACTOR_DRAW; + } + + // If all the pawns are on the same B or G file, then it's potentially a draw + if ( (pawnsFile == FILE_B || pawnsFile == FILE_G) + && !(pos.pieces(PAWN) & ~file_bb(pawnsFile)) + && pos.non_pawn_material(weakSide) == 0 + && pos.count(weakSide) >= 1) + { + // Get weakSide pawn that is closest to the home rank + Square weakPawnSq = backmost_sq(weakSide, pos.pieces(weakSide, PAWN)); + + Square strongKingSq = pos.square(strongSide); + Square weakKingSq = pos.square(weakSide); + Square bishopSq = pos.square(strongSide); + + // There's potential for a draw if our pawn is blocked on the 7th rank, + // the bishop cannot attack it or they only have one pawn left + if ( relative_rank(strongSide, weakPawnSq) == RANK_7 + && (pos.pieces(strongSide, PAWN) & (weakPawnSq + pawn_push(weakSide))) + && (opposite_colors(bishopSq, weakPawnSq) || pos.count(strongSide) == 1)) + { + int strongKingDist = distance(weakPawnSq, strongKingSq); + int weakKingDist = distance(weakPawnSq, weakKingSq); + + // It's a draw if the weak king is on its back two ranks, within 2 + // squares of the blocking pawn and the strong king is not + // closer. (I think this rule only fails in practically + // unreachable positions such as 5k1K/6p1/6P1/8/8/3B4/8/8 w + // and positions where qsearch will immediately correct the + // problem such as 8/4k1p1/6P1/1K6/3B4/8/8/8 w) + if ( relative_rank(strongSide, weakKingSq) >= RANK_7 + && weakKingDist <= 2 + && weakKingDist <= strongKingDist) + return SCALE_FACTOR_DRAW; + } + } + + return SCALE_FACTOR_NONE; +} + + +/// KQ vs KR and one or more pawns. It tests for fortress draws with a rook on +/// the third rank defended by a pawn. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, QueenValueMg, 0)); + assert(pos.count(weakSide) == 1); + assert(pos.count(weakSide) >= 1); + + Square kingSq = pos.square(weakSide); + Square rsq = pos.square(weakSide); + + if ( relative_rank(weakSide, kingSq) <= RANK_2 + && relative_rank(weakSide, pos.square(strongSide)) >= RANK_4 + && relative_rank(weakSide, rsq) == RANK_3 + && ( pos.pieces(weakSide, PAWN) + & pos.attacks_from(kingSq) + & pos.attacks_from(rsq, strongSide))) + return SCALE_FACTOR_DRAW; + + return SCALE_FACTOR_NONE; +} + + +/// KRP vs KR. This function knows a handful of the most important classes of +/// drawn positions, but is far from perfect. It would probably be a good idea +/// to add more knowledge in the future. +/// +/// It would also be nice to rewrite the actual code for this function, +/// which is mostly copied from Glaurung 1.x, and isn't very pretty. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, RookValueMg, 1)); + assert(verify_material(pos, weakSide, RookValueMg, 0)); + + // Assume strongSide is white and the pawn is on files A-D + Square wksq = normalize(pos, strongSide, pos.square(strongSide)); + Square bksq = normalize(pos, strongSide, pos.square(weakSide)); + Square wrsq = normalize(pos, strongSide, pos.square(strongSide)); + Square wpsq = normalize(pos, strongSide, pos.square(strongSide)); + Square brsq = normalize(pos, strongSide, pos.square(weakSide)); + + File f = file_of(wpsq); + Rank r = rank_of(wpsq); + Square queeningSq = make_square(f, RANK_8); + int tempo = (pos.side_to_move() == strongSide); + + // If the pawn is not too far advanced and the defending king defends the + // queening square, use the third-rank defence. + if ( r <= RANK_5 + && distance(bksq, queeningSq) <= 1 + && wksq <= SQ_H5 + && (rank_of(brsq) == RANK_6 || (r <= RANK_3 && rank_of(wrsq) != RANK_6))) + return SCALE_FACTOR_DRAW; + + // The defending side saves a draw by checking from behind in case the pawn + // has advanced to the 6th rank with the king behind. + if ( r == RANK_6 + && distance(bksq, queeningSq) <= 1 + && rank_of(wksq) + tempo <= RANK_6 + && (rank_of(brsq) == RANK_1 || (!tempo && distance(brsq, wpsq) >= 3))) + return SCALE_FACTOR_DRAW; + + if ( r >= RANK_6 + && bksq == queeningSq + && rank_of(brsq) == RANK_1 + && (!tempo || distance(wksq, wpsq) >= 2)) + return SCALE_FACTOR_DRAW; + + // White pawn on a7 and rook on a8 is a draw if black's king is on g7 or h7 + // and the black rook is behind the pawn. + if ( wpsq == SQ_A7 + && wrsq == SQ_A8 + && (bksq == SQ_H7 || bksq == SQ_G7) + && file_of(brsq) == FILE_A + && (rank_of(brsq) <= RANK_3 || file_of(wksq) >= FILE_D || rank_of(wksq) <= RANK_5)) + return SCALE_FACTOR_DRAW; + + // If the defending king blocks the pawn and the attacking king is too far + // away, it's a draw. + if ( r <= RANK_5 + && bksq == wpsq + NORTH + && distance(wksq, wpsq) - tempo >= 2 + && distance(wksq, brsq) - tempo >= 2) + return SCALE_FACTOR_DRAW; + + // Pawn on the 7th rank supported by the rook from behind usually wins if the + // attacking king is closer to the queening square than the defending king, + // and the defending king cannot gain tempi by threatening the attacking rook. + if ( r == RANK_7 + && f != FILE_A + && file_of(wrsq) == f + && wrsq != queeningSq + && (distance(wksq, queeningSq) < distance(bksq, queeningSq) - 2 + tempo) + && (distance(wksq, queeningSq) < distance(bksq, wrsq) + tempo)) + return ScaleFactor(SCALE_FACTOR_MAX - 2 * distance(wksq, queeningSq)); + + // Similar to the above, but with the pawn further back + if ( f != FILE_A + && file_of(wrsq) == f + && wrsq < wpsq + && (distance(wksq, queeningSq) < distance(bksq, queeningSq) - 2 + tempo) + && (distance(wksq, wpsq + NORTH) < distance(bksq, wpsq + NORTH) - 2 + tempo) + && ( distance(bksq, wrsq) + tempo >= 3 + || ( distance(wksq, queeningSq) < distance(bksq, wrsq) + tempo + && (distance(wksq, wpsq + NORTH) < distance(bksq, wrsq) + tempo)))) + return ScaleFactor( SCALE_FACTOR_MAX + - 8 * distance(wpsq, queeningSq) + - 2 * distance(wksq, queeningSq)); + + // If the pawn is not far advanced and the defending king is somewhere in + // the pawn's path, it's probably a draw. + if (r <= RANK_4 && bksq > wpsq) + { + if (file_of(bksq) == file_of(wpsq)) + return ScaleFactor(10); + if ( distance(bksq, wpsq) == 1 + && distance(wksq, bksq) > 2) + return ScaleFactor(24 - 2 * distance(wksq, bksq)); + } + return SCALE_FACTOR_NONE; +} + +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, RookValueMg, 1)); + assert(verify_material(pos, weakSide, BishopValueMg, 0)); + + // Test for a rook pawn + if (pos.pieces(PAWN) & (FileABB | FileHBB)) + { + Square ksq = pos.square(weakSide); + Square bsq = pos.square(weakSide); + Square psq = pos.square(strongSide); + Rank rk = relative_rank(strongSide, psq); + Direction push = pawn_push(strongSide); + + // If the pawn is on the 5th rank and the pawn (currently) is on + // the same color square as the bishop then there is a chance of + // a fortress. Depending on the king position give a moderate + // reduction or a stronger one if the defending king is near the + // corner but not trapped there. + if (rk == RANK_5 && !opposite_colors(bsq, psq)) + { + int d = distance(psq + 3 * push, ksq); + + if (d <= 2 && !(d == 0 && ksq == pos.square(strongSide) + 2 * push)) + return ScaleFactor(24); + else + return ScaleFactor(48); + } + + // When the pawn has moved to the 6th rank we can be fairly sure + // it's drawn if the bishop attacks the square in front of the + // pawn from a reasonable distance and the defending king is near + // the corner + if ( rk == RANK_6 + && distance(psq + 2 * push, ksq) <= 1 + && (PseudoAttacks[BISHOP][bsq] & (psq + push)) + && distance(bsq, psq) >= 2) + return ScaleFactor(8); + } + + return SCALE_FACTOR_NONE; +} + +/// KRPP vs KRP. There is just a single rule: if the stronger side has no passed +/// pawns and the defending king is actively placed, the position is drawish. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, RookValueMg, 2)); + assert(verify_material(pos, weakSide, RookValueMg, 1)); + + Square wpsq1 = pos.squares(strongSide)[0]; + Square wpsq2 = pos.squares(strongSide)[1]; + Square bksq = pos.square(weakSide); + + // Does the stronger side have a passed pawn? + if (pos.pawn_passed(strongSide, wpsq1) || pos.pawn_passed(strongSide, wpsq2)) + return SCALE_FACTOR_NONE; + + Rank r = std::max(relative_rank(strongSide, wpsq1), relative_rank(strongSide, wpsq2)); + + if ( distance(bksq, wpsq1) <= 1 + && distance(bksq, wpsq2) <= 1 + && relative_rank(strongSide, bksq) > r) + { + assert(r > RANK_1 && r < RANK_7); + return ScaleFactor(KRPPKRPScaleFactors[r]); + } + return SCALE_FACTOR_NONE; +} + + +/// K and two or more pawns vs K. There is just a single rule here: If all pawns +/// are on the same rook file and are blocked by the defending king, it's a draw. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(pos.non_pawn_material(strongSide) == VALUE_ZERO); + assert(pos.count(strongSide) >= 2); + assert(verify_material(pos, weakSide, VALUE_ZERO, 0)); + + Square ksq = pos.square(weakSide); + Bitboard pawns = pos.pieces(strongSide, PAWN); + + // If all pawns are ahead of the king, on a single rook file and + // the king is within one file of the pawns, it's a draw. + if ( !(pawns & ~forward_ranks_bb(weakSide, ksq)) + && !((pawns & ~FileABB) && (pawns & ~FileHBB)) + && distance(ksq, lsb(pawns)) <= 1) + return SCALE_FACTOR_DRAW; + + return SCALE_FACTOR_NONE; +} + + +/// KBP vs KB. There are two rules: if the defending king is somewhere along the +/// path of the pawn, and the square of the king is not of the same color as the +/// stronger side's bishop, it's a draw. If the two bishops have opposite color, +/// it's almost always a draw. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, BishopValueMg, 1)); + assert(verify_material(pos, weakSide, BishopValueMg, 0)); + + Square pawnSq = pos.square(strongSide); + Square strongBishopSq = pos.square(strongSide); + Square weakBishopSq = pos.square(weakSide); + Square weakKingSq = pos.square(weakSide); + + // Case 1: Defending king blocks the pawn, and cannot be driven away + if ( file_of(weakKingSq) == file_of(pawnSq) + && relative_rank(strongSide, pawnSq) < relative_rank(strongSide, weakKingSq) + && ( opposite_colors(weakKingSq, strongBishopSq) + || relative_rank(strongSide, weakKingSq) <= RANK_6)) + return SCALE_FACTOR_DRAW; + + // Case 2: Opposite colored bishops + if (opposite_colors(strongBishopSq, weakBishopSq)) + return SCALE_FACTOR_DRAW; + + return SCALE_FACTOR_NONE; +} + + +/// KBPP vs KB. It detects a few basic draws with opposite-colored bishops +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, BishopValueMg, 2)); + assert(verify_material(pos, weakSide, BishopValueMg, 0)); + + Square wbsq = pos.square(strongSide); + Square bbsq = pos.square(weakSide); + + if (!opposite_colors(wbsq, bbsq)) + return SCALE_FACTOR_NONE; + + Square ksq = pos.square(weakSide); + Square psq1 = pos.squares(strongSide)[0]; + Square psq2 = pos.squares(strongSide)[1]; + Rank r1 = rank_of(psq1); + Rank r2 = rank_of(psq2); + Square blockSq1, blockSq2; + + if (relative_rank(strongSide, psq1) > relative_rank(strongSide, psq2)) + { + blockSq1 = psq1 + pawn_push(strongSide); + blockSq2 = make_square(file_of(psq2), rank_of(psq1)); + } + else + { + blockSq1 = psq2 + pawn_push(strongSide); + blockSq2 = make_square(file_of(psq1), rank_of(psq2)); + } + + switch (distance(psq1, psq2)) + { + case 0: + // Both pawns are on the same file. It's an easy draw if the defender firmly + // controls some square in the frontmost pawn's path. + if ( file_of(ksq) == file_of(blockSq1) + && relative_rank(strongSide, ksq) >= relative_rank(strongSide, blockSq1) + && opposite_colors(ksq, wbsq)) + return SCALE_FACTOR_DRAW; + else + return SCALE_FACTOR_NONE; + + case 1: + // Pawns on adjacent files. It's a draw if the defender firmly controls the + // square in front of the frontmost pawn's path, and the square diagonally + // behind this square on the file of the other pawn. + if ( ksq == blockSq1 + && opposite_colors(ksq, wbsq) + && ( bbsq == blockSq2 + || (pos.attacks_from(blockSq2) & pos.pieces(weakSide, BISHOP)) + || distance(r1, r2) >= 2)) + return SCALE_FACTOR_DRAW; + + else if ( ksq == blockSq2 + && opposite_colors(ksq, wbsq) + && ( bbsq == blockSq1 + || (pos.attacks_from(blockSq1) & pos.pieces(weakSide, BISHOP)))) + return SCALE_FACTOR_DRAW; + else + return SCALE_FACTOR_NONE; + + default: + // The pawns are not on the same file or adjacent files. No scaling. + return SCALE_FACTOR_NONE; + } +} + + +/// KBP vs KN. There is a single rule: If the defending king is somewhere along +/// the path of the pawn, and the square of the king is not of the same color as +/// the stronger side's bishop, it's a draw. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, BishopValueMg, 1)); + assert(verify_material(pos, weakSide, KnightValueMg, 0)); + + Square pawnSq = pos.square(strongSide); + Square strongBishopSq = pos.square(strongSide); + Square weakKingSq = pos.square(weakSide); + + if ( file_of(weakKingSq) == file_of(pawnSq) + && relative_rank(strongSide, pawnSq) < relative_rank(strongSide, weakKingSq) + && ( opposite_colors(weakKingSq, strongBishopSq) + || relative_rank(strongSide, weakKingSq) <= RANK_6)) + return SCALE_FACTOR_DRAW; + + return SCALE_FACTOR_NONE; +} + + +/// KNP vs K. There is a single rule: if the pawn is a rook pawn on the 7th rank +/// and the defending king prevents the pawn from advancing, the position is drawn. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, KnightValueMg, 1)); + assert(verify_material(pos, weakSide, VALUE_ZERO, 0)); + + // Assume strongSide is white and the pawn is on files A-D + Square pawnSq = normalize(pos, strongSide, pos.square(strongSide)); + Square weakKingSq = normalize(pos, strongSide, pos.square(weakSide)); + + if (pawnSq == SQ_A7 && distance(SQ_A8, weakKingSq) <= 1) + return SCALE_FACTOR_DRAW; + + return SCALE_FACTOR_NONE; +} + + +/// KNP vs KB. If knight can block bishop from taking pawn, it's a win. +/// Otherwise the position is drawn. +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + Square pawnSq = pos.square(strongSide); + Square bishopSq = pos.square(weakSide); + Square weakKingSq = pos.square(weakSide); + + // King needs to get close to promoting pawn to prevent knight from blocking. + // Rules for this are very tricky, so just approximate. + if (forward_file_bb(strongSide, pawnSq) & pos.attacks_from(bishopSq)) + return ScaleFactor(distance(weakKingSq, pawnSq)); + + return SCALE_FACTOR_NONE; +} + + +/// KP vs KP. This is done by removing the weakest side's pawn and probing the +/// KP vs K bitbase: If the weakest side has a draw without the pawn, it probably +/// has at least a draw with the pawn as well. The exception is when the stronger +/// side's pawn is far advanced and not on a rook file; in this case it is often +/// possible to win (e.g. 8/4k3/3p4/3P4/6K1/8/8/8 w - - 0 1). +template<> +ScaleFactor Endgame::operator()(const Position& pos) const { + + assert(verify_material(pos, strongSide, VALUE_ZERO, 1)); + assert(verify_material(pos, weakSide, VALUE_ZERO, 1)); + + // Assume strongSide is white and the pawn is on files A-D + Square wksq = normalize(pos, strongSide, pos.square(strongSide)); + Square bksq = normalize(pos, strongSide, pos.square(weakSide)); + Square psq = normalize(pos, strongSide, pos.square(strongSide)); + + Color us = strongSide == pos.side_to_move() ? WHITE : BLACK; + + // If the pawn has advanced to the fifth rank or further, and is not a + // rook pawn, it's too dangerous to assume that it's at least a draw. + if (rank_of(psq) >= RANK_5 && file_of(psq) != FILE_A) + return SCALE_FACTOR_NONE; + + // Probe the KPK bitbase with the weakest side's pawn removed. If it's a draw, + // it's probably at least a draw even with the pawn. + return Bitbases::probe(wksq, psq, bksq, us) ? SCALE_FACTOR_NONE : SCALE_FACTOR_DRAW; +} diff --git a/Engines/Windows/mcbrain/src/endgame.h b/Engines/Windows/mcbrain/src/endgame.h new file mode 100644 index 0000000..58338cc --- /dev/null +++ b/Engines/Windows/mcbrain/src/endgame.h @@ -0,0 +1,147 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef ENDGAME_H_INCLUDED +#define ENDGAME_H_INCLUDED + +#include +#include +#include +#include +#include + +#include "position.h" +#include "types.h" + + +/// EndgameCode lists all supported endgame functions by corresponding codes + +enum EndgameCode { + + EVALUATION_FUNCTIONS, + KNNK, // KNN vs K + KXK, // Generic "mate lone king" eval + KQXKX, // Big material advantage eval + KBNK, // KBN vs K + KPK, // KP vs K + KRKP, // KR vs KP + KRKB, // KR vs KB + KRKN, // KR vs KN + KQKP, // KQ vs KP + KQKR, // KQ vs KR + + SCALING_FUNCTIONS, + KBPsK, // KB and pawns vs K + KQKRPs, // KQ vs KR and pawns + KRPKR, // KRP vs KR + KRPKB, // KRP vs KB + KRPPKRP, // KRPP vs KRP + KPsK, // K and pawns vs K + KBPKB, // KBP vs KB + KBPPKB, // KBPP vs KB + KBPKN, // KBP vs KN + KNPK, // KNP vs K + KNPKB, // KNP vs KB + KPKP // KP vs KP +}; + + +/// Endgame functions can be of two types depending on whether they return a +/// Value or a ScaleFactor. + +template using +eg_type = typename std::conditional<(E < SCALING_FUNCTIONS), Value, ScaleFactor>::type; + + +/// Base and derived functors for endgame evaluation and scaling functions + +template +struct EndgameBase { + + explicit EndgameBase(Color c) : strongSide(c), weakSide(~c) {} + virtual ~EndgameBase() = default; + virtual T operator()(const Position&) const = 0; + + const Color strongSide, weakSide; +}; + + +template> +struct Endgame : public EndgameBase { + + explicit Endgame(Color c) : EndgameBase(c) {} + T operator()(const Position&) const override; +}; + + +/// The Endgames class stores the pointers to endgame evaluation and scaling +/// base objects in two std::map. We use polymorphism to invoke the actual +/// endgame function by calling its virtual operator(). + +class Endgames { + + template using Ptr = std::unique_ptr>; + template using Map = std::map>; + + template + Map& map() { + return std::get::value>(maps); + } + + template> + void add(const std::string& code) { + + StateInfo st; + map()[Position().set(code, WHITE, &st).material_key()] = Ptr(new Endgame(WHITE)); + map()[Position().set(code, BLACK, &st).material_key()] = Ptr(new Endgame(BLACK)); + } + + std::pair, Map> maps; + +public: + Endgames() { + + add("KPK"); + add("KNNK"); + add("KBNK"); + add("KRKP"); + add("KRKB"); + add("KRKN"); + add("KQKP"); + add("KQKR"); + + add("KNPK"); + add("KNPKB"); + add("KRPKR"); + add("KRPKB"); + add("KBPKB"); + add("KBPKN"); + add("KBPPKB"); + add("KRPPKRP"); + } + + template + const EndgameBase* probe(Key key) { + return map().count(key) ? map()[key].get() : nullptr; + } +}; + +#endif // #ifndef ENDGAME_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/evaluate.cpp b/Engines/Windows/mcbrain/src/evaluate.cpp new file mode 100644 index 0000000..0aa95e1 --- /dev/null +++ b/Engines/Windows/mcbrain/src/evaluate.cpp @@ -0,0 +1,1135 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include // For std::memset +#include +#include +#include + +#include "bitboard.h" +#include "evaluate.h" +#include "material.h" +#include "pawns.h" +#include "thread.h" +#include "uci.h" + +//#define PAWN_SCORES + +namespace Trace { + + enum Tracing { NO_TRACE, TRACE }; + + enum Term { // The first 8 entries are reserved for PieceType + MATERIAL = 8, IMBALANCE, MOBILITY, THREAT, PASSED, SPACE, +#ifdef PAWN_SCORES + CENTER, +#endif + INITIATIVE, TOTAL, TERM_NB + }; + + Score scores[TERM_NB][COLOR_NB]; + + double to_cp(Value v) { return double(v) / PawnValueEg; } + + void add(int idx, Color c, Score s) { + scores[idx][c] = s; + } + + void add(int idx, Score w, Score b = SCORE_ZERO) { + scores[idx][WHITE] = w; + scores[idx][BLACK] = b; + } + + std::ostream& operator<<(std::ostream& os, Score s) { + os << std::setw(5) << to_cp(mg_value(s)) << " " + << std::setw(5) << to_cp(eg_value(s)); + return os; + } + + std::ostream& operator<<(std::ostream& os, Term t) { + + if (t == MATERIAL || t == IMBALANCE || t == INITIATIVE || t == TOTAL) + os << " ---- ----" << " | " << " ---- ----"; + else + os << scores[t][WHITE] << " | " << scores[t][BLACK]; + + os << " | " << scores[t][WHITE] - scores[t][BLACK] << "\n"; + return os; + } +} + +using namespace Trace; + +namespace { + + constexpr Bitboard QueenSide = FileABB | FileBBB | FileCBB | FileDBB; + constexpr Bitboard CenterFiles = FileCBB | FileDBB | FileEBB | FileFBB; + constexpr Bitboard KingSide = FileEBB | FileFBB | FileGBB | FileHBB; + constexpr Bitboard Center = (FileDBB | FileEBB) & (Rank4BB | Rank5BB); + + constexpr Bitboard KingFlank[FILE_NB] = { + QueenSide ^ FileDBB, QueenSide, QueenSide, + CenterFiles, CenterFiles, + KingSide, KingSide, KingSide ^ FileEBB + }; + + // Threshold for lazy and space evaluation + constexpr Value LazyThreshold = Value(1500); + constexpr Value SpaceThreshold = Value(12222); + + // KingAttackWeights[PieceType] contains king attack weights by piece type + constexpr int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 77, 55, 44, 10 }; + + // Penalties for enemy's safe checks + constexpr int QueenSafeCheck = 780; + constexpr int RookSafeCheck = 880; + constexpr int BishopSafeCheck = 435; + constexpr int KnightSafeCheck = 790; + +#define S(mg, eg) make_score(mg, eg) + + // MobilityBonus[PieceType-2][attacked] contains bonuses for middle and end game, + // indexed by piece type and number of attacked squares in the mobility area. + constexpr Score MobilityBonus[][32] = { + { S(-75,-76), S(-57,-54), S( -9,-28), S( -2,-10), S( 6, 5), S( 14, 12), // Knights + S( 22, 26), S( 29, 29), S( 36, 29) }, + { S(-48,-59), S(-20,-23), S( 16, -3), S( 26, 13), S( 38, 24), S( 51, 42), // Bishops + S( 55, 54), S( 63, 57), S( 63, 65), S( 68, 73), S( 81, 78), S( 81, 86), + S( 91, 88), S( 98, 97) }, + { S(-58,-76), S(-27,-18), S(-15, 28), S(-10, 55), S( -5, 69), S( -2, 82), // Rooks + S( 9,112), S( 16,118), S( 30,132), S( 29,142), S( 32,155), S( 38,165), + S( 46,166), S( 48,169), S( 58,171) }, + { S(-39,-36), S(-21,-15), S( 3, 8), S( 3, 18), S( 14, 34), S( 22, 54), // Queens + S( 28, 61), S( 41, 73), S( 43, 79), S( 48, 92), S( 56, 94), S( 60,104), + S( 60,113), S( 66,120), S( 67,123), S( 70,126), S( 71,133), S( 73,136), + S( 79,140), S( 88,143), S( 88,148), S( 99,166), S(102,170), S(102,175), + S(106,184), S(109,191), S(113,206), S(116,212) } + }; + + // Outpost[knight/bishop][supported by pawn] contains bonuses for minor + // pieces if they occupy or can reach an outpost square, bigger if that + // square is supported by a pawn. + constexpr Score Outpost[][2] = { + { S(22, 6), S(36,12) }, // Knight + { S( 9, 2), S(15, 5) } // Bishop + }; + + // RookOnFile[semiopen/open] contains bonuses for each rook when there is + // no (friendly) pawn on the rook file. + constexpr Score RookOnFile[] = { S(20, 7), S(45, 20) }; + + // ThreatByMinor/ByRook[attacked PieceType] contains bonuses according to + // which piece type attacks which one. Attacks on lesser pieces which are + // pawn-defended are not considered. + constexpr Score ThreatByMinor[PIECE_TYPE_NB] = { + S(0, 0), S(0, 31), S(39, 42), S(57, 44), S(68, 112), S(47, 120) + }; + + constexpr Score ThreatByRook[PIECE_TYPE_NB] = { + S(0, 0), S(0, 24), S(38, 71), S(38, 61), S(0, 38), S(36, 38) + }; + + // PassedRank[Rank] contains a bonus according to the rank of a passed pawn + constexpr Score PassedRank[RANK_NB] = { + S(0, 0), S(5, 18), S(12, 23), S(10, 31), S(57, 62), S(163, 167), S(271, 250) + }; + + // PassedFile[File] contains a bonus according to the file of a passed pawn + constexpr Score PassedFile[FILE_NB] = { + S( -1, 7), S( 0, 9), S(-9, -8), S(-30,-14), + S(-30,-14), S(-9, -8), S( 0, 9), S( -1, 7) + }; + + // PassedDanger[Rank] contains a term to weight the passed score + constexpr int PassedDanger[RANK_NB] = { 0, 0, 0, 3, 7, 11, 20 }; + + // Knight Scores Board + constexpr Score KnightScoresBoard[RANK_NB][FILE_NB] = { + { S(-25, -25), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-10, -10), S(-25, -25) }, + { S(-15, -15), S(- 5, - 5), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(- 5, - 5), S(-15, -15) }, + { S(-10, -10), S(+ 0, + 0), S(+10, +10), S(+10, +10), S(+10, +10), S(+10, +10), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+10, +10), S(+25, +25), S(+25, +25), S(+10, +10), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+20, +20), S(+30, +30), S(+30, +30), S(+20, +20), S(+ 0, + 0), S(-10, -10) }, + { S(-10, -10), S(+ 0, + 0), S(+15, +15), S(+20, +20), S(+20, +20), S(+15, +15), S(+ 0, + 0), S(-10, -10) }, + { S(-15, -15), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(-15, -15) }, + { S(-20, -20), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(- 5, - 5), S(-20, -20) }, + }; + // Pawn for Knight Scores advantage compensation + constexpr Score PawnScores = S(+ 4, + 6); + // Bishop for Knight Scores advantage compensation + constexpr Score BishopScores = S(+10, +5); + // Rook for Knight Scores advantage compensation + constexpr Score RookScores = S(+15, +30); + // Queen for Knight Scores advantage compensation + constexpr Score QueenScores = S(+20, +60); + + // Pawns Shelter for Knight Scores advantage compensation + constexpr Score PawnShelterCompensationKnightScores = S(+ 10, + 0); // Exact numbers to be determined + +#ifdef PAWN_SCORES + // Pawn Scores Board + constexpr Score PawnScoresBoard[RANK_NB][FILE_NB] = { + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 8, + 0), S(+ 8, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+10, + 0), S(+10, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 6, + 0), S(+ 6, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + { S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0), S(+ 0, + 0) }, + }; + + // Undeveloped Piece Penalty + constexpr Score UndevelopedPiecePenalty = S(-20,-10); + +#endif + // Assorted bonuses and penalties + constexpr Score BishopPawns = S( 3, 7); + constexpr Score CloseEnemies = S( 6, 0); + constexpr Score CorneredBishop = S( 50, 50); + constexpr Score Hanging = S( 57, 32); + constexpr Score HinderPassedPawn = S( 8, 0); + constexpr Score KingProtector = S( 6, 6); + constexpr Score KnightOnQueen = S( 21, 11); + constexpr Score LongDiagonalBishop = S( 46, 0); + constexpr Score MinorBehindPawn = S( 16, 0); + constexpr Score Overload = S( 13, 6); + constexpr Score PawnlessFlank = S( 19, 84); + constexpr Score RookOnPawn = S( 10, 30); + constexpr Score SliderOnQueen = S( 42, 21); + constexpr Score ThreatByKing = S( 23, 76); + constexpr Score ThreatByPawnPush = S( 45, 40); + constexpr Score ThreatByRank = S( 16, 3); + constexpr Score ThreatBySafePawn = S(173,102); + constexpr Score TrappedRook = S( 92, 0); + constexpr Score WeakQueen = S( 50, 10); + constexpr Score WeakUnopposedPawn = S( 5, 29); + +#undef S + + // Evaluation class computes and stores attacks tables and other working data + template + class Evaluation { + + public: + Evaluation() = delete; + explicit Evaluation(const Position& p) : pos(p) {} + Evaluation& operator=(const Evaluation&) = delete; + Value value(); + + private: + template void initialize(); + template Score pieces(); + template Score king() const; + template Score threats() const; + template Score passed() const; + template Score space() const; +#ifdef PAWN_SCORES + template Score pawn_center() const; +#endif + ScaleFactor scale_factor(Value eg) const; + Score initiative(Value eg) const; + + const Position& pos; + Material::Entry* me; + Pawns::Entry* pe; + Bitboard mobilityArea[COLOR_NB]; + Score mobility[COLOR_NB] = { SCORE_ZERO, SCORE_ZERO }; + + // attackedBy[color][piece type] is a bitboard representing all squares + // attacked by a given color and piece type. Special "piece types" which + // is also calculated is ALL_PIECES. + Bitboard attackedBy[COLOR_NB][PIECE_TYPE_NB]; + + // attackedBy2[color] are the squares attacked by 2 pieces of a given color, + // possibly via x-ray or by one pawn and one piece. Diagonal x-ray through + // pawn or squares attacked by 2 pawns are not explicitly added. + Bitboard attackedBy2[COLOR_NB]; + + // kingRing[color] are the squares adjacent to the king, plus (only for a + // king on its first rank) the squares two ranks in front. For instance, + // if black's king is on g8, kingRing[BLACK] is f8, h8, f7, g7, h7, f6, g6 + // and h6. It is set to 0 when king safety evaluation is skipped. + Bitboard kingRing[COLOR_NB]; + + // kingAttackersCount[color] is the number of pieces of the given color + // which attack a square in the kingRing of the enemy king. + int kingAttackersCount[COLOR_NB]; + + // kingAttackersWeight[color] is the sum of the "weights" of the pieces of + // the given color which attack a square in the kingRing of the enemy king. + // The weights of the individual piece types are given by the elements in + // the KingAttackWeights array. + int kingAttackersWeight[COLOR_NB]; + + // kingAttacksCount[color] is the number of attacks by the given color to + // squares directly adjacent to the enemy king. Pieces which attack more + // than one square are counted multiple times. For instance, if there is + // a white knight on g5 and black's king is on g8, this white knight adds 2 + // to kingAttacksCount[WHITE]. + int kingAttacksCount[COLOR_NB]; + }; + + + // Evaluation::initialize() computes king and pawn attacks, and the king ring + // bitboard for a given color. This is done at the beginning of the evaluation. + template template + void Evaluation::initialize() { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); + constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH); + constexpr Bitboard LowRanks = (Us == WHITE ? Rank2BB | Rank3BB: Rank7BB | Rank6BB); + + // Find our pawns that are blocked or on the first two ranks + Bitboard b = pos.pieces(Us, PAWN) & (shift(pos.pieces()) | LowRanks); + + // Squares occupied by those pawns, by our king or queen, or controlled by enemy pawns + // are excluded from the mobility area. + mobilityArea[Us] = ~(b | pos.pieces(Us, KING, QUEEN) | pe->pawn_attacks(Them)); + + // Initialise attackedBy bitboards for kings and pawns + attackedBy[Us][KING] = pos.attacks_from(pos.square(Us)); + attackedBy[Us][PAWN] = pe->pawn_attacks(Us); + attackedBy[Us][ALL_PIECES] = attackedBy[Us][KING] | attackedBy[Us][PAWN]; + attackedBy2[Us] = attackedBy[Us][KING] & attackedBy[Us][PAWN]; + + // Init our king safety tables only if we are going to use them + if (pos.non_pawn_material(Them) >= RookValueMg + KnightValueMg) + { + kingRing[Us] = attackedBy[Us][KING]; + if (relative_rank(Us, pos.square(Us)) == RANK_1) + kingRing[Us] |= shift(kingRing[Us]); + + if (file_of(pos.square(Us)) == FILE_H) + kingRing[Us] |= shift(kingRing[Us]); + + else if (file_of(pos.square(Us)) == FILE_A) + kingRing[Us] |= shift(kingRing[Us]); + + kingAttackersCount[Them] = popcount(kingRing[Us] & pe->pawn_attacks(Them)); + kingAttacksCount[Them] = kingAttackersWeight[Them] = 0; + } + else + kingRing[Us] = kingAttackersCount[Them] = 0; + } + + + // Evaluation::pieces() scores pieces of a given color and type + template template + Score Evaluation::pieces() { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH); + constexpr Bitboard OutpostRanks = (Us == WHITE ? Rank4BB | Rank5BB | Rank6BB + : Rank5BB | Rank4BB | Rank3BB); + const Square* pl = pos.squares(Us); + + Bitboard b, bb; + Square s; + Score score = SCORE_ZERO; + + attackedBy[Us][Pt] = 0; + + while ((s = *pl++) != SQ_NONE) + { + // Find attacked squares, including x-ray attacks for bishops and rooks + b = Pt == BISHOP ? attacks_bb(s, pos.pieces() ^ pos.pieces(QUEEN)) + : Pt == ROOK ? attacks_bb< ROOK>(s, pos.pieces() ^ pos.pieces(QUEEN) ^ pos.pieces(Us, ROOK)) + : pos.attacks_from(s); + + if (pos.blockers_for_king(Us) & s) + b &= LineBB[pos.square(Us)][s]; + + attackedBy2[Us] |= attackedBy[Us][ALL_PIECES] & b; + attackedBy[Us][Pt] |= b; + attackedBy[Us][ALL_PIECES] |= b; + + if (b & kingRing[Them]) + { + kingAttackersCount[Us]++; + kingAttackersWeight[Us] += KingAttackWeights[Pt]; + kingAttacksCount[Us] += popcount(b & attackedBy[Them][KING]); + } + + int mob = popcount(b & mobilityArea[Us]); + + mobility[Us] += MobilityBonus[Pt - 2][mob]; + + if (Pt == BISHOP || Pt == KNIGHT) + { + // Bonus if piece is on an outpost square or can reach one + bb = OutpostRanks & ~pe->pawn_attacks_span(Them); + if (bb & s) + score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & s)] * 2; + + else if (bb &= b & ~pos.pieces(Us)) + score += Outpost[Pt == BISHOP][bool(attackedBy[Us][PAWN] & bb)]; + + // Knight and Bishop bonus for being right behind a pawn + if (shift(pos.pieces(PAWN)) & s) + score += MinorBehindPawn; + + // Penalty if the piece is far from the king + score -= KingProtector * distance(s, pos.square(Us)); + + if (Pt == BISHOP) + { + // Penalty according to number of pawns on the same color square as the + // bishop, bigger when the center files are blocked with pawns. + Bitboard blocked = pos.pieces(Us, PAWN) & shift(pos.pieces()); + + score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s) + * (1 + popcount(blocked & CenterFiles)); + + // Bonus for bishop on a long diagonal which can "see" both center squares + if (more_than_one(attacks_bb(s, pos.pieces(PAWN)) & Center)) + score += LongDiagonalBishop; + + if (pos.piece_on(s) == make_piece(Us, BISHOP)) + { + score += BishopScores; + } + } + + // An important Chess960 pattern: A cornered bishop blocked by a friendly + // pawn diagonally in front of it is a very serious problem, especially + // when that pawn is also blocked. + if ( Pt == BISHOP + && pos.is_chess960() + && (s == relative_square(Us, SQ_A1) || s == relative_square(Us, SQ_H1))) + { + Direction d = pawn_push(Us) + (file_of(s) == FILE_A ? EAST : WEST); + if (pos.piece_on(s + d) == make_piece(Us, PAWN)) + score -= !pos.empty(s + d + pawn_push(Us)) ? CorneredBishop * 4 + : pos.piece_on(s + d + d) == make_piece(Us, PAWN) ? CorneredBishop * 2 + : CorneredBishop; + } + + if (Pt == KNIGHT) + { + if (pos.piece_on(s) == make_piece(Us, KNIGHT)) + { + int rank = rank_of(s); + int file = file_of(s); + if (Us == WHITE) + { + score += KnightScoresBoard[rank][file]; + } + else + { + if (Us == BLACK) + { + score += KnightScoresBoard[RANK_NB - 1 -rank][file]; + } + else + { + assert(false); + } + } + } + } + } + + if (Pt == ROOK) + { + // Bonus for aligning rook with enemy pawns on the same rank/file + if (relative_rank(Us, s) >= RANK_5) + score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s]); + + // Bonus for rook on an open or semi-open file + if (pe->semiopen_file(Us, file_of(s))) + score += RookOnFile[bool(pe->semiopen_file(Them, file_of(s)))]; + + // Penalty when trapped by the king, even more if the king cannot castle + else if (mob <= 3) + { + File kf = file_of(pos.square(Us)); + if ((kf < FILE_E) == (file_of(s) < kf)) + score -= (TrappedRook - make_score(mob * 22, 0)) * (1 + !pos.can_castle(Us)); + } + + if (pos.piece_on(s) == make_piece(Us, ROOK)) + { + score += RookScores; + } + } + + if (Pt == QUEEN) + { + // Penalty if any relative pin or discovered attack against the queen + Bitboard queenPinners; + if (pos.slider_blockers(pos.pieces(Them, ROOK, BISHOP), s, queenPinners)) + score -= WeakQueen; + + if (pos.piece_on(s) == make_piece(Us, QUEEN)) + { + score += QueenScores; + } + } + } + if (T) + Trace::add(Pt, Us, score); + + return score; + } + + + // Evaluation::king() assigns bonuses and penalties to a king of a given color + template template + Score Evaluation::king() const { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Bitboard Camp = (Us == WHITE ? AllSquares ^ Rank6BB ^ Rank7BB ^ Rank8BB + : AllSquares ^ Rank1BB ^ Rank2BB ^ Rank3BB); + + const Square ksq = pos.square(Us); + Bitboard kingFlank, weak, b, b1, b2, safe, unsafeChecks; + + // King shelter and enemy pawns storm + Score score = pe->king_safety(pos, ksq); + + // Find the squares that opponent attacks in our king flank, and the squares + // which are attacked twice in that flank but not defended by our pawns. + kingFlank = KingFlank[file_of(ksq)]; + b1 = attackedBy[Them][ALL_PIECES] & kingFlank & Camp; + b2 = b1 & attackedBy2[Them] & ~attackedBy[Us][PAWN]; + + int tropism = popcount(b1) + popcount(b2); + + // Main king safety evaluation + if (kingAttackersCount[Them] > 1 - pos.count(Them)) + { + int kingDanger = 0; + unsafeChecks = 0; + + // Attacked squares defended at most once by our queen or king + weak = attackedBy[Them][ALL_PIECES] + & ~attackedBy2[Us] + & (~attackedBy[Us][ALL_PIECES] | attackedBy[Us][KING] | attackedBy[Us][QUEEN]); + + // Analyse the safe enemy's checks which are possible on next move + safe = ~pos.pieces(Them); + safe &= ~attackedBy[Us][ALL_PIECES] | (weak & attackedBy2[Them]); + + b1 = attacks_bb(ksq, pos.pieces() ^ pos.pieces(Us, QUEEN)); + b2 = attacks_bb(ksq, pos.pieces() ^ pos.pieces(Us, QUEEN)); + + // Enemy queen safe checks + if ((b1 | b2) & attackedBy[Them][QUEEN] & safe & ~attackedBy[Us][QUEEN]) + kingDanger += QueenSafeCheck; + + b1 &= attackedBy[Them][ROOK]; + b2 &= attackedBy[Them][BISHOP]; + + // Enemy rooks checks + if (b1 & safe) + kingDanger += RookSafeCheck; + else + unsafeChecks |= b1; + + // Enemy bishops checks + if (b2 & safe) + kingDanger += BishopSafeCheck; + else + unsafeChecks |= b2; + + // Enemy knights checks + b = pos.attacks_from(ksq) & attackedBy[Them][KNIGHT]; + if (b & safe) + kingDanger += KnightSafeCheck; + else + unsafeChecks |= b; + + // Unsafe or occupied checking squares will also be considered, as long as + // the square is in the attacker's mobility area. + unsafeChecks &= mobilityArea[Them]; + + kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them] + + 69 * kingAttacksCount[Them] + + 185 * popcount(kingRing[Us] & weak) + + 129 * popcount(pos.blockers_for_king(Us) | unsafeChecks) + + 4 * tropism + - 873 * !pos.count(Them) + - 6 * mg_value(score) / 8 + - 30; + + // Transform the kingDanger units into a Score, and subtract it from the evaluation + if (kingDanger > 0) + { + int mobilityDanger = mg_value(mobility[Them] - mobility[Us]); + kingDanger = std::max(0, kingDanger + mobilityDanger); +#ifdef Maverick + score -= make_score(kingDanger * kingDanger / 3584, kingDanger / 14); +#else + score -= make_score(kingDanger * kingDanger / 4096, kingDanger / 16); +#endif + } + } + + // Penalty when our king is on a pawnless flank + if (!(pos.pieces(PAWN) & kingFlank)) + { + score -= PawnlessFlank; + + const Square* pl = pos.squares(Us); + Square s; + + while ((s = *pl++) != SQ_NONE) + { + score += PawnShelterCompensationKnightScores; + } + } + + // King tropism bonus, to anticipate slow motion attacks on our king + score -= CloseEnemies * tropism; + + if (T) + Trace::add(KING, Us, score); + + return score; + } + + + // Evaluation::threats() assigns bonuses according to the types of the + // attacking and the attacked pieces. + template template + Score Evaluation::threats() const { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); + constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB); + + Bitboard b, weak, defended, nonPawnEnemies, stronglyProtected, safe; + Score score = SCORE_ZERO; + + // Non-pawn enemies + nonPawnEnemies = pos.pieces(Them) ^ pos.pieces(Them, PAWN); + + // Squares strongly protected by the enemy, either because they defend the + // square with a pawn, or because they defend the square twice and we don't. + stronglyProtected = attackedBy[Them][PAWN] + | (attackedBy2[Them] & ~attackedBy2[Us]); + + // Non-pawn enemies, strongly protected + defended = nonPawnEnemies & stronglyProtected; + + // Enemies not strongly protected and under our attack + weak = pos.pieces(Them) & ~stronglyProtected & attackedBy[Us][ALL_PIECES]; + + // Safe or protected squares + safe = ~attackedBy[Them][ALL_PIECES] | attackedBy[Us][ALL_PIECES]; + + // Bonus according to the kind of attacking pieces + if (defended | weak) + { + b = (defended | weak) & (attackedBy[Us][KNIGHT] | attackedBy[Us][BISHOP]); + while (b) + { + Square s = pop_lsb(&b); + score += ThreatByMinor[type_of(pos.piece_on(s))]; + if (type_of(pos.piece_on(s)) != PAWN) + score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; + } + + b = weak & attackedBy[Us][ROOK]; + while (b) + { + Square s = pop_lsb(&b); + score += ThreatByRook[type_of(pos.piece_on(s))]; + if (type_of(pos.piece_on(s)) != PAWN) + score += ThreatByRank * (int)relative_rank(Them, s); + + else if (pos.blockers_for_king(Them) & s) + score += ThreatByRank * (int)relative_rank(Them, s) / 2; + } + + if (weak & attackedBy[Us][KING]) + score += ThreatByKing; + + score += Hanging * popcount(weak & ~attackedBy[Them][ALL_PIECES]); + + b = weak & nonPawnEnemies & attackedBy[Them][ALL_PIECES]; + score += Overload * popcount(b); + } + + // Bonus for enemy unopposed weak pawns + if (pos.pieces(Us, ROOK, QUEEN)) + score += WeakUnopposedPawn * pe->weak_unopposed(Them); + + // Find squares where our pawns can push on the next move + b = shift(pos.pieces(Us, PAWN)) & ~pos.pieces(); + b |= shift(b & TRank3BB) & ~pos.pieces(); + + // Keep only the squares which are relatively safe + b &= ~attackedBy[Them][PAWN] & safe; + + // Bonus for safe pawn threats on the next move + b = pawn_attacks_bb(b) & pos.pieces(Them); + score += ThreatByPawnPush * popcount(b); + + // Our safe or protected pawns + b = pos.pieces(Us, PAWN) & safe; + + b = pawn_attacks_bb(b) & nonPawnEnemies; + score += ThreatBySafePawn * popcount(b); + + // Bonus for threats on the next moves against enemy queen + if (pos.count(Them) == 1) + { + Square s = pos.square(Them); + safe = mobilityArea[Us] & ~stronglyProtected; + + b = attackedBy[Us][KNIGHT] & pos.attacks_from(s); + + score += KnightOnQueen * popcount(b & safe); + + b = (attackedBy[Us][BISHOP] & pos.attacks_from(s)) + | (attackedBy[Us][ROOK ] & pos.attacks_from(s)); + + score += SliderOnQueen * popcount(b & safe & attackedBy2[Us]); + } + + if (T) + Trace::add(THREAT, Us, score); + + return score; + } + + // Evaluation::passed() evaluates the passed pawns and candidate passed + // pawns of the given color. + + template template + Score Evaluation::passed() const { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); + + auto king_proximity = [&](Color c, Square s) { + return std::min(distance(pos.square(c), s), 5); + }; + + Bitboard b, bb, squaresToQueen, defendedSquares, unsafeSquares; + Score score = SCORE_ZERO; + + b = pe->passed_pawns(Us); + + while (b) + { + Square s = pop_lsb(&b); + + assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up))); + + if (forward_file_bb(Us, s) & pos.pieces(Them)) + score -= HinderPassedPawn; + + int r = relative_rank(Us, s); + int w = PassedDanger[r]; + + Score bonus = PassedRank[r]; + + if (w) + { + Square blockSq = s + Up; + + // Adjust bonus based on the king's proximity + bonus += make_score(0, ( king_proximity(Them, blockSq) * 5 + - king_proximity(Us, blockSq) * 2) * w); + + // If blockSq is not the queening square then consider also a second push + if (r != RANK_7) + bonus -= make_score(0, king_proximity(Us, blockSq + Up) * w); + + // If the pawn is free to advance, then increase the bonus + if (pos.empty(blockSq)) + { + // If there is a rook or queen attacking/defending the pawn from behind, + // consider all the squaresToQueen. Otherwise consider only the squares + // in the pawn's path attacked or occupied by the enemy. + defendedSquares = unsafeSquares = squaresToQueen = forward_file_bb(Us, s); + + bb = forward_file_bb(Them, s) & pos.pieces(ROOK, QUEEN) & pos.attacks_from(s); + + if (!(pos.pieces(Us) & bb)) + defendedSquares &= attackedBy[Us][ALL_PIECES]; + + if (!(pos.pieces(Them) & bb)) + unsafeSquares &= attackedBy[Them][ALL_PIECES] | pos.pieces(Them); + + // If there aren't any enemy attacks, assign a big bonus. Otherwise + // assign a smaller bonus if the block square isn't attacked. + int k = !unsafeSquares ? 20 : !(unsafeSquares & blockSq) ? 9 : 0; + + // If the path to the queen is fully defended, assign a big bonus. + // Otherwise assign a smaller bonus if the block square is defended. + if (defendedSquares == squaresToQueen) + k += 6; + + else if (defendedSquares & blockSq) + k += 4; + + bonus += make_score(k * w, k * w); + } + else if (pos.pieces(Us) & blockSq) + bonus += make_score(w + r * 2, w + r * 2); + } // w != 0 + + // Scale down bonus for candidate passers which need more than one + // pawn push to become passed, or have a pawn in front of them. + if ( !pos.pawn_passed(Us, s + Up) + || (pos.pieces(PAWN) & forward_file_bb(Us, s))) + bonus = bonus / 2; + + score += bonus + PassedFile[file_of(s)]; + } + + if (T) + Trace::add(PASSED, Us, score); + + return score; + } + + +#ifdef PAWN_SCORES + // Pawn Center evaluation + + template template + Score Evaluation::pawn_center() const { + + //constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + + const Square* pl = pos.squares(Us); + + Square s; + Score score = SCORE_ZERO; + + while ((s = *pl++) != SQ_NONE) + { + if (pos.piece_on(s) == make_piece(Us, PAWN)) + { + int rank = rank_of(s); + int file = file_of(s); + if (Us == WHITE) + { + score += PawnScoresBoard[rank][file]; + } + else + { + if (Us == BLACK) + { + score += PawnScoresBoard[RANK_NB - 1 - rank][file]; + } + else + { + assert(false); + } + } + } + } + + // Evaluation of development + + const Square* pld = pos.squares(Us); + + while ((s = *pld++) != SQ_NONE) + { + if (relative_rank(Us, s) == RANK_1) + { + score += UndevelopedPiecePenalty; + } + } + + if (T) + Trace::add(CENTER, Us, score); + + return score; + } +#endif + + + // Evaluation::space() computes the space evaluation for a given side. The + // space evaluation is a simple bonus based on the number of safe squares + // available for minor pieces on the central four files on ranks 2--4. Safe + // squares one, two or three squares behind a friendly pawn are counted + // twice. Finally, the space bonus is multiplied by a weight. The aim is to + // improve play on game opening. + + template template + Score Evaluation::space() const { + + if (pos.non_pawn_material() < SpaceThreshold) + return SCORE_ZERO; + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Bitboard SpaceMask = + Us == WHITE ? CenterFiles & (Rank2BB | Rank3BB | Rank4BB) + : CenterFiles & (Rank7BB | Rank6BB | Rank5BB); + + // Find the available squares for our pieces inside the area defined by SpaceMask + Bitboard safe = SpaceMask + & ~pos.pieces(Us, PAWN) + & ~attackedBy[Them][PAWN]; + + // Find all squares which are at most three squares behind some friendly pawn + Bitboard behind = pos.pieces(Us, PAWN); + behind |= (Us == WHITE ? behind >> 8 : behind << 8); + behind |= (Us == WHITE ? behind >> 16 : behind << 16); + + int bonus = popcount(safe) + popcount(behind & safe); + int weight = pos.count(Us) - 2 * pe->open_files(); + + Score score = make_score(bonus * weight * weight / 16, 0); + + if (T) + Trace::add(SPACE, Us, score); + + return score; + } + + + // Evaluation::initiative() computes the initiative correction value + // for the position. It is a second order bonus/malus based on the + // known attacking/defending status of the players. + + template + Score Evaluation::initiative(Value eg) const { + + int outflanking = distance(pos.square(WHITE), pos.square(BLACK)) + - distance(pos.square(WHITE), pos.square(BLACK)); + + bool pawnsOnBothFlanks = (pos.pieces(PAWN) & QueenSide) + && (pos.pieces(PAWN) & KingSide); + +#ifdef Maverick + // Compute the initiative bonus for the attacking side + int complexity = 8 * pe->pawn_asymmetry() + + 12 * pos.count() + + 12 * outflanking + + 32 * pawnsOnBothFlanks + + 48 * !pos.non_pawn_material() + - 132; +#else + // Compute the initiative bonus for the attacking side + int complexity = 8 * pe->pawn_asymmetry() + + 12 * pos.count() + + 12 * outflanking + + 16 * pawnsOnBothFlanks + + 48 * !pos.non_pawn_material() + - 116; +#endif + // Now apply the bonus: note that we find the attacking side by extracting + // the sign of the endgame value, and that we carefully cap the bonus so + // that the endgame score will never change sign after the bonus. + int v = ((eg > 0) - (eg < 0)) * std::max(complexity, -abs(eg)); + + if (T) + Trace::add(INITIATIVE, make_score(0, v)); + + return make_score(0, v); + } + + + // Evaluation::scale_factor() computes the scale factor for the winning side + + template + ScaleFactor Evaluation::scale_factor(Value eg) const { + + Color strongSide = eg > VALUE_DRAW ? WHITE : BLACK; + int sf = me->scale_factor(pos, strongSide); + + // If scale is not already specific, scale down the endgame via general heuristics + if (sf == SCALE_FACTOR_NORMAL) + { + if ( pos.opposite_bishops() + && pos.non_pawn_material(WHITE) == BishopValueMg + && pos.non_pawn_material(BLACK) == BishopValueMg) + sf = 31; + else + sf = std::min(40 + (pos.opposite_bishops() ? 2 : 7) * pos.count(strongSide), sf); + } + + return ScaleFactor(sf); + } + + + // Evaluation::value() is the main function of the class. It computes the various + // parts of the evaluation and returns the value of the position from the point + // of view of the side to move. + + template + Value Evaluation::value() { + + assert(!pos.checkers()); + + // Probe the material hash table + me = Material::probe(pos); + + // If we have a specialized evaluation function for the current material + // configuration, call it and return. + if (me->specialized_eval_exists()) + return me->evaluate(pos); + + // Initialize score by reading the incrementally updated scores included in + // the position object (material + piece square tables) and the material + // imbalance. Score is computed internally from the white point of view. + Score score = pos.psq_score() + me->imbalance() + pos.this_thread()->contempt; + + // Probe the pawn hash table + pe = Pawns::probe(pos); + score += pe->pawn_score(WHITE) - pe->pawn_score(BLACK); + + score += PawnScores * pos.count(WHITE) - PawnScores * pos.count(BLACK); + + // Early exit if score is high + Value v = (mg_value(score) + eg_value(score)) / 2; + if (abs(v) > LazyThreshold) + return pos.side_to_move() == WHITE ? v : -v; + + // Main evaluation begins here + + initialize(); + initialize(); + + // Pieces should be evaluated first (populate attack tables) + score += pieces() - pieces() + + pieces() - pieces() + + pieces() - pieces() + + pieces() - pieces(); + + Value v_Dynamic_test = v; + + constexpr double DYNAMIC_ADVANTAGE_PAWNS_COUNT = 1.0; + constexpr Value DYNAMIC_ADVANTAGE_VALUE = Value(int(DYNAMIC_ADVANTAGE_PAWNS_COUNT * double(PawnValueMg + PawnValueEg) / 2.0)); + constexpr double Dynamic_Scale_Factor_Default = 1.0; + + double king_Dynamic_scale = Dynamic_Scale_Factor_Default; + double passed_Dynamic_scale = Dynamic_Scale_Factor_Default; + + constexpr double Dynamic_Winning_Scale_Factor_Default = 0.05; + constexpr double Alpha = 0.5; + const double Beta = fabs(Dynamic_Winning_Scale_Factor_Default * 2 / (MidgameLimit + EndgameLimit)); + + const double Dynamic_Scale_Factor_Bonus = (-abs(v_Dynamic_test / DYNAMIC_ADVANTAGE_VALUE) + Alpha); + + if (abs(v_Dynamic_test) >= double(PawnValueMg + PawnValueEg) / 2.0) + { + king_Dynamic_scale = Dynamic_Scale_Factor_Default - Dynamic_Scale_Factor_Bonus * Beta; + } + else + { + passed_Dynamic_scale = Dynamic_Scale_Factor_Default + Dynamic_Scale_Factor_Bonus * Beta; + } + + score += mobility[WHITE] - mobility[BLACK]; + Score default_king = king< WHITE>() - king< BLACK>(); + Score score_king = Score(int(double(default_king) * king_Dynamic_scale)); + score += score_king; + score += threats() - threats(); + Score default_passed = passed< WHITE>() - passed< BLACK>(); + Score score_passed = Score(int(double(default_passed) * passed_Dynamic_scale)); + score += score_passed; + score += space< WHITE>() - space< BLACK>(); + score += initiative(eg_value(score)); + + +#ifdef PAWN_SCORES + score += pawn_center() - pawn_center(); +#endif + + // Interpolate between a middlegame and a (scaled by 'sf') endgame score + ScaleFactor sf = scale_factor(eg_value(score)); + v = mg_value(score) * int(me->game_phase()) + + eg_value(score) * int(PHASE_MIDGAME - me->game_phase()) * sf / SCALE_FACTOR_NORMAL; + + v /= int(PHASE_MIDGAME); + + // In case of tracing add all remaining individual evaluation terms + if (T) + { + Trace::add(MATERIAL, pos.psq_score()); + Trace::add(IMBALANCE, me->imbalance()); + Trace::add(PAWN, pe->pawn_score(WHITE), pe->pawn_score(BLACK)); + Trace::add(MOBILITY, mobility[WHITE], mobility[BLACK]); + Trace::add(TOTAL, score); + } + + return (pos.side_to_move() == WHITE ? v : -v) // Side to move point of view + + Eval::Tempo; + } + +} // namespace + + +/// evaluate() is the evaluator for the outer world. It returns a static +/// evaluation of the position from the point of view of the side to move. + +Value Eval::evaluate(const Position& pos) { + return Evaluation(pos).value(); +} + + +/// trace() is like evaluate(), but instead of returning a value, it returns +/// a string (suitable for outputting to stdout) that contains the detailed +/// descriptions and values of each evaluation term. Useful for debugging. + +std::string Eval::trace(const Position& pos) { + + std::memset(scores, 0, sizeof(scores)); + + pos.this_thread()->contempt = SCORE_ZERO; // Reset any dynamic contempt + + Value v = Evaluation(pos).value(); + + v = pos.side_to_move() == WHITE ? v : -v; // Trace scores are from white's point of view + + std::stringstream ss; + ss << std::showpoint << std::noshowpos << std::fixed << std::setprecision(2) + << " Term | White | Black | Total \n" + << " | MG EG | MG EG | MG EG \n" + << " ------------+-------------+-------------+------------\n" + << " Material | " << Term(MATERIAL) + << " Imbalance | " << Term(IMBALANCE) + << " Initiative | " << Term(INITIATIVE) + << " Pawns | " << Term(PAWN) +#ifdef PAWN_SCORES + << " Pawns Bonus | " << Term(CENTER) +#endif + << " Knights | " << Term(KNIGHT) + << " Bishops | " << Term(BISHOP) + << " Rooks | " << Term(ROOK) + << " Queens | " << Term(QUEEN) + << " Mobility | " << Term(MOBILITY) + << " King safety | " << Term(KING) + << " Threats | " << Term(THREAT) + << " Passed | " << Term(PASSED) + << " Space | " << Term(SPACE) + << " ------------+-------------+-------------+------------\n" + << " Total | " << Term(TOTAL); + + ss << "\nTotal evaluation: " << to_cp(v) << " (white side)\n"; + + return ss.str(); +} diff --git a/Engines/Windows/mcbrain/src/evaluate.h b/Engines/Windows/mcbrain/src/evaluate.h new file mode 100644 index 0000000..976ccec --- /dev/null +++ b/Engines/Windows/mcbrain/src/evaluate.h @@ -0,0 +1,40 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef EVALUATE_H_INCLUDED +#define EVALUATE_H_INCLUDED + +#include + +#include "types.h" + +class Position; + +namespace Eval { + +constexpr Value Tempo = Value(20); // Must be visible to search + +std::string trace(const Position& pos); + +Value evaluate(const Position& pos); +} + +#endif // #ifndef EVALUATE_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/main.cpp b/Engines/Windows/mcbrain/src/main.cpp new file mode 100644 index 0000000..e62f857 --- /dev/null +++ b/Engines/Windows/mcbrain/src/main.cpp @@ -0,0 +1,97 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "bitboard.h" +#include "position.h" +#include "search.h" +#include "thread.h" +#include "tt.h" +#include "uci.h" +#include "syzygy/tbprobe.h" +#include "polybook.h" + +namespace PSQT { + void init(); +} + +int main(int argc, char* argv[]) { + + { +#ifdef _WIN32 + const size_t time_length_const = 100; + char time_local[time_length_const]; + memset(time_local, char(0), time_length_const); + time_t result = time(NULL); + tm tm_local; + errno_t errno_local = localtime_s(&tm_local, &result); + if (errno_local == 0) + { + errno_local = asctime_s(time_local, time_length_const, &tm_local); + if (errno_local == 0) + { + std::cout << time_local; + } + else + { + assert(errno_local != 0); + } + } + else + { + assert(errno_local != 0); + } +#else + std::time_t result = std::time(NULL); + std::cout << std::asctime(std::localtime(&result)); +#endif + } + + std::cout << hardware_info() << std::endl; + std::cout << system_info() << std::endl; + std::cout << engine_info() << std::endl; + std::cout << cores_info() << std::endl; + + UCI::init(Options); + PSQT::init(); + Bitboards::init(); + Position::init(); + Bitbases::init(); + + Search::init(Options["Clear Search"]); + Pawns::init(); + polybook.init(Options["BookFile"]); + Tablebases::init(Options["SyzygyPath"]); // After Bitboards are set + Threads.set(Options["Threads"]); + Search::clear(); // After threads are up + + UCI::loop(argc, argv); + + Threads.set(0); + return 0; +} diff --git a/Engines/Windows/mcbrain/src/material.cpp b/Engines/Windows/mcbrain/src/material.cpp new file mode 100644 index 0000000..760d671 --- /dev/null +++ b/Engines/Windows/mcbrain/src/material.cpp @@ -0,0 +1,239 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include // For std::min +#include +#include // For std::memset + +#include "material.h" +#include "thread.h" + +using namespace std; + +namespace { + + // Polynomial material imbalance parameters + + constexpr int QuadraticOurs[][PIECE_TYPE_NB] = { + // OUR PIECES + // pair pawn knight bishop rook queen + {1438 }, // Bishop pair + { 40, 38 }, // Pawn + { 32, 255, -62 }, // Knight OUR PIECES + { 0, 104, 4, 0 }, // Bishop + { -26, -2, 47, 105, -208 }, // Rook + {-189, 24, 117, 133, -134, -6 } // Queen + }; + + constexpr int QuadraticTheirs[][PIECE_TYPE_NB] = { + // THEIR PIECES + // pair pawn knight bishop rook queen + { 0 }, // Bishop pair + { 36, 0 }, // Pawn + { 9, 63, 0 }, // Knight OUR PIECES + { 59, 65, 42, 0 }, // Bishop + { 46, 39, 24, -24, 0 }, // Rook + { 97, 100, -42, 137, 268, 0 } // Queen + }; + + // Endgame evaluation and scaling functions are accessed directly and not through + // the function maps because they correspond to more than one material hash key. + Endgame EvaluateKXK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame EvaluateKQXKX[] = { Endgame(WHITE), Endgame(BLACK) }; + + Endgame ScaleKBPsK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame ScaleKQKRPs[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame ScaleKPsK[] = { Endgame(WHITE), Endgame(BLACK) }; + Endgame ScaleKPKP[] = { Endgame(WHITE), Endgame(BLACK) }; + + // Helper used to detect a given material distribution + bool is_KXK(const Position& pos, Color us) { + return !more_than_one(pos.pieces(~us)) + && pos.non_pawn_material(us) >= RookValueMg; + } + + bool is_KQXKX(const Position& pos, Color us) { + return more_than_one(pos.pieces(~us)) + && !pos.count(~us) + && pos.non_pawn_material(~us) <= RookValueMg + && pos.count(us) + && pos.non_pawn_material(us) > QueenValueMg + RookValueMg; + } + + bool is_KBPsK(const Position& pos, Color us) { + return pos.non_pawn_material(us) == BishopValueMg + && pos.count(us) == 1 + && pos.count(us) >= 1; + } + + bool is_KQKRPs(const Position& pos, Color us) { + return !pos.count(us) + && pos.non_pawn_material(us) == QueenValueMg + && pos.count(us) == 1 + && pos.count(~us) == 1 + && pos.count(~us) >= 1; + } + + /// imbalance() calculates the imbalance by comparing the piece count of each + /// piece type for both colors. + template + int imbalance(const int pieceCount[][PIECE_TYPE_NB]) { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + + int bonus = 0; + + // Second-degree polynomial material imbalance, by Tord Romstad + for (int pt1 = NO_PIECE_TYPE; pt1 <= QUEEN; ++pt1) + { + if (!pieceCount[Us][pt1]) + continue; + + int v = 0; + + for (int pt2 = NO_PIECE_TYPE; pt2 <= pt1; ++pt2) + v += QuadraticOurs[pt1][pt2] * pieceCount[Us][pt2] + + QuadraticTheirs[pt1][pt2] * pieceCount[Them][pt2]; + + bonus += pieceCount[Us][pt1] * v; + } + + return bonus; + } + +} // namespace + +namespace Material { + +/// Material::probe() looks up the current position's material configuration in +/// the material hash table. It returns a pointer to the Entry if the position +/// is found. Otherwise a new Entry is computed and stored there, so we don't +/// have to recompute all when the same material configuration occurs again. + +Entry* probe(const Position& pos) { + + Key key = pos.material_key(); + Entry* e = pos.this_thread()->materialTable[key]; + + if (e->key == key) + return e; + + std::memset(e, 0, sizeof(Entry)); + e->key = key; + e->factor[WHITE] = e->factor[BLACK] = (uint8_t)SCALE_FACTOR_NORMAL; + + Value npm_w = pos.non_pawn_material(WHITE); + Value npm_b = pos.non_pawn_material(BLACK); + Value npm = std::max(EndgameLimit, std::min(npm_w + npm_b, MidgameLimit)); + + // Map total non-pawn material into [PHASE_ENDGAME, PHASE_MIDGAME] + e->gamePhase = Phase(((npm - EndgameLimit) * PHASE_MIDGAME) / (MidgameLimit - EndgameLimit)); + + // Let's look if we have a specialized evaluation function for this particular + // material configuration. Firstly we look for a fixed configuration one, then + // for a generic one if the previous search failed. + if ((e->evaluationFunction = pos.this_thread()->endgames.probe(key)) != nullptr) + return e; + + for (Color c = WHITE; c <= BLACK; ++c) + { + if (is_KXK(pos, c)) + { + e->evaluationFunction = &EvaluateKXK[c]; + return e; + } + else if (is_KQXKX(pos, c)) + { + e->evaluationFunction = &EvaluateKQXKX[c]; + return e; + } + } + + // OK, we didn't find any special evaluation function for the current material + // configuration. Is there a suitable specialized scaling function? + const EndgameBase* sf; + + if ((sf = pos.this_thread()->endgames.probe(key)) != nullptr) + { + e->scalingFunction[sf->strongSide] = sf; // Only strong color assigned + return e; + } + + // We didn't find any specialized scaling function, so fall back on generic + // ones that refer to more than one material distribution. Note that in this + // case we don't return after setting the function. + for (Color c = WHITE; c <= BLACK; ++c) + { + if (is_KBPsK(pos, c)) + e->scalingFunction[c] = &ScaleKBPsK[c]; + + else if (is_KQKRPs(pos, c)) + e->scalingFunction[c] = &ScaleKQKRPs[c]; + } + + if (npm_w + npm_b == VALUE_ZERO && pos.pieces(PAWN)) // Only pawns on the board + { + if (!pos.count(BLACK)) + { + assert(pos.count(WHITE) >= 2); + + e->scalingFunction[WHITE] = &ScaleKPsK[WHITE]; + } + else if (!pos.count(WHITE)) + { + assert(pos.count(BLACK) >= 2); + + e->scalingFunction[BLACK] = &ScaleKPsK[BLACK]; + } + else if (pos.count(WHITE) == 1 && pos.count(BLACK) == 1) + { + // This is a special case because we set scaling functions + // for both colors instead of only one. + e->scalingFunction[WHITE] = &ScaleKPKP[WHITE]; + e->scalingFunction[BLACK] = &ScaleKPKP[BLACK]; + } + } + + // Zero or just one pawn makes it difficult to win, even with a small material + // advantage. This catches some trivial draws like KK, KBK and KNK and gives a + // drawish scale factor for cases such as KRKBP and KmmKm (except for KBBKN). + if (!pos.count(WHITE) && npm_w - npm_b <= BishopValueMg) + e->factor[WHITE] = uint8_t(npm_w < RookValueMg ? SCALE_FACTOR_DRAW : + npm_b <= BishopValueMg ? 4 : 14); + + if (!pos.count(BLACK) && npm_b - npm_w <= BishopValueMg) + e->factor[BLACK] = uint8_t(npm_b < RookValueMg ? SCALE_FACTOR_DRAW : + npm_w <= BishopValueMg ? 4 : 14); + + // Evaluate the material imbalance. We use PIECE_TYPE_NONE as a place holder + // for the bishop pair "extended piece", which allows us to be more flexible + // in defining bishop pair bonuses. + const int pieceCount[COLOR_NB][PIECE_TYPE_NB] = { + { pos.count(WHITE) > 1, pos.count(WHITE), pos.count(WHITE), + pos.count(WHITE) , pos.count(WHITE), pos.count(WHITE) }, + { pos.count(BLACK) > 1, pos.count(BLACK), pos.count(BLACK), + pos.count(BLACK) , pos.count(BLACK), pos.count(BLACK) } }; + + e->value = int16_t((imbalance(pieceCount) - imbalance(pieceCount)) / 16); + return e; +} + +} // namespace Material diff --git a/Engines/Windows/mcbrain/src/material.h b/Engines/Windows/mcbrain/src/material.h new file mode 100644 index 0000000..e15f2e0 --- /dev/null +++ b/Engines/Windows/mcbrain/src/material.h @@ -0,0 +1,74 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef MATERIAL_H_INCLUDED +#define MATERIAL_H_INCLUDED + +#include "endgame.h" +#include "misc.h" +#include "position.h" +#include "types.h" + +namespace Material { + +/// Material::Entry contains various information about a material configuration. +/// It contains a material imbalance evaluation, a function pointer to a special +/// endgame evaluation function (which in most cases is NULL, meaning that the +/// standard evaluation function will be used), and scale factors. +/// +/// The scale factors are used to scale the evaluation score up or down. For +/// instance, in KRB vs KR endgames, the score is scaled down by a factor of 4, +/// which will result in scores of absolute value less than one pawn. + +struct Entry { + + Score imbalance() const { return make_score(value, value); } + Phase game_phase() const { return gamePhase; } + bool specialized_eval_exists() const { return evaluationFunction != nullptr; } + Value evaluate(const Position& pos) const { return (*evaluationFunction)(pos); } + + // scale_factor takes a position and a color as input and returns a scale factor + // for the given color. We have to provide the position in addition to the color + // because the scale factor may also be a function which should be applied to + // the position. For instance, in KBP vs K endgames, the scaling function looks + // for rook pawns and wrong-colored bishops. + ScaleFactor scale_factor(const Position& pos, Color c) const { + ScaleFactor sf = scalingFunction[c] ? (*scalingFunction[c])(pos) + : SCALE_FACTOR_NONE; + return sf != SCALE_FACTOR_NONE ? sf : ScaleFactor(factor[c]); + } + + Key key; + const EndgameBase* evaluationFunction; + const EndgameBase* scalingFunction[COLOR_NB]; // Could be one for each + // side (e.g. KPKP, KBPsKs) + int16_t value; + uint8_t factor[COLOR_NB]; + Phase gamePhase; +}; + +typedef HashTable Table; + +Entry* probe(const Position& pos); + +} // namespace Material + +#endif // #ifndef MATERIAL_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/misc.cpp b/Engines/Windows/mcbrain/src/misc.cpp new file mode 100644 index 0000000..36697c2 --- /dev/null +++ b/Engines/Windows/mcbrain/src/misc.cpp @@ -0,0 +1,554 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifdef _WIN32 +#if _WIN32_WINNT < 0x0601 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0601 // Force to include needed API prototypes +#endif + +#ifndef NOMINMAX +#define NOMINMAX +#endif + +#include +// The needed Windows API for processor groups could be missed from old Windows +// versions, so instead of calling them directly (forcing the linker to resolve +// the calls at compile time), try to load them at runtime. To do this we need +// first to define the corresponding function pointers. +extern "C" { +typedef bool(WINAPI *fun1_t)(LOGICAL_PROCESSOR_RELATIONSHIP, + PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD); +typedef bool(WINAPI *fun2_t)(USHORT, PGROUP_AFFINITY); +typedef bool(WINAPI *fun3_t)(HANDLE, CONST GROUP_AFFINITY*, PGROUP_AFFINITY); + +#include "VersionHelpers.h" +} +#endif + +#include +#include +#include +#include +#include +#include +#include "misc.h" +#include "thread.h" + +using namespace std; + +namespace { + +/// Version number. If Version is left empty, then compile date in the format +/// DD-MM-YY and show in engine_info. +#ifdef Maverick +const string Version = "the Maverick"; +#else +const string Version = "9.9"; +#endif + + +/// Our fancy logging facility. The trick here is to replace cin.rdbuf() and +/// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We +/// can toggle the logging of std::cout and std:cin at runtime whilst preserving +/// usual I/O functionality, all without changing a single line of code! +/// Idea from http://groups.google.com/group/comp.lang.c++/msg/1d941c0f26ea0d81 + +struct Tie: public streambuf { // MSVC requires split streambuf for cin and cout + + Tie(streambuf* b, streambuf* l) : buf(b), logBuf(l) {} + + int sync() override { return logBuf->pubsync(), buf->pubsync(); } + int overflow(int c) override { return log(buf->sputc((char)c), "<< "); } + int underflow() override { return buf->sgetc(); } + int uflow() override { return log(buf->sbumpc(), ">> "); } + + streambuf *buf, *logBuf; + + int log(int c, const char* prefix) { + + static int last = '\n'; // Single log file + + if (last == '\n') + logBuf->sputn(prefix, 3); + + return last = logBuf->sputc((char)c); + } +}; + +class Logger { + + Logger() : in(cin.rdbuf(), file.rdbuf()), out(cout.rdbuf(), file.rdbuf()) {} + ~Logger() { start(""); } + + ofstream file; + Tie in, out; + +public: + static void start(const std::string& fname) { + + static Logger l; + + if (!fname.empty() && !l.file.is_open()) + { + l.file.open(fname, ifstream::out); + cin.rdbuf(&l.in); + cout.rdbuf(&l.out); + } + else if (fname.empty() && l.file.is_open()) + { + cout.rdbuf(l.out.buf); + cin.rdbuf(l.in.buf); + l.file.close(); + } + } +}; + +} // namespace + +/// engine_info() returns the full name of the current SugaR version. This +/// will be either "SugaR DD-MM-YY" (where DD-MM-YY is the date when +/// the program was compiled) or "SugaR ", depending on whether +/// Version is empty. + +const string engine_info(bool to_uci) { + + const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"); + string month, day, year; + stringstream ss, date(__DATE__); // From compiler, format is "Sep 21 2008" +#ifdef Maverick + ss << "McCain-v2 -> " << Version << setfill('0'); +#else + ss << "McBrain " << Version << setfill('0'); +#endif + + if (Version.empty()) + { + date >> month >> day >> year; + ss << setw(2) << day << setw(2) << (1 + months.find(month) / 4) << year.substr(2); + } +#ifdef Maverick + ss //<< (Is64Bit ? " 64" : " 32") + //<< (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : "")) + << (to_uci ? "\nid author ": "->") + << "dedicated to John S McCain, an American Hero."; +#else + ss << (Is64Bit ? " 64" : " 32") + << (HasPext ? " BMI2" : (HasPopCnt ? " POPCNT" : "")) + << (to_uci ? "\nid author ": " by ") + << "M. Byrne and scores of others..."; +#endif + + return ss.str(); +} + +const std::string system_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + InitVersion(); + + if (IsWindowsXPOrGreater()) + { + if (IsWindowsXPSP1OrGreater()) + { + if (IsWindowsXPSP2OrGreater()) + { + if (IsWindowsXPSP3OrGreater()) + { + if (IsWindowsVistaOrGreater()) + { + if (IsWindowsVistaSP1OrGreater()) + { + if (IsWindowsVistaSP2OrGreater()) + { + if (IsWindows7OrGreater()) + { + if (IsWindows7SP1OrGreater()) + { + if (IsWindows8OrGreater()) + { + if (IsWindows8Point1OrGreater()) + { + if (IsWindows10OrGreater()) + { + result << std::string("Windows 10"); + } + else + { + result << std::string("Windows 8.1"); + } + } + else + { + result << std::string("Windows 8"); + } + } + else + { + result << std::string("Windows 7 SP1"); + } + } + else + { + result << std::string("Windows 7"); + } + } + else + { + result << std::string("Vista SP2"); + } + } + else + { + result << std::string("Vista SP1"); + } + } + else + { + result << std::string("Vista"); + } + } + else + { + result << std::string("XP SP3"); + } + } + else + { + result << std::string("XP SP2"); + } + } + else + { + result << std::string("XP SP1"); + } + } + else + { + result << std::string("XP"); + } + } + + if (IsWindowsServer()) + { + result << std::string(" Server "); + } + else + { + result << std::string(" Client "); + } + + result << std::string("Or Greater") << std::endl; + + result << std::endl; + } +#endif + + return result.str(); +} + +const std::string hardware_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + SYSTEM_INFO siSysInfo; + + // Copy the hardware information to the SYSTEM_INFO structure. + + GetSystemInfo(&siSysInfo); + + HKEY hKey = HKEY_LOCAL_MACHINE; + const DWORD Const_Data_Size = 10000; + TCHAR Data[Const_Data_Size]; + + ZeroMemory(Data, Const_Data_Size * sizeof(TCHAR)); + + DWORD buffersize = Const_Data_Size; + + LONG result_registry_functions = ERROR_SUCCESS; + + result_registry_functions = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("Hardware\\Description\\System\\CentralProcessor\\0\\"), 0, KEY_READ, &hKey); + + if (result_registry_functions == ERROR_SUCCESS) + { + // Query the registry value + result_registry_functions = RegQueryValueEx(hKey, TEXT("ProcessorNameString"), NULL, NULL, (LPBYTE)&Data, &buffersize); + + if (result_registry_functions == ERROR_SUCCESS) + { + // Close the Registry Key + result_registry_functions = RegCloseKey(hKey); + + assert(result_registry_functions == ERROR_SUCCESS); + } + else + { + assert(result_registry_functions == ERROR_SUCCESS); + } + } + else + { + assert(result_registry_functions == ERROR_SUCCESS); + } + + std::string ProcessorName(Data); + + // Display the contents of the SYSTEM_INFO structure. + + result << std::endl; + + result << "Hardware information : " << std::endl; + result << " CPU Brand : " << ProcessorName << std::endl; + //result << " CPU Architecture : " << siSysInfo.wProcessorArchitecture << std::endl; + result << " CPU Core : " << siSysInfo.dwNumberOfProcessors << std::endl; + //result << " Processor type : " << siSysInfo.dwProcessorType << std::endl; + + // Used to convert bytes to MB + const size_t local_1000_000 = 1000 * 1000; + + MEMORYSTATUSEX statex; + + statex.dwLength = sizeof(statex); + + GlobalMemoryStatusEx(&statex); + + result << " Total RAM : " << statex.ullTotalPhys / local_1000_000 << "MB" << std::endl; + + result << std::endl; + } +#endif + + return result.str(); +} + +const std::string cores_info() +{ + std::stringstream result; + +#ifdef _WIN32 + { + SYSTEM_INFO siSysInfo; + + // Copy the hardware information to the SYSTEM_INFO structure. + + GetSystemInfo(&siSysInfo); + + result << std::endl; + + DWORD n = DWORD(std::thread::hardware_concurrency()); + result << "Test running " << n << " Cores\n"; + + DWORD local_mask = siSysInfo.dwActiveProcessorMask; + + for (DWORD core_counter = 0; core_counterSize > 0 && byteOffset + ptr->Size <= returnLength) + { + if (ptr->Relationship == RelationNumaNode) + nodes++; + + else if (ptr->Relationship == RelationProcessorCore) + { + cores++; + threads += (ptr->Processor.Flags == LTP_PC_SMT) ? 2 : 1; + } + + byteOffset += ptr->Size; + ptr = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)(((char*)ptr) + ptr->Size); + } + + free(buffer); + + std::vector groups; + + // Run as many threads as possible on the same node until core limit is + // reached, then move on filling the next node. + for (int n = 0; n < nodes; n++) + for (int i = 0; i < cores / nodes; i++) + groups.push_back(n); + + // In case a core has more than one logical processor (we assume 2) and we + // have still threads to allocate, then spread them evenly across available + // nodes. + for (int t = 0; t < threads - cores; t++) + groups.push_back(t % nodes); + + // If we still have more threads than the total number of logical processors + // then return -1 and let the OS to decide what to do. + return idx < groups.size() ? groups[idx] : -1; +} + + +/// bindThisThread() set the group affinity of the current thread + +void bindThisThread(size_t idx) { + + // Use only local variables to be thread-safe + int group = best_group(idx); + + if (group == -1) + return; + + // Early exit if the needed API are not available at runtime + HMODULE k32 = GetModuleHandle("Kernel32.dll"); + auto fun2 = (fun2_t)(void(*)())GetProcAddress(k32, "GetNumaNodeProcessorMaskEx"); + auto fun3 = (fun3_t)(void(*)())GetProcAddress(k32, "SetThreadGroupAffinity"); + + if (!fun2 || !fun3) + return; + + GROUP_AFFINITY affinity; + if (fun2(group, &affinity)) + fun3(GetCurrentThread(), &affinity, nullptr); +} + +#endif + +} // namespace WinProcGroup diff --git a/Engines/Windows/mcbrain/src/misc.h b/Engines/Windows/mcbrain/src/misc.h new file mode 100644 index 0000000..de6a8ec --- /dev/null +++ b/Engines/Windows/mcbrain/src/misc.h @@ -0,0 +1,119 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef MISC_H_INCLUDED +#define MISC_H_INCLUDED + +#include +#include +#include +#include +#include + +#include "types.h" + +const std::string engine_info(bool to_uci = false); +const std::string hardware_info(); +const std::string system_info(); +const std::string cores_info(); + +void prefetch(void* addr); +void prefetch2(void* addr); +void start_logger(const std::string& fname); + +void dbg_hit_on(bool b); +void dbg_hit_on(bool c, bool b); +void dbg_mean_of(int v); +void dbg_print(); + +typedef std::chrono::milliseconds::rep TimePoint; // A value in milliseconds + +static_assert(sizeof(TimePoint) == sizeof(int64_t), "TimePoint should be 64 bits"); + +inline TimePoint now() { + return std::chrono::duration_cast + (std::chrono::steady_clock::now().time_since_epoch()).count(); +} + +template +struct HashTable { + Entry* operator[](Key key) { return &table[(uint32_t)key & (Size - 1)]; } + +private: + std::vector table = std::vector(Size); +}; + + +enum SyncCout { IO_LOCK, IO_UNLOCK }; +std::ostream& operator<<(std::ostream&, SyncCout); + +#define sync_cout std::cout << IO_LOCK +#define sync_endl std::endl << IO_UNLOCK + + +/// xorshift64star Pseudo-Random Number Generator +/// This class is based on original code written and dedicated +/// to the public domain by Sebastiano Vigna (2014). +/// It has the following characteristics: +/// +/// - Outputs 64-bit numbers +/// - Passes Dieharder and SmallCrush test batteries +/// - Does not require warm-up, no zeroland to escape +/// - Internal state is a single 64-bit integer +/// - Period is 2^64 - 1 +/// - Speed: 1.60 ns/call (Core i7 @3.40GHz) +/// +/// For further analysis see +/// + +class PRNG { + + uint64_t s; + + uint64_t rand64() { + + s ^= s >> 12, s ^= s << 25, s ^= s >> 27; + return s * 2685821657736338717LL; + } + +public: + PRNG(uint64_t seed) : s(seed) { assert(seed); } + + template T rand() { return T(rand64()); } + + /// Special generator used to fast init magic numbers. + /// Output values only have 1/8th of their bits set on average. + template T sparse_rand() + { return T(rand64() & rand64() & rand64()); } +}; + + +/// Under Windows it is not possible for a process to run on more than one +/// logical processor group. This usually means to be limited to use max 64 +/// cores. To overcome this, some special platform specific API should be +/// called to set group affinity for each thread. Original code from Texel by +/// Peter Österlund. + +namespace WinProcGroup { + void bindThisThread(size_t idx); +} + +#endif // #ifndef MISC_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/movegen.cpp b/Engines/Windows/mcbrain/src/movegen.cpp new file mode 100644 index 0000000..1fa31c7 --- /dev/null +++ b/Engines/Windows/mcbrain/src/movegen.cpp @@ -0,0 +1,422 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include + +#include "movegen.h" +#include "position.h" + +namespace { + + template + ExtMove* generate_castling(const Position& pos, ExtMove* moveList, Color us) { + + constexpr bool KingSide = (Cr == WHITE_OO || Cr == BLACK_OO); + + if (pos.castling_impeded(Cr) || !pos.can_castle(Cr)) + return moveList; + + // After castling, the rook and king final positions are the same in Chess960 + // as they would be in standard chess. + Square kfrom = pos.square(us); + Square rfrom = pos.castling_rook_square(Cr); + Square kto = relative_square(us, KingSide ? SQ_G1 : SQ_C1); + Bitboard enemies = pos.pieces(~us); + + assert(!pos.checkers()); + + const Direction step = Chess960 ? kto > kfrom ? WEST : EAST + : KingSide ? WEST : EAST; + + for (Square s = kto; s != kfrom; s += step) + if (pos.attackers_to(s) & enemies) + return moveList; + + // Because we generate only legal castling moves we need to verify that + // when moving the castling rook we do not discover some hidden checker. + // For instance an enemy queen in SQ_A1 when castling rook is in SQ_B1. + if (Chess960 && (attacks_bb(kto, pos.pieces() ^ rfrom) & pos.pieces(~us, ROOK, QUEEN))) + return moveList; + + Move m = make(kfrom, rfrom); + + if (Checks && !pos.gives_check(m)) + return moveList; + + *moveList++ = m; + return moveList; + } + + + template + ExtMove* make_promotions(ExtMove* moveList, Square to, Square ksq) { + + if (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS) + *moveList++ = make(to - D, to, QUEEN); + + if (Type == QUIETS || Type == EVASIONS || Type == NON_EVASIONS) + { + *moveList++ = make(to - D, to, ROOK); + *moveList++ = make(to - D, to, BISHOP); + *moveList++ = make(to - D, to, KNIGHT); + } + + // Knight promotion is the only promotion that can give a direct check + // that's not already included in the queen promotion. + if (Type == QUIET_CHECKS && (PseudoAttacks[KNIGHT][to] & ksq)) + *moveList++ = make(to - D, to, KNIGHT); + else + (void)ksq; // Silence a warning under MSVC + + return moveList; + } + + + template + ExtMove* generate_pawn_moves(const Position& pos, ExtMove* moveList, Bitboard target) { + + // Compute our parametrized parameters at compile time, named according to + // the point of view of white side. + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Bitboard TRank8BB = (Us == WHITE ? Rank8BB : Rank1BB); + constexpr Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB); + constexpr Bitboard TRank3BB = (Us == WHITE ? Rank3BB : Rank6BB); + constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); + constexpr Direction UpRight = (Us == WHITE ? NORTH_EAST : SOUTH_WEST); + constexpr Direction UpLeft = (Us == WHITE ? NORTH_WEST : SOUTH_EAST); + + Bitboard emptySquares; + + Bitboard pawnsOn7 = pos.pieces(Us, PAWN) & TRank7BB; + Bitboard pawnsNotOn7 = pos.pieces(Us, PAWN) & ~TRank7BB; + + Bitboard enemies = (Type == EVASIONS ? pos.pieces(Them) & target: + Type == CAPTURES ? target : pos.pieces(Them)); + + // Single and double pawn pushes, no promotions + if (Type != CAPTURES) + { + emptySquares = (Type == QUIETS || Type == QUIET_CHECKS ? target : ~pos.pieces()); + + Bitboard b1 = shift(pawnsNotOn7) & emptySquares; + Bitboard b2 = shift(b1 & TRank3BB) & emptySquares; + + if (Type == EVASIONS) // Consider only blocking squares + { + b1 &= target; + b2 &= target; + } + + if (Type == QUIET_CHECKS) + { + Square ksq = pos.square(Them); + + b1 &= pos.attacks_from(ksq, Them); + b2 &= pos.attacks_from(ksq, Them); + + // Add pawn pushes which give discovered check. This is possible only + // if the pawn is not on the same file as the enemy king, because we + // don't generate captures. Note that a possible discovery check + // promotion has been already generated amongst the captures. + Bitboard dcCandidates = pos.blockers_for_king(Them); + if (pawnsNotOn7 & dcCandidates) + { + Bitboard dc1 = shift(pawnsNotOn7 & dcCandidates) & emptySquares & ~file_bb(ksq); + Bitboard dc2 = shift(dc1 & TRank3BB) & emptySquares; + + b1 |= dc1; + b2 |= dc2; + } + } + + while (b1) + { + Square to = pop_lsb(&b1); + *moveList++ = make_move(to - Up, to); + } + + while (b2) + { + Square to = pop_lsb(&b2); + *moveList++ = make_move(to - Up - Up, to); + } + } + + // Promotions and underpromotions + if (pawnsOn7 && (Type != EVASIONS || (target & TRank8BB))) + { + if (Type == CAPTURES) + emptySquares = ~pos.pieces(); + + if (Type == EVASIONS) + emptySquares &= target; + + Bitboard b1 = shift(pawnsOn7) & enemies; + Bitboard b2 = shift(pawnsOn7) & enemies; + Bitboard b3 = shift(pawnsOn7) & emptySquares; + + Square ksq = pos.square(Them); + + while (b1) + moveList = make_promotions(moveList, pop_lsb(&b1), ksq); + + while (b2) + moveList = make_promotions(moveList, pop_lsb(&b2), ksq); + + while (b3) + moveList = make_promotions(moveList, pop_lsb(&b3), ksq); + } + + // Standard and en-passant captures + if (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS) + { + Bitboard b1 = shift(pawnsNotOn7) & enemies; + Bitboard b2 = shift(pawnsNotOn7) & enemies; + + while (b1) + { + Square to = pop_lsb(&b1); + *moveList++ = make_move(to - UpRight, to); + } + + while (b2) + { + Square to = pop_lsb(&b2); + *moveList++ = make_move(to - UpLeft, to); + } + + if (pos.ep_square() != SQ_NONE) + { + assert(rank_of(pos.ep_square()) == relative_rank(Us, RANK_6)); + + // An en passant capture can be an evasion only if the checking piece + // is the double pushed pawn and so is in the target. Otherwise this + // is a discovery check and we are forced to do otherwise. + if (Type == EVASIONS && !(target & (pos.ep_square() - Up))) + return moveList; + + b1 = pawnsNotOn7 & pos.attacks_from(pos.ep_square(), Them); + + assert(b1); + + while (b1) + *moveList++ = make(pop_lsb(&b1), pos.ep_square()); + } + } + + return moveList; + } + + + template + ExtMove* generate_moves(const Position& pos, ExtMove* moveList, Color us, + Bitboard target) { + + assert(Pt != KING && Pt != PAWN); + + const Square* pl = pos.squares(us); + + for (Square from = *pl; from != SQ_NONE; from = *++pl) + { + if (Checks) + { + if ( (Pt == BISHOP || Pt == ROOK || Pt == QUEEN) + && !(PseudoAttacks[Pt][from] & target & pos.check_squares(Pt))) + continue; + + if (pos.blockers_for_king(~us) & from) + continue; + } + + Bitboard b = pos.attacks_from(from) & target; + + if (Checks) + b &= pos.check_squares(Pt); + + while (b) + *moveList++ = make_move(from, pop_lsb(&b)); + } + + return moveList; + } + + + template + ExtMove* generate_all(const Position& pos, ExtMove* moveList, Bitboard target) { + + constexpr bool Checks = Type == QUIET_CHECKS; + + moveList = generate_pawn_moves(pos, moveList, target); + moveList = generate_moves(pos, moveList, Us, target); + moveList = generate_moves(pos, moveList, Us, target); + moveList = generate_moves< ROOK, Checks>(pos, moveList, Us, target); + moveList = generate_moves< QUEEN, Checks>(pos, moveList, Us, target); + + if (Type != QUIET_CHECKS && Type != EVASIONS) + { + Square ksq = pos.square(Us); + Bitboard b = pos.attacks_from(ksq) & target; + while (b) + *moveList++ = make_move(ksq, pop_lsb(&b)); + } + + if (Type != CAPTURES && Type != EVASIONS && pos.can_castle(Us)) + { + if (pos.is_chess960()) + { + moveList = generate_castling::right, Checks, true>(pos, moveList, Us); + moveList = generate_castling::right, Checks, true>(pos, moveList, Us); + } + else + { + moveList = generate_castling::right, Checks, false>(pos, moveList, Us); + moveList = generate_castling::right, Checks, false>(pos, moveList, Us); + } + } + + return moveList; + } + +} // namespace + + +/// generate generates all pseudo-legal captures and queen +/// promotions. Returns a pointer to the end of the move list. +/// +/// generate generates all pseudo-legal non-captures and +/// underpromotions. Returns a pointer to the end of the move list. +/// +/// generate generates all pseudo-legal captures and +/// non-captures. Returns a pointer to the end of the move list. + +template +ExtMove* generate(const Position& pos, ExtMove* moveList) { + + assert(Type == CAPTURES || Type == QUIETS || Type == NON_EVASIONS); + assert(!pos.checkers()); + + Color us = pos.side_to_move(); + + Bitboard target = Type == CAPTURES ? pos.pieces(~us) + : Type == QUIETS ? ~pos.pieces() + : Type == NON_EVASIONS ? ~pos.pieces(us) : 0; + + return us == WHITE ? generate_all(pos, moveList, target) + : generate_all(pos, moveList, target); +} + +// Explicit template instantiations +template ExtMove* generate(const Position&, ExtMove*); +template ExtMove* generate(const Position&, ExtMove*); +template ExtMove* generate(const Position&, ExtMove*); + + +/// generate generates all pseudo-legal non-captures and knight +/// underpromotions that give check. Returns a pointer to the end of the move list. +template<> +ExtMove* generate(const Position& pos, ExtMove* moveList) { + + assert(!pos.checkers()); + + Color us = pos.side_to_move(); + Bitboard dc = pos.blockers_for_king(~us) & pos.pieces(us); + + while (dc) + { + Square from = pop_lsb(&dc); + PieceType pt = type_of(pos.piece_on(from)); + + if (pt == PAWN) + continue; // Will be generated together with direct checks + + Bitboard b = pos.attacks_from(pt, from) & ~pos.pieces(); + + if (pt == KING) + b &= ~PseudoAttacks[QUEEN][pos.square(~us)]; + + while (b) + *moveList++ = make_move(from, pop_lsb(&b)); + } + + return us == WHITE ? generate_all(pos, moveList, ~pos.pieces()) + : generate_all(pos, moveList, ~pos.pieces()); +} + + +/// generate generates all pseudo-legal check evasions when the side +/// to move is in check. Returns a pointer to the end of the move list. +template<> +ExtMove* generate(const Position& pos, ExtMove* moveList) { + + assert(pos.checkers()); + + Color us = pos.side_to_move(); + Square ksq = pos.square(us); + Bitboard sliderAttacks = 0; + Bitboard sliders = pos.checkers() & ~pos.pieces(KNIGHT, PAWN); + + // Find all the squares attacked by slider checkers. We will remove them from + // the king evasions in order to skip known illegal moves, which avoids any + // useless legality checks later on. + while (sliders) + { + Square checksq = pop_lsb(&sliders); + sliderAttacks |= LineBB[checksq][ksq] ^ checksq; + } + + // Generate evasions for king, capture and non capture moves + Bitboard b = pos.attacks_from(ksq) & ~pos.pieces(us) & ~sliderAttacks; + while (b) + *moveList++ = make_move(ksq, pop_lsb(&b)); + + if (more_than_one(pos.checkers())) + return moveList; // Double check, only a king move can save the day + + // Generate blocking evasions or captures of the checking piece + Square checksq = lsb(pos.checkers()); + Bitboard target = between_bb(checksq, ksq) | checksq; + + return us == WHITE ? generate_all(pos, moveList, target) + : generate_all(pos, moveList, target); +} + + +/// generate generates all the legal moves in the given position + +template<> +ExtMove* generate(const Position& pos, ExtMove* moveList) { + + Color us = pos.side_to_move(); + Bitboard pinned = pos.blockers_for_king(us) & pos.pieces(us); + Square ksq = pos.square(us); + ExtMove* cur = moveList; + + moveList = pos.checkers() ? generate(pos, moveList) + : generate(pos, moveList); + while (cur != moveList) + if ( (pinned || from_sq(*cur) == ksq || type_of(*cur) == ENPASSANT) + && !pos.legal(*cur)) + *cur = (--moveList)->move; + else + ++cur; + + return moveList; +} diff --git a/Engines/Windows/mcbrain/src/movegen.h b/Engines/Windows/mcbrain/src/movegen.h new file mode 100644 index 0000000..aaff773 --- /dev/null +++ b/Engines/Windows/mcbrain/src/movegen.h @@ -0,0 +1,76 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef MOVEGEN_H_INCLUDED +#define MOVEGEN_H_INCLUDED + +#include + +#include "types.h" + +class Position; + +enum GenType { + CAPTURES, + QUIETS, + QUIET_CHECKS, + EVASIONS, + NON_EVASIONS, + LEGAL +}; + +struct ExtMove { + Move move; + int value; + + operator Move() const { return move; } + void operator=(Move m) { move = m; } + + // Inhibit unwanted implicit conversions to Move + // with an ambiguity that yields to a compile error. + operator float() const = delete; +}; + +inline bool operator<(const ExtMove& f, const ExtMove& s) { + return f.value < s.value; +} + +template +ExtMove* generate(const Position& pos, ExtMove* moveList); + +/// The MoveList struct is a simple wrapper around generate(). It sometimes comes +/// in handy to use this class instead of the low level generate() function. +template +struct MoveList { + + explicit MoveList(const Position& pos) : last(generate(pos, moveList)) {} + const ExtMove* begin() const { return moveList; } + const ExtMove* end() const { return last; } + size_t size() const { return last - moveList; } + bool contains(Move move) const { + return std::find(begin(), end(), move) != end(); + } + +private: + ExtMove moveList[MAX_MOVES], *last; +}; + +#endif // #ifndef MOVEGEN_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/movepick.cpp b/Engines/Windows/mcbrain/src/movepick.cpp new file mode 100644 index 0000000..886ea15 --- /dev/null +++ b/Engines/Windows/mcbrain/src/movepick.cpp @@ -0,0 +1,270 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include + +#include "movepick.h" + +namespace { + + enum Stages { + MAIN_TT, CAPTURE_INIT, GOOD_CAPTURE, REFUTATION, QUIET_INIT, QUIET, BAD_CAPTURE, + EVASION_TT, EVASION_INIT, EVASION, + PROBCUT_TT, PROBCUT_INIT, PROBCUT, + QSEARCH_TT, QCAPTURE_INIT, QCAPTURE, QCHECK_INIT, QCHECK + }; + + // Helper filter used with select() + const auto Any = [](){ return true; }; + + // partial_insertion_sort() sorts moves in descending order up to and including + // a given limit. The order of moves smaller than the limit is left unspecified. + void partial_insertion_sort(ExtMove* begin, ExtMove* end, int limit) { + + for (ExtMove *sortedEnd = begin, *p = begin + 1; p < end; ++p) + if (p->value >= limit) + { + ExtMove tmp = *p, *q; + *p = *++sortedEnd; + for (q = sortedEnd; q != begin && *(q - 1) < tmp; --q) + *q = *(q - 1); + *q = tmp; + } + } + +} // namespace + + +/// Constructors of the MovePicker class. As arguments we pass information +/// to help it to return the (presumably) good moves first, to decide which +/// moves to return (in the quiescence search, for instance, we only want to +/// search captures, promotions, and some checks) and how important good move +/// ordering is at the current node. + +/// MovePicker constructor for the main search +MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh, + const CapturePieceToHistory* cph, const PieceToHistory** ch, Move cm, Move* killers) + : pos(p), mainHistory(mh), captureHistory(cph), continuationHistory(ch), + refutations{{killers[0], 0}, {killers[1], 0}, {cm, 0}}, depth(d) { + + assert(d > DEPTH_ZERO); + + stage = pos.checkers() ? EVASION_TT : MAIN_TT; + ttMove = ttm && pos.pseudo_legal(ttm) ? ttm : MOVE_NONE; + stage += (ttMove == MOVE_NONE); +} + +/// MovePicker constructor for quiescence search +MovePicker::MovePicker(const Position& p, Move ttm, Depth d, const ButterflyHistory* mh, + const CapturePieceToHistory* cph, const PieceToHistory** ch, Square rs) + : pos(p), mainHistory(mh), captureHistory(cph), continuationHistory(ch), recaptureSquare(rs), depth(d) { + + assert(d <= DEPTH_ZERO); + + stage = pos.checkers() ? EVASION_TT : QSEARCH_TT; + ttMove = ttm + && pos.pseudo_legal(ttm) + && (depth > DEPTH_QS_RECAPTURES || to_sq(ttm) == recaptureSquare) ? ttm : MOVE_NONE; + stage += (ttMove == MOVE_NONE); +} + +/// MovePicker constructor for ProbCut: we generate captures with SEE greater +/// than or equal to the given threshold. +MovePicker::MovePicker(const Position& p, Move ttm, Value th, const CapturePieceToHistory* cph) + : pos(p), captureHistory(cph), threshold(th) { + + assert(!pos.checkers()); + + stage = PROBCUT_TT; + ttMove = ttm + && pos.pseudo_legal(ttm) + && pos.capture(ttm) + && pos.see_ge(ttm, threshold) ? ttm : MOVE_NONE; + stage += (ttMove == MOVE_NONE); +} + +/// MovePicker::score() assigns a numerical value to each move in a list, used +/// for sorting. Captures are ordered by Most Valuable Victim (MVV), preferring +/// captures with a good history. Quiets moves are ordered using the histories. +template +void MovePicker::score() { + + static_assert(Type == CAPTURES || Type == QUIETS || Type == EVASIONS, "Wrong type"); + + for (auto& m : *this) + if (Type == CAPTURES) + m.value = PieceValue[MG][pos.piece_on(to_sq(m))] + + (*captureHistory)[pos.moved_piece(m)][to_sq(m)][type_of(pos.piece_on(to_sq(m)))] / 8; + + else if (Type == QUIETS) + m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] + + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)] + + (*continuationHistory[1])[pos.moved_piece(m)][to_sq(m)] + + (*continuationHistory[3])[pos.moved_piece(m)][to_sq(m)]; + + else // Type == EVASIONS + { + if (pos.capture(m)) + m.value = PieceValue[MG][pos.piece_on(to_sq(m))] + - Value(type_of(pos.moved_piece(m))); + else + m.value = (*mainHistory)[pos.side_to_move()][from_to(m)] + + (*continuationHistory[0])[pos.moved_piece(m)][to_sq(m)] + - (1 << 28); + } +} + +/// MovePicker::select() returns the next move satisfying a predicate function. +/// It never returns the TT move. +template +Move MovePicker::select(Pred filter) { + + while (cur < endMoves) + { + if (T == Best) + std::swap(*cur, *std::max_element(cur, endMoves)); + + move = *cur++; + + if (move != ttMove && filter()) + return move; + } + return move = MOVE_NONE; +} + +/// MovePicker::next_move() is the most important method of the MovePicker class. It +/// returns a new pseudo legal move every time it is called until there are no more +/// moves left, picking the move with the highest score from a list of generated moves. +Move MovePicker::next_move(bool skipQuiets) { + +top: + switch (stage) { + + case MAIN_TT: + case EVASION_TT: + case QSEARCH_TT: + case PROBCUT_TT: + ++stage; + return ttMove; + + case CAPTURE_INIT: + case PROBCUT_INIT: + case QCAPTURE_INIT: + cur = endBadCaptures = moves; + endMoves = generate(pos, cur); + + score(); + ++stage; + goto top; + + case GOOD_CAPTURE: + if (select([&](){ + return pos.see_ge(move, Value(-55 * (cur-1)->value / 1024)) ? + // Move losing capture to endBadCaptures to be tried later + true : (*endBadCaptures++ = move, false); })) + return move; + + // Prepare the pointers to loop over the refutations array + cur = std::begin(refutations); + endMoves = std::end(refutations); + + // If the countermove is the same as a killer, skip it + if ( refutations[0].move == refutations[2].move + || refutations[1].move == refutations[2].move) + --endMoves; + + ++stage; + /* fallthrough */ + + case REFUTATION: + if (select([&](){ return move != MOVE_NONE + && !pos.capture(move) + && pos.pseudo_legal(move); })) + return move; + ++stage; + /* fallthrough */ + + case QUIET_INIT: + cur = endBadCaptures; + endMoves = generate(pos, cur); + + score(); + partial_insertion_sort(cur, endMoves, -4000 * depth / ONE_PLY); + ++stage; + /* fallthrough */ + + case QUIET: + if ( !skipQuiets + && select([&](){return move != refutations[0] + && move != refutations[1] + && move != refutations[2];})) + return move; + + // Prepare the pointers to loop over the bad captures + cur = moves; + endMoves = endBadCaptures; + + ++stage; + /* fallthrough */ + + case BAD_CAPTURE: + return select(Any); + + case EVASION_INIT: + cur = moves; + endMoves = generate(pos, cur); + + score(); + ++stage; + /* fallthrough */ + + case EVASION: + return select(Any); + + case PROBCUT: + return select([&](){ return pos.see_ge(move, threshold); }); + + case QCAPTURE: + if (select([&](){ return depth > DEPTH_QS_RECAPTURES + || to_sq(move) == recaptureSquare; })) + return move; + + // If we did not find any move and we do not try checks, we have finished + if (depth != DEPTH_QS_CHECKS) + return MOVE_NONE; + + ++stage; + /* fallthrough */ + + case QCHECK_INIT: + cur = moves; + endMoves = generate(pos, cur); + + ++stage; + /* fallthrough */ + + case QCHECK: + return select(Any); + } + + assert(false); + return MOVE_NONE; // Silence warning +} diff --git a/Engines/Windows/mcbrain/src/movepick.h b/Engines/Windows/mcbrain/src/movepick.h new file mode 100644 index 0000000..377874a --- /dev/null +++ b/Engines/Windows/mcbrain/src/movepick.h @@ -0,0 +1,153 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef MOVEPICK_H_INCLUDED +#define MOVEPICK_H_INCLUDED + +#include +#include +#include + +#include "movegen.h" +#include "position.h" +#include "types.h" + +/// StatsEntry stores the stat table value. It is usually a number but could +/// be a move or even a nested history. We use a class instead of naked value +/// to directly call history update operator<<() on the entry so to use stats +/// tables at caller sites as simple multi-dim arrays. +template +class StatsEntry { + + T entry; + +public: + void operator=(const T& v) { entry = v; } + T* operator&() { return &entry; } + T* operator->() { return &entry; } + operator const T&() const { return entry; } + + void operator<<(int bonus) { + assert(abs(bonus) <= D); // Ensure range is [-D, D] + static_assert(D <= std::numeric_limits::max(), "D overflows T"); + + entry += bonus - entry * abs(bonus) / D; + + assert(abs(entry) <= D); + } +}; + +/// Stats is a generic N-dimensional array used to store various statistics. +/// The first template parameter T is the base type of the array, the second +/// template parameter D limits the range of updates in [-D, D] when we update +/// values with the << operator, while the last parameters (Size and Sizes) +/// encode the dimensions of the array. +template +struct Stats : public std::array, Size> +{ + typedef Stats stats; + + void fill(const T& v) { + + // For standard-layout 'this' points to first struct member + assert(std::is_standard_layout::value); + + typedef StatsEntry entry; + entry* p = reinterpret_cast(this); + std::fill(p, p + sizeof(*this) / sizeof(entry), v); + } +}; + +template +struct Stats : public std::array, Size> {}; + +/// In stats table, D=0 means that the template parameter is not used +enum StatsParams { NOT_USED = 0 }; + + +/// ButterflyHistory records how often quiet moves have been successful or +/// unsuccessful during the current search, and is used for reduction and move +/// ordering decisions. It uses 2 tables (one for each color) indexed by +/// the move's from and to squares, see chessprogramming.wikispaces.com/Butterfly+Boards +typedef Stats ButterflyHistory; + +/// CounterMoveHistory stores counter moves indexed by [piece][to] of the previous +/// move, see chessprogramming.wikispaces.com/Countermove+Heuristic +typedef Stats CounterMoveHistory; + +/// CapturePieceToHistory is addressed by a move's [piece][to][captured piece type] +typedef Stats CapturePieceToHistory; + +/// PieceToHistory is like ButterflyHistory but is addressed by a move's [piece][to] +typedef Stats PieceToHistory; + +/// ContinuationHistory is the combined history of a given pair of moves, usually +/// the current one given a previous one. The nested history table is based on +/// PieceToHistory instead of ButterflyBoards. +typedef Stats ContinuationHistory; + + +/// MovePicker class is used to pick one pseudo legal move at a time from the +/// current position. The most important method is next_move(), which returns a +/// new pseudo legal move each time it is called, until there are no moves left, +/// when MOVE_NONE is returned. In order to improve the efficiency of the alpha +/// beta algorithm, MovePicker attempts to return the moves which are most likely +/// to get a cut-off first. +class MovePicker { + + enum PickType { Next, Best }; + +public: + MovePicker(const MovePicker&) = delete; + MovePicker& operator=(const MovePicker&) = delete; + MovePicker(const Position&, Move, Value, const CapturePieceToHistory*); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Square); + MovePicker(const Position&, Move, Depth, const ButterflyHistory*, + const CapturePieceToHistory*, + const PieceToHistory**, + Move, + Move*); + Move next_move(bool skipQuiets = false); + +private: + template Move select(Pred); + template void score(); + ExtMove* begin() { return cur; } + ExtMove* end() { return endMoves; } + + const Position& pos; + const ButterflyHistory* mainHistory; + const CapturePieceToHistory* captureHistory; + const PieceToHistory** continuationHistory; + Move ttMove; + ExtMove refutations[3], *cur, *endMoves, *endBadCaptures; + int stage; + Move move; + Square recaptureSquare; + Value threshold; + Depth depth; + ExtMove moves[MAX_MOVES]; +}; + +#endif // #ifndef MOVEPICK_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/pawns.cpp b/Engines/Windows/mcbrain/src/pawns.cpp new file mode 100644 index 0000000..bce5d3a --- /dev/null +++ b/Engines/Windows/mcbrain/src/pawns.cpp @@ -0,0 +1,441 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include + +#include "bitboard.h" +#include "pawns.h" +#include "position.h" +#include "thread.h" + +//#define PAWN_SCORES //not inclued in McCain + +namespace { + + #define V Value + #define S(mg, eg) make_score(mg, eg) + + // Pawn penalties + constexpr Score Isolated = S( 5, 15); + constexpr Score Backward = S( 9, 24); + constexpr Score Doubled = S(11, 56); + + +#ifdef PAWN_SCORES + // Pawn Scores Isolated in Rank 3 + constexpr Score PawnScoresIsolatedRank3 = S(- 5, + 0); + + // Pawn Scores Connected Passed + constexpr Score PawnScoresConnectedPassed = S(-16, +16); + constexpr Score KingSafetyCompensationPawnScoresConnectedPassed = S(- 5, + 0); + // Protected Passed Pawn + constexpr Score ProtectedPassedPawn = S(+ 5, + 5); + constexpr Score RemotePassedPawn = S(+ 4, + 4); + +#endif + + // Connected pawn bonus by opposed, phalanx, #support and rank + Score Connected[2][2][3][RANK_NB]; + + // Strength of pawn shelter for our king by [distance from edge][rank]. + // RANK_1 = 0 is used for files where we have no pawn, or pawn is behind our king. + constexpr Value ShelterStrength[int(FILE_NB) / 2][RANK_NB] = { + { V( -6), V( 81), V( 93), V( 58), V( 39), V( 18), V( 25) }, + { V(-43), V( 61), V( 35), V(-49), V(-29), V(-11), V( -63) }, + { V(-10), V( 75), V( 23), V( -2), V( 32), V( 3), V( -45) }, + { V(-39), V(-13), V(-29), V(-52), V(-48), V(-67), V(-166) } + }; + + // Danger of enemy pawns moving toward our king by [distance from edge][rank]. + // RANK_1 = 0 is used for files where the enemy has no pawn, or their pawn + // is behind our king. + constexpr Value UnblockedStorm[int(FILE_NB) / 2][RANK_NB] = { + { V( 89), V(107), V(123), V(93), V(57), V( 45), V( 51) }, + { V( 44), V(-18), V(123), V(46), V(39), V( -7), V( 23) }, + { V( 4), V( 52), V(162), V(37), V( 7), V(-14), V( -2) }, + { V(-10), V(-14), V( 90), V(15), V( 2), V( -7), V(-16) } + }; + + // Danger of blocked enemy pawns storming our king, by rank + constexpr Value BlockedStorm[RANK_NB] = + { V(0), V(0), V(66), V(6), V(5), V(1), V(15) }; + + #undef S + #undef V + + template + Score evaluate(const Position& pos, Pawns::Entry* e) { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Direction Up = (Us == WHITE ? NORTH : SOUTH); + + Bitboard b, neighbours, stoppers, doubled, supported, phalanx; + Bitboard lever, leverPush; + Square s; + bool opposed, backward; + Score score = SCORE_ZERO; + const Square* pl = pos.squares(Us); + + Bitboard ourPawns = pos.pieces( Us, PAWN); + Bitboard theirPawns = pos.pieces(Them, PAWN); + + e->passedPawns[Us] = e->pawnAttacksSpan[Us] = e->weakUnopposed[Us] = 0; + e->semiopenFiles[Us] = 0xFF; + e->kingSquares[Us] = SQ_NONE; + e->pawnAttacks[Us] = pawn_attacks_bb(ourPawns); + e->pawnsOnSquares[Us][BLACK] = popcount(ourPawns & DarkSquares); + e->pawnsOnSquares[Us][WHITE] = pos.count(Us) - e->pawnsOnSquares[Us][BLACK]; + + // Loop through all pawns of the current color and score each pawn + while ((s = *pl++) != SQ_NONE) + { + assert(pos.piece_on(s) == make_piece(Us, PAWN)); + + File f = file_of(s); + + e->semiopenFiles[Us] &= ~(1 << f); + e->pawnAttacksSpan[Us] |= pawn_attack_span(Us, s); + + // Flag the pawn + opposed = theirPawns & forward_file_bb(Us, s); + stoppers = theirPawns & passed_pawn_mask(Us, s); + lever = theirPawns & PawnAttacks[Us][s]; + leverPush = theirPawns & PawnAttacks[Us][s + Up]; + doubled = ourPawns & (s - Up); + neighbours = ourPawns & adjacent_files_bb(f); + phalanx = neighbours & rank_bb(s); + supported = neighbours & rank_bb(s - Up); + + // A pawn is backward when it is behind all pawns of the same color + // on the adjacent files and cannot be safely advanced. + backward = !(ourPawns & pawn_attack_span(Them, s + Up)) + && (stoppers & (leverPush | (s + Up))); + + // Passed pawns will be properly scored in evaluation because we need + // full attack info to evaluate them. Include also not passed pawns + // which could become passed after one or two pawn pushes when are + // not attacked more times than defended. + if ( !(stoppers ^ lever ^ leverPush) + && popcount(supported) >= popcount(lever) - 1 + && popcount(phalanx) >= popcount(leverPush)) + e->passedPawns[Us] |= s; + + else if ( stoppers == SquareBB[s + Up] + && relative_rank(Us, s) >= RANK_5) + { + b = shift(supported) & ~theirPawns; + while (b) + if (!more_than_one(theirPawns & PawnAttacks[Us][pop_lsb(&b)])) + e->passedPawns[Us] |= s; + } + + // Score this pawn + if (supported | phalanx) + score += Connected[opposed][bool(phalanx)][popcount(supported)][relative_rank(Us, s)]; + + else if (!neighbours) + { + score -= Isolated, e->weakUnopposed[Us] += !opposed; + +#ifdef PAWN_SCORES + if (relative_rank(Us, s) == RANK_3) + { + score += PawnScoresIsolatedRank3; + } +#endif + } + + else if (backward) + score -= Backward, e->weakUnopposed[Us] += !opposed; + + + if (doubled && !supported) + score -= Doubled; + +#ifdef PAWN_SCORES + bool protected_passed_pawn = false; + + bool passed1 = bool(passed_pawn_mask(Us, s) & ourPawns); + + //File fp1 = file_of(s); + Rank rp1 = rank_of(s); + + File fp0 = f; + File fp2 = f; + + if (fp0 > FILE_A) + { + fp0 = File(fp0 - 1); + } + + if (f < FILE_H) + { + fp2 = File(fp2 + 1); + } + + Rank rpp = rp1; + + if (Us == WHITE) + { + if (rpp > RANK_2) + { + rpp = Rank(rpp - 1); + } + } + else + { + if (rpp < RANK_7) + { + rpp = Rank(rpp + 1); + } + } + + if (rpp != rp1) + { + if (fp0 != f) + { + protected_passed_pawn = make_piece(Us, PAWN) == pos.piece_on(make_square(fp0, rpp)); + } + + if (fp2 != f) + { + protected_passed_pawn = protected_passed_pawn || (make_piece(Us, PAWN) == pos.piece_on(make_square(fp2, rpp))); + } + + if (passed1 && protected_passed_pawn) + { + score += ProtectedPassedPawn; + } + } + + if (passed1) + { + bool passed_in_flang = (f < FILE_C) || (f > FILE_F); + + if (passed_in_flang) + { + score += RemotePassedPawn; + } + } +#endif + } + +#ifdef PAWN_SCORES + const Square* pl_1 = pos.squares(Us); + + // Loop through all pawns of the current color and score each pawn + while ((s = *pl_1++) != SQ_NONE) + { + assert(pos.piece_on(s) == make_piece(Us, PAWN)); + + File f = file_of(s); + + File f0 = f; + File f2 = f; + + if (f0 > FILE_A) + { + f0 = File(f0 - 1); + } + + if (f < FILE_H) + { + f2 = File(f2 + 1); + } + + bool passed1 = bool(passed_pawn_mask(Us, s) & ourPawns); + + if (f0 != f) + { + bool passed0 = false; + + if (passed1) + { + for (Rank r0 = RANK_2; r0 <= RANK_7; r0 = Rank(r0 + 1)) + { + Square s0 = make_square(f0, r0); + + if (pos.piece_on(s0) == make_piece(Us, PAWN)) + { + passed0 = e->passedPawns[Us] & s0; + + if (passed0) + { + break; + } + } + } + + if (passed0 && passed1) + { + score += PawnScoresConnectedPassed; + + Square UsKingSquare = SQ_A1; + + Piece UsKing = make_piece(Us, KING); + + while (pos.piece_on(UsKingSquare) != UsKing) + { + UsKingSquare = Square(UsKingSquare + 1); + + assert(UsKingSquare != SQUARE_NB); + } + + File UsKingFile = file_of(UsKingSquare); + //Rank UsKingRank = rank_of(UsKingSquare); + + bool connected_passed_defend_king = (UsKingFile >= f0 && UsKingFile <= f2); + + if (connected_passed_defend_king) + { + score += KingSafetyCompensationPawnScoresConnectedPassed; + } + } + } + } + } +#endif + + return score; + } +} // namespace + +namespace Pawns { + +/// Pawns::init() initializes some tables needed by evaluation. Instead of using +/// hard-coded tables, when makes sense, we prefer to calculate them with a formula +/// to reduce independent parameters and to allow easier tuning and better insight. + +void init() { + + static constexpr int Seed[RANK_NB] = { 0, 13, 24, 18, 65, 100, 175, 330 }; + + for (int opposed = 0; opposed <= 1; ++opposed) + for (int phalanx = 0; phalanx <= 1; ++phalanx) + for (int support = 0; support <= 2; ++support) + for (Rank r = RANK_2; r < RANK_8; ++r) + { + int v = 17 * support; + v += (Seed[r] + (phalanx ? (Seed[r + 1] - Seed[r]) / 2 : 0)) >> opposed; + + Connected[opposed][phalanx][support][r] = make_score(v, v * (r - 2) / 4); + } +} + + +/// Pawns::probe() looks up the current position's pawns configuration in +/// the pawns hash table. It returns a pointer to the Entry if the position +/// is found. Otherwise a new Entry is computed and stored there, so we don't +/// have to recompute all when the same pawns configuration occurs again. + +Entry* probe(const Position& pos) { + + Key key = pos.pawn_key(); + Entry* e = pos.this_thread()->pawnsTable[key]; + + if (e->key == key) + return e; + + e->key = key; + e->scores[WHITE] = evaluate(pos, e); + e->scores[BLACK] = evaluate(pos, e); + e->openFiles = popcount(e->semiopenFiles[WHITE] & e->semiopenFiles[BLACK]); + e->asymmetry = popcount( (e->passedPawns[WHITE] | e->passedPawns[BLACK]) + | (e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK])); + + return e; +} + + +/// Entry::evaluate_shelter() calculates the shelter bonus and the storm +/// penalty for a king, looking at the king file and the two closest files. + +template +Value Entry::evaluate_shelter(const Position& pos, Square ksq) { + + constexpr Color Them = (Us == WHITE ? BLACK : WHITE); + constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH); + constexpr Bitboard BlockRanks = (Us == WHITE ? Rank1BB | Rank2BB : Rank8BB | Rank7BB); + + Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq); + Bitboard ourPawns = b & pos.pieces(Us); + Bitboard theirPawns = b & pos.pieces(Them); +#ifdef Maverick + Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ? + Value(448) : Value(6); +#else + Value safety = (shift(theirPawns) & (FileABB | FileHBB) & BlockRanks & ksq) ? + Value(374) : Value(5); +#endif + + File center = std::max(FILE_B, std::min(FILE_G, file_of(ksq))); + for (File f = File(center - 1); f <= File(center + 1); ++f) + { + if (more_than_one(theirPawns & FileBB[f])) safety -= Value( 18); + + b = ourPawns & file_bb(f); + int ourRank = b ? relative_rank(Us, backmost_sq(Us, b)) : 0; + + b = theirPawns & file_bb(f); + int theirRank = b ? relative_rank(Us, frontmost_sq(Them, b)) : 0; + + int d = std::min(f, ~f); + safety += ShelterStrength[d][ourRank]; + safety -= (ourRank && (ourRank == theirRank - 1)) ? BlockedStorm[theirRank] + : UnblockedStorm[d][theirRank]; + } + + return safety; +} + + +/// Entry::do_king_safety() calculates a bonus for king safety. It is called only +/// when king square changes, which is about 20% of total king_safety() calls. + +template +Score Entry::do_king_safety(const Position& pos, Square ksq) { + + kingSquares[Us] = ksq; + castlingRights[Us] = pos.can_castle(Us); + int minKingPawnDistance = 0; + + Bitboard pawns = pos.pieces(Us, PAWN); + if (pawns) + while (!(DistanceRingBB[ksq][++minKingPawnDistance] & pawns)) {} + + Value bonus = evaluate_shelter(pos, ksq); + + // If we can castle use the bonus after the castling if it is bigger + if (pos.can_castle(MakeCastling::right)) + bonus = std::max(bonus, evaluate_shelter(pos, relative_square(Us, SQ_G1))); + + if (pos.can_castle(MakeCastling::right)) + bonus = std::max(bonus, evaluate_shelter(pos, relative_square(Us, SQ_C1))); + + return make_score(bonus, -16 * minKingPawnDistance); +} + +// Explicit template instantiation +template Score Entry::do_king_safety(const Position& pos, Square ksq); +template Score Entry::do_king_safety(const Position& pos, Square ksq); + +} // namespace Pawns diff --git a/Engines/Windows/mcbrain/src/pawns.h b/Engines/Windows/mcbrain/src/pawns.h new file mode 100644 index 0000000..3825d08 --- /dev/null +++ b/Engines/Windows/mcbrain/src/pawns.h @@ -0,0 +1,87 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef PAWNS_H_INCLUDED +#define PAWNS_H_INCLUDED + +#include "misc.h" +#include "position.h" +#include "types.h" + +namespace Pawns { + +/// Pawns::Entry contains various information about a pawn structure. A lookup +/// to the pawn hash table (performed by calling the probe function) returns a +/// pointer to an Entry object. + +struct Entry { + + Score pawn_score(Color c) const { return scores[c]; } + Bitboard pawn_attacks(Color c) const { return pawnAttacks[c]; } + Bitboard passed_pawns(Color c) const { return passedPawns[c]; } + Bitboard pawn_attacks_span(Color c) const { return pawnAttacksSpan[c]; } + int weak_unopposed(Color c) const { return weakUnopposed[c]; } + int pawn_asymmetry() const { return asymmetry; } + int open_files() const { return openFiles; } + + int semiopen_file(Color c, File f) const { + return semiopenFiles[c] & (1 << f); + } + + int pawns_on_same_color_squares(Color c, Square s) const { + return pawnsOnSquares[c][bool(DarkSquares & s)]; + } + + template + Score king_safety(const Position& pos, Square ksq) { + return kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us) + ? kingSafety[Us] : (kingSafety[Us] = do_king_safety(pos, ksq)); + } + + template + Score do_king_safety(const Position& pos, Square ksq); + + template + Value evaluate_shelter(const Position& pos, Square ksq); + + Key key; + Score scores[COLOR_NB]; + Bitboard passedPawns[COLOR_NB]; + Bitboard pawnAttacks[COLOR_NB]; + Bitboard pawnAttacksSpan[COLOR_NB]; + Square kingSquares[COLOR_NB]; + Score kingSafety[COLOR_NB]; + int weakUnopposed[COLOR_NB]; + int castlingRights[COLOR_NB]; + int semiopenFiles[COLOR_NB]; + int pawnsOnSquares[COLOR_NB][COLOR_NB]; // [color][light/dark squares] + int asymmetry; + int openFiles; +}; + +typedef HashTable Table; + +void init(); +Entry* probe(const Position& pos); + +} // namespace Pawns + +#endif // #ifndef PAWNS_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/polybook.cpp b/Engines/Windows/mcbrain/src/polybook.cpp new file mode 100644 index 0000000..6d27fb5 --- /dev/null +++ b/Engines/Windows/mcbrain/src/polybook.cpp @@ -0,0 +1,745 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +// polybook.cpp was written by Thomas Ziproth +/* +BrainFish, a UCI chess playing engine derived from Stockfish +Copyright (C) 2016-2018 Thomas Zipproth + +BrainFish is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +BrainFish is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "polybook.h" +#include "uci.h" +#include "movegen.h" +#include "thread.h" +#include +#include "misc.h" +#include + +PolyBook polybook; // global PolyBook + +using namespace std; + +// Random numbers from PolyGlot, used to compute book hash keys +const union { + uint64_t PolyGlotRandoms[781]; + struct { + uint64_t psq[12][64]; // [piece][square] + uint64_t castle[4]; // [castle right] + uint64_t enpassant[8]; // [file] + uint64_t turn; + } Zobrist; +} PG = { { + 0x9D39247E33776D41ULL, 0x2AF7398005AAA5C7ULL, 0x44DB015024623547ULL, + 0x9C15F73E62A76AE2ULL, 0x75834465489C0C89ULL, 0x3290AC3A203001BFULL, + 0x0FBBAD1F61042279ULL, 0xE83A908FF2FB60CAULL, 0x0D7E765D58755C10ULL, + 0x1A083822CEAFE02DULL, 0x9605D5F0E25EC3B0ULL, 0xD021FF5CD13A2ED5ULL, + 0x40BDF15D4A672E32ULL, 0x011355146FD56395ULL, 0x5DB4832046F3D9E5ULL, + 0x239F8B2D7FF719CCULL, 0x05D1A1AE85B49AA1ULL, 0x679F848F6E8FC971ULL, + 0x7449BBFF801FED0BULL, 0x7D11CDB1C3B7ADF0ULL, 0x82C7709E781EB7CCULL, + 0xF3218F1C9510786CULL, 0x331478F3AF51BBE6ULL, 0x4BB38DE5E7219443ULL, + 0xAA649C6EBCFD50FCULL, 0x8DBD98A352AFD40BULL, 0x87D2074B81D79217ULL, + 0x19F3C751D3E92AE1ULL, 0xB4AB30F062B19ABFULL, 0x7B0500AC42047AC4ULL, + 0xC9452CA81A09D85DULL, 0x24AA6C514DA27500ULL, 0x4C9F34427501B447ULL, + 0x14A68FD73C910841ULL, 0xA71B9B83461CBD93ULL, 0x03488B95B0F1850FULL, + 0x637B2B34FF93C040ULL, 0x09D1BC9A3DD90A94ULL, 0x3575668334A1DD3BULL, + 0x735E2B97A4C45A23ULL, 0x18727070F1BD400BULL, 0x1FCBACD259BF02E7ULL, + 0xD310A7C2CE9B6555ULL, 0xBF983FE0FE5D8244ULL, 0x9F74D14F7454A824ULL, + 0x51EBDC4AB9BA3035ULL, 0x5C82C505DB9AB0FAULL, 0xFCF7FE8A3430B241ULL, + 0x3253A729B9BA3DDEULL, 0x8C74C368081B3075ULL, 0xB9BC6C87167C33E7ULL, + 0x7EF48F2B83024E20ULL, 0x11D505D4C351BD7FULL, 0x6568FCA92C76A243ULL, + 0x4DE0B0F40F32A7B8ULL, 0x96D693460CC37E5DULL, 0x42E240CB63689F2FULL, + 0x6D2BDCDAE2919661ULL, 0x42880B0236E4D951ULL, 0x5F0F4A5898171BB6ULL, + 0x39F890F579F92F88ULL, 0x93C5B5F47356388BULL, 0x63DC359D8D231B78ULL, + 0xEC16CA8AEA98AD76ULL, 0x5355F900C2A82DC7ULL, 0x07FB9F855A997142ULL, + 0x5093417AA8A7ED5EULL, 0x7BCBC38DA25A7F3CULL, 0x19FC8A768CF4B6D4ULL, + 0x637A7780DECFC0D9ULL, 0x8249A47AEE0E41F7ULL, 0x79AD695501E7D1E8ULL, + 0x14ACBAF4777D5776ULL, 0xF145B6BECCDEA195ULL, 0xDABF2AC8201752FCULL, + 0x24C3C94DF9C8D3F6ULL, 0xBB6E2924F03912EAULL, 0x0CE26C0B95C980D9ULL, + 0xA49CD132BFBF7CC4ULL, 0xE99D662AF4243939ULL, 0x27E6AD7891165C3FULL, + 0x8535F040B9744FF1ULL, 0x54B3F4FA5F40D873ULL, 0x72B12C32127FED2BULL, + 0xEE954D3C7B411F47ULL, 0x9A85AC909A24EAA1ULL, 0x70AC4CD9F04F21F5ULL, + 0xF9B89D3E99A075C2ULL, 0x87B3E2B2B5C907B1ULL, 0xA366E5B8C54F48B8ULL, + 0xAE4A9346CC3F7CF2ULL, 0x1920C04D47267BBDULL, 0x87BF02C6B49E2AE9ULL, + 0x092237AC237F3859ULL, 0xFF07F64EF8ED14D0ULL, 0x8DE8DCA9F03CC54EULL, + 0x9C1633264DB49C89ULL, 0xB3F22C3D0B0B38EDULL, 0x390E5FB44D01144BULL, + 0x5BFEA5B4712768E9ULL, 0x1E1032911FA78984ULL, 0x9A74ACB964E78CB3ULL, + 0x4F80F7A035DAFB04ULL, 0x6304D09A0B3738C4ULL, 0x2171E64683023A08ULL, + 0x5B9B63EB9CEFF80CULL, 0x506AACF489889342ULL, 0x1881AFC9A3A701D6ULL, + 0x6503080440750644ULL, 0xDFD395339CDBF4A7ULL, 0xEF927DBCF00C20F2ULL, + 0x7B32F7D1E03680ECULL, 0xB9FD7620E7316243ULL, 0x05A7E8A57DB91B77ULL, + 0xB5889C6E15630A75ULL, 0x4A750A09CE9573F7ULL, 0xCF464CEC899A2F8AULL, + 0xF538639CE705B824ULL, 0x3C79A0FF5580EF7FULL, 0xEDE6C87F8477609DULL, + 0x799E81F05BC93F31ULL, 0x86536B8CF3428A8CULL, 0x97D7374C60087B73ULL, + 0xA246637CFF328532ULL, 0x043FCAE60CC0EBA0ULL, 0x920E449535DD359EULL, + 0x70EB093B15B290CCULL, 0x73A1921916591CBDULL, 0x56436C9FE1A1AA8DULL, + 0xEFAC4B70633B8F81ULL, 0xBB215798D45DF7AFULL, 0x45F20042F24F1768ULL, + 0x930F80F4E8EB7462ULL, 0xFF6712FFCFD75EA1ULL, 0xAE623FD67468AA70ULL, + 0xDD2C5BC84BC8D8FCULL, 0x7EED120D54CF2DD9ULL, 0x22FE545401165F1CULL, + 0xC91800E98FB99929ULL, 0x808BD68E6AC10365ULL, 0xDEC468145B7605F6ULL, + 0x1BEDE3A3AEF53302ULL, 0x43539603D6C55602ULL, 0xAA969B5C691CCB7AULL, + 0xA87832D392EFEE56ULL, 0x65942C7B3C7E11AEULL, 0xDED2D633CAD004F6ULL, + 0x21F08570F420E565ULL, 0xB415938D7DA94E3CULL, 0x91B859E59ECB6350ULL, + 0x10CFF333E0ED804AULL, 0x28AED140BE0BB7DDULL, 0xC5CC1D89724FA456ULL, + 0x5648F680F11A2741ULL, 0x2D255069F0B7DAB3ULL, 0x9BC5A38EF729ABD4ULL, + 0xEF2F054308F6A2BCULL, 0xAF2042F5CC5C2858ULL, 0x480412BAB7F5BE2AULL, + 0xAEF3AF4A563DFE43ULL, 0x19AFE59AE451497FULL, 0x52593803DFF1E840ULL, + 0xF4F076E65F2CE6F0ULL, 0x11379625747D5AF3ULL, 0xBCE5D2248682C115ULL, + 0x9DA4243DE836994FULL, 0x066F70B33FE09017ULL, 0x4DC4DE189B671A1CULL, + 0x51039AB7712457C3ULL, 0xC07A3F80C31FB4B4ULL, 0xB46EE9C5E64A6E7CULL, + 0xB3819A42ABE61C87ULL, 0x21A007933A522A20ULL, 0x2DF16F761598AA4FULL, + 0x763C4A1371B368FDULL, 0xF793C46702E086A0ULL, 0xD7288E012AEB8D31ULL, + 0xDE336A2A4BC1C44BULL, 0x0BF692B38D079F23ULL, 0x2C604A7A177326B3ULL, + 0x4850E73E03EB6064ULL, 0xCFC447F1E53C8E1BULL, 0xB05CA3F564268D99ULL, + 0x9AE182C8BC9474E8ULL, 0xA4FC4BD4FC5558CAULL, 0xE755178D58FC4E76ULL, + 0x69B97DB1A4C03DFEULL, 0xF9B5B7C4ACC67C96ULL, 0xFC6A82D64B8655FBULL, + 0x9C684CB6C4D24417ULL, 0x8EC97D2917456ED0ULL, 0x6703DF9D2924E97EULL, + 0xC547F57E42A7444EULL, 0x78E37644E7CAD29EULL, 0xFE9A44E9362F05FAULL, + 0x08BD35CC38336615ULL, 0x9315E5EB3A129ACEULL, 0x94061B871E04DF75ULL, + 0xDF1D9F9D784BA010ULL, 0x3BBA57B68871B59DULL, 0xD2B7ADEEDED1F73FULL, + 0xF7A255D83BC373F8ULL, 0xD7F4F2448C0CEB81ULL, 0xD95BE88CD210FFA7ULL, + 0x336F52F8FF4728E7ULL, 0xA74049DAC312AC71ULL, 0xA2F61BB6E437FDB5ULL, + 0x4F2A5CB07F6A35B3ULL, 0x87D380BDA5BF7859ULL, 0x16B9F7E06C453A21ULL, + 0x7BA2484C8A0FD54EULL, 0xF3A678CAD9A2E38CULL, 0x39B0BF7DDE437BA2ULL, + 0xFCAF55C1BF8A4424ULL, 0x18FCF680573FA594ULL, 0x4C0563B89F495AC3ULL, + 0x40E087931A00930DULL, 0x8CFFA9412EB642C1ULL, 0x68CA39053261169FULL, + 0x7A1EE967D27579E2ULL, 0x9D1D60E5076F5B6FULL, 0x3810E399B6F65BA2ULL, + 0x32095B6D4AB5F9B1ULL, 0x35CAB62109DD038AULL, 0xA90B24499FCFAFB1ULL, + 0x77A225A07CC2C6BDULL, 0x513E5E634C70E331ULL, 0x4361C0CA3F692F12ULL, + 0xD941ACA44B20A45BULL, 0x528F7C8602C5807BULL, 0x52AB92BEB9613989ULL, + 0x9D1DFA2EFC557F73ULL, 0x722FF175F572C348ULL, 0x1D1260A51107FE97ULL, + 0x7A249A57EC0C9BA2ULL, 0x04208FE9E8F7F2D6ULL, 0x5A110C6058B920A0ULL, + 0x0CD9A497658A5698ULL, 0x56FD23C8F9715A4CULL, 0x284C847B9D887AAEULL, + 0x04FEABFBBDB619CBULL, 0x742E1E651C60BA83ULL, 0x9A9632E65904AD3CULL, + 0x881B82A13B51B9E2ULL, 0x506E6744CD974924ULL, 0xB0183DB56FFC6A79ULL, + 0x0ED9B915C66ED37EULL, 0x5E11E86D5873D484ULL, 0xF678647E3519AC6EULL, + 0x1B85D488D0F20CC5ULL, 0xDAB9FE6525D89021ULL, 0x0D151D86ADB73615ULL, + 0xA865A54EDCC0F019ULL, 0x93C42566AEF98FFBULL, 0x99E7AFEABE000731ULL, + 0x48CBFF086DDF285AULL, 0x7F9B6AF1EBF78BAFULL, 0x58627E1A149BBA21ULL, + 0x2CD16E2ABD791E33ULL, 0xD363EFF5F0977996ULL, 0x0CE2A38C344A6EEDULL, + 0x1A804AADB9CFA741ULL, 0x907F30421D78C5DEULL, 0x501F65EDB3034D07ULL, + 0x37624AE5A48FA6E9ULL, 0x957BAF61700CFF4EULL, 0x3A6C27934E31188AULL, + 0xD49503536ABCA345ULL, 0x088E049589C432E0ULL, 0xF943AEE7FEBF21B8ULL, + 0x6C3B8E3E336139D3ULL, 0x364F6FFA464EE52EULL, 0xD60F6DCEDC314222ULL, + 0x56963B0DCA418FC0ULL, 0x16F50EDF91E513AFULL, 0xEF1955914B609F93ULL, + 0x565601C0364E3228ULL, 0xECB53939887E8175ULL, 0xBAC7A9A18531294BULL, + 0xB344C470397BBA52ULL, 0x65D34954DAF3CEBDULL, 0xB4B81B3FA97511E2ULL, + 0xB422061193D6F6A7ULL, 0x071582401C38434DULL, 0x7A13F18BBEDC4FF5ULL, + 0xBC4097B116C524D2ULL, 0x59B97885E2F2EA28ULL, 0x99170A5DC3115544ULL, + 0x6F423357E7C6A9F9ULL, 0x325928EE6E6F8794ULL, 0xD0E4366228B03343ULL, + 0x565C31F7DE89EA27ULL, 0x30F5611484119414ULL, 0xD873DB391292ED4FULL, + 0x7BD94E1D8E17DEBCULL, 0xC7D9F16864A76E94ULL, 0x947AE053EE56E63CULL, + 0xC8C93882F9475F5FULL, 0x3A9BF55BA91F81CAULL, 0xD9A11FBB3D9808E4ULL, + 0x0FD22063EDC29FCAULL, 0xB3F256D8ACA0B0B9ULL, 0xB03031A8B4516E84ULL, + 0x35DD37D5871448AFULL, 0xE9F6082B05542E4EULL, 0xEBFAFA33D7254B59ULL, + 0x9255ABB50D532280ULL, 0xB9AB4CE57F2D34F3ULL, 0x693501D628297551ULL, + 0xC62C58F97DD949BFULL, 0xCD454F8F19C5126AULL, 0xBBE83F4ECC2BDECBULL, + 0xDC842B7E2819E230ULL, 0xBA89142E007503B8ULL, 0xA3BC941D0A5061CBULL, + 0xE9F6760E32CD8021ULL, 0x09C7E552BC76492FULL, 0x852F54934DA55CC9ULL, + 0x8107FCCF064FCF56ULL, 0x098954D51FFF6580ULL, 0x23B70EDB1955C4BFULL, + 0xC330DE426430F69DULL, 0x4715ED43E8A45C0AULL, 0xA8D7E4DAB780A08DULL, + 0x0572B974F03CE0BBULL, 0xB57D2E985E1419C7ULL, 0xE8D9ECBE2CF3D73FULL, + 0x2FE4B17170E59750ULL, 0x11317BA87905E790ULL, 0x7FBF21EC8A1F45ECULL, + 0x1725CABFCB045B00ULL, 0x964E915CD5E2B207ULL, 0x3E2B8BCBF016D66DULL, + 0xBE7444E39328A0ACULL, 0xF85B2B4FBCDE44B7ULL, 0x49353FEA39BA63B1ULL, + 0x1DD01AAFCD53486AULL, 0x1FCA8A92FD719F85ULL, 0xFC7C95D827357AFAULL, + 0x18A6A990C8B35EBDULL, 0xCCCB7005C6B9C28DULL, 0x3BDBB92C43B17F26ULL, + 0xAA70B5B4F89695A2ULL, 0xE94C39A54A98307FULL, 0xB7A0B174CFF6F36EULL, + 0xD4DBA84729AF48ADULL, 0x2E18BC1AD9704A68ULL, 0x2DE0966DAF2F8B1CULL, + 0xB9C11D5B1E43A07EULL, 0x64972D68DEE33360ULL, 0x94628D38D0C20584ULL, + 0xDBC0D2B6AB90A559ULL, 0xD2733C4335C6A72FULL, 0x7E75D99D94A70F4DULL, + 0x6CED1983376FA72BULL, 0x97FCAACBF030BC24ULL, 0x7B77497B32503B12ULL, + 0x8547EDDFB81CCB94ULL, 0x79999CDFF70902CBULL, 0xCFFE1939438E9B24ULL, + 0x829626E3892D95D7ULL, 0x92FAE24291F2B3F1ULL, 0x63E22C147B9C3403ULL, + 0xC678B6D860284A1CULL, 0x5873888850659AE7ULL, 0x0981DCD296A8736DULL, + 0x9F65789A6509A440ULL, 0x9FF38FED72E9052FULL, 0xE479EE5B9930578CULL, + 0xE7F28ECD2D49EECDULL, 0x56C074A581EA17FEULL, 0x5544F7D774B14AEFULL, + 0x7B3F0195FC6F290FULL, 0x12153635B2C0CF57ULL, 0x7F5126DBBA5E0CA7ULL, + 0x7A76956C3EAFB413ULL, 0x3D5774A11D31AB39ULL, 0x8A1B083821F40CB4ULL, + 0x7B4A38E32537DF62ULL, 0x950113646D1D6E03ULL, 0x4DA8979A0041E8A9ULL, + 0x3BC36E078F7515D7ULL, 0x5D0A12F27AD310D1ULL, 0x7F9D1A2E1EBE1327ULL, + 0xDA3A361B1C5157B1ULL, 0xDCDD7D20903D0C25ULL, 0x36833336D068F707ULL, + 0xCE68341F79893389ULL, 0xAB9090168DD05F34ULL, 0x43954B3252DC25E5ULL, + 0xB438C2B67F98E5E9ULL, 0x10DCD78E3851A492ULL, 0xDBC27AB5447822BFULL, + 0x9B3CDB65F82CA382ULL, 0xB67B7896167B4C84ULL, 0xBFCED1B0048EAC50ULL, + 0xA9119B60369FFEBDULL, 0x1FFF7AC80904BF45ULL, 0xAC12FB171817EEE7ULL, + 0xAF08DA9177DDA93DULL, 0x1B0CAB936E65C744ULL, 0xB559EB1D04E5E932ULL, + 0xC37B45B3F8D6F2BAULL, 0xC3A9DC228CAAC9E9ULL, 0xF3B8B6675A6507FFULL, + 0x9FC477DE4ED681DAULL, 0x67378D8ECCEF96CBULL, 0x6DD856D94D259236ULL, + 0xA319CE15B0B4DB31ULL, 0x073973751F12DD5EULL, 0x8A8E849EB32781A5ULL, + 0xE1925C71285279F5ULL, 0x74C04BF1790C0EFEULL, 0x4DDA48153C94938AULL, + 0x9D266D6A1CC0542CULL, 0x7440FB816508C4FEULL, 0x13328503DF48229FULL, + 0xD6BF7BAEE43CAC40ULL, 0x4838D65F6EF6748FULL, 0x1E152328F3318DEAULL, + 0x8F8419A348F296BFULL, 0x72C8834A5957B511ULL, 0xD7A023A73260B45CULL, + 0x94EBC8ABCFB56DAEULL, 0x9FC10D0F989993E0ULL, 0xDE68A2355B93CAE6ULL, + 0xA44CFE79AE538BBEULL, 0x9D1D84FCCE371425ULL, 0x51D2B1AB2DDFB636ULL, + 0x2FD7E4B9E72CD38CULL, 0x65CA5B96B7552210ULL, 0xDD69A0D8AB3B546DULL, + 0x604D51B25FBF70E2ULL, 0x73AA8A564FB7AC9EULL, 0x1A8C1E992B941148ULL, + 0xAAC40A2703D9BEA0ULL, 0x764DBEAE7FA4F3A6ULL, 0x1E99B96E70A9BE8BULL, + 0x2C5E9DEB57EF4743ULL, 0x3A938FEE32D29981ULL, 0x26E6DB8FFDF5ADFEULL, + 0x469356C504EC9F9DULL, 0xC8763C5B08D1908CULL, 0x3F6C6AF859D80055ULL, + 0x7F7CC39420A3A545ULL, 0x9BFB227EBDF4C5CEULL, 0x89039D79D6FC5C5CULL, + 0x8FE88B57305E2AB6ULL, 0xA09E8C8C35AB96DEULL, 0xFA7E393983325753ULL, + 0xD6B6D0ECC617C699ULL, 0xDFEA21EA9E7557E3ULL, 0xB67C1FA481680AF8ULL, + 0xCA1E3785A9E724E5ULL, 0x1CFC8BED0D681639ULL, 0xD18D8549D140CAEAULL, + 0x4ED0FE7E9DC91335ULL, 0xE4DBF0634473F5D2ULL, 0x1761F93A44D5AEFEULL, + 0x53898E4C3910DA55ULL, 0x734DE8181F6EC39AULL, 0x2680B122BAA28D97ULL, + 0x298AF231C85BAFABULL, 0x7983EED3740847D5ULL, 0x66C1A2A1A60CD889ULL, + 0x9E17E49642A3E4C1ULL, 0xEDB454E7BADC0805ULL, 0x50B704CAB602C329ULL, + 0x4CC317FB9CDDD023ULL, 0x66B4835D9EAFEA22ULL, 0x219B97E26FFC81BDULL, + 0x261E4E4C0A333A9DULL, 0x1FE2CCA76517DB90ULL, 0xD7504DFA8816EDBBULL, + 0xB9571FA04DC089C8ULL, 0x1DDC0325259B27DEULL, 0xCF3F4688801EB9AAULL, + 0xF4F5D05C10CAB243ULL, 0x38B6525C21A42B0EULL, 0x36F60E2BA4FA6800ULL, + 0xEB3593803173E0CEULL, 0x9C4CD6257C5A3603ULL, 0xAF0C317D32ADAA8AULL, + 0x258E5A80C7204C4BULL, 0x8B889D624D44885DULL, 0xF4D14597E660F855ULL, + 0xD4347F66EC8941C3ULL, 0xE699ED85B0DFB40DULL, 0x2472F6207C2D0484ULL, + 0xC2A1E7B5B459AEB5ULL, 0xAB4F6451CC1D45ECULL, 0x63767572AE3D6174ULL, + 0xA59E0BD101731A28ULL, 0x116D0016CB948F09ULL, 0x2CF9C8CA052F6E9FULL, + 0x0B090A7560A968E3ULL, 0xABEEDDB2DDE06FF1ULL, 0x58EFC10B06A2068DULL, + 0xC6E57A78FBD986E0ULL, 0x2EAB8CA63CE802D7ULL, 0x14A195640116F336ULL, + 0x7C0828DD624EC390ULL, 0xD74BBE77E6116AC7ULL, 0x804456AF10F5FB53ULL, + 0xEBE9EA2ADF4321C7ULL, 0x03219A39EE587A30ULL, 0x49787FEF17AF9924ULL, + 0xA1E9300CD8520548ULL, 0x5B45E522E4B1B4EFULL, 0xB49C3B3995091A36ULL, + 0xD4490AD526F14431ULL, 0x12A8F216AF9418C2ULL, 0x001F837CC7350524ULL, + 0x1877B51E57A764D5ULL, 0xA2853B80F17F58EEULL, 0x993E1DE72D36D310ULL, + 0xB3598080CE64A656ULL, 0x252F59CF0D9F04BBULL, 0xD23C8E176D113600ULL, + 0x1BDA0492E7E4586EULL, 0x21E0BD5026C619BFULL, 0x3B097ADAF088F94EULL, + 0x8D14DEDB30BE846EULL, 0xF95CFFA23AF5F6F4ULL, 0x3871700761B3F743ULL, + 0xCA672B91E9E4FA16ULL, 0x64C8E531BFF53B55ULL, 0x241260ED4AD1E87DULL, + 0x106C09B972D2E822ULL, 0x7FBA195410E5CA30ULL, 0x7884D9BC6CB569D8ULL, + 0x0647DFEDCD894A29ULL, 0x63573FF03E224774ULL, 0x4FC8E9560F91B123ULL, + 0x1DB956E450275779ULL, 0xB8D91274B9E9D4FBULL, 0xA2EBEE47E2FBFCE1ULL, + 0xD9F1F30CCD97FB09ULL, 0xEFED53D75FD64E6BULL, 0x2E6D02C36017F67FULL, + 0xA9AA4D20DB084E9BULL, 0xB64BE8D8B25396C1ULL, 0x70CB6AF7C2D5BCF0ULL, + 0x98F076A4F7A2322EULL, 0xBF84470805E69B5FULL, 0x94C3251F06F90CF3ULL, + 0x3E003E616A6591E9ULL, 0xB925A6CD0421AFF3ULL, 0x61BDD1307C66E300ULL, + 0xBF8D5108E27E0D48ULL, 0x240AB57A8B888B20ULL, 0xFC87614BAF287E07ULL, + 0xEF02CDD06FFDB432ULL, 0xA1082C0466DF6C0AULL, 0x8215E577001332C8ULL, + 0xD39BB9C3A48DB6CFULL, 0x2738259634305C14ULL, 0x61CF4F94C97DF93DULL, + 0x1B6BACA2AE4E125BULL, 0x758F450C88572E0BULL, 0x959F587D507A8359ULL, + 0xB063E962E045F54DULL, 0x60E8ED72C0DFF5D1ULL, 0x7B64978555326F9FULL, + 0xFD080D236DA814BAULL, 0x8C90FD9B083F4558ULL, 0x106F72FE81E2C590ULL, + 0x7976033A39F7D952ULL, 0xA4EC0132764CA04BULL, 0x733EA705FAE4FA77ULL, + 0xB4D8F77BC3E56167ULL, 0x9E21F4F903B33FD9ULL, 0x9D765E419FB69F6DULL, + 0xD30C088BA61EA5EFULL, 0x5D94337FBFAF7F5BULL, 0x1A4E4822EB4D7A59ULL, + 0x6FFE73E81B637FB3ULL, 0xDDF957BC36D8B9CAULL, 0x64D0E29EEA8838B3ULL, + 0x08DD9BDFD96B9F63ULL, 0x087E79E5A57D1D13ULL, 0xE328E230E3E2B3FBULL, + 0x1C2559E30F0946BEULL, 0x720BF5F26F4D2EAAULL, 0xB0774D261CC609DBULL, + 0x443F64EC5A371195ULL, 0x4112CF68649A260EULL, 0xD813F2FAB7F5C5CAULL, + 0x660D3257380841EEULL, 0x59AC2C7873F910A3ULL, 0xE846963877671A17ULL, + 0x93B633ABFA3469F8ULL, 0xC0C0F5A60EF4CDCFULL, 0xCAF21ECD4377B28CULL, + 0x57277707199B8175ULL, 0x506C11B9D90E8B1DULL, 0xD83CC2687A19255FULL, + 0x4A29C6465A314CD1ULL, 0xED2DF21216235097ULL, 0xB5635C95FF7296E2ULL, + 0x22AF003AB672E811ULL, 0x52E762596BF68235ULL, 0x9AEBA33AC6ECC6B0ULL, + 0x944F6DE09134DFB6ULL, 0x6C47BEC883A7DE39ULL, 0x6AD047C430A12104ULL, + 0xA5B1CFDBA0AB4067ULL, 0x7C45D833AFF07862ULL, 0x5092EF950A16DA0BULL, + 0x9338E69C052B8E7BULL, 0x455A4B4CFE30E3F5ULL, 0x6B02E63195AD0CF8ULL, + 0x6B17B224BAD6BF27ULL, 0xD1E0CCD25BB9C169ULL, 0xDE0C89A556B9AE70ULL, + 0x50065E535A213CF6ULL, 0x9C1169FA2777B874ULL, 0x78EDEFD694AF1EEDULL, + 0x6DC93D9526A50E68ULL, 0xEE97F453F06791EDULL, 0x32AB0EDB696703D3ULL, + 0x3A6853C7E70757A7ULL, 0x31865CED6120F37DULL, 0x67FEF95D92607890ULL, + 0x1F2B1D1F15F6DC9CULL, 0xB69E38A8965C6B65ULL, 0xAA9119FF184CCCF4ULL, + 0xF43C732873F24C13ULL, 0xFB4A3D794A9A80D2ULL, 0x3550C2321FD6109CULL, + 0x371F77E76BB8417EULL, 0x6BFA9AAE5EC05779ULL, 0xCD04F3FF001A4778ULL, + 0xE3273522064480CAULL, 0x9F91508BFFCFC14AULL, 0x049A7F41061A9E60ULL, + 0xFCB6BE43A9F2FE9BULL, 0x08DE8A1C7797DA9BULL, 0x8F9887E6078735A1ULL, + 0xB5B4071DBFC73A66ULL, 0x230E343DFBA08D33ULL, 0x43ED7F5A0FAE657DULL, + 0x3A88A0FBBCB05C63ULL, 0x21874B8B4D2DBC4FULL, 0x1BDEA12E35F6A8C9ULL, + 0x53C065C6C8E63528ULL, 0xE34A1D250E7A8D6BULL, 0xD6B04D3B7651DD7EULL, + 0x5E90277E7CB39E2DULL, 0x2C046F22062DC67DULL, 0xB10BB459132D0A26ULL, + 0x3FA9DDFB67E2F199ULL, 0x0E09B88E1914F7AFULL, 0x10E8B35AF3EEAB37ULL, + 0x9EEDECA8E272B933ULL, 0xD4C718BC4AE8AE5FULL, 0x81536D601170FC20ULL, + 0x91B534F885818A06ULL, 0xEC8177F83F900978ULL, 0x190E714FADA5156EULL, + 0xB592BF39B0364963ULL, 0x89C350C893AE7DC1ULL, 0xAC042E70F8B383F2ULL, + 0xB49B52E587A1EE60ULL, 0xFB152FE3FF26DA89ULL, 0x3E666E6F69AE2C15ULL, + 0x3B544EBE544C19F9ULL, 0xE805A1E290CF2456ULL, 0x24B33C9D7ED25117ULL, + 0xE74733427B72F0C1ULL, 0x0A804D18B7097475ULL, 0x57E3306D881EDB4FULL, + 0x4AE7D6A36EB5DBCBULL, 0x2D8D5432157064C8ULL, 0xD1E649DE1E7F268BULL, + 0x8A328A1CEDFE552CULL, 0x07A3AEC79624C7DAULL, 0x84547DDC3E203C94ULL, + 0x990A98FD5071D263ULL, 0x1A4FF12616EEFC89ULL, 0xF6F7FD1431714200ULL, + 0x30C05B1BA332F41CULL, 0x8D2636B81555A786ULL, 0x46C9FEB55D120902ULL, + 0xCCEC0A73B49C9921ULL, 0x4E9D2827355FC492ULL, 0x19EBB029435DCB0FULL, + 0x4659D2B743848A2CULL, 0x963EF2C96B33BE31ULL, 0x74F85198B05A2E7DULL, + 0x5A0F544DD2B1FB18ULL, 0x03727073C2E134B1ULL, 0xC7F6AA2DE59AEA61ULL, + 0x352787BAA0D7C22FULL, 0x9853EAB63B5E0B35ULL, 0xABBDCDD7ED5C0860ULL, + 0xCF05DAF5AC8D77B0ULL, 0x49CAD48CEBF4A71EULL, 0x7A4C10EC2158C4A6ULL, + 0xD9E92AA246BF719EULL, 0x13AE978D09FE5557ULL, 0x730499AF921549FFULL, + 0x4E4B705B92903BA4ULL, 0xFF577222C14F0A3AULL, 0x55B6344CF97AAFAEULL, + 0xB862225B055B6960ULL, 0xCAC09AFBDDD2CDB4ULL, 0xDAF8E9829FE96B5FULL, + 0xB5FDFC5D3132C498ULL, 0x310CB380DB6F7503ULL, 0xE87FBB46217A360EULL, + 0x2102AE466EBB1148ULL, 0xF8549E1A3AA5E00DULL, 0x07A69AFDCC42261AULL, + 0xC4C118BFE78FEAAEULL, 0xF9F4892ED96BD438ULL, 0x1AF3DBE25D8F45DAULL, + 0xF5B4B0B0D2DEEEB4ULL, 0x962ACEEFA82E1C84ULL, 0x046E3ECAAF453CE9ULL, + 0xF05D129681949A4CULL, 0x964781CE734B3C84ULL, 0x9C2ED44081CE5FBDULL, + 0x522E23F3925E319EULL, 0x177E00F9FC32F791ULL, 0x2BC60A63A6F3B3F2ULL, + 0x222BBFAE61725606ULL, 0x486289DDCC3D6780ULL, 0x7DC7785B8EFDFC80ULL, + 0x8AF38731C02BA980ULL, 0x1FAB64EA29A2DDF7ULL, 0xE4D9429322CD065AULL, + 0x9DA058C67844F20CULL, 0x24C0E332B70019B0ULL, 0x233003B5A6CFE6ADULL, + 0xD586BD01C5C217F6ULL, 0x5E5637885F29BC2BULL, 0x7EBA726D8C94094BULL, + 0x0A56A5F0BFE39272ULL, 0xD79476A84EE20D06ULL, 0x9E4C1269BAA4BF37ULL, + 0x17EFEE45B0DEE640ULL, 0x1D95B0A5FCF90BC6ULL, 0x93CBE0B699C2585DULL, + 0x65FA4F227A2B6D79ULL, 0xD5F9E858292504D5ULL, 0xC2B5A03F71471A6FULL, + 0x59300222B4561E00ULL, 0xCE2F8642CA0712DCULL, 0x7CA9723FBB2E8988ULL, + 0x2785338347F2BA08ULL, 0xC61BB3A141E50E8CULL, 0x150F361DAB9DEC26ULL, + 0x9F6A419D382595F4ULL, 0x64A53DC924FE7AC9ULL, 0x142DE49FFF7A7C3DULL, + 0x0C335248857FA9E7ULL, 0x0A9C32D5EAE45305ULL, 0xE6C42178C4BBB92EULL, + 0x71F1CE2490D20B07ULL, 0xF1BCC3D275AFE51AULL, 0xE728E8C83C334074ULL, + 0x96FBF83A12884624ULL, 0x81A1549FD6573DA5ULL, 0x5FA7867CAF35E149ULL, + 0x56986E2EF3ED091BULL, 0x917F1DD5F8886C61ULL, 0xD20D8C88C8FFE65FULL, + 0x31D71DCE64B2C310ULL, 0xF165B587DF898190ULL, 0xA57E6339DD2CF3A0ULL, + 0x1EF6E6DBB1961EC9ULL, 0x70CC73D90BC26E24ULL, 0xE21A6B35DF0C3AD7ULL, + 0x003A93D8B2806962ULL, 0x1C99DED33CB890A1ULL, 0xCF3145DE0ADD4289ULL, + 0xD0E4427A5514FB72ULL, 0x77C621CC9FB3A483ULL, 0x67A34DAC4356550BULL, + 0xF8D626AAAF278509ULL + } }; + + +PolyBook::PolyBook() +{ + keycount = 0; + polyhash = NULL; + + use_best_book_move = true; + max_book_depth = 255; + book_depth_count = 0; + + last_position = 0; + akt_position = 0; + last_anz_pieces = 0; + akt_anz_pieces = 0; + search_counter = 0; + + do_search = true; + enabled = false; +} + + +PolyBook::~PolyBook() +{ + if (polyhash != NULL) + delete[]polyhash; +} + + +void PolyBook::init(const std::string& bookfile) +{ + if (bookfile.length() == 0) return; + const char *file_name = bookfile.c_str(); + + if (strcmp(file_name, "") == 0) + { + enabled = false; + return; + } + +#ifdef _WIN32 + FILE *fpt; + errno_t errno_local = fopen_s(&fpt, file_name, "rb"); + if (fpt == NULL || errno_local != 0) + { + assert(errno_local != 0); +#else + FILE *fpt = fopen(file_name, "rb"); + if (fpt == NULL) + { +#endif + sync_cout << "info string Could not open " << bookfile << sync_endl; + enabled = false; + return; + } + + if (polyhash != NULL) + { + free(polyhash); + polyhash = NULL; + } + + fseek(fpt, 0L, SEEK_END); + int filesize = ftell(fpt); + fseek(fpt, 0L, SEEK_SET); + + keycount = filesize / 16; + polyhash = new PolyHash[keycount]; + + fread(polyhash, 1, filesize, fpt); + fclose(fpt); + + for (int i = 0; i= max_book_depth) + return m1; + + Key key = polyglot_key(pos); + + int n = find_first_key(key); + + if (n < 1) + { + search_counter++; + if (search_counter > 4) + { + // stop searching after 4 times not in the book till position changes + // according to check_do_search() + do_search = false; + search_counter = 0; + book_depth_count = 0; + } + + return m1; + } + + book_depth_count++; + + int idx1; + if (use_best_book_move) + idx1 = index_best; + else + idx1 = index_rand; + + m1 = pg_move_to_sf_move(pos, polyhash[idx1].move); + + if (!pos.is_draw(64)) return m1; + if (n == 1) return m1; + + // special case draw position and 2 moves available + + if (!check_draw(m1, pos)) + return m1; + + int idx2 = index_first; + if (idx1 == idx2) + idx2 = index_first + 1; + Move m2 = pg_move_to_sf_move(pos, polyhash[idx2].move); + + if (!check_draw(m2, pos)) + return m2; + + return MOVE_NONE; +} + + +Key PolyBook::polyglot_key(const Position & pos) +{ + Key key = 0; + Bitboard b = pos.pieces(); + + while (b) + { + Square s = pop_lsb(&b); + Piece p = pos.piece_on(s); + + // PolyGlot pieces are: BP = 0, WP = 1, BN = 2, ... BK = 10, WK = 11 + key ^= PG.Zobrist.psq[2 * (type_of(p) - 1) + (color_of(p) == WHITE)][s]; + } + + b = pos.can_castle(ANY_CASTLING); + + while (b) + key ^= PG.Zobrist.castle[pop_lsb(&b)]; + + if (pos.ep_square() != SQ_NONE) + key ^= PG.Zobrist.enpassant[file_of(pos.ep_square())]; + + if (pos.side_to_move() == WHITE) + key ^= PG.Zobrist.turn; + + return key; +} + +// A PolyGlot book move is encoded as follows: +// +// bit 0- 5: destination square (from 0 to 63) +// bit 6-11: origin square (from 0 to 63) +// bit 12-14: promotion piece (from KNIGHT == 1 to QUEEN == 4) +// +// Castling moves follow "king captures rook" representation. So in case book +// move is a promotion we have to convert to our representation, in all the +// other cases we can directly compare with a Move after having masked out +// the special Move's flags (bit 14-15) that are not supported by PolyGlot. +// +// SF: +// bit 0- 5: destination square (from 0 to 63) +// bit 6-11: origin square (from 0 to 63) +// bit 12-13: promotion piece type - 2 (from KNIGHT-2 to QUEEN-2) +// bit 14-15: special move flag: promotion (1), en passant (2), castling (3) +Move PolyBook::pg_move_to_sf_move(const Position & pos, unsigned short pg_move) +{ + Move move = Move(pg_move); + + int pt = (move >> 12) & 7; + if (pt) + return make(from_sq(move), to_sq(move), PieceType(pt + 1)); + + // Add 'special move' flags and verify it is legal + for (const auto& m : MoveList(pos)) + { + if (move == (m.move & (~(3 << 14)))) // compare with MoveType (bit 14-15) masked out + return m; + } + + return MOVE_NONE; +} + + +int PolyBook::find_first_key(uint64_t key) +{ + index_first = -1; + index_count = 0; + index_weight_count = 0; + index_best = -1; + index_rand = -1; + + int start = 0; + int end = keycount; + + for (;;) + { + int mid = (end + start) / 2; + + if (polyhash[mid].key < key) + start = mid; + else + { + if (polyhash[mid].key > key) + end = mid; + else + { + start = max(mid - 4, 0); + end = min(mid + 4, keycount); + } + } + + if (end - start < 9) + break; + } + + for (int i = start; i < end; i++) + { + if (key == polyhash[i].key) + { + index_first = i; + while ((index_first>0) && (key == polyhash[index_first - 1].key)) + index_first--; + return get_key_data(); + } + } + + return -1; +} + + +int PolyBook::get_key_data() +{ + int best_weight = polyhash[index_first].weight; + index_weight_count = best_weight; + uint64_t key = polyhash[index_first].key; + + index_count = 1; + index_best = index_first; + + for (int i = index_first + 1; i best_weight) + { + best_weight = polyhash[i].weight; + index_best = i; + } + } + + int rand_pos = (rand64() % index_weight_count); + int weight_count = 0; + index_rand = index_best; + + for (int i = index_first; i < index_first + index_count; i++) + { + if ((rand_pos >= weight_count) && (rand_pos < weight_count + polyhash[i].weight)) + { + index_rand = i; + break; + } + weight_count += polyhash[i].weight; + } + + return index_count; +} + + +bool PolyBook::check_do_search(const Position & pos) +{ + akt_position = pos.pieces(); + akt_anz_pieces = popcount(akt_position); + + bool pos_changed = false; + + Bitboard b = akt_position ^ last_position; + int n2 = popcount(b); + + if (n2 > 6) pos_changed = true; + if (akt_position == last_position) pos_changed = true; + if (akt_anz_pieces > last_anz_pieces) pos_changed = true; + if (akt_anz_pieces < last_anz_pieces - 2) pos_changed = true; + if (pos.key() == 0xB4D30CD15A43432D) pos_changed = true; + + // reset do_search and book depth counter if + // postion changed more than one move can do or in initial position + if (pos_changed) + { + book_depth_count = 0; + do_search = true; + } + + last_position = akt_position; + last_anz_pieces = akt_anz_pieces; + + return do_search; +} + + +bool PolyBook::check_draw(Move m, Position & pos) +{ + StateInfo st; + + pos.do_move(m, st, pos.gives_check(m)); + bool draw = pos.is_draw(64); + pos.undo_move(m); + + return draw; +} + + +void PolyBook::byteswap_polyhash(PolyHash *ph) +{ + if (is_little_endian()) + { + ph->key = swap_uint64(ph->key); + ph->move = swap_uint16(ph->move); + ph->weight = swap_uint16(ph->weight); + ph->learn = swap_uint32(ph->learn); + } +} + + +uint64_t PolyBook::rand64() +{ + sr ^= sr >> 12, sr ^= sr << 25, sr ^= sr >> 27; + return sr * 2685821657736338717LL; +} + + +bool PolyBook::is_little_endian() +{ + int num = 1; + return (*(uint8_t *)&num == 1); +} + + +uint64_t PolyBook::swap_uint64(uint64_t d) +{ + uint64_t a; + uint8_t *dst = (uint8_t *)&a; + uint8_t *src = (uint8_t *)&d; + + dst[0] = src[7]; + dst[1] = src[6]; + dst[2] = src[5]; + dst[3] = src[4]; + dst[4] = src[3]; + dst[5] = src[2]; + dst[6] = src[1]; + dst[7] = src[0]; + + return a; +} + + +uint32_t PolyBook::swap_uint32(uint32_t d) +{ + uint32_t a; + uint8_t *dst = (uint8_t *)&a; + uint8_t *src = (uint8_t *)&d; + + dst[0] = src[3]; + dst[1] = src[2]; + dst[2] = src[1]; + dst[3] = src[0]; + + return a; +} + + +uint16_t PolyBook::swap_uint16(uint16_t d) +{ + uint16_t a; + uint8_t *dst = (uint8_t *)&a; + uint8_t *src = (uint8_t *)&d; + + dst[0] = src[1]; + dst[1] = src[0]; + + return a; +} + diff --git a/Engines/Windows/mcbrain/src/polybook.h b/Engines/Windows/mcbrain/src/polybook.h new file mode 100644 index 0000000..8c0d11a --- /dev/null +++ b/Engines/Windows/mcbrain/src/polybook.h @@ -0,0 +1,113 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ +//polybook.h was wriiten by Thomas Zipproth +/* +polybook.h was written by Thomas Zipproth +BrainFish, a UCI chess playing engine derived from Stockfish +Copyright (C) 2016-2018 Thomas Zipproth + +BrainFish is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +BrainFish is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef POLYBOOK_H_INCLUDED +#define POLYBOOK_H_INCLUDED + +#include "bitboard.h" +#include "position.h" +#include "string.h" + +typedef struct { + uint64_t key; + uint16_t move; + uint16_t weight; + uint32_t learn; +} PolyHash; + +class PolyBook +{ +public: + + PolyBook(); + ~PolyBook(); + + void init(const std::string& bookfile); + void set_best_book_move(bool best_book_move); + void set_book_depth(int book_depth); + + Move probe(Position& pos); + +private: + + Key polyglot_key(const Position& pos); + Move pg_move_to_sf_move(const Position & pos, unsigned short pg_move); + + int find_first_key(uint64_t key); + int get_key_data(); + + bool check_do_search(const Position & pos); + bool check_draw(Move m, Position& pos); + + void byteswap_polyhash(PolyHash *ph); + uint64_t rand64(); + + bool is_little_endian(); + uint64_t swap_uint64(uint64_t d); + uint32_t swap_uint32(uint32_t d); + uint16_t swap_uint16(uint16_t d); + + int keycount; + PolyHash *polyhash; + + bool use_best_book_move; + int max_book_depth; + int book_depth_count; + + int index_first; + int index_count; + int index_best; + int index_rand; + int index_weight_count; + + uint64_t sr; + + Bitboard last_position; + Bitboard akt_position; + int last_anz_pieces; + int akt_anz_pieces; + int search_counter; + + bool enabled, do_search; +}; + +extern PolyBook polybook; + +#endif // #ifndef POLYBOOK_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/position.cpp b/Engines/Windows/mcbrain/src/position.cpp new file mode 100644 index 0000000..2c10df8 --- /dev/null +++ b/Engines/Windows/mcbrain/src/position.cpp @@ -0,0 +1,1314 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include // For offsetof() +#include // For std::memset, std::memcmp +#include +#include + +#include "bitboard.h" +#include "misc.h" +#include "movegen.h" +#include "position.h" +#include "thread.h" +#include "tt.h" +#include "uci.h" +#include "syzygy/tbprobe.h" + +using std::string; + +namespace Zobrist { + + Key psq[PIECE_NB][SQUARE_NB]; + Key enpassant[FILE_NB]; + Key castling[CASTLING_RIGHT_NB]; + Key side, noPawns; +} + +namespace { + +const string PieceToChar(" PNBRQK pnbrqk"); + +constexpr Piece Pieces[] = { W_PAWN, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING, + B_PAWN, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING }; + +// min_attacker() is a helper function used by see_ge() to locate the least +// valuable attacker for the side to move, remove the attacker we just found +// from the bitboards and scan for new X-ray attacks behind it. + +template +PieceType min_attacker(const Bitboard* byTypeBB, Square to, Bitboard stmAttackers, + Bitboard& occupied, Bitboard& attackers) { + + Bitboard b = stmAttackers & byTypeBB[Pt]; + if (!b) + return min_attacker(byTypeBB, to, stmAttackers, occupied, attackers); + + occupied ^= lsb(b); // Remove the attacker from occupied + + // Add any X-ray attack behind the just removed piece. For instance with + // rooks in a8 and a7 attacking a1, after removing a7 we add rook in a8. + // Note that new added attackers can be of any color. + if (Pt == PAWN || Pt == BISHOP || Pt == QUEEN) + attackers |= attacks_bb(to, occupied) & (byTypeBB[BISHOP] | byTypeBB[QUEEN]); + + if (Pt == ROOK || Pt == QUEEN) + attackers |= attacks_bb(to, occupied) & (byTypeBB[ROOK] | byTypeBB[QUEEN]); + + // X-ray may add already processed pieces because byTypeBB[] is constant: in + // the rook example, now attackers contains _again_ rook in a7, so remove it. + attackers &= occupied; + return (PieceType)Pt; +} + +template<> +PieceType min_attacker(const Bitboard*, Square, Bitboard, Bitboard&, Bitboard&) { + return KING; // No need to update bitboards: it is the last cycle +} + +} // namespace + + +/// operator<<(Position) returns an ASCII representation of the position + +std::ostream& operator<<(std::ostream& os, const Position& pos) { + + os << "\n +---+---+---+---+---+---+---+---+\n"; + + for (Rank r = RANK_8; r >= RANK_1; --r) + { + for (File f = FILE_A; f <= FILE_H; ++f) + os << " | " << PieceToChar[pos.piece_on(make_square(f, r))]; + + os << " |\n +---+---+---+---+---+---+---+---+\n"; + } + + os << "\nFen: " << pos.fen() << "\nKey: " << std::hex << std::uppercase + << std::setfill('0') << std::setw(16) << pos.key() + << std::setfill(' ') << std::dec << "\nCheckers: "; + + for (Bitboard b = pos.checkers(); b; ) + os << UCI::square(pop_lsb(&b)) << " "; + + if ( int(Tablebases::MaxCardinality) >= popcount(pos.pieces()) + && !pos.can_castle(ANY_CASTLING)) + { + StateInfo st; + Position p; + p.set(pos.fen(), pos.is_chess960(), &st, pos.this_thread()); + Tablebases::ProbeState s1, s2; + Tablebases::WDLScore wdl = Tablebases::probe_wdl(p, &s1); + int dtz = Tablebases::probe_dtz(p, &s2); + os << "\nTablebases WDL: " << std::setw(4) << wdl << " (" << s1 << ")" + << "\nTablebases DTZ: " << std::setw(4) << dtz << " (" << s2 << ")"; + } + + return os; +} + + +// Marcel van Kervinck's cuckoo algorithm for fast detection of "upcoming repetition" +// situations. Description of the algorithm in the following paper: +// https://marcelk.net/2013-04-06/paper/upcoming-rep-v2.pdf + +// First and second hash functions for indexing the cuckoo tables +inline int H1(Key h) { return h & 0x1fff; } +inline int H2(Key h) { return (h >> 16) & 0x1fff; } + +// Cuckoo tables with Zobrist hashes of valid reversible moves, and the moves themselves +Key cuckoo[8192]; +Move cuckooMove[8192]; + + +/// Position::init() initializes at startup the various arrays used to compute +/// hash keys. + +void Position::init() { + + PRNG rng(1070372); + + for (Piece pc : Pieces) + for (Square s = SQ_A1; s <= SQ_H8; ++s) + Zobrist::psq[pc][s] = rng.rand(); + + for (File f = FILE_A; f <= FILE_H; ++f) + Zobrist::enpassant[f] = rng.rand(); + + for (int cr = NO_CASTLING; cr <= ANY_CASTLING; ++cr) + { + Zobrist::castling[cr] = 0; + Bitboard b = cr; + while (b) + { + Key k = Zobrist::castling[1ULL << pop_lsb(&b)]; + Zobrist::castling[cr] ^= k ? k : rng.rand(); + } + } + + Zobrist::side = rng.rand(); + Zobrist::noPawns = rng.rand(); + + // Prepare the cuckoo tables + std::memset(cuckoo, 0, sizeof(cuckoo)); + std::memset(cuckooMove, 0, sizeof(cuckooMove)); + int count = 0; + for (Piece pc : Pieces) + for (Square s1 = SQ_A1; s1 <= SQ_H8; ++s1) + for (Square s2 = Square(s1 + 1); s2 <= SQ_H8; ++s2) + if (PseudoAttacks[type_of(pc)][s1] & s2) + { + Move move = make_move(s1, s2); + Key key = Zobrist::psq[pc][s1] ^ Zobrist::psq[pc][s2] ^ Zobrist::side; + int i = H1(key); + while (true) + { + std::swap(cuckoo[i], key); + std::swap(cuckooMove[i], move); + if (move == 0) // Arrived at empty slot ? + break; + i = (i == H1(key)) ? H2(key) : H1(key); // Push victim to alternative slot + } + count++; + } + assert(count == 3668); +} + + +/// Position::set() initializes the position object with the given FEN string. +/// This function is not very robust - make sure that input FENs are correct, +/// this is assumed to be the responsibility of the GUI. + +Position& Position::set(const string& fenStr, bool isChess960, StateInfo* si, Thread* th) { +/* + A FEN string defines a particular position using only the ASCII character set. + + A FEN string contains six fields separated by a space. The fields are: + + 1) Piece placement (from white's perspective). Each rank is described, starting + with rank 8 and ending with rank 1. Within each rank, the contents of each + square are described from file A through file H. Following the Standard + Algebraic Notation (SAN), each piece is identified by a single letter taken + from the standard English names. White pieces are designated using upper-case + letters ("PNBRQK") whilst Black uses lowercase ("pnbrqk"). Blank squares are + noted using digits 1 through 8 (the number of blank squares), and "/" + separates ranks. + + 2) Active color. "w" means white moves next, "b" means black. + + 3) Castling availability. If neither side can castle, this is "-". Otherwise, + this has one or more letters: "K" (White can castle kingside), "Q" (White + can castle queenside), "k" (Black can castle kingside), and/or "q" (Black + can castle queenside). + + 4) En passant target square (in algebraic notation). If there's no en passant + target square, this is "-". If a pawn has just made a 2-square move, this + is the position "behind" the pawn. This is recorded only if there is a pawn + in position to make an en passant capture, and if there really is a pawn + that might have advanced two squares. + + 5) Halfmove clock. This is the number of halfmoves since the last pawn advance + or capture. This is used to determine if a draw can be claimed under the + fifty-move rule. + + 6) Fullmove number. The number of the full move. It starts at 1, and is + incremented after Black's move. +*/ + + unsigned char col, row, token; + size_t idx; + Square sq = SQ_A8; + std::istringstream ss(fenStr); + + std::memset(this, 0, sizeof(Position)); + std::memset(si, 0, sizeof(StateInfo)); + std::fill_n(&pieceList[0][0], sizeof(pieceList) / sizeof(Square), SQ_NONE); + st = si; + + ss >> std::noskipws; + + // 1. Piece placement + while ((ss >> token) && !isspace(token)) + { + if (isdigit(token)) + sq += (token - '0') * EAST; // Advance the given number of files + + else if (token == '/') + sq += 2 * SOUTH; + + else if ((idx = PieceToChar.find(token)) != string::npos) + { + put_piece(Piece(idx), sq); + ++sq; + } + } + + // 2. Active color + ss >> token; + sideToMove = (token == 'w' ? WHITE : BLACK); + ss >> token; + + // 3. Castling availability. Compatible with 3 standards: Normal FEN standard, + // Shredder-FEN that uses the letters of the columns on which the rooks began + // the game instead of KQkq and also X-FEN standard that, in case of Chess960, + // if an inner rook is associated with the castling right, the castling tag is + // replaced by the file letter of the involved rook, as for the Shredder-FEN. + while ((ss >> token) && !isspace(token)) + { + Square rsq; + Color c = islower(token) ? BLACK : WHITE; + Piece rook = make_piece(c, ROOK); + + token = char(toupper(token)); + + if (token == 'K') + for (rsq = relative_square(c, SQ_H1); piece_on(rsq) != rook; --rsq) {} + + else if (token == 'Q') + for (rsq = relative_square(c, SQ_A1); piece_on(rsq) != rook; ++rsq) {} + + else if (token >= 'A' && token <= 'H') + rsq = make_square(File(token - 'A'), relative_rank(c, RANK_1)); + + else + continue; + + set_castling_right(c, rsq); + } + + // 4. En passant square. Ignore if no pawn capture is possible + if ( ((ss >> col) && (col >= 'a' && col <= 'h')) + && ((ss >> row) && (row == '3' || row == '6'))) + { + st->epSquare = make_square(File(col - 'a'), Rank(row - '1')); + + if ( !(attackers_to(st->epSquare) & pieces(sideToMove, PAWN)) + || !(pieces(~sideToMove, PAWN) & (st->epSquare + pawn_push(~sideToMove)))) + st->epSquare = SQ_NONE; + } + else + st->epSquare = SQ_NONE; + + // 5-6. Halfmove clock and fullmove number + ss >> std::skipws >> st->rule50 >> gamePly; + + // Convert from fullmove starting from 1 to gamePly starting from 0, + // handle also common incorrect FEN with fullmove = 0. + gamePly = std::max(2 * (gamePly - 1), 0) + (sideToMove == BLACK); + + chess960 = isChess960; + thisThread = th; + set_state(st); + + assert(pos_is_ok()); + + return *this; +} + + +/// Position::set_castling_right() is a helper function used to set castling +/// rights given the corresponding color and the rook starting square. + +void Position::set_castling_right(Color c, Square rfrom) { + + Square kfrom = square(c); + CastlingSide cs = kfrom < rfrom ? KING_SIDE : QUEEN_SIDE; + CastlingRight cr = (c | cs); + + st->castlingRights |= cr; + castlingRightsMask[kfrom] |= cr; + castlingRightsMask[rfrom] |= cr; + castlingRookSquare[cr] = rfrom; + + Square kto = relative_square(c, cs == KING_SIDE ? SQ_G1 : SQ_C1); + Square rto = relative_square(c, cs == KING_SIDE ? SQ_F1 : SQ_D1); + + for (Square s = std::min(rfrom, rto); s <= std::max(rfrom, rto); ++s) + if (s != kfrom && s != rfrom) + castlingPath[cr] |= s; + + for (Square s = std::min(kfrom, kto); s <= std::max(kfrom, kto); ++s) + if (s != kfrom && s != rfrom) + castlingPath[cr] |= s; +} + + +/// Position::set_check_info() sets king attacks to detect if a move gives check + +void Position::set_check_info(StateInfo* si) const { + + si->blockersForKing[WHITE] = slider_blockers(pieces(BLACK), square(WHITE), si->pinners[BLACK]); + si->blockersForKing[BLACK] = slider_blockers(pieces(WHITE), square(BLACK), si->pinners[WHITE]); + + Square ksq = square(~sideToMove); + + si->checkSquares[PAWN] = attacks_from(ksq, ~sideToMove); + si->checkSquares[KNIGHT] = attacks_from(ksq); + si->checkSquares[BISHOP] = attacks_from(ksq); + si->checkSquares[ROOK] = attacks_from(ksq); + si->checkSquares[QUEEN] = si->checkSquares[BISHOP] | si->checkSquares[ROOK]; + si->checkSquares[KING] = 0; +} + + +/// Position::set_state() computes the hash keys of the position, and other +/// data that once computed is updated incrementally as moves are made. +/// The function is only used when a new position is set up, and to verify +/// the correctness of the StateInfo data when running in debug mode. + +void Position::set_state(StateInfo* si) const { + + si->key = si->materialKey = 0; + si->pawnKey = Zobrist::noPawns; + si->nonPawnMaterial[WHITE] = si->nonPawnMaterial[BLACK] = VALUE_ZERO; + si->checkersBB = attackers_to(square(sideToMove)) & pieces(~sideToMove); + + set_check_info(si); + + for (Bitboard b = pieces(); b; ) + { + Square s = pop_lsb(&b); + Piece pc = piece_on(s); + si->key ^= Zobrist::psq[pc][s]; + } + + if (si->epSquare != SQ_NONE) + si->key ^= Zobrist::enpassant[file_of(si->epSquare)]; + + if (sideToMove == BLACK) + si->key ^= Zobrist::side; + + si->key ^= Zobrist::castling[si->castlingRights]; + + for (Bitboard b = pieces(PAWN); b; ) + { + Square s = pop_lsb(&b); + si->pawnKey ^= Zobrist::psq[piece_on(s)][s]; + } + + for (Piece pc : Pieces) + { + if (type_of(pc) != PAWN && type_of(pc) != KING) + si->nonPawnMaterial[color_of(pc)] += pieceCount[pc] * PieceValue[MG][pc]; + + for (int cnt = 0; cnt < pieceCount[pc]; ++cnt) + si->materialKey ^= Zobrist::psq[pc][cnt]; + } +} + + +/// Position::set() is an overload to initialize the position object with +/// the given endgame code string like "KBPKN". It is mainly a helper to +/// get the material key out of an endgame code. + +Position& Position::set(const string& code, Color c, StateInfo* si) { + + assert(code.length() > 0 && code.length() < 8); + assert(code[0] == 'K'); + + string sides[] = { code.substr(code.find('K', 1)), // Weak + code.substr(0, code.find('K', 1)) }; // Strong + + std::transform(sides[c].begin(), sides[c].end(), sides[c].begin(), tolower); + + string fenStr = "8/" + sides[0] + char(8 - sides[0].length() + '0') + "/8/8/8/8/" + + sides[1] + char(8 - sides[1].length() + '0') + "/8 w - - 0 10"; + + return set(fenStr, false, si, nullptr); +} + + +/// Position::fen() returns a FEN representation of the position. In case of +/// Chess960 the Shredder-FEN notation is used. This is mainly a debugging function. + +const string Position::fen() const { + + int emptyCnt; + std::ostringstream ss; + + for (Rank r = RANK_8; r >= RANK_1; --r) + { + for (File f = FILE_A; f <= FILE_H; ++f) + { + for (emptyCnt = 0; f <= FILE_H && empty(make_square(f, r)); ++f) + ++emptyCnt; + + if (emptyCnt) + ss << emptyCnt; + + if (f <= FILE_H) + ss << PieceToChar[piece_on(make_square(f, r))]; + } + + if (r > RANK_1) + ss << '/'; + } + + ss << (sideToMove == WHITE ? " w " : " b "); + + if (can_castle(WHITE_OO)) + ss << (chess960 ? char('A' + file_of(castling_rook_square(WHITE | KING_SIDE))) : 'K'); + + if (can_castle(WHITE_OOO)) + ss << (chess960 ? char('A' + file_of(castling_rook_square(WHITE | QUEEN_SIDE))) : 'Q'); + + if (can_castle(BLACK_OO)) + ss << (chess960 ? char('a' + file_of(castling_rook_square(BLACK | KING_SIDE))) : 'k'); + + if (can_castle(BLACK_OOO)) + ss << (chess960 ? char('a' + file_of(castling_rook_square(BLACK | QUEEN_SIDE))) : 'q'); + + if (!can_castle(WHITE) && !can_castle(BLACK)) + ss << '-'; + + ss << (ep_square() == SQ_NONE ? " - " : " " + UCI::square(ep_square()) + " ") + << st->rule50 << " " << 1 + (gamePly - (sideToMove == BLACK)) / 2; + + return ss.str(); +} + + +/// Position::slider_blockers() returns a bitboard of all the pieces (both colors) +/// that are blocking attacks on the square 's' from 'sliders'. A piece blocks a +/// slider if removing that piece from the board would result in a position where +/// square 's' is attacked. For example, a king-attack blocking piece can be either +/// a pinned or a discovered check piece, according if its color is the opposite +/// or the same of the color of the slider. + +Bitboard Position::slider_blockers(Bitboard sliders, Square s, Bitboard& pinners) const { + + Bitboard blockers = 0; + pinners = 0; + + // Snipers are sliders that attack 's' when a piece is removed + Bitboard snipers = ( (PseudoAttacks[ ROOK][s] & pieces(QUEEN, ROOK)) + | (PseudoAttacks[BISHOP][s] & pieces(QUEEN, BISHOP))) & sliders; + + while (snipers) + { + Square sniperSq = pop_lsb(&snipers); + Bitboard b = between_bb(s, sniperSq) & pieces(); + + if (b && !more_than_one(b)) + { + blockers |= b; + if (b & pieces(color_of(piece_on(s)))) + pinners |= sniperSq; + } + } + return blockers; +} + + +/// Position::attackers_to() computes a bitboard of all pieces which attack a +/// given square. Slider attacks use the occupied bitboard to indicate occupancy. + +Bitboard Position::attackers_to(Square s, Bitboard occupied) const { + + return (attacks_from(s, BLACK) & pieces(WHITE, PAWN)) + | (attacks_from(s, WHITE) & pieces(BLACK, PAWN)) + | (attacks_from(s) & pieces(KNIGHT)) + | (attacks_bb< ROOK>(s, occupied) & pieces( ROOK, QUEEN)) + | (attacks_bb(s, occupied) & pieces(BISHOP, QUEEN)) + | (attacks_from(s) & pieces(KING)); +} + + +/// Position::legal() tests whether a pseudo-legal move is legal + +bool Position::legal(Move m) const { + + assert(is_ok(m)); + + Color us = sideToMove; + Square from = from_sq(m); + + assert(color_of(moved_piece(m)) == us); + assert(piece_on(square(us)) == make_piece(us, KING)); + + // En passant captures are a tricky special case. Because they are rather + // uncommon, we do it simply by testing whether the king is attacked after + // the move is made. + if (type_of(m) == ENPASSANT) + { + Square ksq = square(us); + Square to = to_sq(m); + Square capsq = to - pawn_push(us); + Bitboard occupied = (pieces() ^ from ^ capsq) | to; + + assert(to == ep_square()); + assert(moved_piece(m) == make_piece(us, PAWN)); + assert(piece_on(capsq) == make_piece(~us, PAWN)); + assert(piece_on(to) == NO_PIECE); + + return !(attacks_bb< ROOK>(ksq, occupied) & pieces(~us, QUEEN, ROOK)) + && !(attacks_bb(ksq, occupied) & pieces(~us, QUEEN, BISHOP)); + } + + // If the moving piece is a king, check whether the destination + // square is attacked by the opponent. Castling moves are checked + // for legality during move generation. + if (type_of(piece_on(from)) == KING) + return type_of(m) == CASTLING || !(attackers_to(to_sq(m)) & pieces(~us)); + + // A non-king move is legal if and only if it is not pinned or it + // is moving along the ray towards or away from the king. + return !(blockers_for_king(us) & from) + || aligned(from, to_sq(m), square(us)); +} + + +/// Position::pseudo_legal() takes a random move and tests whether the move is +/// pseudo legal. It is used to validate moves from TT that can be corrupted +/// due to SMP concurrent access or hash position key aliasing. + +bool Position::pseudo_legal(const Move m) const { + + Color us = sideToMove; + Square from = from_sq(m); + Square to = to_sq(m); + Piece pc = moved_piece(m); + + // Use a slower but simpler function for uncommon cases + if (type_of(m) != NORMAL) + return MoveList(*this).contains(m); + + // Is not a promotion, so promotion piece must be empty + if (promotion_type(m) - KNIGHT != NO_PIECE_TYPE) + return false; + + // If the 'from' square is not occupied by a piece belonging to the side to + // move, the move is obviously not legal. + if (pc == NO_PIECE || color_of(pc) != us) + return false; + + // The destination square cannot be occupied by a friendly piece + if (pieces(us) & to) + return false; + + // Handle the special case of a pawn move + if (type_of(pc) == PAWN) + { + // We have already handled promotion moves, so destination + // cannot be on the 8th/1st rank. + if (rank_of(to) == relative_rank(us, RANK_8)) + return false; + + if ( !(attacks_from(from, us) & pieces(~us) & to) // Not a capture + && !((from + pawn_push(us) == to) && empty(to)) // Not a single push + && !( (from + 2 * pawn_push(us) == to) // Not a double push + && (rank_of(from) == relative_rank(us, RANK_2)) + && empty(to) + && empty(to - pawn_push(us)))) + return false; + } + else if (!(attacks_from(type_of(pc), from) & to)) + return false; + + // Evasions generator already takes care to avoid some kind of illegal moves + // and legal() relies on this. We therefore have to take care that the same + // kind of moves are filtered out here. + if (checkers()) + { + if (type_of(pc) != KING) + { + // Double check? In this case a king move is required + if (more_than_one(checkers())) + return false; + + // Our move must be a blocking evasion or a capture of the checking piece + if (!((between_bb(lsb(checkers()), square(us)) | checkers()) & to)) + return false; + } + // In case of king moves under check we have to remove king so as to catch + // invalid moves like b1a1 when opposite queen is on c1. + else if (attackers_to(to, pieces() ^ from) & pieces(~us)) + return false; + } + + return true; +} + + +/// Position::gives_check() tests whether a pseudo-legal move gives a check + +bool Position::gives_check(Move m) const { + + assert(is_ok(m)); + assert(color_of(moved_piece(m)) == sideToMove); + + Square from = from_sq(m); + Square to = to_sq(m); + + // Is there a direct check? + if (st->checkSquares[type_of(piece_on(from))] & to) + return true; + + // Is there a discovered check? + if ( (st->blockersForKing[~sideToMove] & from) + && !aligned(from, to, square(~sideToMove))) + return true; + + switch (type_of(m)) + { + case NORMAL: + return false; + + case PROMOTION: + return attacks_bb(promotion_type(m), to, pieces() ^ from) & square(~sideToMove); + + // En passant capture with check? We have already handled the case + // of direct checks and ordinary discovered check, so the only case we + // need to handle is the unusual case of a discovered check through + // the captured pawn. + case ENPASSANT: + { + Square capsq = make_square(file_of(to), rank_of(from)); + Bitboard b = (pieces() ^ from ^ capsq) | to; + + return (attacks_bb< ROOK>(square(~sideToMove), b) & pieces(sideToMove, QUEEN, ROOK)) + | (attacks_bb(square(~sideToMove), b) & pieces(sideToMove, QUEEN, BISHOP)); + } + case CASTLING: + { + Square kfrom = from; + Square rfrom = to; // Castling is encoded as 'King captures the rook' + Square kto = relative_square(sideToMove, rfrom > kfrom ? SQ_G1 : SQ_C1); + Square rto = relative_square(sideToMove, rfrom > kfrom ? SQ_F1 : SQ_D1); + + return (PseudoAttacks[ROOK][rto] & square(~sideToMove)) + && (attacks_bb(rto, (pieces() ^ kfrom ^ rfrom) | rto | kto) & square(~sideToMove)); + } + default: + assert(false); + return false; + } +} + + +/// Position::do_move() makes a move, and saves all information necessary +/// to a StateInfo object. The move is assumed to be legal. Pseudo-legal +/// moves should be filtered out before this function is called. + +void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) { + + assert(is_ok(m)); + assert(&newSt != st); + + thisThread->nodes.fetch_add(1, std::memory_order_relaxed); + Key k = st->key ^ Zobrist::side; + + // Copy some fields of the old state to our new StateInfo object except the + // ones which are going to be recalculated from scratch anyway and then switch + // our state pointer to point to the new (ready to be updated) state. + std::memcpy(&newSt, st, offsetof(StateInfo, key)); + newSt.previous = st; + st = &newSt; + + // Increment ply counters. In particular, rule50 will be reset to zero later on + // in case of a capture or a pawn move. + ++gamePly; + ++st->rule50; + ++st->pliesFromNull; + + Color us = sideToMove; + Color them = ~us; + Square from = from_sq(m); + Square to = to_sq(m); + Piece pc = piece_on(from); + Piece captured = type_of(m) == ENPASSANT ? make_piece(them, PAWN) : piece_on(to); + + assert(color_of(pc) == us); + assert(captured == NO_PIECE || color_of(captured) == (type_of(m) != CASTLING ? them : us)); + assert(type_of(captured) != KING); + + if (type_of(m) == CASTLING) + { + assert(pc == make_piece(us, KING)); + assert(captured == make_piece(us, ROOK)); + + Square rfrom, rto; + do_castling(us, from, to, rfrom, rto); + + k ^= Zobrist::psq[captured][rfrom] ^ Zobrist::psq[captured][rto]; + captured = NO_PIECE; + } + + if (captured) + { + Square capsq = to; + + // If the captured piece is a pawn, update pawn hash key, otherwise + // update non-pawn material. + if (type_of(captured) == PAWN) + { + if (type_of(m) == ENPASSANT) + { + capsq -= pawn_push(us); + + assert(pc == make_piece(us, PAWN)); + assert(to == st->epSquare); + assert(relative_rank(us, to) == RANK_6); + assert(piece_on(to) == NO_PIECE); + assert(piece_on(capsq) == make_piece(them, PAWN)); + + board[capsq] = NO_PIECE; // Not done by remove_piece() + } + + st->pawnKey ^= Zobrist::psq[captured][capsq]; + } + else + st->nonPawnMaterial[them] -= PieceValue[MG][captured]; + + // Update board and piece lists + remove_piece(captured, capsq); + + // Update material hash key and prefetch access to materialTable + k ^= Zobrist::psq[captured][capsq]; + st->materialKey ^= Zobrist::psq[captured][pieceCount[captured]]; + prefetch(thisThread->materialTable[st->materialKey]); + + // Reset rule 50 counter + st->rule50 = 0; + } + + // Update hash key + k ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; + + // Reset en passant square + if (st->epSquare != SQ_NONE) + { + k ^= Zobrist::enpassant[file_of(st->epSquare)]; + st->epSquare = SQ_NONE; + } + + // Update castling rights if needed + if (st->castlingRights && (castlingRightsMask[from] | castlingRightsMask[to])) + { + int cr = castlingRightsMask[from] | castlingRightsMask[to]; + k ^= Zobrist::castling[st->castlingRights & cr]; + st->castlingRights &= ~cr; + } + + // Move the piece. The tricky Chess960 castling is handled earlier + if (type_of(m) != CASTLING) + move_piece(pc, from, to); + + // If the moving piece is a pawn do some special extra work + if (type_of(pc) == PAWN) + { + // Set en-passant square if the moved pawn can be captured + if ( (int(to) ^ int(from)) == 16 + && (attacks_from(to - pawn_push(us), us) & pieces(them, PAWN))) + { + st->epSquare = to - pawn_push(us); + k ^= Zobrist::enpassant[file_of(st->epSquare)]; + } + + else if (type_of(m) == PROMOTION) + { + Piece promotion = make_piece(us, promotion_type(m)); + + assert(relative_rank(us, to) == RANK_8); + assert(type_of(promotion) >= KNIGHT && type_of(promotion) <= QUEEN); + + remove_piece(pc, to); + put_piece(promotion, to); + + // Update hash keys + k ^= Zobrist::psq[pc][to] ^ Zobrist::psq[promotion][to]; + st->pawnKey ^= Zobrist::psq[pc][to]; + st->materialKey ^= Zobrist::psq[promotion][pieceCount[promotion]-1] + ^ Zobrist::psq[pc][pieceCount[pc]]; + + // Update material + st->nonPawnMaterial[us] += PieceValue[MG][promotion]; + } + + // Update pawn hash key and prefetch access to pawnsTable + st->pawnKey ^= Zobrist::psq[pc][from] ^ Zobrist::psq[pc][to]; + prefetch2(thisThread->pawnsTable[st->pawnKey]); + + // Reset rule 50 draw counter + st->rule50 = 0; + } + + // Set capture piece + st->capturedPiece = captured; + + // Update the key with the final value + st->key = k; + + // Calculate checkers bitboard (if move gives check) + st->checkersBB = givesCheck ? attackers_to(square(them)) & pieces(us) : 0; + + sideToMove = ~sideToMove; + + // Update king attacks used for fast check detection + set_check_info(st); + + assert(pos_is_ok()); +} + + +/// Position::undo_move() unmakes a move. When it returns, the position should +/// be restored to exactly the same state as before the move was made. + +void Position::undo_move(Move m) { + + assert(is_ok(m)); + + sideToMove = ~sideToMove; + + Color us = sideToMove; + Square from = from_sq(m); + Square to = to_sq(m); + Piece pc = piece_on(to); + + assert(empty(from) || type_of(m) == CASTLING); + assert(type_of(st->capturedPiece) != KING); + + if (type_of(m) == PROMOTION) + { + assert(relative_rank(us, to) == RANK_8); + assert(type_of(pc) == promotion_type(m)); + assert(type_of(pc) >= KNIGHT && type_of(pc) <= QUEEN); + + remove_piece(pc, to); + pc = make_piece(us, PAWN); + put_piece(pc, to); + } + + if (type_of(m) == CASTLING) + { + Square rfrom, rto; + do_castling(us, from, to, rfrom, rto); + } + else + { + move_piece(pc, to, from); // Put the piece back at the source square + + if (st->capturedPiece) + { + Square capsq = to; + + if (type_of(m) == ENPASSANT) + { + capsq -= pawn_push(us); + + assert(type_of(pc) == PAWN); + assert(to == st->previous->epSquare); + assert(relative_rank(us, to) == RANK_6); + assert(piece_on(capsq) == NO_PIECE); + assert(st->capturedPiece == make_piece(~us, PAWN)); + } + + put_piece(st->capturedPiece, capsq); // Restore the captured piece + } + } + + // Finally point our state pointer back to the previous state + st = st->previous; + --gamePly; + + assert(pos_is_ok()); +} + + +/// Position::do_castling() is a helper used to do/undo a castling move. This +/// is a bit tricky in Chess960 where from/to squares can overlap. +template +void Position::do_castling(Color us, Square from, Square& to, Square& rfrom, Square& rto) { + + bool kingSide = to > from; + rfrom = to; // Castling is encoded as "king captures friendly rook" + rto = relative_square(us, kingSide ? SQ_F1 : SQ_D1); + to = relative_square(us, kingSide ? SQ_G1 : SQ_C1); + + // Remove both pieces first since squares could overlap in Chess960 + remove_piece(make_piece(us, KING), Do ? from : to); + remove_piece(make_piece(us, ROOK), Do ? rfrom : rto); + board[Do ? from : to] = board[Do ? rfrom : rto] = NO_PIECE; // Since remove_piece doesn't do it for us + put_piece(make_piece(us, KING), Do ? to : from); + put_piece(make_piece(us, ROOK), Do ? rto : rfrom); +} + + +/// Position::do(undo)_null_move() is used to do(undo) a "null move": It flips +/// the side to move without executing any move on the board. + +void Position::do_null_move(StateInfo& newSt) { + + assert(!checkers()); + assert(&newSt != st); + + std::memcpy(&newSt, st, sizeof(StateInfo)); + newSt.previous = st; + st = &newSt; + + if (st->epSquare != SQ_NONE) + { + st->key ^= Zobrist::enpassant[file_of(st->epSquare)]; + st->epSquare = SQ_NONE; + } + + st->key ^= Zobrist::side; + prefetch(TT.first_entry(st->key)); + + ++st->rule50; + st->pliesFromNull = 0; + + sideToMove = ~sideToMove; + + set_check_info(st); + + assert(pos_is_ok()); +} + +void Position::undo_null_move() { + + assert(!checkers()); + + st = st->previous; + sideToMove = ~sideToMove; +} + + +/// Position::key_after() computes the new hash key after the given move. Needed +/// for speculative prefetch. It doesn't recognize special moves like castling, +/// en-passant and promotions. + +Key Position::key_after(Move m) const { + + Square from = from_sq(m); + Square to = to_sq(m); + Piece pc = piece_on(from); + Piece captured = piece_on(to); + Key k = st->key ^ Zobrist::side; + + if (captured) + k ^= Zobrist::psq[captured][to]; + + return k ^ Zobrist::psq[pc][to] ^ Zobrist::psq[pc][from]; +} + + +/// Position::see_ge (Static Exchange Evaluation Greater or Equal) tests if the +/// SEE value of move is greater or equal to the given threshold. We'll use an +/// algorithm similar to alpha-beta pruning with a null window. + +bool Position::see_ge(Move m, Value threshold) const { + + assert(is_ok(m)); + + // Only deal with normal moves, assume others pass a simple see + if (type_of(m) != NORMAL) + return VALUE_ZERO >= threshold; + + Bitboard stmAttackers; + Square from = from_sq(m), to = to_sq(m); + PieceType nextVictim = type_of(piece_on(from)); + Color us = color_of(piece_on(from)); + Color stm = ~us; // First consider opponent's move + Value balance; // Values of the pieces taken by us minus opponent's ones + + // The opponent may be able to recapture so this is the best result + // we can hope for. + balance = PieceValue[MG][piece_on(to)] - threshold; + + if (balance < VALUE_ZERO) + return false; + + // Now assume the worst possible result: that the opponent can + // capture our piece for free. + balance -= PieceValue[MG][nextVictim]; + + // If it is enough (like in PxQ) then return immediately. Note that + // in case nextVictim == KING we always return here, this is ok + // if the given move is legal. + if (balance >= VALUE_ZERO) + return true; + + // Find all attackers to the destination square, with the moving piece + // removed, but possibly an X-ray attacker added behind it. + Bitboard occupied = pieces() ^ from ^ to; + Bitboard attackers = attackers_to(to, occupied) & occupied; + + while (true) + { + stmAttackers = attackers & pieces(stm); + + // Don't allow pinned pieces to attack (except the king) as long as + // all pinners are on their original square. + if (!(st->pinners[~stm] & ~occupied)) + stmAttackers &= ~st->blockersForKing[stm]; + + // If stm has no more attackers then give up: stm loses + if (!stmAttackers) + break; + + // Locate and remove the next least valuable attacker, and add to + // the bitboard 'attackers' the possibly X-ray attackers behind it. + nextVictim = min_attacker(byTypeBB, to, stmAttackers, occupied, attackers); + + stm = ~stm; // Switch side to move + + // Negamax the balance with alpha = balance, beta = balance+1 and + // add nextVictim's value. + // + // (balance, balance+1) -> (-balance-1, -balance) + // + assert(balance < VALUE_ZERO); + + balance = -balance - 1 - PieceValue[MG][nextVictim]; + + // If balance is still non-negative after giving away nextVictim then we + // win. The only thing to be careful about it is that we should revert + // stm if we captured with the king when the opponent still has attackers. + if (balance >= VALUE_ZERO) + { + if (nextVictim == KING && (attackers & pieces(stm))) + stm = ~stm; + break; + } + assert(nextVictim != KING); + } + return us != stm; // We break the above loop when stm loses +} + + +/// Position::is_draw() tests whether the position is drawn by 50-move rule +/// or by repetition. It does not detect stalemates. + +bool Position::is_draw(int ply) const { + + if (st->rule50 > 99 && (!checkers() || MoveList(*this).size())) + return true; + + int end = std::min(st->rule50, st->pliesFromNull); + + if (end < 4) + return false; + + StateInfo* stp = st->previous->previous; + int cnt = 0; + + for (int i = 4; i <= end; i += 2) + { + stp = stp->previous->previous; + + // Return a draw score if a position repeats once earlier but strictly + // after the root, or repeats twice before or at the root. + if ( stp->key == st->key + && ++cnt + (ply > i) == 2) + return true; + } + + return false; +} + + +// Position::has_repeated() tests whether there has been at least one repetition +// of positions since the last capture or pawn move. + +bool Position::has_repeated() const { + + StateInfo* stc = st; + while (true) + { + int i = 4, end = std::min(stc->rule50, stc->pliesFromNull); + + if (end < i) + return false; + + StateInfo* stp = st->previous->previous; + + do { + stp = stp->previous->previous; + + if (stp->key == stc->key) + return true; + + i += 2; + } while (i <= end); + + stc = stc->previous; + } +} + + +/// Position::has_game_cycle() tests if the position has a move which draws by repetition, +/// or an earlier position has a move that directly reaches the current position. + +bool Position::has_game_cycle(int ply) const { + + int j; + + int end = std::min(st->rule50, st->pliesFromNull); + + if (end < 3) + return false; + + Key originalKey = st->key; + StateInfo* stp = st->previous; + + for (int i = 3; i <= end; i += 2) + { + stp = stp->previous->previous; + + Key moveKey = originalKey ^ stp->key; + if ( (j = H1(moveKey), cuckoo[j] == moveKey) + || (j = H2(moveKey), cuckoo[j] == moveKey)) + { + Move move = cuckooMove[j]; + Square s1 = from_sq(move); + Square s2 = to_sq(move); + + if (!(between_bb(s1, s2) & pieces())) + { + // In the cuckoo table, both moves Rc1c5 and Rc5c1 are stored in the same + // location. We select the legal one by reversing the move variable if necessary. + if (empty(s1)) + move = make_move(s2, s1); + + if (ply > i) + return true; + + // For repetitions before or at the root, require one more + StateInfo* next_stp = stp; + for (int k = i + 2; k <= end; k += 2) + { + next_stp = next_stp->previous->previous; + if (next_stp->key == stp->key) + return true; + } + } + } + } + return false; +} + + +/// Position::flip() flips position with the white and black sides reversed. This +/// is only useful for debugging e.g. for finding evaluation symmetry bugs. + +void Position::flip() { + + string f, token; + std::stringstream ss(fen()); + + for (Rank r = RANK_8; r >= RANK_1; --r) // Piece placement + { + std::getline(ss, token, r > RANK_1 ? '/' : ' '); + f.insert(0, token + (f.empty() ? " " : "/")); + } + + ss >> token; // Active color + f += (token == "w" ? "B " : "W "); // Will be lowercased later + + ss >> token; // Castling availability + f += token + " "; + + std::transform(f.begin(), f.end(), f.begin(), + [](char c) { return char(islower(c) ? toupper(c) : tolower(c)); }); + + ss >> token; // En passant square + f += (token == "-" ? token : token.replace(1, 1, token[1] == '3' ? "6" : "3")); + + std::getline(ss, token); // Half and full moves + f += token; + + set(f, is_chess960(), st, this_thread()); + + assert(pos_is_ok()); +} + + +/// Position::pos_is_ok() performs some consistency checks for the +/// position object and raises an asserts if something wrong is detected. +/// This is meant to be helpful when debugging. + +bool Position::pos_is_ok() const { + + constexpr bool Fast = true; // Quick (default) or full check? + + if ( (sideToMove != WHITE && sideToMove != BLACK) + || piece_on(square(WHITE)) != W_KING + || piece_on(square(BLACK)) != B_KING + || ( ep_square() != SQ_NONE + && relative_rank(sideToMove, ep_square()) != RANK_6)) + assert(0 && "pos_is_ok: Default"); + + if (Fast) + return true; + + if ( pieceCount[W_KING] != 1 + || pieceCount[B_KING] != 1 + || attackers_to(square(~sideToMove)) & pieces(sideToMove)) + assert(0 && "pos_is_ok: Kings"); + + if ( (pieces(PAWN) & (Rank1BB | Rank8BB)) + || pieceCount[W_PAWN] > 8 + || pieceCount[B_PAWN] > 8) + assert(0 && "pos_is_ok: Pawns"); + + if ( (pieces(WHITE) & pieces(BLACK)) + || (pieces(WHITE) | pieces(BLACK)) != pieces() + || popcount(pieces(WHITE)) > 16 + || popcount(pieces(BLACK)) > 16) + assert(0 && "pos_is_ok: Bitboards"); + + for (PieceType p1 = PAWN; p1 <= KING; ++p1) + for (PieceType p2 = PAWN; p2 <= KING; ++p2) + if (p1 != p2 && (pieces(p1) & pieces(p2))) + assert(0 && "pos_is_ok: Bitboards"); + + StateInfo si = *st; + set_state(&si); + if (std::memcmp(&si, st, sizeof(StateInfo))) + assert(0 && "pos_is_ok: State"); + + for (Piece pc : Pieces) + { + if ( pieceCount[pc] != popcount(pieces(color_of(pc), type_of(pc))) + || pieceCount[pc] != std::count(board, board + SQUARE_NB, pc)) + assert(0 && "pos_is_ok: Pieces"); + + for (int i = 0; i < pieceCount[pc]; ++i) + if (board[pieceList[pc][i]] != pc || index[pieceList[pc][i]] != i) + assert(0 && "pos_is_ok: Index"); + } + + for (Color c = WHITE; c <= BLACK; ++c) + for (CastlingSide s = KING_SIDE; s <= QUEEN_SIDE; s = CastlingSide(s + 1)) + { + if (!can_castle(c | s)) + continue; + + if ( piece_on(castlingRookSquare[c | s]) != make_piece(c, ROOK) + || castlingRightsMask[castlingRookSquare[c | s]] != (c | s) + || (castlingRightsMask[square(c)] & (c | s)) != (c | s)) + assert(0 && "pos_is_ok: Castling"); + } + + return true; +} diff --git a/Engines/Windows/mcbrain/src/position.h b/Engines/Windows/mcbrain/src/position.h new file mode 100644 index 0000000..b7e3a7a --- /dev/null +++ b/Engines/Windows/mcbrain/src/position.h @@ -0,0 +1,437 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef POSITION_H_INCLUDED +#define POSITION_H_INCLUDED + +#include +#include +#include // For std::unique_ptr +#include + +#include "bitboard.h" +#include "types.h" + + +/// StateInfo struct stores information needed to restore a Position object to +/// its previous state when we retract a move. Whenever a move is made on the +/// board (by calling Position::do_move), a StateInfo object must be passed. + +struct StateInfo { + + // Copied when making a move + Key pawnKey; + Key materialKey; + Value nonPawnMaterial[COLOR_NB]; + int castlingRights; + int rule50; + int pliesFromNull; + Square epSquare; + + // Not copied when making a move (will be recomputed anyhow) + Key key; + Bitboard checkersBB; + Piece capturedPiece; + StateInfo* previous; + Bitboard blockersForKing[COLOR_NB]; + Bitboard pinners[COLOR_NB]; + Bitboard checkSquares[PIECE_TYPE_NB]; +}; + +/// A list to keep track of the position states along the setup moves (from the +/// start position to the position just before the search starts). Needed by +/// 'draw by repetition' detection. Use a std::deque because pointers to +/// elements are not invalidated upon list resizing. +typedef std::unique_ptr> StateListPtr; + + +/// Position class stores information regarding the board representation as +/// pieces, side to move, hash keys, castling info, etc. Important methods are +/// do_move() and undo_move(), used by the search to update node info when +/// traversing the search tree. +class Thread; + +class Position { +public: + static void init(); + + Position() = default; + Position(const Position&) = delete; + Position& operator=(const Position&) = delete; + + // FEN string input/output + Position& set(const std::string& fenStr, bool isChess960, StateInfo* si, Thread* th); + Position& set(const std::string& code, Color c, StateInfo* si); + const std::string fen() const; + + // Position representation + Bitboard pieces() const; + Bitboard pieces(PieceType pt) const; + Bitboard pieces(PieceType pt1, PieceType pt2) const; + Bitboard pieces(Color c) const; + Bitboard pieces(Color c, PieceType pt) const; + Bitboard pieces(Color c, PieceType pt1, PieceType pt2) const; + Piece piece_on(Square s) const; + Square ep_square() const; + bool empty(Square s) const; + template int count(Color c) const; + template int count() const; + template const Square* squares(Color c) const; + template Square square(Color c) const; + + // Castling + int can_castle(Color c) const; + int can_castle(CastlingRight cr) const; + bool castling_impeded(CastlingRight cr) const; + Square castling_rook_square(CastlingRight cr) const; + + // Checking + Bitboard checkers() const; + Bitboard blockers_for_king(Color c) const; + Bitboard check_squares(PieceType pt) const; + + // Attacks to/from a given square + Bitboard attackers_to(Square s) const; + Bitboard attackers_to(Square s, Bitboard occupied) const; + Bitboard attacks_from(PieceType pt, Square s) const; + template Bitboard attacks_from(Square s) const; + template Bitboard attacks_from(Square s, Color c) const; + Bitboard slider_blockers(Bitboard sliders, Square s, Bitboard& pinners) const; + + // Properties of moves + bool legal(Move m) const; + bool pseudo_legal(const Move m) const; + bool capture(Move m) const; + bool capture_or_promotion(Move m) const; + bool gives_check(Move m) const; + bool advanced_pawn_push(Move m) const; + bool promotion_pawn_push(Move m) const; + Piece moved_piece(Move m) const; + Piece captured_piece() const; + + // Piece specific + bool pawn_passed(Color c, Square s) const; + bool opposite_bishops() const; + + // Doing and undoing moves + void do_move(Move m, StateInfo& newSt); + void do_move(Move m, StateInfo& newSt, bool givesCheck); + void undo_move(Move m); + void do_null_move(StateInfo& newSt); + void undo_null_move(); + + // Static Exchange Evaluation + bool see_ge(Move m, Value threshold = VALUE_ZERO) const; + + // Accessing hash keys + Key key() const; + Key key_after(Move m) const; + Key material_key() const; + Key pawn_key() const; + + // Other properties of the position + Color side_to_move() const; + int game_ply() const; + bool is_chess960() const; + Thread* this_thread() const; + bool is_draw(int ply) const; + bool has_game_cycle(int ply) const; + bool has_repeated() const; + int rule50_count() const; + Score psq_score() const; + Value non_pawn_material(Color c) const; + Value non_pawn_material() const; + + // Position consistency check, for debugging + bool pos_is_ok() const; + void flip(); + +private: + // Initialization helpers (used while setting up a position) + void set_castling_right(Color c, Square rfrom); + void set_state(StateInfo* si) const; + void set_check_info(StateInfo* si) const; + + // Other helpers + void put_piece(Piece pc, Square s); + void remove_piece(Piece pc, Square s); + void move_piece(Piece pc, Square from, Square to); + template + void do_castling(Color us, Square from, Square& to, Square& rfrom, Square& rto); + + // Data members + Piece board[SQUARE_NB]; + Bitboard byTypeBB[PIECE_TYPE_NB]; + Bitboard byColorBB[COLOR_NB]; + int pieceCount[PIECE_NB]; + Square pieceList[PIECE_NB][16]; + int index[SQUARE_NB]; + int castlingRightsMask[SQUARE_NB]; + Square castlingRookSquare[CASTLING_RIGHT_NB]; + Bitboard castlingPath[CASTLING_RIGHT_NB]; + int gamePly; + Color sideToMove; + Score psq; + Thread* thisThread; + StateInfo* st; + bool chess960; +}; + +namespace PSQT { + extern Score psq[PIECE_NB][SQUARE_NB]; +} + +extern std::ostream& operator<<(std::ostream& os, const Position& pos); + +inline Color Position::side_to_move() const { + return sideToMove; +} + +inline bool Position::empty(Square s) const { + return board[s] == NO_PIECE; +} + +inline Piece Position::piece_on(Square s) const { + return board[s]; +} + +inline Piece Position::moved_piece(Move m) const { + return board[from_sq(m)]; +} + +inline Bitboard Position::pieces() const { + return byTypeBB[ALL_PIECES]; +} + +inline Bitboard Position::pieces(PieceType pt) const { + return byTypeBB[pt]; +} + +inline Bitboard Position::pieces(PieceType pt1, PieceType pt2) const { + return byTypeBB[pt1] | byTypeBB[pt2]; +} + +inline Bitboard Position::pieces(Color c) const { + return byColorBB[c]; +} + +inline Bitboard Position::pieces(Color c, PieceType pt) const { + return byColorBB[c] & byTypeBB[pt]; +} + +inline Bitboard Position::pieces(Color c, PieceType pt1, PieceType pt2) const { + return byColorBB[c] & (byTypeBB[pt1] | byTypeBB[pt2]); +} + +template inline int Position::count(Color c) const { + return pieceCount[make_piece(c, Pt)]; +} + +template inline int Position::count() const { + return pieceCount[make_piece(WHITE, Pt)] + pieceCount[make_piece(BLACK, Pt)]; +} + +template inline const Square* Position::squares(Color c) const { + return pieceList[make_piece(c, Pt)]; +} + +template inline Square Position::square(Color c) const { + assert(pieceCount[make_piece(c, Pt)] == 1); + return pieceList[make_piece(c, Pt)][0]; +} + +inline Square Position::ep_square() const { + return st->epSquare; +} + +inline int Position::can_castle(CastlingRight cr) const { + return st->castlingRights & cr; +} + +inline int Position::can_castle(Color c) const { + return st->castlingRights & ((WHITE_OO | WHITE_OOO) << (2 * c)); +} + +inline bool Position::castling_impeded(CastlingRight cr) const { + return byTypeBB[ALL_PIECES] & castlingPath[cr]; +} + +inline Square Position::castling_rook_square(CastlingRight cr) const { + return castlingRookSquare[cr]; +} + +template +inline Bitboard Position::attacks_from(Square s) const { + assert(Pt != PAWN); + return Pt == BISHOP || Pt == ROOK ? attacks_bb(s, byTypeBB[ALL_PIECES]) + : Pt == QUEEN ? attacks_from(s) | attacks_from(s) + : PseudoAttacks[Pt][s]; +} + +template<> +inline Bitboard Position::attacks_from(Square s, Color c) const { + return PawnAttacks[c][s]; +} + +inline Bitboard Position::attacks_from(PieceType pt, Square s) const { + return attacks_bb(pt, s, byTypeBB[ALL_PIECES]); +} + +inline Bitboard Position::attackers_to(Square s) const { + return attackers_to(s, byTypeBB[ALL_PIECES]); +} + +inline Bitboard Position::checkers() const { + return st->checkersBB; +} + +inline Bitboard Position::blockers_for_king(Color c) const { + return st->blockersForKing[c]; +} + +inline Bitboard Position::check_squares(PieceType pt) const { + return st->checkSquares[pt]; +} + +inline bool Position::pawn_passed(Color c, Square s) const { + return !(pieces(~c, PAWN) & passed_pawn_mask(c, s)); +} + +inline bool Position::advanced_pawn_push(Move m) const { + return type_of(moved_piece(m)) == PAWN + && relative_rank(sideToMove, from_sq(m)) > RANK_4; +} +inline bool Position::promotion_pawn_push(Move m) const { + return type_of(moved_piece(m)) == PAWN + && relative_rank(sideToMove, to_sq(m)) == RANK_8; +}//MichaelB7 + +inline Key Position::key() const { + return st->key; +} + +inline Key Position::pawn_key() const { + return st->pawnKey; +} + +inline Key Position::material_key() const { + return st->materialKey; +} + +inline Score Position::psq_score() const { + return psq; +} + +inline Value Position::non_pawn_material(Color c) const { + return st->nonPawnMaterial[c]; +} + +inline Value Position::non_pawn_material() const { + return st->nonPawnMaterial[WHITE] + st->nonPawnMaterial[BLACK]; +} + +inline int Position::game_ply() const { + return gamePly; +} + +inline int Position::rule50_count() const { + return st->rule50; +} + +inline bool Position::opposite_bishops() const { + return pieceCount[W_BISHOP] == 1 + && pieceCount[B_BISHOP] == 1 + && opposite_colors(square(WHITE), square(BLACK)); +} + +inline bool Position::is_chess960() const { + return chess960; +} + +inline bool Position::capture_or_promotion(Move m) const { + assert(is_ok(m)); + return type_of(m) != NORMAL ? type_of(m) != CASTLING : !empty(to_sq(m)); +} + +inline bool Position::capture(Move m) const { + assert(is_ok(m)); + // Castling is encoded as "king captures rook" + return (!empty(to_sq(m)) && type_of(m) != CASTLING) || type_of(m) == ENPASSANT; +} + +inline Piece Position::captured_piece() const { + return st->capturedPiece; +} + +inline Thread* Position::this_thread() const { + return thisThread; +} + +inline void Position::put_piece(Piece pc, Square s) { + + board[s] = pc; + byTypeBB[ALL_PIECES] |= s; + byTypeBB[type_of(pc)] |= s; + byColorBB[color_of(pc)] |= s; + index[s] = pieceCount[pc]++; + pieceList[pc][index[s]] = s; + pieceCount[make_piece(color_of(pc), ALL_PIECES)]++; + psq += PSQT::psq[pc][s]; +} + +inline void Position::remove_piece(Piece pc, Square s) { + + // WARNING: This is not a reversible operation. If we remove a piece in + // do_move() and then replace it in undo_move() we will put it at the end of + // the list and not in its original place, it means index[] and pieceList[] + // are not invariant to a do_move() + undo_move() sequence. + byTypeBB[ALL_PIECES] ^= s; + byTypeBB[type_of(pc)] ^= s; + byColorBB[color_of(pc)] ^= s; + /* board[s] = NO_PIECE; Not needed, overwritten by the capturing one */ + Square lastSquare = pieceList[pc][--pieceCount[pc]]; + index[lastSquare] = index[s]; + pieceList[pc][index[lastSquare]] = lastSquare; + pieceList[pc][pieceCount[pc]] = SQ_NONE; + pieceCount[make_piece(color_of(pc), ALL_PIECES)]--; + psq -= PSQT::psq[pc][s]; +} + +inline void Position::move_piece(Piece pc, Square from, Square to) { + + // index[from] is not updated and becomes stale. This works as long as index[] + // is accessed just by known occupied squares. + Bitboard fromTo = SquareBB[from] ^ SquareBB[to]; + byTypeBB[ALL_PIECES] ^= fromTo; + byTypeBB[type_of(pc)] ^= fromTo; + byColorBB[color_of(pc)] ^= fromTo; + board[from] = NO_PIECE; + board[to] = pc; + index[to] = index[from]; + pieceList[pc][index[to]] = to; + psq += PSQT::psq[pc][to] - PSQT::psq[pc][from]; +} + +inline void Position::do_move(Move m, StateInfo& newSt) { + do_move(m, newSt, gives_check(m)); +} + +#endif // #ifndef POSITION_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/psqt.cpp b/Engines/Windows/mcbrain/src/psqt.cpp new file mode 100644 index 0000000..c51e594 --- /dev/null +++ b/Engines/Windows/mcbrain/src/psqt.cpp @@ -0,0 +1,127 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include + +#include "types.h" + +Value PieceValue[PHASE_NB][PIECE_NB] = { + { VALUE_ZERO, PawnValueMg, KnightValueMg, BishopValueMg, RookValueMg, QueenValueMg }, + { VALUE_ZERO, PawnValueEg, KnightValueEg, BishopValueEg, RookValueEg, QueenValueEg } +}; + +namespace PSQT { + +#define S(mg, eg) make_score(mg, eg) + +// Bonus[PieceType][Square / 2] contains Piece-Square scores. For each piece +// type on a given square a (middlegame, endgame) score pair is assigned. Table +// is defined for files A..D and white side: it is symmetric for black side and +// second half of the files. +constexpr Score Bonus[][RANK_NB][int(FILE_NB) / 2] = { + { }, + { // Pawn + { S( 0, 0), S( 0, 0), S( 0, 0), S( 0, 0) }, + { S(-11, 7), S( 6,-4), S( 7, 8), S( 3,-2) }, + { S(-18,-4), S( -2,-5), S( 19, 5), S(24, 4) }, + { S(-17, 3), S( -9, 3), S( 20,-8), S(35,-3) }, + { S( -6, 8), S( 5, 9), S( 3, 7), S(21,-6) }, + { S( -6, 8), S( -8,-5), S( -6, 2), S(-2, 4) }, + { S( -4, 3), S( 20,-9), S( -8, 1), S(-4,18) } + }, + { // Knight + { S(-161,-105), S(-96,-82), S(-80,-46), S(-73,-14) }, + { S( -83, -69), S(-43,-54), S(-21,-17), S(-10, 9) }, + { S( -71, -50), S(-22,-39), S( 0, -7), S( 9, 28) }, + { S( -25, -41), S( 18,-25), S( 43, 6), S( 47, 38) }, + { S( -26, -46), S( 16,-25), S( 38, 3), S( 50, 40) }, + { S( -11, -54), S( 37,-38), S( 56, -7), S( 65, 27) }, + { S( -63, -65), S(-19,-50), S( 5,-24), S( 14, 13) }, + { S(-195,-109), S(-67,-89), S(-42,-50), S(-29,-13) } + }, + { // Bishop + { S(-64,-58), S(-13,-31), S(-25,-37), S(-34,-19) }, + { S(-20,-34), S( 0, -9), S( 12,-14), S( 1, 4) }, + { S( -9,-23), S( 27, 0), S( 1, -3), S( 11, 16) }, + { S(-11,-26), S( 28, -3), S( 21, -5), S( 32, 16) }, + { S(-11,-26), S( 27, -4), S( 16, -7), S( 31, 14) }, + { S(-17,-24), S( 16, -2), S( -8, 0), S( 2, 13) }, + { S(-23,-34), S( -3,-10), S( 6,-12), S( -2, 6) }, + { S(-55,-55), S(-11,-32), S(-19,-36), S(-29,-17) } + }, + { // Rook + { S(-25, 0), S(-16, 0), S(-16, 0), S(-9, 0) }, + { S(-21, 0), S( -8, 0), S( -3, 0), S( 0, 0) }, + { S(-21, 0), S( -9, 0), S( -4, 0), S( 2, 0) }, + { S(-22, 0), S( -6, 0), S( -1, 0), S( 2, 0) }, + { S(-22, 0), S( -7, 0), S( 0, 0), S( 1, 0) }, + { S(-21, 0), S( -7, 0), S( 0, 0), S( 2, 0) }, + { S(-12, 0), S( 4, 0), S( 8, 0), S(12, 0) }, + { S(-23, 0), S(-15, 0), S(-11, 0), S(-5, 0) } + }, + { // Queen + { S( 0,-71), S(-4,-56), S(-3,-42), S(-1,-29) }, + { S(-4,-56), S( 6,-30), S( 9,-21), S( 8, -5) }, + { S(-2,-39), S( 6,-17), S( 9, -8), S( 9, 5) }, + { S(-1,-29), S( 8, -5), S(10, 9), S( 7, 19) }, + { S(-3,-27), S( 9, -5), S( 8, 10), S( 7, 21) }, + { S(-2,-40), S( 6,-16), S( 8,-10), S(10, 3) }, + { S(-2,-55), S( 7,-30), S( 7,-21), S( 6, -6) }, + { S(-1,-74), S(-4,-55), S(-1,-43), S( 0,-30) } + }, + { // King + { S(272, 0), S(325, 41), S(273, 80), S(190, 93) }, + { S(277, 57), S(305, 98), S(241,138), S(183,131) }, + { S(198, 86), S(253,138), S(168,165), S(120,173) }, + { S(169,103), S(191,152), S(136,168), S(108,169) }, + { S(145, 98), S(176,166), S(112,197), S(69, 194) }, + { S(122, 87), S(159,164), S(85, 174), S(36, 189) }, + { S(87, 40), S(120, 99), S(64, 128), S(25, 141) }, + { S(64, 5), S(87, 60), S(49, 75), S(0, 75) } + } +}; + +#undef S + +Score psq[PIECE_NB][SQUARE_NB]; + +// init() initializes piece-square tables: the white halves of the tables are +// copied from Bonus[] adding the piece value, then the black halves of the +// tables are initialized by flipping and changing the sign of the white scores. +void init() { + + for (Piece pc = W_PAWN; pc <= W_KING; ++pc) + { + PieceValue[MG][~pc] = PieceValue[MG][pc]; + PieceValue[EG][~pc] = PieceValue[EG][pc]; + + Score score = make_score(PieceValue[MG][pc], PieceValue[EG][pc]); + + for (Square s = SQ_A1; s <= SQ_H8; ++s) + { + File f = std::min(file_of(s), ~file_of(s)); + psq[ pc][ s] = score + Bonus[pc][rank_of(s)][f]; + psq[~pc][~s] = -psq[pc][s]; + } + } +} + +} // namespace PSQT diff --git a/Engines/Windows/mcbrain/src/search.cpp b/Engines/Windows/mcbrain/src/search.cpp new file mode 100644 index 0000000..895952e --- /dev/null +++ b/Engines/Windows/mcbrain/src/search.cpp @@ -0,0 +1,1833 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include +#include // For std::memset +#include //for sleep //MichaelB7 +#include +#include +#include +#include "book.h" +#include "evaluate.h" +#include "misc.h" +#include "movegen.h" +#include "movepick.h" +#include "position.h" +#include "polybook.h" +#include "search.h" +#include "thread.h" +#include "timeman.h" +#include "tt.h" +#include "uci.h" +#include "syzygy/tbprobe.h" + +namespace Search { + + LimitsType Limits; +} + +namespace Tablebases { + + int Cardinality; + bool RootInTB; + bool UseRule50; + Depth ProbeDepth; +} + +namespace TB = Tablebases; + +using std::string; +using Eval::evaluate; +using namespace Search; + +namespace { + + // Different node types, used as a template parameter + enum NodeType { NonPV, PV }; + + // Sizes and phases of the skip-blocks, used for distributing search depths across the threads + constexpr int SkipSize[] = { 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4 }; + constexpr int SkipPhase[] = { 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7 }; + + // Razor and futility margins + constexpr int RazorMargin = 600; + Value futility_margin(Depth d, bool improving) { + return Value((175 - 50 * improving) * d / ONE_PLY); + } + + // Futility and reductions lookup tables, initialized at startup + int FutilityMoveCounts[2][16]; // [improving][depth] + int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber] + + template Depth reduction(bool i, Depth d, int mn) { + return Reductions[PvNode][i][std::min(d / ONE_PLY, 63)][std::min(mn, 63)] * ONE_PLY; + } + + // History and stats update bonus, based on depth + int stat_bonus(Depth depth) { + int d = depth / ONE_PLY; + return d > 17 ? 0 : 29 * d * d + 138 * d - 134; + } + + // Skill structure is used to implement strength limit + struct Skill { + explicit Skill(int l) : level(l) {} + bool enabled() const { return level < 20; } + bool time_to_pick(Depth depth) const { return depth / ONE_PLY == 1 + level; } + Move pick_best(size_t multiPV); + + int level; + Move best = MOVE_NONE; + }; + + bool doNull, doLMR, cleanSearch, limitStrength, bookEnabled, bruteForce, minOutput; + Depth maxLMR; + + int tactical, variety; + + template + Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode); + + template + Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth = DEPTH_ZERO); + + Value value_to_tt(Value v, int ply); + Value value_from_tt(Value v, int ply); + void update_pv(Move* pv, Move move, Move* childPv); + void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus); + void update_quiet_stats(const Position& pos, Stack* ss, Move move, Move* quiets, int quietsCnt, int bonus); + void update_capture_stats(const Position& pos, Move move, Move* captures, int captureCnt, int bonus); + bool PV_is_draw(Position& pos); + + inline bool gives_check(const Position& pos, Move move) { + Color us = pos.side_to_move(); + return type_of(move) == NORMAL && !(pos.blockers_for_king(~us) & pos.pieces(us)) + ? pos.check_squares(type_of(pos.moved_piece(move))) & to_sq(move) + : pos.gives_check(move); + } + + // perft() is our utility to verify move generation. All the leaf nodes up + // to the given depth are generated and counted, and the sum is returned. + template + uint64_t perft(Position& pos, Depth depth) { + + StateInfo st; + uint64_t cnt, nodes = 0; + const bool leaf = (depth == 2 * ONE_PLY); + + for (const auto& m : MoveList(pos)) + { + if (Root && depth <= ONE_PLY) + cnt = 1, nodes++; + else + { + pos.do_move(m, st); + cnt = leaf ? MoveList(pos).size() : perft(pos, depth - ONE_PLY); + nodes += cnt; + pos.undo_move(m); + } + if (Root) + sync_cout << UCI::move(m, pos.is_chess960()) << ": " << cnt << sync_endl; + } + return nodes; + } + +} // namespace + + +/// Search::init() is called at startup to initialize various lookup tables + +void Search::init(bool OptioncleanSearch) { + cleanSearch = OptioncleanSearch; + + for (int imp = 0; imp <= 1; ++imp) + for (int d = 1; d < 64; ++d) + for (int mc = 1; mc < 64; ++mc) + { + double r = log(d) * log(mc) / 1.95; + + Reductions[NonPV][imp][d][mc] = int(std::round(r)); + Reductions[PV][imp][d][mc] = std::max(Reductions[NonPV][imp][d][mc] - 1, 0); + + // Increase reduction for non-PV nodes when eval is not improving + if (!imp && r > 1.0) + Reductions[NonPV][imp][d][mc]++; + } + + for (int d = 0; d < 16; ++d) + { + FutilityMoveCounts[0][d] = int(2.4 + 0.74 * pow(d, 1.78)); + FutilityMoveCounts[1][d] = int(5.0 + 1.00 * pow(d, 2.00)); + } +} + + +/// Search::clear() resets search state to its initial value + +void Search::clear() { +//Hash + if (Options["NeverClearHash"]) + return; +//end_Hash + + Threads.main()->wait_for_search_finished(); + + Time.availableNodes = 0; + TT.clear(); + Threads.clear(); +} + + +/// MainThread::search() is called by the main thread when the program receives +/// the UCI 'go' command. It searches from the root position and outputs the "bestmove". + +void MainThread::search() { + + if (Limits.perft) + { + nodes = perft(rootPos, Limits.perft * ONE_PLY); + sync_cout << "\nNodes searched: " << nodes << "\n" << sync_endl; + return; + } + + static PolyglotBook book; // Defined static to initialize the PRNG only once + limitStrength = Options["UCI_LimitStrength"]; + int uci_elo = (Options["UCI_ELO"]); + + + bookEnabled = Options["Book_Enabled"]; + Color us = rootPos.side_to_move(); + Time.init(Limits, us, rootPos.game_ply()); +//Hash + if (!Limits.infinite) + TT.new_search(); + else + TT.infinite_search(); +//end_hash + + // Read search options + bruteForce = Options["BruteForce"]; + doNull = Options["NullMove"]; + doLMR = Options["LMR"]; + maxLMR = Options["MaxLMReduction"] * ONE_PLY; + tactical = Options["ICCF Analysis"]; + variety = Options["Variety"]; + + if (rootMoves.empty()) + { + rootMoves.emplace_back(MOVE_NONE); + sync_cout << "info depth 0 score " + << UCI::value(rootPos.checkers() ? -VALUE_MATE : VALUE_DRAW) + << sync_endl; + } + else + { + if (bool(Options["OwnBook"]) && !Limits.infinite && !Limits.mate) + { + Move bookMove = book.probe(rootPos, Options["Book File"], Options["Best Book Line"]); + + if (bookMove && std::count(rootMoves.begin(), rootMoves.end(), bookMove)) + { + std::swap(rootMoves[0], *std::find(rootMoves.begin(), rootMoves.end(), bookMove)); + goto finalize; + } + } + Move bookMove = MOVE_NONE; + + if (!Limits.infinite && !Limits.mate) + bookMove = polybook.probe(rootPos); + + if (bookEnabled && bookMove && std::count(rootMoves.begin(), rootMoves.end(), bookMove)) + { + for (Thread* th : Threads) + std::swap(th->rootMoves[0], *std::find(th->rootMoves.begin(), th->rootMoves.end(), bookMove)); + } + else + { + + if (limitStrength) + { + std::mt19937 gen(now()); + std::uniform_int_distribution dis(-33, 33); + int rand = dis(gen); + uci_elo += rand; + int NodesToSearch = pow(1.005958946,(((uci_elo)/1500) - 1 ) + + (uci_elo - 1500)) * 32 ; + Limits.nodes = NodesToSearch; + + Limits.nodes *= Time.optimum()/1000 ; + std::this_thread::sleep_for (std::chrono::seconds(Time.optimum()/1000) * (1 - Limits.nodes/724000)); + } + + + + + for (Thread* th : Threads) + if (th != this) + th->start_searching(); + + Thread::search(); // Let's start searching! + } + } + +finalize: + // When we reach the maximum depth, we can arrive here without a raise of + // Threads.stop. However, if we are pondering or in an infinite search, + // the UCI protocol states that we shouldn't print the best move before the + // GUI sends a "stop" or "ponderhit" command. We therefore simply wait here + // until the GUI sends one of those commands (which also raises Threads.stop). + Threads.stopOnPonderhit = true; + + while (!Threads.stop && (Threads.ponder || Limits.infinite)) + {} // Busy wait for a stop or a ponder reset + + // Stop the threads if not already stopped (also raise the stop if + // "ponderhit" just reset Threads.ponder). + Threads.stop = true; + + // Wait until all threads have finished + for (Thread* th : Threads) + if (th != this) + th->wait_for_search_finished(); + + // When playing in 'nodes as time' mode, subtract the searched nodes from + // the available ones before exiting. + if (Limits.npmsec) + Time.availableNodes += Limits.inc[us] - Threads.nodes_searched(); + + // Check if there are threads with a better score than main thread + Thread* bestThread = this; + if ( int(Options["MultiPV"]) == 1 + && !Limits.depth + && !Skill(int(Options["Skill Level"])).enabled() + && rootMoves[0].pv[0] != MOVE_NONE) + { + std::map votes; + Value minScore = this->rootMoves[0].score; + + // Find out minimum score and reset votes for moves which can be voted + for (Thread* th: Threads) + { + minScore = std::min(minScore, th->rootMoves[0].score); + votes[th->rootMoves[0].pv[0]] = 0; + } + + // Vote according to score and depth + for (Thread* th : Threads) + votes[th->rootMoves[0].pv[0]] += int(th->rootMoves[0].score - minScore) + + int(th->completedDepth); + + // Select best thread + int bestVote = votes[this->rootMoves[0].pv[0]]; + for (Thread* th : Threads) + { + if (votes[th->rootMoves[0].pv[0]] > bestVote) + { + bestVote = votes[th->rootMoves[0].pv[0]]; + bestThread = th; + } + } + } + + previousScore = bestThread->rootMoves[0].score; + + // Send again PV info if we have a new best thread + if (bestThread != this) + sync_cout << UCI::pv(bestThread->rootPos, bestThread->completedDepth, -VALUE_INFINITE, VALUE_INFINITE) << sync_endl; + + sync_cout << "bestmove " << UCI::move(bestThread->rootMoves[0].pv[0], rootPos.is_chess960()); + + if (bestThread->rootMoves[0].pv.size() > 1 || bestThread->rootMoves[0].extract_ponder_from_tt(rootPos)) + std::cout << " ponder " << UCI::move(bestThread->rootMoves[0].pv[1], rootPos.is_chess960()); + + std::cout << sync_endl; +} + + +/// Thread::search() is the main iterative deepening loop. It calls search() +/// repeatedly with increasing depth until the allocated thinking time has been +/// consumed, the user stops the search, or the maximum search depth is reached. + +void Thread::search() { + + Stack stack[MAX_PLY+7], *ss = stack+4; // To reference from (ss-4) to (ss+2) + Value bestValue, alpha, beta, delta; + Move lastBestMove = MOVE_NONE; + Depth lastBestMoveDepth = DEPTH_ZERO; + MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); + double timeReduction = 1.0; + Color us = rootPos.side_to_move(); + bool failedLow; + + std::memset(ss-4, 0, 7 * sizeof(Stack)); + for (int i = 4; i > 0; i--) + (ss-i)->continuationHistory = &this->continuationHistory[NO_PIECE][0]; // Use as sentinel + + if (cleanSearch) + Search::clear(); + + bestValue = delta = alpha = -VALUE_INFINITE; + beta = VALUE_INFINITE; + + if (mainThread) + mainThread->bestMoveChanges = 0, failedLow = false; + + size_t multiPV = Options["MultiPV"]; + int local_int = Options["Skill Level"]; + Skill skill(local_int); + + if (tactical) multiPV = size_t(pow(2, tactical)); + + // When playing with strength handicap enable MultiPV search that we will + // use behind the scenes to retrieve a set of possible moves. + if (skill.enabled()) + multiPV = std::max(multiPV, (size_t)4); + + multiPV = std::min(multiPV, rootMoves.size()); + + int ct = int(Options["Contempt"]) * PawnValueEg / 100; // From centipawns + + // In analysis mode, adjust contempt in accordance with user preference + if (Limits.infinite || bool(Options["UCI_AnalyseMode"])) + ct = Options["Analysis Contempt"] == "Off" ? 0 + : Options["Analysis Contempt"] == "Both" ? ct + : Options["Analysis Contempt"] == "White" && us == BLACK ? -ct + : Options["Analysis Contempt"] == "Black" && us == WHITE ? -ct + : ct; + + // In evaluate.cpp the evaluation is from the white point of view + contempt = (us == WHITE ? make_score(ct, ct / 2) + : -make_score(ct, ct / 2)); + pvDraw = false; + + // Iterative deepening loop until requested to stop or the target depth is reached + while ( (rootDepth += ONE_PLY) < DEPTH_MAX + && rootDepth <= MAX_PLY-1 + && !Threads.stop + && !(Limits.depth && mainThread && rootDepth / ONE_PLY > Limits.depth)) + { + // Distribute search depths across the helper threads + if (idx > 0) + { + int i = (idx - 1) % 20; + if (((rootDepth / ONE_PLY + SkipPhase[i]) / SkipSize[i]) % 2) + continue; // Retry with an incremented rootDepth + } + + // Age out PV variability metric + if (mainThread) + mainThread->bestMoveChanges *= 0.517, failedLow = false; + + // Save the last iteration's scores before first PV line is searched and + // all the move scores except the (new) PV are set to -VALUE_INFINITE. + for (RootMove& rm : rootMoves) + rm.previousScore = rm.score; + + size_t pvFirst = 0; + pvLast = 0; + + // MultiPV loop. We perform a full root search for each PV line + for (pvIdx = 0; pvIdx < multiPV && !Threads.stop; ++pvIdx) + { + if (pvIdx == pvLast) + { + pvFirst = pvLast; + for (pvLast++; pvLast < rootMoves.size(); pvLast++) + if (rootMoves[pvLast].tbRank != rootMoves[pvFirst].tbRank) + break; + } + + // Reset UCI info selDepth for each depth and each PV line + selDepth = 0; + + // Reset aspiration window starting size + if (rootDepth >= 5 * ONE_PLY) + { + Value previousScore = rootMoves[pvIdx].previousScore; + delta = Value(18); + alpha = std::max(previousScore - delta,-VALUE_INFINITE); + beta = std::min(previousScore + delta, VALUE_INFINITE); + + // Adjust contempt based on root move's previousScore (dynamic contempt) + int dct = ct + 88 * previousScore / (abs(previousScore) + 200); + + contempt = (us == WHITE ? make_score(dct, dct / 2) + : -make_score(dct, dct / 2)); + } + + // Start with a small aspiration window and, in the case of a fail + // high/low, re-search with a bigger window until we don't fail + // high/low anymore. + while (true) + { + bestValue = ::search(rootPos, ss, alpha, beta, rootDepth, false); + + // Bring the best move to the front. It is critical that sorting + // is done with a stable algorithm because all the values but the + // first and eventually the new best one are set to -VALUE_INFINITE + // and we want to keep the same order for all the moves except the + // new PV that goes to the front. Note that in case of MultiPV + // search the already searched PV lines are preserved. + std::stable_sort(rootMoves.begin() + pvIdx, rootMoves.begin() + pvLast); + + // If search has been stopped, we break immediately. Sorting is + // safe because RootMoves is still valid, although it refers to + // the previous iteration. + if (Threads.stop) + break; + + // record if the PV is draw + pvDraw = ::PV_is_draw(rootPos); + + // When failing high/low give some update (without cluttering + // the UI) before a re-search. + if ( mainThread + && multiPV == 1 + && (bestValue <= alpha || bestValue >= beta) + && Time.elapsed() > 3000) + sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; + + // In case of failing low/high increase aspiration window and + // re-search, otherwise exit the loop. + if (bestValue <= alpha) + { + beta = (alpha + beta) / 2; + alpha = std::max(bestValue - delta, -VALUE_INFINITE); + + if (mainThread) + { + failedLow = true; + Threads.stopOnPonderhit = false; + } + } + else if (bestValue >= beta) + beta = std::min(bestValue + delta, VALUE_INFINITE); + else + break; + + delta += delta / 4 + 5; + + assert(alpha >= -VALUE_INFINITE && beta <= VALUE_INFINITE); + } + + // Sort the PV lines searched so far and update the GUI + std::stable_sort(rootMoves.begin() + pvFirst, rootMoves.begin() + pvIdx + 1); + + if ( mainThread + && (Threads.stop || pvIdx + 1 == multiPV || Time.elapsed() > 3000)) + sync_cout << UCI::pv(rootPos, rootDepth, alpha, beta) << sync_endl; + } + + if (!Threads.stop) + completedDepth = rootDepth; + + if (rootMoves[0].pv[0] != lastBestMove) { + lastBestMove = rootMoves[0].pv[0]; + lastBestMoveDepth = rootDepth; + } + + // Have we found a "mate in x"? + if ( Limits.mate + && bestValue >= VALUE_MATE_IN_MAX_PLY + && VALUE_MATE - bestValue <= 2 * Limits.mate) + Threads.stop = true; + + if (!mainThread) + continue; +//BEGINS MichaelB7 + if (Options["FastPlay"]) + { + if ( Time.elapsed() > Time.optimum() / 256 + && ( abs(bestValue) > 12300 || abs(bestValue) >= VALUE_MATE_IN_MAX_PLY )) + Threads.stop = true; + } +//ENDS MichaelB7 + // If skill level is enabled and time is up, pick a sub-optimal best move + if (skill.enabled() && skill.time_to_pick(rootDepth)) + skill.pick_best(multiPV); + + // Do we have time for the next iteration? Can we stop searching now? + if ( Limits.use_time_management() + && !Threads.stop + && !Threads.stopOnPonderhit) + { + const int F[] = { failedLow, + bestValue - mainThread->previousScore }; + + int improvingFactor = std::max(246, std::min(832, 306 + 119 * F[0] - 6 * F[1])); + + // If the bestMove is stable over several iterations, reduce time accordingly + timeReduction = 1.0; + for (int i : {3, 4, 5}) + if (lastBestMoveDepth * i < completedDepth) + timeReduction *= 1.25; + + // Use part of the gained time from a previous stable move for the current move + double bestMoveInstability = 1.0 + mainThread->bestMoveChanges; + bestMoveInstability *= std::pow(mainThread->previousTimeReduction, 0.528) / timeReduction; + + // Stop the search if we have only one legal move, or if available time elapsed + if ( rootMoves.size() == 1 + || Time.elapsed() > Time.optimum() * bestMoveInstability * improvingFactor / 581) + { + // If we are allowed to ponder do not stop the search now but + // keep pondering until the GUI sends "ponderhit" or "stop". + if (Threads.ponder) + Threads.stopOnPonderhit = true; + else + Threads.stop = true; + } + } + } + + if (!mainThread) + return; + + mainThread->previousTimeReduction = timeReduction; + + // If skill level is enabled, swap best PV line with the sub-optimal one + if (skill.enabled()) + std::swap(rootMoves[0], *std::find(rootMoves.begin(), rootMoves.end(), + skill.best ? skill.best : skill.pick_best(multiPV))); +} + + +namespace { + + // search<>() is the main search function for both PV and non-PV nodes + + template + Value search(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth, bool cutNode) { + + constexpr bool PvNode = NT == PV; + const bool rootNode = PvNode && ss->ply == 0; + + // Check if we have an upcoming move which draws by repetition, or + // if the opponent had an alternative move earlier to this position. + if ( pos.rule50_count() >= 3 + && alpha < VALUE_DRAW + && !rootNode + && pos.has_game_cycle(ss->ply)) + { + alpha = VALUE_DRAW; + if (alpha >= beta) + return alpha; + } + + // Dive into quiescence search when the depth reaches zero + if (depth < ONE_PLY) + return qsearch(pos, ss, alpha, beta); + + assert(-VALUE_INFINITE <= alpha && alpha < beta && beta <= VALUE_INFINITE); + assert(PvNode || (alpha == beta - 1)); + assert(DEPTH_ZERO < depth && depth < DEPTH_MAX); + assert(!(PvNode && cutNode)); + assert(depth / ONE_PLY * ONE_PLY == depth); + + Move pv[MAX_PLY+1], capturesSearched[32], quietsSearched[64]; + StateInfo st; + TTEntry* tte; + Key posKey; + Move ttMove, move, excludedMove, bestMove; + Depth extension, newDepth; + Value bestValue, value, ttValue, eval, maxValue, pureStaticEval; + bool ttHit, inCheck, givesCheck, improving; + bool captureOrPromotion, doFullDepthSearch, moveCountPruning, skipQuiets, ttCapture, pvExact; + Piece movedPiece; + int moveCount, captureCount, quietCount; + + // Step 1. Initialize node + Thread* thisThread = pos.this_thread(); + inCheck = pos.checkers(); + Color us = pos.side_to_move(); + moveCount = captureCount = quietCount = ss->moveCount = 0; + bestValue = -VALUE_INFINITE; + maxValue = VALUE_INFINITE; + + // Check for the available remaining time + if (thisThread == Threads.main()) + static_cast(thisThread)->check_time(); + + // Used to send selDepth info to GUI (selDepth counts from 1, ply from 0) + if (PvNode && thisThread->selDepth < ss->ply + 1) + thisThread->selDepth = ss->ply + 1; + + if (!rootNode) + { + // Step 2. Check for aborted search and immediate draw + if ( Threads.stop.load(std::memory_order_relaxed) + || pos.is_draw(ss->ply) + || ss->ply >= MAX_PLY) + return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) - 10 * ((ss-1)->statScore > 0) + : VALUE_DRAW; + + // Step 3. Mate distance pruning. Even if we mate at the next move our score + // would be at best mate_in(ss->ply+1), but if alpha is already bigger because + // a shorter mate was found upward in the tree then there is no need to search + // because we will never beat the current alpha. Same logic but with reversed + // signs applies also in the opposite condition of being mated instead of giving + // mate. In this case return a fail-high score. + alpha = std::max(mated_in(ss->ply), alpha); + beta = std::min(mate_in(ss->ply+1), beta); + if (alpha >= beta) + return alpha; + } + + assert(0 <= ss->ply && ss->ply < MAX_PLY); + + (ss+1)->ply = ss->ply + 1; + ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE; + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; + (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; + Square prevSq = to_sq((ss-1)->currentMove); + + // Initialize statScore to zero for the grandchildren of the current position. + // So statScore is shared between all grandchildren and only the first grandchild + // starts with statScore = 0. Later grandchildren start with the last calculated + // statScore of the previous grandchild. This influences the reduction rules in + // LMR which are based on the statScore of parent position. + (ss+2)->statScore = 0; + + // Step 4. Transposition table lookup. We don't want the score of a partial + // search to overwrite a previous full search TT value, so we use a different + // position key in case of an excluded move. + excludedMove = ss->excludedMove; + posKey = pos.key() ^ Key(excludedMove << 16); // Isn't a very good hash + tte = TT.probe(posKey, ttHit); + ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; + ttMove = rootNode ? thisThread->rootMoves[thisThread->pvIdx].pv[0] + : ttHit ? tte->move() : MOVE_NONE; + + // At non-PV nodes we check for an early TT cutoff + if ( !PvNode + && !thisThread->pvDraw + && ttHit + && tte->depth() >= depth + && ttValue != VALUE_NONE // Possible in case of TT access race + && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) + : (tte->bound() & BOUND_UPPER))) + { + // If ttMove is quiet, update move sorting heuristics on TT hit + if (ttMove) + { + if (ttValue >= beta) + { + if (!pos.capture_or_promotion(ttMove)) + update_quiet_stats(pos, ss, ttMove, nullptr, 0, stat_bonus(depth)); + + // Extra penalty for a quiet TT move in previous ply when it gets refuted + if ((ss-1)->moveCount == 1 && !pos.captured_piece()) + update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY)); + } + // Penalty for a quiet ttMove that fails low + else if (!pos.capture_or_promotion(ttMove)) + { + int penalty = -stat_bonus(depth); + thisThread->mainHistory[us][from_to(ttMove)] << penalty; + update_continuation_histories(ss, pos.moved_piece(ttMove), to_sq(ttMove), penalty); + } + } + return ttValue; + } + + // Step 5. Tablebases probe + if (!rootNode && TB::Cardinality) + { + int piecesCount = pos.count(); + + if ( piecesCount <= TB::Cardinality + && (piecesCount < TB::Cardinality || depth >= TB::ProbeDepth) + && pos.rule50_count() == 0 + && !pos.can_castle(ANY_CASTLING)) + { + TB::ProbeState err; + TB::WDLScore wdl = Tablebases::probe_wdl(pos, &err); + + if (err != TB::ProbeState::FAIL) + { + thisThread->tbHits.fetch_add(1, std::memory_order_relaxed); + + int drawScore = TB::UseRule50 ? 1 : 0; + + value = wdl < -drawScore ? -VALUE_MATE + MAX_PLY + ss->ply + 1 + : wdl > drawScore ? VALUE_MATE - MAX_PLY - ss->ply - 1 + : VALUE_DRAW + 2 * wdl * drawScore; + + Bound b = wdl < -drawScore ? BOUND_UPPER + : wdl > drawScore ? BOUND_LOWER : BOUND_EXACT; + + if ( b == BOUND_EXACT + || (b == BOUND_LOWER ? value >= beta : value <= alpha)) + { + tte->save(posKey, value_to_tt(value, ss->ply), b, + std::min(DEPTH_MAX - ONE_PLY, depth + 6 * ONE_PLY), + MOVE_NONE, VALUE_NONE); + + return value; + } + + if (PvNode) + { + if (b == BOUND_LOWER) + bestValue = value, alpha = std::max(alpha, bestValue); + else + maxValue = value; + } + } + } + } + + // Step 6. Static evaluation of the position + if (inCheck) + { + ss->staticEval = eval = pureStaticEval = VALUE_NONE; + improving = false; + goto moves_loop; // Skip early pruning when in check + } + else if (ttHit) + { + // Never assume anything on values stored in TT + ss->staticEval = eval = pureStaticEval = tte->eval(); + if (eval == VALUE_NONE) + ss->staticEval = eval = pureStaticEval = evaluate(pos); + + // Can ttValue be used as a better position evaluation? + if ( ttValue != VALUE_NONE + && (tte->bound() & (ttValue > eval ? BOUND_LOWER : BOUND_UPPER))) + eval = ttValue; + } + else + { + if ((ss-1)->currentMove != MOVE_NULL) + { + int p = (ss-1)->statScore; + int bonus = p > 0 ? (-p - 2500) / 512 : + p < 0 ? (-p + 2500) / 512 : 0; + + pureStaticEval = evaluate(pos); + ss->staticEval = eval = pureStaticEval + bonus; + } + else + ss->staticEval = eval = pureStaticEval = -(ss-1)->staticEval + 2 * Eval::Tempo; + + tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, pureStaticEval); + } + + // Step 7. Razoring (~2 Elo) + if ( !bruteForce && depth < 2 * ONE_PLY + && eval <= alpha - RazorMargin) + return qsearch(pos, ss, alpha, beta); + + improving = ss->staticEval >= (ss-2)->staticEval + || (ss-2)->staticEval == VALUE_NONE; + + // Step 8. Futility pruning: child node (~30 Elo) + if ( !bruteForce && !rootNode + && depth < 7 * ONE_PLY + && eval - futility_margin(depth, improving) >= beta + && eval < VALUE_KNOWN_WIN) // Do not return unproven wins + return eval; + + // Step 9. Null move search with verification search (~40 Elo) + if ( doNull + && !PvNode + && (ss-1)->currentMove != MOVE_NULL + && (ss-1)->statScore < 23200 + && eval >= beta + && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225 + && !excludedMove + && thisThread->selDepth + 3 > thisThread->rootDepth / ONE_PLY // idea from Corchess/IIvec + && pos.non_pawn_material(us) + && (ss->ply >= thisThread->nmpMinPly || us != thisThread->nmpColor) + && !(MoveList(pos).size() == 1)) //MichaelB7 + { + assert(eval - beta >= 0); + + // Null move dynamic reduction based on depth and value + Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY; + + ss->currentMove = MOVE_NULL; + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; + + pos.do_null_move(st); + + Value nullValue = -search(pos, ss+1, -beta, -beta+1, depth-R, !cutNode); + + pos.undo_null_move(); + + if (nullValue >= beta) + { + // Do not return unproven mate scores + if (nullValue >= VALUE_MATE_IN_MAX_PLY) + nullValue = beta; + + if (thisThread->nmpMinPly || (abs(beta) < VALUE_KNOWN_WIN && depth < 12 * ONE_PLY)) + return nullValue; + + assert(!thisThread->nmpMinPly); // Recursive verification is not allowed + + // Do verification search at high depths, with null move pruning disabled + // for us, until ply exceeds nmpMinPly. + thisThread->nmpMinPly = ss->ply + 3 * (depth-R) / 4; + thisThread->nmpColor = us; + + Value v = search(pos, ss, beta-1, beta, depth-R, false); + + thisThread->nmpMinPly = 0; + + if (v >= beta) + return nullValue; + } + } + + // Step 10. ProbCut (~10 Elo) + // If we have a good enough capture and a reduced search returns a value + // much above beta, we can (almost) safely prune the previous move. + if ( !PvNode + && depth >= 5 * ONE_PLY + && abs(beta) < VALUE_MATE_IN_MAX_PLY) + { + Value rbeta = std::min(beta + 216 - 48 * improving, VALUE_INFINITE); + MovePicker mp(pos, ttMove, rbeta - ss->staticEval, &thisThread->captureHistory); + int probCutCount = 0; + + while ( (move = mp.next_move()) != MOVE_NONE + && probCutCount < 3) + if (move != excludedMove && pos.legal(move)) + { + probCutCount++; + + ss->currentMove = move; + ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; + + assert(depth >= 5 * ONE_PLY); + + pos.do_move(move, st); + + // Perform a preliminary qsearch to verify that the move holds + value = -qsearch(pos, ss+1, -rbeta, -rbeta+1); + + // If the qsearch held perform the regular search + if (value >= rbeta) + value = -search(pos, ss+1, -rbeta, -rbeta+1, depth - 4 * ONE_PLY, !cutNode); + + pos.undo_move(move); + + if (value >= rbeta) + return value; + } + } + + // Step 11. Internal iterative deepening (~2 Elo) + if ( depth >= 8 * ONE_PLY + && !ttMove) + { + search(pos, ss, alpha, beta, depth - 7 * ONE_PLY, cutNode); + + tte = TT.probe(posKey, ttHit); + ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; + ttMove = ttHit ? tte->move() : MOVE_NONE; + } + +moves_loop: // When in check, search starts from here + + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; + Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq]; + + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, + countermove, + ss->killers); + value = bestValue; // Workaround a bogus 'uninitialized' warning under gcc + + skipQuiets = false; + ttCapture = false; + pvExact = PvNode && ttHit && tte->bound() == BOUND_EXACT; + + // Step 12. Loop through all pseudo-legal moves until no moves remain + // or a beta cutoff occurs. + while ((move = mp.next_move(skipQuiets)) != MOVE_NONE) + { + assert(is_ok(move)); + + if (move == excludedMove) + continue; + + // At root obey the "searchmoves" option and skip moves not listed in Root + // Move List. As a consequence any illegal move is also skipped. In MultiPV + // mode we also skip PV moves which have been already searched and those + // of lower "TB rank" if we are in a TB root position. + if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->pvIdx, + thisThread->rootMoves.begin() + thisThread->pvLast, move)) + continue; + + ss->moveCount = ++moveCount; + + if (!minOutput && rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) + sync_cout << "info depth " << depth / ONE_PLY + << " currmove " << UCI::move(move, pos.is_chess960()) + << " currmovenumber " << moveCount + thisThread->pvIdx << sync_endl; + if (PvNode) + (ss+1)->pv = nullptr; + + extension = DEPTH_ZERO; + captureOrPromotion = pos.capture_or_promotion(move); + movedPiece = pos.moved_piece(move); + givesCheck = gives_check(pos, move); + + moveCountPruning = depth < 16 * ONE_PLY + && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY]; + + // Step 13. Extensions (~70 Elo) + + // Singular extension search (~60 Elo). If all moves but one fail low on a + // search of (alpha-s, beta-s), and just one fails high on (alpha, beta), + // then that move is singular and should be extended. To verify this we do + // a reduced search on on all the other moves but the ttMove and if the + // result is lower than ttValue minus a margin then we will extend the ttMove. + if ( depth >= 8 * ONE_PLY + && move == ttMove + && !rootNode + && !excludedMove // Recursive singular search is not allowed + && ttValue != VALUE_NONE + && (tte->bound() & BOUND_LOWER) + && tte->depth() >= depth - 3 * ONE_PLY + && pos.legal(move)) + { + Value rBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE); + ss->excludedMove = move; + value = search(pos, ss, rBeta - 1, rBeta, depth / 2, cutNode); + ss->excludedMove = MOVE_NONE; + + if (value < rBeta) + extension = ONE_PLY; + } + else if ( (givesCheck // Check extension (~2 Elo) + && !moveCountPruning + && pos.see_ge(move)) + || (pos.promotion_pawn_push(move) + && !moveCountPruning)) + extension = ONE_PLY; + + // Calculate new depth for this move + newDepth = depth - ONE_PLY + extension; + + // Step 14. Pruning at shallow depth (~170 Elo) + if ( !rootNode + && pos.non_pawn_material(us) + && bestValue > VALUE_MATED_IN_MAX_PLY) + { + if ( !captureOrPromotion + && !givesCheck + && (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= Value(5000))) + { + // Move count based pruning (~30 Elo) + if (moveCountPruning) + { + skipQuiets = true; + continue; + } + + // Reduced depth of the next LMR search + int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO) / ONE_PLY; + + // Countermoves based pruning (~20 Elo) + if ( lmrDepth < 3 + ((ss-1)->statScore > 0) + && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold + && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold) + continue; + + // Futility pruning: parent node (~2 Elo) + if ( lmrDepth < 7 + && !inCheck + && ss->staticEval + 256 + 200 * lmrDepth <= alpha) + continue; + + // Prune moves with negative SEE (~10 Elo) + if (!pos.see_ge(move, Value(-29 * lmrDepth * lmrDepth))) + continue; + } + else if ( !extension // (~20 Elo) + && !pos.see_ge(move, -PawnValueEg * (depth / ONE_PLY))) + continue; + } + + // Speculative prefetch as early as possible + prefetch(TT.first_entry(pos.key_after(move))); + + // Check for legality just before making the move + if (!rootNode && !pos.legal(move)) + { + ss->moveCount = --moveCount; + continue; + } + + if (move == ttMove && captureOrPromotion) + ttCapture = true; + + // Update the current move (this must be done after singular extension search) + ss->currentMove = move; + ss->continuationHistory = &thisThread->continuationHistory[movedPiece][to_sq(move)]; + + // Step 15. Make the move + pos.do_move(move, st, givesCheck); + + // Step 16. Reduced depth search (LMR). If the move fails high it will be + // re-searched at full depth. + if ( doLMR + && depth >= 3 * ONE_PLY + && moveCount > 1 + && (!captureOrPromotion || moveCountPruning)) + { + Depth r = reduction(improving, depth, moveCount); + + // Decrease reduction if opponent's move count is high (~10 Elo) + if ((ss-1)->moveCount > 15) + r -= ONE_PLY; + + if (!captureOrPromotion) + { + // Decrease reduction for exact PV nodes (~0 Elo) + if (pvExact) + r -= ONE_PLY; + + // Increase reduction if ttMove is a capture (~0 Elo) + if (ttCapture) + r += ONE_PLY; + + // Increase reduction for cut nodes (~5 Elo) + if (cutNode) + r += 2 * ONE_PLY; + + // Decrease reduction for moves that escape a capture. Filter out + // castling moves, because they are coded as "king captures rook" and + // hence break make_move(). (~5 Elo) + else if ( type_of(move) == NORMAL + && !pos.see_ge(make_move(to_sq(move), from_sq(move)))) + r -= 2 * ONE_PLY; + + ss->statScore = thisThread->mainHistory[us][from_to(move)] + + (*contHist[0])[movedPiece][to_sq(move)] + + (*contHist[1])[movedPiece][to_sq(move)] + + (*contHist[3])[movedPiece][to_sq(move)] + - 4000; + + // Decrease/increase reduction by comparing opponent's stat score (~10 Elo) + if (ss->statScore >= 0 && (ss-1)->statScore < 0) + r -= ONE_PLY; + + else if ((ss-1)->statScore >= 0 && ss->statScore < 0) + r += ONE_PLY; + + // Decrease/increase reduction for moves with a good/bad history (~30 Elo) + r -= ss->statScore / 20000 * ONE_PLY; + } + + // Set maximum reduction + r = std::min(r, maxLMR); + + Depth d = std::max(newDepth - std::max(r, DEPTH_ZERO), ONE_PLY); + + value = -search(pos, ss+1, -(alpha+1), -alpha, d, true); + + doFullDepthSearch = (value > alpha && d != newDepth); + } + else + doFullDepthSearch = !PvNode || moveCount > 1; + + // Step 17. Full depth search when LMR is skipped or fails high + if (doFullDepthSearch) + value = -search(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode); + + // For PV nodes only, do a full PV search on the first move or after a fail + // high (in the latter case search only if value < beta), otherwise let the + // parent node fail low with value <= alpha and try another move. + if (PvNode && (moveCount == 1 || (value > alpha && (rootNode || value < beta)))) + { + (ss+1)->pv = pv; + (ss+1)->pv[0] = MOVE_NONE; + + value = -search(pos, ss+1, -beta, -alpha, newDepth, false); + } + + // Step 18. Undo move + pos.undo_move(move); + + assert(value > -VALUE_INFINITE && value < VALUE_INFINITE); + + // Step 19. Check for a new best move + // Finished searching the move. If a stop occurred, the return value of + // the search cannot be trusted, and we return immediately without + // updating best move, PV and TT. + if (Threads.stop.load(std::memory_order_relaxed)) + return VALUE_ZERO; + + if (rootNode) + { + RootMove& rm = *std::find(thisThread->rootMoves.begin(), + thisThread->rootMoves.end(), move); + + // PV move or new best move? + if (moveCount == 1 || value > alpha) + { + rm.score = value; + rm.selDepth = thisThread->selDepth; + rm.pv.resize(1); + + assert((ss+1)->pv); + + for (Move* m = (ss+1)->pv; *m != MOVE_NONE; ++m) + rm.pv.push_back(*m); + + // We record how often the best move has been changed in each + // iteration. This information is used for time management: When + // the best move changes frequently, we allocate some more time. + if (moveCount > 1 && thisThread == Threads.main()) + ++static_cast(thisThread)->bestMoveChanges; + } + else + // All other moves but the PV are set to the lowest value: this + // is not a problem when sorting because the sort is stable and the + // move position in the list is preserved - just the PV is pushed up. + rm.score = -VALUE_INFINITE; + } + + if (value > bestValue) + { + bestValue = value; + + if (value > alpha) + { + bestMove = move; + + if (PvNode && !rootNode) // Update pv even in fail-high case + update_pv(ss->pv, move, (ss+1)->pv); + + if (PvNode && value < beta) // Update alpha! Always alpha < beta + alpha = value; + else + { + assert(value >= beta); // Fail high + ss->statScore = 0; + break; + } + } + } + + if (move != bestMove) + { + if (captureOrPromotion && captureCount < 32) + capturesSearched[captureCount++] = move; + + else if (!captureOrPromotion && quietCount < 64) + quietsSearched[quietCount++] = move; + } + } + + // The following condition would detect a stop only after move loop has been + // completed. But in this case bestValue is valid because we have fully + // searched our subtree, and we can anyhow save the result in TT. + /* + if (Threads.stop) + return VALUE_DRAW; + */ + + // Step 20. Check for mate and stalemate + // All legal moves have been searched and if there are no legal moves, it + // must be a mate or a stalemate. If we are in a singular extension search then + // return a fail low score. + + assert(moveCount || !inCheck || excludedMove || !MoveList(pos).size()); + + if (!moveCount) + bestValue = excludedMove ? alpha + : inCheck ? mated_in(ss->ply) : VALUE_DRAW; + else if (bestMove) + { + // Quiet best move: update move sorting heuristics + if (!pos.capture_or_promotion(bestMove)) + update_quiet_stats(pos, ss, bestMove, quietsSearched, quietCount, + stat_bonus(depth + (bestValue > beta + PawnValueMg ? ONE_PLY : DEPTH_ZERO))); + + update_capture_stats(pos, bestMove, capturesSearched, captureCount, stat_bonus(depth + ONE_PLY)); + + // Extra penalty for a quiet TT move in previous ply when it gets refuted + if ((ss-1)->moveCount == 1 && !pos.captured_piece()) + update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, -stat_bonus(depth + ONE_PLY)); + } + // Bonus for prior countermove that caused the fail low + else if ( (depth >= 3 * ONE_PLY || PvNode) + && !pos.captured_piece() + && is_ok((ss-1)->currentMove)) + update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth)); + + if (PvNode) + bestValue = std::min(bestValue, maxValue); + + if (!excludedMove) + tte->save(posKey, value_to_tt(bestValue, ss->ply), + bestValue >= beta ? BOUND_LOWER : + PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, + depth, bestMove, pureStaticEval); + + assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); + + return bestValue; + } + + + // qsearch() is the quiescence search function, which is called by the main + // search function with depth zero, or recursively with depth less than ONE_PLY. + template + Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) { + + constexpr bool PvNode = NT == PV; + + assert(alpha >= -VALUE_INFINITE && alpha < beta && beta <= VALUE_INFINITE); + assert(PvNode || (alpha == beta - 1)); + assert(depth <= DEPTH_ZERO); + assert(depth / ONE_PLY * ONE_PLY == depth); + + Move pv[MAX_PLY+1]; + StateInfo st; + TTEntry* tte; + Key posKey; + Move ttMove, move, bestMove; + Depth ttDepth; + Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha; + bool ttHit, inCheck, givesCheck, evasionPrunable; + int moveCount; + + if (PvNode) + { + oldAlpha = alpha; // To flag BOUND_EXACT when eval above alpha and no available moves + (ss+1)->pv = pv; + ss->pv[0] = MOVE_NONE; + } + + Thread* thisThread = pos.this_thread(); + (ss+1)->ply = ss->ply + 1; + ss->currentMove = bestMove = MOVE_NONE; + ss->continuationHistory = &thisThread->continuationHistory[NO_PIECE][0]; + inCheck = pos.checkers(); + moveCount = 0; + + // Check for an immediate draw or maximum ply reached + if ( pos.is_draw(ss->ply) + || ss->ply >= MAX_PLY) + return (ss->ply >= MAX_PLY && !inCheck) ? evaluate(pos) : VALUE_DRAW; + + assert(0 <= ss->ply && ss->ply < MAX_PLY); + + // Decide whether or not to include checks: this fixes also the type of + // TT entry depth that we are going to use. Note that in qsearch we use + // only two types of depth in TT: DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS. + ttDepth = inCheck || depth >= DEPTH_QS_CHECKS ? DEPTH_QS_CHECKS + : DEPTH_QS_NO_CHECKS; + // Transposition table lookup + posKey = pos.key(); + tte = TT.probe(posKey, ttHit); + ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; + ttMove = ttHit ? tte->move() : MOVE_NONE; + + if ( !PvNode + && ttHit + && tte->depth() >= ttDepth + && ttValue != VALUE_NONE // Only in case of TT access race + && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) + : (tte->bound() & BOUND_UPPER))) + return ttValue; + + // Evaluate the position statically + if (inCheck) + { + ss->staticEval = VALUE_NONE; + bestValue = futilityBase = -VALUE_INFINITE; + } + else + { + if (ttHit) + { + // Never assume anything on values stored in TT + if ((ss->staticEval = bestValue = tte->eval()) == VALUE_NONE) + ss->staticEval = bestValue = evaluate(pos); + + // Can ttValue be used as a better position evaluation? + if ( ttValue != VALUE_NONE + && (tte->bound() & (ttValue > bestValue ? BOUND_LOWER : BOUND_UPPER))) + bestValue = ttValue; + } + else + ss->staticEval = bestValue = + (ss-1)->currentMove != MOVE_NULL ? evaluate(pos) + : -(ss-1)->staticEval + 2 * Eval::Tempo; + + // Stand pat. Return immediately if static value is at least beta + if (bestValue >= beta) + { + if (!ttHit) + tte->save(posKey, value_to_tt(bestValue, ss->ply), BOUND_LOWER, + DEPTH_NONE, MOVE_NONE, ss->staticEval); + + return bestValue; + } + + if (PvNode && bestValue > alpha) + alpha = bestValue; + + futilityBase = bestValue + 128; + } + + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; + + // Initialize a MovePicker object for the current position, and prepare + // to search the moves. Because the depth is <= 0 here, only captures, + // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will + // be generated. + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, + to_sq((ss-1)->currentMove)); + + // Loop through the moves until no moves remain or a beta cutoff occurs + while ((move = mp.next_move()) != MOVE_NONE) + { + assert(is_ok(move)); + + givesCheck = gives_check(pos, move); + + moveCount++; + + // Futility pruning + if ( !inCheck + && !givesCheck + && futilityBase > -VALUE_KNOWN_WIN + && !pos.advanced_pawn_push(move)) + { + assert(type_of(move) != ENPASSANT); // Due to !pos.advanced_pawn_push + + futilityValue = futilityBase + PieceValue[EG][pos.piece_on(to_sq(move))]; + + if (futilityValue <= alpha) + { + bestValue = std::max(bestValue, futilityValue); + continue; + } + + if (futilityBase <= alpha && !pos.see_ge(move, VALUE_ZERO + 1)) + { + bestValue = std::max(bestValue, futilityBase); + continue; + } + } + + // Detect non-capture evasions that are candidates to be pruned + evasionPrunable = inCheck + && (depth != DEPTH_ZERO || moveCount > 2) + && bestValue > VALUE_MATED_IN_MAX_PLY + && !pos.capture(move); + + // Don't search moves with negative SEE values + if ( (!inCheck || evasionPrunable) + && !pos.see_ge(move)) + continue; + + // Speculative prefetch as early as possible + prefetch(TT.first_entry(pos.key_after(move))); + + // Check for legality just before making the move + if (!pos.legal(move)) + { + moveCount--; + continue; + } + + ss->currentMove = move; + ss->continuationHistory = &thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)]; + + // Make and search the move + pos.do_move(move, st, givesCheck); + value = -qsearch(pos, ss+1, -beta, -alpha, depth - ONE_PLY); + pos.undo_move(move); + + assert(value > -VALUE_INFINITE && value < VALUE_INFINITE); + + // Check for a new best move + if (value > bestValue) + { + bestValue = value; + + if (value > alpha) + { + if (PvNode) // Update pv even in fail-high case + update_pv(ss->pv, move, (ss+1)->pv); + + if (PvNode && value < beta) // Update alpha here! + { + alpha = value; + bestMove = move; + } + else // Fail high + { + tte->save(posKey, value_to_tt(value, ss->ply), BOUND_LOWER, + ttDepth, move, ss->staticEval); + + return value; + } + } + } + } + + if (variety && (bestValue + (variety * PawnValueEg / 100) >= 0 )) + bestValue += rand() % (variety + 1); + + // All legal moves have been searched. A special case: If we're in check + // and no legal moves were found, it is checkmate. + if (inCheck && bestValue == -VALUE_INFINITE) + return mated_in(ss->ply); // Plies to mate from the root + + tte->save(posKey, value_to_tt(bestValue, ss->ply), + PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, + ttDepth, bestMove, ss->staticEval); + + assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); + + return bestValue; + } + + + // value_to_tt() adjusts a mate score from "plies to mate from the root" to + // "plies to mate from the current position". Non-mate scores are unchanged. + // The function is called before storing a value in the transposition table. + + Value value_to_tt(Value v, int ply) { + + assert(v != VALUE_NONE); + + return v >= VALUE_MATE_IN_MAX_PLY ? v + ply + : v <= VALUE_MATED_IN_MAX_PLY ? v - ply : v; + } + + + // value_from_tt() is the inverse of value_to_tt(): It adjusts a mate score + // from the transposition table (which refers to the plies to mate/be mated + // from current position) to "plies to mate/be mated from the root". + + Value value_from_tt(Value v, int ply) { + + return v == VALUE_NONE ? VALUE_NONE + : v >= VALUE_MATE_IN_MAX_PLY ? v - ply + : v <= VALUE_MATED_IN_MAX_PLY ? v + ply : v; + } + + + // update_pv() adds current move and appends child pv[] + + void update_pv(Move* pv, Move move, Move* childPv) { + + for (*pv++ = move; childPv && *childPv != MOVE_NONE; ) + *pv++ = *childPv++; + *pv = MOVE_NONE; + } + + + // update_continuation_histories() updates histories of the move pairs formed + // by moves at ply -1, -2, and -4 with current move. + + void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus) { + + for (int i : {1, 2, 4}) + if (is_ok((ss-i)->currentMove)) + (*(ss-i)->continuationHistory)[pc][to] << bonus; + } + + + // update_capture_stats() updates move sorting heuristics when a new capture best move is found + + void update_capture_stats(const Position& pos, Move move, + Move* captures, int captureCnt, int bonus) { + + CapturePieceToHistory& captureHistory = pos.this_thread()->captureHistory; + Piece moved_piece = pos.moved_piece(move); + PieceType captured = type_of(pos.piece_on(to_sq(move))); + + if (pos.capture_or_promotion(move)) + captureHistory[moved_piece][to_sq(move)][captured] << bonus; + + // Decrease all the other played capture moves + for (int i = 0; i < captureCnt; ++i) + { + moved_piece = pos.moved_piece(captures[i]); + captured = type_of(pos.piece_on(to_sq(captures[i]))); + captureHistory[moved_piece][to_sq(captures[i])][captured] << -bonus; + } + } + + + // update_quiet_stats() updates move sorting heuristics when a new quiet best move is found + + void update_quiet_stats(const Position& pos, Stack* ss, Move move, + Move* quiets, int quietsCnt, int bonus) { + + if (ss->killers[0] != move) + { + ss->killers[1] = ss->killers[0]; + ss->killers[0] = move; + } + + Color us = pos.side_to_move(); + Thread* thisThread = pos.this_thread(); + thisThread->mainHistory[us][from_to(move)] << bonus; + update_continuation_histories(ss, pos.moved_piece(move), to_sq(move), bonus); + + if (is_ok((ss-1)->currentMove)) + { + Square prevSq = to_sq((ss-1)->currentMove); + thisThread->counterMoves[pos.piece_on(prevSq)][prevSq] = move; + } + + // Decrease all the other played quiet moves + for (int i = 0; i < quietsCnt; ++i) + { + thisThread->mainHistory[us][from_to(quiets[i])] << -bonus; + update_continuation_histories(ss, pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus); + } + } + + // When playing with strength handicap, choose best move among a set of RootMoves + // using a statistical rule dependent on 'level'. Idea by Heinz van Saanen. + + Move Skill::pick_best(size_t multiPV) { + + const RootMoves& rootMoves = Threads.main()->rootMoves; + static PRNG rng(now()); // PRNG sequence should be non-deterministic + + // RootMoves are already sorted by score in descending order + Value topScore = rootMoves[0].score; + int delta = std::min(topScore - rootMoves[multiPV - 1].score, PawnValueMg); + int weakness = 120 - 2 * level; + int maxScore = -VALUE_INFINITE; + + // Choose best move. For each move score we add two terms, both dependent on + // weakness. One is deterministic and bigger for weaker levels, and one is + // random. Then we choose the move with the resulting highest score. + for (size_t i = 0; i < multiPV; ++i) + { + // This is our magic formula + int push = ( weakness * int(topScore - rootMoves[i].score) + + delta * (rng.rand() % weakness)) / 128; + + if (rootMoves[i].score + push >= maxScore) + { + maxScore = rootMoves[i].score + push; + best = rootMoves[i].pv[0]; + } + } + + return best; + } + + // is the PV leading to a draw position ? + bool PV_is_draw(Position& pos) { + auto& pv = pos.this_thread()->rootMoves[0].pv; + StateInfo st[MAX_PLY]; + + for (size_t i = 0; i < pv.size(); i++) + pos.do_move(pv[i], st[i]); + + bool isDraw = pos.is_draw(pv.size()); + + for (size_t i = pv.size(); i > 0; i--) + pos.undo_move(pv[i-1]); + + return isDraw; + } + + +} // namespace + +/// MainThread::check_time() is used to print debug info and, more importantly, +/// to detect when we are out of available time and thus stop the search. + +void MainThread::check_time() { + + if (--callsCnt > 0) + return; + + // When using nodes, ensure checking rate is not lower than 0.1% of nodes + callsCnt = Limits.nodes ? std::min(1024, int(Limits.nodes / 1024)) : 1024; + + static TimePoint lastInfoTime = now(); + + TimePoint elapsed = Time.elapsed(); + TimePoint tick = Limits.startTime + elapsed; + + if (tick - lastInfoTime >= 1000) + { + lastInfoTime = tick; + dbg_print(); + } + + // We should not stop pondering until told so by the GUI + if (Threads.ponder) + return; + + if ( (Limits.use_time_management() && elapsed > Time.maximum() - 10) + || (Limits.movetime && elapsed >= Limits.movetime) + || (Limits.nodes && Threads.nodes_searched() >= (uint64_t)Limits.nodes)) + Threads.stop = true; +} + + +/// UCI::pv() formats PV information according to the UCI protocol. UCI requires +/// that all (if any) unsearched PV lines are sent using a previous search score. + +string UCI::pv(const Position& pos, Depth depth, Value alpha, Value beta) { + + std::stringstream ss; + TimePoint elapsed = Time.elapsed() + 1; + const RootMoves& rootMoves = pos.this_thread()->rootMoves; + size_t pvIdx = pos.this_thread()->pvIdx; + size_t multiPV = std::min((size_t)Options["MultiPV"], rootMoves.size()); + uint64_t nodesSearched = Threads.nodes_searched(); + uint64_t tbHits = Threads.tb_hits() + (TB::RootInTB ? rootMoves.size() : 0); + + for (size_t i = 0; i < multiPV; ++i) + { + bool updated = (i <= pvIdx && rootMoves[i].score != -VALUE_INFINITE); + + if (depth == ONE_PLY && !updated) + continue; + + Depth d = updated ? depth : depth - ONE_PLY; + Value v = updated ? rootMoves[i].score : rootMoves[i].previousScore; + + bool tb = TB::RootInTB && abs(v) < VALUE_MATE - MAX_PLY; + v = tb ? rootMoves[i].tbScore : v; + + if (ss.rdbuf()->in_avail()) // Not at first line + ss << "\n"; + + ss << "info" + << " depth " << d / ONE_PLY + << " seldepth " << rootMoves[i].selDepth + << " multipv " << i + 1 + << " score " << UCI::value(v); + + if (!tb && i == pvIdx) + ss << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : ""); + + ss << " nodes " << nodesSearched + << " nps " << nodesSearched * 1000 / elapsed; + + if (elapsed > 1000) // Earlier makes little sense + ss << " hashfull " << TT.hashfull(); + + ss << " tbhits " << tbHits + << " time " << elapsed + << " pv"; + + for (Move m : rootMoves[i].pv) + ss << " " << UCI::move(m, pos.is_chess960()); + } + + return ss.str(); +} + + +/// RootMove::extract_ponder_from_tt() is called in case we have no ponder move +/// before exiting the search, for instance, in case we stop the search during a +/// fail high at root. We try hard to have a ponder move to return to the GUI, +/// otherwise in case of 'ponder on' we have nothing to think on. + +bool RootMove::extract_ponder_from_tt(Position& pos) { + + StateInfo st; + bool ttHit; + + assert(pv.size() == 1); + + if (!pv[0]) + return false; + + pos.do_move(pv[0], st); + TTEntry* tte = TT.probe(pos.key(), ttHit); + + if (ttHit) + { + Move m = tte->move(); // Local copy to be SMP safe + if (MoveList(pos).contains(m)) + pv.push_back(m); + } + + pos.undo_move(pv[0]); + return pv.size() > 1; +} + +void Tablebases::rank_root_moves(Position& pos, Search::RootMoves& rootMoves) { + + RootInTB = false; + UseRule50 = bool(Options["Syzygy50MoveRule"]); + ProbeDepth = int(Options["SyzygyProbeDepth"]) * ONE_PLY; + Cardinality = int(Options["SyzygyProbeLimit"]); + bool dtz_available = true; + + // Tables with fewer pieces than SyzygyProbeLimit are searched with + // ProbeDepth == DEPTH_ZERO + if (Cardinality > MaxCardinality) + { + Cardinality = MaxCardinality; + ProbeDepth = DEPTH_ZERO; + } + + if (Cardinality >= popcount(pos.pieces()) && !pos.can_castle(ANY_CASTLING)) + { + // Rank moves using DTZ tables + RootInTB = root_probe(pos, rootMoves); + + if (!RootInTB) + { + // DTZ tables are missing; try to rank moves using WDL tables + dtz_available = false; + RootInTB = root_probe_wdl(pos, rootMoves); + } + } + + if (RootInTB) + { + // Sort moves according to TB rank + std::sort(rootMoves.begin(), rootMoves.end(), + [](const RootMove &a, const RootMove &b) { return a.tbRank > b.tbRank; } ); + + // Probe during search only if DTZ is not available and we are winning + if (dtz_available || rootMoves[0].tbScore <= VALUE_DRAW) + Cardinality = 0; + } + else + { + // Assign the same rank to all moves + for (auto& m : rootMoves) + m.tbRank = 0; + } +} diff --git a/Engines/Windows/mcbrain/src/search.h b/Engines/Windows/mcbrain/src/search.h new file mode 100644 index 0000000..7faa36c --- /dev/null +++ b/Engines/Windows/mcbrain/src/search.h @@ -0,0 +1,108 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef SEARCH_H_INCLUDED +#define SEARCH_H_INCLUDED + +#include + +#include "misc.h" +#include "movepick.h" +#include "types.h" + +class Position; +namespace Search { + +/// Threshold used for countermoves based pruning +constexpr int CounterMovePruneThreshold = 0; + + +/// Stack struct keeps track of the information we need to remember from nodes +/// shallower and deeper in the tree during the search. Each search thread has +/// its own array of Stack objects, indexed by the current ply. + +struct Stack { + Move* pv; + PieceToHistory* continuationHistory; + int ply; + Move currentMove; + Move excludedMove; + Move killers[2]; + Value staticEval; + int statScore; + int moveCount; +}; + + +/// RootMove struct is used for moves at the root of the tree. For each root move +/// we store a score and a PV (really a refutation in the case of moves which +/// fail low). Score is normally set at -VALUE_INFINITE for all non-pv moves. + +struct RootMove { + + explicit RootMove(Move m) : pv(1, m) {} + bool extract_ponder_from_tt(Position& pos); + bool operator==(const Move& m) const { return pv[0] == m; } + bool operator<(const RootMove& m) const { // Sort in descending order + return m.score != score ? m.score < score + : m.previousScore < previousScore; + } + + Value score = -VALUE_INFINITE; + Value previousScore = -VALUE_INFINITE; + int selDepth = 0; + int tbRank; + Value tbScore; + std::vector pv; +}; + +typedef std::vector RootMoves; + + +/// LimitsType struct stores information sent by GUI about available time to +/// search the current move, maximum depth/time, or if we are in analysis mode. + +struct LimitsType { + + LimitsType() { // Init explicitly due to broken value-initialization of non POD in MSVC + time[WHITE] = time[BLACK] = inc[WHITE] = inc[BLACK] = npmsec = movetime = TimePoint(0); + movestogo = depth = mate = perft = infinite = 0; + nodes = 0; + } + + bool use_time_management() const { + return !(mate | movetime | depth | nodes | perft | infinite); + } + + std::vector searchmoves; + TimePoint time[COLOR_NB], inc[COLOR_NB], npmsec, movetime, startTime; + int movestogo, depth, mate, perft, infinite; + int64_t nodes; +}; + +extern LimitsType Limits; + +void init(bool OptioncleanSearch); +void clear(); + +} // namespace Search + +#endif // #ifndef SEARCH_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/syzygy/.DS_Store b/Engines/Windows/mcbrain/src/syzygy/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/Engines/Windows/mcbrain/src/syzygy/.DS_Store differ diff --git a/Engines/Linux64/mcbrain/src/tbprobe.cpp b/Engines/Windows/mcbrain/src/syzygy/tbprobe.cpp similarity index 72% rename from Engines/Linux64/mcbrain/src/tbprobe.cpp rename to Engines/Windows/mcbrain/src/syzygy/tbprobe.cpp index d019f28..dfcb33f 100644 --- a/Engines/Linux64/mcbrain/src/tbprobe.cpp +++ b/Engines/Windows/mcbrain/src/syzygy/tbprobe.cpp @@ -3,7 +3,7 @@ Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) - Copyright (C) 2017 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) McBrain is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ #include #include #include -#include // For std::memset +#include // For std::memset and std::memcpy #include #include #include @@ -30,12 +30,13 @@ #include #include -#include "bitboard.h" -#include "movegen.h" -#include "position.h" -#include "search.h" -#include "thread_win32.h" -#include "types.h" +#include "../bitboard.h" +#include "../movegen.h" +#include "../position.h" +#include "../search.h" +#include "../thread_win32.h" +#include "../types.h" +#include "../uci.h" #include "tbprobe.h" @@ -56,161 +57,34 @@ int Tablebases::MaxCardinality; namespace { +constexpr int TBPIECES = 7; // Max number of supported pieces + +enum { BigEndian, LittleEndian }; +enum TBType { KEY, WDL, DTZ }; // Used as template parameter + // Each table has a set of flags: all of them refer to DTZ tables, the last one to WDL tables -enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, SingleValue = 128 }; +enum TBFlag { STM = 1, Mapped = 2, WinPlies = 4, LossPlies = 8, Wide = 16, SingleValue = 128 }; inline WDLScore operator-(WDLScore d) { return WDLScore(-int(d)); } inline Square operator^=(Square& s, int i) { return s = Square(int(s) ^ i); } inline Square operator^(Square s, int i) { return Square(int(s) ^ i); } -// DTZ tables don't store valid scores for moves that reset the rule50 counter -// like captures and pawn moves but we can easily recover the correct dtz of the -// previous move if we know the position's WDL score. -int dtz_before_zeroing(WDLScore wdl) { - return wdl == WDLWin ? 1 : - wdl == WDLCursedWin ? 101 : - wdl == WDLBlessedLoss ? -101 : - wdl == WDLLoss ? -1 : 0; -} - -// Return the sign of a number (-1, 0, 1) -template int sign_of(T val) { - return (T(0) < val) - (val < T(0)); -} - -// Numbers in little endian used by sparseIndex[] to point into blockLength[] -struct SparseEntry { - char block[4]; // Number of block - char offset[2]; // Offset within the block -}; - -static_assert(sizeof(SparseEntry) == 6, "SparseEntry must be 6 bytes"); - -typedef uint16_t Sym; // Huffman symbol - -struct LR { - enum Side { Left, Right, Value }; - - uint8_t lr[3]; // The first 12 bits is the left-hand symbol, the second 12 - // bits is the right-hand symbol. If symbol has length 1, - // then the first byte is the stored value. - template - Sym get() { - return S == Left ? ((lr[1] & 0xF) << 8) | lr[0] : - S == Right ? (lr[2] << 4) | (lr[1] >> 4) : - S == Value ? lr[0] : (assert(false), Sym(-1)); - } -}; - -static_assert(sizeof(LR) == 3, "LR tree entry must be 3 bytes"); - -const int TBPIECES = 6; - -struct PairsData { - int flags; - size_t sizeofBlock; // Block size in bytes - size_t span; // About every span values there is a SparseIndex[] entry - int blocksNum; // Number of blocks in the TB file - int maxSymLen; // Maximum length in bits of the Huffman symbols - int minSymLen; // Minimum length in bits of the Huffman symbols - Sym* lowestSym; // lowestSym[l] is the symbol of length l with the lowest value - LR* btree; // btree[sym] stores the left and right symbols that expand sym - uint16_t* blockLength; // Number of stored positions (minus one) for each block: 1..65536 - int blockLengthSize; // Size of blockLength[] table: padded so it's bigger than blocksNum - SparseEntry* sparseIndex; // Partial indices into blockLength[] - size_t sparseIndexSize; // Size of SparseIndex[] table - uint8_t* data; // Start of Huffman compressed data - std::vector base64; // base64[l - min_sym_len] is the 64bit-padded lowest symbol of length l - std::vector symlen; // Number of values (-1) represented by a given Huffman symbol: 1..256 - Piece pieces[TBPIECES]; // Position pieces: the order of pieces defines the groups - uint64_t groupIdx[TBPIECES+1]; // Start index used for the encoding of the group's pieces - int groupLen[TBPIECES+1]; // Number of pieces in a given group: KRKN -> (3, 1) -}; - -// Helper struct to avoid manually defining entry copy constructor as we -// should because the default one is not compatible with std::atomic_bool. -struct Atomic { - Atomic() = default; - Atomic(const Atomic& e) { ready = e.ready.load(); } // MSVC 2013 wants assignment within body - std::atomic_bool ready; -}; - -// We define types for the different parts of the WDLEntry and DTZEntry with -// corresponding specializations for pieces or pawns. - -struct WDLEntryPiece { - PairsData* precomp; -}; - -struct WDLEntryPawn { - uint8_t pawnCount[2]; // [Lead color / other color] - WDLEntryPiece file[2][4]; // [wtm / btm][FILE_A..FILE_D] -}; - -struct DTZEntryPiece { - PairsData* precomp; - uint16_t map_idx[4]; // WDLWin, WDLLoss, WDLCursedWin, WDLBlessedLoss - uint8_t* map; -}; - -struct DTZEntryPawn { - uint8_t pawnCount[2]; - DTZEntryPiece file[4]; - uint8_t* map; -}; - -struct TBEntry : public Atomic { - void* baseAddress; - uint64_t mapping; - Key key; - Key key2; - int pieceCount; - bool hasPawns; - bool hasUniquePieces; -}; - -// Now the main types: WDLEntry and DTZEntry -struct WDLEntry : public TBEntry { - WDLEntry(const std::string& code); - ~WDLEntry(); - union { - WDLEntryPiece pieceTable[2]; // [wtm / btm] - WDLEntryPawn pawnTable; - }; -}; - -struct DTZEntry : public TBEntry { - DTZEntry(const WDLEntry& wdl); - ~DTZEntry(); - union { - DTZEntryPiece pieceTable; - DTZEntryPawn pawnTable; - }; -}; - -typedef decltype(WDLEntry::pieceTable) WDLPieceTable; -typedef decltype(DTZEntry::pieceTable) DTZPieceTable; -typedef decltype(WDLEntry::pawnTable ) WDLPawnTable; -typedef decltype(DTZEntry::pawnTable ) DTZPawnTable; - -auto item(WDLPieceTable& e, int stm, int ) -> decltype(e[stm])& { return e[stm]; } -auto item(DTZPieceTable& e, int , int ) -> decltype(e)& { return e; } -auto item(WDLPawnTable& e, int stm, int f) -> decltype(e.file[stm][f])& { return e.file[stm][f]; } -auto item(DTZPawnTable& e, int , int f) -> decltype(e.file[f])& { return e.file[f]; } - -template struct Ret { typedef int type; }; -template<> struct Ret { typedef WDLScore type; }; +const std::string PieceToChar = " PNBRQK pnbrqk"; int MapPawns[SQUARE_NB]; int MapB1H1H7[SQUARE_NB]; int MapA1D1D4[SQUARE_NB]; int MapKK[10][SQUARE_NB]; // [MapA1D1D4][SQUARE_NB] +int Binomial[6][SQUARE_NB]; // [k][n] k elements from a set of n elements +int LeadPawnIdx[6][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] +int LeadPawnsSize[6][4]; // [leadPawnsCnt][FILE_A..FILE_D] + // Comparison function to sort leading pawns in ascending MapPawns[] order bool pawns_comp(Square i, Square j) { return MapPawns[i] < MapPawns[j]; } int off_A1H8(Square sq) { return int(rank_of(sq)) - file_of(sq); } -const Value WDL_to_value[] = { +constexpr Value WDL_to_value[] = { -VALUE_MATE + MAX_PLY + 1, VALUE_DRAW - 2, VALUE_DRAW, @@ -218,27 +92,21 @@ const Value WDL_to_value[] = { VALUE_MATE - MAX_PLY - 1 }; -const std::string PieceToChar = " PNBRQK pnbrqk"; - -int Binomial[6][SQUARE_NB]; // [k][n] k elements from a set of n elements -int LeadPawnIdx[5][SQUARE_NB]; // [leadPawnsCnt][SQUARE_NB] -int LeadPawnsSize[5][4]; // [leadPawnsCnt][FILE_A..FILE_D] - -enum { BigEndian, LittleEndian }; - template -inline void swap_byte(T& x) +inline void swap_endian(T& x) { - char tmp, *c = (char*)&x; + static_assert(std::is_unsigned::value, "Argument of swap_endian not unsigned"); + + uint8_t tmp, *c = (uint8_t*)&x; for (int i = 0; i < Half; ++i) tmp = c[i], c[i] = c[End - i], c[End - i] = tmp; } -template<> inline void swap_byte(uint8_t&) {} +template<> inline void swap_endian(uint8_t&) {} template T number(void* addr) { - const union { uint32_t i; char c[4]; } Le = { 0x01020304 }; - const bool IsLittleEndian = (Le.c[0] == 4); + static const union { uint32_t i; char c[4]; } Le = { 0x01020304 }; + static const bool IsLittleEndian = (Le.c[0] == 4); T v; @@ -248,59 +116,59 @@ template T number(void* addr) v = *((T*)addr); if (LE != IsLittleEndian) - swap_byte(v); + swap_endian(v); return v; } -class HashTable { - - typedef std::pair EntryPair; - typedef std::pair Entry; +// DTZ tables don't store valid scores for moves that reset the rule50 counter +// like captures and pawn moves but we can easily recover the correct dtz of the +// previous move if we know the position's WDL score. +int dtz_before_zeroing(WDLScore wdl) { + return wdl == WDLWin ? 1 : + wdl == WDLCursedWin ? 101 : + wdl == WDLBlessedLoss ? -101 : + wdl == WDLLoss ? -1 : 0; +} - static const int TBHASHBITS = 10; - static const int HSHMAX = 5; +// Return the sign of a number (-1, 0, 1) +template int sign_of(T val) { + return (T(0) < val) - (val < T(0)); +} - Entry hashTable[1 << TBHASHBITS][HSHMAX]; +// Numbers in little endian used by sparseIndex[] to point into blockLength[] +struct SparseEntry { + char block[4]; // Number of block + char offset[2]; // Offset within the block +}; - std::deque wdlTable; - std::deque dtzTable; +static_assert(sizeof(SparseEntry) == 6, "SparseEntry must be 6 bytes"); - void insert(Key key, WDLEntry* wdl, DTZEntry* dtz) { - Entry* entry = hashTable[key >> (64 - TBHASHBITS)]; +typedef uint16_t Sym; // Huffman symbol - for (int i = 0; i < HSHMAX; ++i, ++entry) - if (!entry->second.first || entry->first == key) { - *entry = std::make_pair(key, std::make_pair(wdl, dtz)); - return; - } +struct LR { + enum Side { Left, Right }; - std::cerr << "HSHMAX too low!" << std::endl; - exit(1); + uint8_t lr[3]; // The first 12 bits is the left-hand symbol, the second 12 + // bits is the right-hand symbol. If symbol has length 1, + // then the left-hand symbol is the stored value. + template + Sym get() { + return S == Left ? ((lr[1] & 0xF) << 8) | lr[0] : + S == Right ? (lr[2] << 4) | (lr[1] >> 4) : (assert(false), Sym(-1)); } - -public: - template::value ? 0 : 1> - E* get(Key key) { - Entry* entry = hashTable[key >> (64 - TBHASHBITS)]; - - for (int i = 0; i < HSHMAX; ++i, ++entry) - if (entry->first == key) - return std::get(entry->second); - - return nullptr; - } - - void clear() { - std::memset(hashTable, 0, sizeof(hashTable)); - wdlTable.clear(); - dtzTable.clear(); - } - size_t size() const { return wdlTable.size(); } - void insert(const std::vector& pieces); }; -HashTable EntryTable; +static_assert(sizeof(LR) == 3, "LR tree entry must be 3 bytes"); + +// Tablebases data layout is structured as following: +// +// TBFile: memory maps/unmaps the physical .rtbw and .rtbz files +// TBTable: one object for each file with corresponding indexing information +// TBTables: has ownership of TBTable objects, keeping a list and a hash +// class TBFile memory maps/unmaps the single .rtbw and .rtbz files. Files are +// memory mapped for best performance. Files are mapped at first access: at init +// time only existence of the file is checked. class TBFile : public std::ifstream { std::string fname; @@ -317,9 +185,9 @@ class TBFile : public std::ifstream { TBFile(const std::string& f) { #ifndef _WIN32 - const char SepChar = ':'; + constexpr char SepChar = ':'; #else - const char SepChar = ';'; + constexpr char SepChar = ';'; #endif std::stringstream ss(Paths); std::string path; @@ -334,7 +202,7 @@ class TBFile : public std::ifstream { // Memory map the file and check it. File should be already open and will be // closed after mapping. - uint8_t* map(void** baseAddress, uint64_t* mapping, const uint8_t* TB_MAGIC) { + uint8_t* map(void** baseAddress, uint64_t* mapping, TBType type) { assert(is_open()); @@ -384,16 +252,16 @@ class TBFile : public std::ifstream { #endif uint8_t* data = (uint8_t*)*baseAddress; - if ( *data++ != *TB_MAGIC++ - || *data++ != *TB_MAGIC++ - || *data++ != *TB_MAGIC++ - || *data++ != *TB_MAGIC) { + constexpr uint8_t Magics[][4] = { { 0xD7, 0x66, 0x0C, 0xA5 }, + { 0x71, 0xE8, 0x23, 0x5D } }; + + if (memcmp(data, Magics[type == WDL], 4)) { std::cerr << "Corrupted table in file " << fname << std::endl; unmap(*baseAddress, *mapping); return *baseAddress = nullptr, nullptr; } - return data; + return data + 4; // Skip Magics's header } static void unmap(void* baseAddress, uint64_t mapping) { @@ -409,80 +277,171 @@ class TBFile : public std::ifstream { std::string TBFile::Paths; -WDLEntry::WDLEntry(const std::string& code) { +// struct PairsData contains low level indexing information to access TB data. +// There are 8, 4 or 2 PairsData records for each TBTable, according to type of +// table and if positions have pawns or not. It is populated at first access. +struct PairsData { + uint8_t flags; // Table flags, see enum TBFlag + uint8_t maxSymLen; // Maximum length in bits of the Huffman symbols + uint8_t minSymLen; // Minimum length in bits of the Huffman symbols + uint32_t blocksNum; // Number of blocks in the TB file + size_t sizeofBlock; // Block size in bytes + size_t span; // About every span values there is a SparseIndex[] entry + Sym* lowestSym; // lowestSym[l] is the symbol of length l with the lowest value + LR* btree; // btree[sym] stores the left and right symbols that expand sym + uint16_t* blockLength; // Number of stored positions (minus one) for each block: 1..65536 + uint32_t blockLengthSize; // Size of blockLength[] table: padded so it's bigger than blocksNum + SparseEntry* sparseIndex; // Partial indices into blockLength[] + size_t sparseIndexSize; // Size of SparseIndex[] table + uint8_t* data; // Start of Huffman compressed data + std::vector base64; // base64[l - min_sym_len] is the 64bit-padded lowest symbol of length l + std::vector symlen; // Number of values (-1) represented by a given Huffman symbol: 1..256 + Piece pieces[TBPIECES]; // Position pieces: the order of pieces defines the groups + uint64_t groupIdx[TBPIECES+1]; // Start index used for the encoding of the group's pieces + int groupLen[TBPIECES+1]; // Number of pieces in a given group: KRKN -> (3, 1) + uint16_t map_idx[4]; // WDLWin, WDLLoss, WDLCursedWin, WDLBlessedLoss (used in DTZ) +}; + +// struct TBTable contains indexing information to access the corresponding TBFile. +// There are 2 types of TBTable, corresponding to a WDL or a DTZ file. TBTable +// is populated at init time but the nested PairsData records are populated at +// first access, when the corresponding file is memory mapped. +template +struct TBTable { + typedef typename std::conditional::type Ret; + + static constexpr int Sides = Type == WDL ? 2 : 1; + + std::atomic_bool ready; + void* baseAddress; + uint8_t* map; + uint64_t mapping; + Key key; + Key key2; + int pieceCount; + bool hasPawns; + bool hasUniquePieces; + uint8_t pawnCount[2]; // [Lead color / other color] + PairsData items[Sides][4]; // [wtm / btm][FILE_A..FILE_D or 0] + + PairsData* get(int stm, int f) { + return &items[stm % Sides][hasPawns ? f : 0]; + } + + TBTable() : ready(false), baseAddress(nullptr) {} + explicit TBTable(const std::string& code); + explicit TBTable(const TBTable& wdl); + + ~TBTable() { + if (baseAddress) + TBFile::unmap(baseAddress, mapping); + } +}; + +template<> +TBTable::TBTable(const std::string& code) : TBTable() { StateInfo st; Position pos; - memset(this, 0, sizeof(WDLEntry)); - - ready = false; key = pos.set(code, WHITE, &st).material_key(); - pieceCount = popcount(pos.pieces()); + pieceCount = pos.count(); hasPawns = pos.pieces(PAWN); + hasUniquePieces = false; for (Color c = WHITE; c <= BLACK; ++c) for (PieceType pt = PAWN; pt < KING; ++pt) if (popcount(pos.pieces(c, pt)) == 1) hasUniquePieces = true; - if (hasPawns) { - // Set the leading color. In case both sides have pawns the leading color - // is the side with less pawns because this leads to better compression. - bool c = !pos.count(BLACK) - || ( pos.count(WHITE) - && pos.count(BLACK) >= pos.count(WHITE)); + // Set the leading color. In case both sides have pawns the leading color + // is the side with less pawns because this leads to better compression. + bool c = !pos.count(BLACK) + || ( pos.count(WHITE) + && pos.count(BLACK) >= pos.count(WHITE)); - pawnTable.pawnCount[0] = pos.count(c ? WHITE : BLACK); - pawnTable.pawnCount[1] = pos.count(c ? BLACK : WHITE); - } + pawnCount[0] = pos.count(c ? WHITE : BLACK); + pawnCount[1] = pos.count(c ? BLACK : WHITE); key2 = pos.set(code, BLACK, &st).material_key(); } -WDLEntry::~WDLEntry() { - - if (baseAddress) - TBFile::unmap(baseAddress, mapping); - - for (int i = 0; i < 2; ++i) - if (hasPawns) - for (File f = FILE_A; f <= FILE_D; ++f) - delete pawnTable.file[i][f].precomp; - else - delete pieceTable[i].precomp; -} - -DTZEntry::DTZEntry(const WDLEntry& wdl) { - - memset(this, 0, sizeof(DTZEntry)); +template<> +TBTable::TBTable(const TBTable& wdl) : TBTable() { - ready = false; + // Use the corresponding WDL table to avoid recalculating all from scratch key = wdl.key; key2 = wdl.key2; pieceCount = wdl.pieceCount; hasPawns = wdl.hasPawns; hasUniquePieces = wdl.hasUniquePieces; + pawnCount[0] = wdl.pawnCount[0]; + pawnCount[1] = wdl.pawnCount[1]; +} + +// class TBTables creates and keeps ownership of the TBTable objects, one for +// each TB file found. It supports a fast, hash based, table lookup. Populated +// at init time, accessed at probe time. +class TBTables { + + typedef std::tuple*, TBTable*> Entry; + + static constexpr int Size = 1 << 12; // 4K table, indexed by key's 12 lsb + static constexpr int Overflow = 1; // Number of elements allowed to map to the last bucket + + Entry hashTable[Size + Overflow]; - if (hasPawns) { - pawnTable.pawnCount[0] = wdl.pawnTable.pawnCount[0]; - pawnTable.pawnCount[1] = wdl.pawnTable.pawnCount[1]; + std::deque> wdlTable; + std::deque> dtzTable; + + void insert(Key key, TBTable* wdl, TBTable* dtz) { + uint32_t homeBucket = (uint32_t)key & (Size - 1); + Entry entry = std::make_tuple(key, wdl, dtz); + + // Ensure last element is empty to avoid overflow when looking up + for (uint32_t bucket = homeBucket; bucket < Size + Overflow - 1; ++bucket) { + Key otherKey = std::get(hashTable[bucket]); + if (otherKey == key || !std::get(hashTable[bucket])) { + hashTable[bucket] = entry; + return; + } + + // Robin Hood hashing: If we've probed for longer than this element, + // insert here and search for a new spot for the other element instead. + uint32_t otherHomeBucket = (uint32_t)otherKey & (Size - 1); + if (otherHomeBucket > homeBucket) { + swap(entry, hashTable[bucket]); + key = otherKey; + homeBucket = otherHomeBucket; + } + } + std::cerr << "TB hash table size too low!" << std::endl; + exit(1); } -} -DTZEntry::~DTZEntry() { +public: + template + TBTable* get(Key key) { + for (const Entry* entry = &hashTable[(uint32_t)key & (Size - 1)]; ; ++entry) { + if (std::get(*entry) == key || !std::get(*entry)) + return std::get(*entry); + } + } - if (baseAddress) - TBFile::unmap(baseAddress, mapping); + void clear() { + memset(hashTable, 0, sizeof(hashTable)); + wdlTable.clear(); + dtzTable.clear(); + } + size_t size() const { return wdlTable.size(); } + void add(const std::vector& pieces); +}; - if (hasPawns) - for (File f = FILE_A; f <= FILE_D; ++f) - delete pawnTable.file[f].precomp; - else - delete pieceTable.precomp; -} +TBTables TBTables; -void HashTable::insert(const std::vector& pieces) { +// If the corresponding file exists two new objects TBTable and TBTable +// are created and added to the lists and hash table. Called at init time. +void TBTables::add(const std::vector& pieces) { std::string code; @@ -501,6 +460,7 @@ void HashTable::insert(const std::vector& pieces) { wdlTable.emplace_back(code); dtzTable.emplace_back(wdlTable.back()); + // Insert into the hash keys for both colors: KRvK with KR white and black insert(wdlTable.back().key , &wdlTable.back(), &dtzTable.back()); insert(wdlTable.back().key2, &wdlTable.back(), &dtzTable.back()); } @@ -566,7 +526,7 @@ int decompress_pairs(PairsData* d, uint64_t idx) { offset -= d->blockLength[block++] + 1; // Finally, we find the start address of our block of canonical Huffman symbols - uint32_t* ptr = (uint32_t*)(d->data + block * d->sizeofBlock); + uint32_t* ptr = (uint32_t*)(d->data + ((uint64_t)block * d->sizeofBlock)); // Read the first 64 bits in our block, this is a (truncated) sequence of // unknown number of symbols of unknown length but we know the first one @@ -629,16 +589,14 @@ int decompress_pairs(PairsData* d, uint64_t idx) { } } - return d->btree[sym].get(); + return d->btree[sym].get(); } -bool check_dtz_stm(WDLEntry*, int, File) { return true; } - -bool check_dtz_stm(DTZEntry* entry, int stm, File f) { +bool check_dtz_stm(TBTable*, int, File) { return true; } - int flags = entry->hasPawns ? entry->pawnTable.file[f].precomp->flags - : entry->pieceTable.precomp->flags; +bool check_dtz_stm(TBTable* entry, int stm, File f) { + auto flags = entry->get(stm, f)->flags; return (flags & TBFlag::STM) == stm || ((entry->key == entry->key2) && !entry->hasPawns); } @@ -647,22 +605,22 @@ bool check_dtz_stm(DTZEntry* entry, int stm, File f) { // values 0, 1, 2, ... in order of decreasing frequency. This is done for each // of the four WDLScore values. The mapping information necessary to reconstruct // the original values is stored in the TB file and read during map[] init. -WDLScore map_score(WDLEntry*, File, int value, WDLScore) { return WDLScore(value - 2); } +WDLScore map_score(TBTable*, File, int value, WDLScore) { return WDLScore(value - 2); } -int map_score(DTZEntry* entry, File f, int value, WDLScore wdl) { +int map_score(TBTable* entry, File f, int value, WDLScore wdl) { - const int WDLMap[] = { 1, 3, 0, 2, 0 }; + constexpr int WDLMap[] = { 1, 3, 0, 2, 0 }; - int flags = entry->hasPawns ? entry->pawnTable.file[f].precomp->flags - : entry->pieceTable.precomp->flags; + auto flags = entry->get(0, f)->flags; - uint8_t* map = entry->hasPawns ? entry->pawnTable.map - : entry->pieceTable.map; - - uint16_t* idx = entry->hasPawns ? entry->pawnTable.file[f].map_idx - : entry->pieceTable.map_idx; - if (flags & TBFlag::Mapped) - value = map[idx[WDLMap[wdl + 2]] + value]; + uint8_t* map = entry->map; + uint16_t* idx = entry->get(0, f)->map_idx; + if (flags & TBFlag::Mapped) { + if (flags & TBFlag::Wide) + value = ((uint16_t *)map)[idx[WDLMap[wdl + 2]] + value]; + else + value = map[idx[WDLMap[wdl + 2]] + value]; + } // DTZ tables store distance to zero in number of moves or plies. We // want to return plies, so we have convert to plies when needed. @@ -681,10 +639,8 @@ int map_score(DTZEntry* entry, File f, int value, WDLScore wdl) { // // idx = Binomial[1][s1] + Binomial[2][s2] + ... + Binomial[k][sk] // -template::type> -T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* result) { - - const bool IsWDL = std::is_same::value; +template +Ret do_probe_table(const Position& pos, T* entry, WDLScore wdl, ProbeState* result) { Square squares[TBPIECES]; Piece pieces[TBPIECES]; @@ -717,7 +673,7 @@ T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* re // In all the 4 tables, pawns are at the beginning of the piece sequence and // their color is the reference one. So we just pick the first one. - Piece pc = Piece(item(entry->pawnTable, 0, 0).precomp->pieces[0] ^ flipColor); + Piece pc = Piece(entry->get(0, 0)->pieces[0] ^ flipColor); assert(type_of(pc) == PAWN); @@ -733,16 +689,13 @@ T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* re tbFile = file_of(squares[0]); if (tbFile > FILE_D) tbFile = file_of(squares[0] ^ 7); // Horizontal flip: SQ_H1 -> SQ_A1 - - d = item(entry->pawnTable , stm, tbFile).precomp; - } else - d = item(entry->pieceTable, stm, tbFile).precomp; + } // DTZ tables are one-sided, i.e. they store positions only for white to // move or only for black to move, so check for side to move to be stm, // early exit otherwise. - if (!IsWDL && !check_dtz_stm(entry, stm, tbFile)) - return *result = CHANGE_STM, T(); + if (!check_dtz_stm(entry, stm, tbFile)) + return *result = CHANGE_STM, Ret(); // Now we are ready to get all the position pieces (but the lead pawns) and // directly map them to the correct color and square. @@ -755,8 +708,10 @@ T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* re assert(size >= 2); + d = entry->get(stm, tbFile); + // Then we reorder the pieces to have the same sequence as the one stored - // in precomp->pieces[i]: the sequence that ensures the best compression. + // in pieces[i]: the sequence that ensures the best compression. for (int i = leadPawnsCnt; i < size; ++i) for (int j = i; j < size; ++j) if (d->pieces[i] == pieces[j]) @@ -874,7 +829,7 @@ T do_probe_table(const Position& pos, Entry* entry, WDLScore wdl, ProbeState* re Square* groupSq = squares + d->groupLen[0]; // Encode remainig pawns then pieces according to square, in ascending order - bool remainingPawns = entry->hasPawns && entry->pawnTable.pawnCount[1]; + bool remainingPawns = entry->hasPawns && entry->pawnCount[1]; while (d->groupLen[++next]) { @@ -936,7 +891,7 @@ void set_groups(T& e, PairsData* d, int order[], File f) { // pawns/pieces -> remainig pawns -> remaining pieces. In particular the // first group is at order[0] position and the remaining pawns, when present, // are at order[1] position. - bool pp = e.hasPawns && e.pawnTable.pawnCount[1]; // Pawns on both sides + bool pp = e.hasPawns && e.pawnCount[1]; // Pawns on both sides int next = pp ? 2 : 1; int freeSquares = 64 - d->groupLen[0] - (pp ? d->groupLen[1] : 0); uint64_t idx = 1; @@ -1003,7 +958,7 @@ uint8_t* set_sizes(PairsData* d, uint8_t* data) { d->sizeofBlock = 1ULL << *data++; d->span = 1ULL << *data++; d->sparseIndexSize = (tbSize + d->span - 1) / d->span; // Round up - int padding = number(data++); + auto padding = number(data++); d->blocksNum = number(data); data += sizeof(uint32_t); d->blockLengthSize = d->blocksNum + padding; // Padded to ensure SparseIndex[] // does not point out of range. @@ -1036,7 +991,7 @@ uint8_t* set_sizes(PairsData* d, uint8_t* data) { d->symlen.resize(number(data)); data += sizeof(uint16_t); d->btree = (LR*)data; - // The comrpession scheme used is "Recursive Pairing", that replaces the most + // The compression scheme used is "Recursive Pairing", that replaces the most // frequent adjacent pair of symbols in the source message by a new symbol, // reevaluating the frequencies of all of the symbol pairs with respect to // the extended alphabet, and then repeating the process. @@ -1050,29 +1005,38 @@ uint8_t* set_sizes(PairsData* d, uint8_t* data) { return data + d->symlen.size() * sizeof(LR) + (d->symlen.size() & 1); } -template -uint8_t* set_dtz_map(WDLEntry&, T&, uint8_t*, File) { return nullptr; } +uint8_t* set_dtz_map(TBTable&, uint8_t* data, File) { return data; } -template -uint8_t* set_dtz_map(DTZEntry&, T& p, uint8_t* data, File maxFile) { +uint8_t* set_dtz_map(TBTable& e, uint8_t* data, File maxFile) { - p.map = data; + e.map = data; for (File f = FILE_A; f <= maxFile; ++f) { - if (item(p, 0, f).precomp->flags & TBFlag::Mapped) - for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x - item(p, 0, f).map_idx[i] = (uint16_t)(data - p.map + 1); - data += *data + 1; + auto flags = e.get(0, f)->flags; + if (flags & TBFlag::Mapped) { + if (flags & TBFlag::Wide) { + data += (uintptr_t)data & 1; // Word alignment, we may have a mixed table + for (int i = 0; i < 4; ++i) { // Sequence like 3,x,x,x,1,x,0,2,x,x + e.get(0, f)->map_idx[i] = (uint16_t)((uint16_t *)data - (uint16_t *)e.map + 1); + data += 2 * number(data) + 2; + } + } + else { + for (int i = 0; i < 4; ++i) { + e.get(0, f)->map_idx[i] = (uint16_t)(data - e.map + 1); + data += *data + 1; + } } + } } return data += (uintptr_t)data & 1; // Word alignment } -template -void do_init(Entry& e, T& p, uint8_t* data) { - - const bool IsWDL = std::is_same::value; +// Populate entry's PairsData records with data from the just memory mapped file. +// Called at first access. +template +void set(T& e, uint8_t* data) { PairsData* d; @@ -1083,70 +1047,71 @@ void do_init(Entry& e, T& p, uint8_t* data) { data++; // First byte stores flags - const int Sides = IsWDL && (e.key != e.key2) ? 2 : 1; - const File MaxFile = e.hasPawns ? FILE_D : FILE_A; + const int sides = T::Sides == 2 && (e.key != e.key2) ? 2 : 1; + const File maxFile = e.hasPawns ? FILE_D : FILE_A; - bool pp = e.hasPawns && e.pawnTable.pawnCount[1]; // Pawns on both sides + bool pp = e.hasPawns && e.pawnCount[1]; // Pawns on both sides - assert(!pp || e.pawnTable.pawnCount[0]); + assert(!pp || e.pawnCount[0]); - for (File f = FILE_A; f <= MaxFile; ++f) { + for (File f = FILE_A; f <= maxFile; ++f) { - for (int i = 0; i < Sides; i++) - item(p, i, f).precomp = new PairsData(); + for (int i = 0; i < sides; i++) + *e.get(i, f) = PairsData(); int order[][2] = { { *data & 0xF, pp ? *(data + 1) & 0xF : 0xF }, { *data >> 4, pp ? *(data + 1) >> 4 : 0xF } }; data += 1 + pp; for (int k = 0; k < e.pieceCount; ++k, ++data) - for (int i = 0; i < Sides; i++) - item(p, i, f).precomp->pieces[k] = Piece(i ? *data >> 4 : *data & 0xF); + for (int i = 0; i < sides; i++) + e.get(i, f)->pieces[k] = Piece(i ? *data >> 4 : *data & 0xF); - for (int i = 0; i < Sides; ++i) - set_groups(e, item(p, i, f).precomp, order[i], f); + for (int i = 0; i < sides; ++i) + set_groups(e, e.get(i, f), order[i], f); } data += (uintptr_t)data & 1; // Word alignment - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) - data = set_sizes(item(p, i, f).precomp, data); + for (File f = FILE_A; f <= maxFile; ++f) + for (int i = 0; i < sides; i++) + data = set_sizes(e.get(i, f), data); - if (!IsWDL) - data = set_dtz_map(e, p, data, MaxFile); + data = set_dtz_map(e, data, maxFile); - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) { - (d = item(p, i, f).precomp)->sparseIndex = (SparseEntry*)data; + for (File f = FILE_A; f <= maxFile; ++f) + for (int i = 0; i < sides; i++) { + (d = e.get(i, f))->sparseIndex = (SparseEntry*)data; data += d->sparseIndexSize * sizeof(SparseEntry); } - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) { - (d = item(p, i, f).precomp)->blockLength = (uint16_t*)data; + for (File f = FILE_A; f <= maxFile; ++f) + for (int i = 0; i < sides; i++) { + (d = e.get(i, f))->blockLength = (uint16_t*)data; data += d->blockLengthSize * sizeof(uint16_t); } - for (File f = FILE_A; f <= MaxFile; ++f) - for (int i = 0; i < Sides; i++) { + for (File f = FILE_A; f <= maxFile; ++f) + for (int i = 0; i < sides; i++) { data = (uint8_t*)(((uintptr_t)data + 0x3F) & ~0x3F); // 64 byte alignment - (d = item(p, i, f).precomp)->data = data; + (d = e.get(i, f))->data = data; data += d->blocksNum * d->sizeofBlock; } } -template -void* init(Entry& e, const Position& pos) { - - const bool IsWDL = std::is_same::value; +// If the TB file corresponding to the given position is already memory mapped +// then return its base address, otherwise try to memory map and init it. Called +// at every probe, memory map and init only at first access. Function is thread +// safe and can be called concurrently. +template +void* mapped(TBTable& e, const Position& pos) { static Mutex mutex; - // Avoid a thread reads 'ready' == true while another is still in do_init(), - // this could happen due to compiler reordering. + // Use 'aquire' to avoid a thread reads 'ready' == true while another is + // still working, this could happen due to compiler reordering. if (e.ready.load(std::memory_order_acquire)) - return e.baseAddress; + return e.baseAddress; // Could be nullptr if file does not exsist std::unique_lock lk(mutex); @@ -1160,30 +1125,28 @@ void* init(Entry& e, const Position& pos) { b += std::string(popcount(pos.pieces(BLACK, pt)), PieceToChar[pt]); } - const uint8_t TB_MAGIC[][4] = { { 0xD7, 0x66, 0x0C, 0xA5 }, - { 0x71, 0xE8, 0x23, 0x5D } }; - fname = (e.key == pos.material_key() ? w + 'v' + b : b + 'v' + w) - + (IsWDL ? ".rtbw" : ".rtbz"); + + (Type == WDL ? ".rtbw" : ".rtbz"); + + uint8_t* data = TBFile(fname).map(&e.baseAddress, &e.mapping, Type); - uint8_t* data = TBFile(fname).map(&e.baseAddress, &e.mapping, TB_MAGIC[IsWDL]); if (data) - e.hasPawns ? do_init(e, e.pawnTable, data) : do_init(e, e.pieceTable, data); + set(e, data); e.ready.store(true, std::memory_order_release); return e.baseAddress; } -template::type> -T probe_table(const Position& pos, ProbeState* result, WDLScore wdl = WDLDraw) { +template::Ret> +Ret probe_table(const Position& pos, ProbeState* result, WDLScore wdl = WDLDraw) { - if (!(pos.pieces() ^ pos.pieces(KING))) - return T(WDLDraw); // KvK + if (pos.count() == 2) // KvK + return Ret(WDLDraw); - E* entry = EntryTable.get(pos.material_key()); + TBTable* entry = TBTables.get(pos.material_key()); - if (!entry || !init(*entry, pos)) - return *result = FAIL, T(); + if (!entry || !mapped(*entry, pos)) + return *result = FAIL, Ret(); return do_probe_table(pos, entry, wdl, result); } @@ -1197,11 +1160,11 @@ T probe_table(const Position& pos, ProbeState* result, WDLScore wdl = WDLDraw) { // All of this means that during probing, the engine must look at captures and probe // their results and must probe the position itself. The "best" result of these // probes is the correct result for the position. -// DTZ table don't store values when a following move is a zeroing winning move +// DTZ tables do not store values when a following move is a zeroing winning move // (winning capture or winning pawn move). Also DTZ store wrong values for positions // where the best move is an ep-move (even if losing). So in all these cases set // the state to ZEROING_BEST_MOVE. -template +template WDLScore search(Position& pos, ProbeState* result) { WDLScore value, bestValue = WDLLoss; @@ -1219,7 +1182,7 @@ WDLScore search(Position& pos, ProbeState* result) { moveCount++; pos.do_move(move, st); - value = -search(pos, result); + value = -search(pos, result); pos.undo_move(move); if (*result == FAIL) @@ -1249,7 +1212,7 @@ WDLScore search(Position& pos, ProbeState* result) { value = bestValue; else { - value = probe_table(pos, result); + value = probe_table(pos, result); if (*result == FAIL) return WDLDraw; @@ -1265,9 +1228,13 @@ WDLScore search(Position& pos, ProbeState* result) { } // namespace + +/// Tablebases::init() is called at startup and after every change to +/// "SyzygyPath" UCI option to (re)create the various tables. It is not thread +/// safe, nor it needs to be. void Tablebases::init(const std::string& paths) { - EntryTable.clear(); + TBTables.clear(); MaxCardinality = 0; TBFile::Paths = paths; @@ -1336,9 +1303,9 @@ void Tablebases::init(const std::string& paths) { // among pawns with same file, the one with lowest rank. int availableSquares = 47; // Available squares when lead pawn is in a2 - // Init the tables for the encoding of leading pawns group: with 6-men TB we - // can have up to 4 leading pawns (KPPPPK). - for (int leadPawnsCnt = 1; leadPawnsCnt <= 4; ++leadPawnsCnt) + // Init the tables for the encoding of leading pawns group: with 7-men TB we + // can have up to 5 leading pawns (KPPPPPK). + for (int leadPawnsCnt = 1; leadPawnsCnt <= 5; ++leadPawnsCnt) for (File f = FILE_A; f <= FILE_D; ++f) { // Restart the index at every file because TB table is splitted @@ -1368,33 +1335,45 @@ void Tablebases::init(const std::string& paths) { LeadPawnsSize[leadPawnsCnt][f] = idx; } + // Add entries in TB tables if the corresponding ".rtbw" file exsists for (PieceType p1 = PAWN; p1 < KING; ++p1) { - EntryTable.insert({KING, p1, KING}); + TBTables.add({KING, p1, KING}); for (PieceType p2 = PAWN; p2 <= p1; ++p2) { - EntryTable.insert({KING, p1, p2, KING}); - EntryTable.insert({KING, p1, KING, p2}); + TBTables.add({KING, p1, p2, KING}); + TBTables.add({KING, p1, KING, p2}); for (PieceType p3 = PAWN; p3 < KING; ++p3) - EntryTable.insert({KING, p1, p2, KING, p3}); + TBTables.add({KING, p1, p2, KING, p3}); for (PieceType p3 = PAWN; p3 <= p2; ++p3) { - EntryTable.insert({KING, p1, p2, p3, KING}); + TBTables.add({KING, p1, p2, p3, KING}); - for (PieceType p4 = PAWN; p4 <= p3; ++p4) - EntryTable.insert({KING, p1, p2, p3, p4, KING}); + for (PieceType p4 = PAWN; p4 <= p3; ++p4) { + TBTables.add({KING, p1, p2, p3, p4, KING}); - for (PieceType p4 = PAWN; p4 < KING; ++p4) - EntryTable.insert({KING, p1, p2, p3, KING, p4}); + for (PieceType p5 = PAWN; p5 <= p4; ++p5) + TBTables.add({KING, p1, p2, p3, p4, p5, KING}); + + for (PieceType p5 = PAWN; p5 < KING; ++p5) + TBTables.add({KING, p1, p2, p3, p4, KING, p5}); + } + + for (PieceType p4 = PAWN; p4 < KING; ++p4) { + TBTables.add({KING, p1, p2, p3, KING, p4}); + + for (PieceType p5 = PAWN; p5 <= p4; ++p5) + TBTables.add({KING, p1, p2, p3, KING, p4, p5}); + } } for (PieceType p3 = PAWN; p3 <= p1; ++p3) for (PieceType p4 = PAWN; p4 <= (p1 == p3 ? p2 : p3); ++p4) - EntryTable.insert({KING, p1, p2, KING, p3, p4}); + TBTables.add({KING, p1, p2, KING, p3, p4}); } } - sync_cout << "Info string found: " << EntryTable.size() << " tablebases" << sync_endl; + sync_cout << "info string Found " << TBTables.size() << " tablebases" << sync_endl; } // Probe the WDL table for a particular position. @@ -1408,7 +1387,7 @@ void Tablebases::init(const std::string& paths) { WDLScore Tablebases::probe_wdl(Position& pos, ProbeState* result) { *result = OK; - return search(pos, result); + return search(pos, result); } // Probe the DTZ table for a particular position. @@ -1416,6 +1395,7 @@ WDLScore Tablebases::probe_wdl(Position& pos, ProbeState* result) { // The return value is from the point of view of the side to move: // n < -100 : loss, but draw under 50-move rule // -100 <= n < -1 : loss in n ply (assuming 50-move counter == 0) +// -1 : loss, the side to move is mated // 0 : draw // 1 < n <= 100 : win in n ply (assuming 50-move counter == 0) // 100 < n : win, but draw under 50-move rule @@ -1449,7 +1429,7 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result) { if (*result == ZEROING_BEST_MOVE) return dtz_before_zeroing(wdl); - int dtz = probe_table(pos, result, wdl); + int dtz = probe_table(pos, result, wdl); if (*result == FAIL) return 0; @@ -1472,13 +1452,12 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result) { // otherwise we will get the dtz of the next move sequence. Search the // position after the move to get the score sign (because even in a // winning position we could make a losing capture or going for a draw). - dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) + dtz = zeroing ? -dtz_before_zeroing(search(pos, result)) : -probe_dtz(pos, result); - pos.undo_move(move); - - if (*result == FAIL) - return 0; + // If the move mates, force minDTZ to 1 + if (dtz == 1 && pos.checkers() && MoveList(pos).size() == 0) + minDTZ = 1; // Convert result from 1-ply search. Zeroing moves are already accounted // by dtz_before_zeroing() that returns the DTZ of the previous move. @@ -1488,217 +1467,118 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result) { // Skip the draws and if we are winning only pick positive dtz if (dtz < minDTZ && sign_of(dtz) == sign_of(wdl)) minDTZ = dtz; - } - // Special handle a mate position, when there are no legal moves, in this - // case return value is somewhat arbitrary, so stick to the original TB code - // that returns -1 in this case. - return minDTZ == 0xFFFF ? -1 : minDTZ; -} - -// Check whether there has been at least one repetition of positions -// since the last capture or pawn move. -static int has_repeated(StateInfo *st) -{ - while (1) { - int i = 4, e = std::min(st->rule50, st->pliesFromNull); + pos.undo_move(move); - if (e < i) + if (*result == FAIL) return 0; - - StateInfo *stp = st->previous->previous; - - do { - stp = stp->previous->previous; - - if (stp->key == st->key) - return 1; - - i += 2; - } while (i <= e); - - st = st->previous; } + + // When there are no legal moves, the position is mate: we return -1 + return minDTZ == 0xFFFF ? -1 : minDTZ; } -// Use the DTZ tables to filter out moves that don't preserve the win or draw. -// If the position is lost, but DTZ is fairly high, only keep moves that -// maximise DTZ. + +// Use the DTZ tables to rank root moves. // -// A return value false indicates that not all probes were successful and that -// no moves were filtered out. -bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score) -{ - assert(rootMoves.size()); +// A return value false indicates that not all probes were successful. +bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves) { ProbeState result; - int dtz = probe_dtz(pos, &result); - - if (result == FAIL) - return false; - StateInfo st; - // Probe each move - for (size_t i = 0; i < rootMoves.size(); ++i) { - Move move = rootMoves[i].pv[0]; - pos.do_move(move, st); - int v = 0; - - if (pos.checkers() && dtz > 0) { - ExtMove s[MAX_MOVES]; - - if (generate(pos, s) == s) - v = 1; - } + // Obtain 50-move counter for the root position + int cnt50 = pos.rule50_count(); - if (!v) { - if (st.rule50 != 0) { - v = -probe_dtz(pos, &result); - - if (v > 0) - ++v; - else if (v < 0) - --v; - } else { - v = -probe_wdl(pos, &result); - v = dtz_before_zeroing(WDLScore(v)); - } - } + // Check whether a position was repeated since the last zeroing move. + bool rep = pos.has_repeated(); - pos.undo_move(move); - - if (result == FAIL) - return false; + int dtz, bound = Options["Syzygy50MoveRule"] ? 900 : 1; - rootMoves[i].score = (Value)v; - } - - // Obtain 50-move counter for the root position. - // In Stockfish there seems to be no clean way, so we do it like this: - int cnt50 = st.previous ? st.previous->rule50 : 0; - - // Use 50-move counter to determine whether the root position is - // won, lost or drawn. - WDLScore wdl = WDLDraw; - - if (dtz > 0) - wdl = (dtz + cnt50 <= 100) ? WDLWin : WDLCursedWin; - else if (dtz < 0) - wdl = (-dtz + cnt50 <= 100) ? WDLLoss : WDLBlessedLoss; - - // Determine the score to report to the user. - score = WDL_to_value[wdl + 2]; - - // If the position is winning or losing, but too few moves left, adjust the - // score to show how close it is to winning or losing. - // NOTE: int(PawnValueEg) is used as scaling factor in score_to_uci(). - if (wdl == WDLCursedWin && dtz <= 100) - score = (Value)(((200 - dtz - cnt50) * int(PawnValueEg)) / 200); - else if (wdl == WDLBlessedLoss && dtz >= -100) - score = -(Value)(((200 + dtz - cnt50) * int(PawnValueEg)) / 200); - - // Now be a bit smart about filtering out moves. - size_t j = 0; - - if (dtz > 0) { // winning (or 50-move rule draw) - int best = 0xffff; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - int v = rootMoves[i].score; + // Probe and rank each move + for (auto& m : rootMoves) + { + pos.do_move(m.pv[0], st); - if (v > 0 && v < best) - best = v; + // Calculate dtz for the current move counting from the root position + if (pos.rule50_count() == 0) + { + // In case of a zeroing move, dtz is one of -101/-1/0/1/101 + WDLScore wdl = -probe_wdl(pos, &result); + dtz = dtz_before_zeroing(wdl); } - - int max = best; - - // If the current phase has not seen repetitions, then try all moves - // that stay safely within the 50-move budget, if there are any. - if (!has_repeated(st.previous) && best + cnt50 <= 99) - max = 99 - cnt50; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - int v = rootMoves[i].score; - - if (v > 0 && v <= max) - rootMoves[j++] = rootMoves[i]; + else + { + // Otherwise, take dtz for the new position and correct by 1 ply + dtz = -probe_dtz(pos, &result); + dtz = dtz > 0 ? dtz + 1 + : dtz < 0 ? dtz - 1 : dtz; } - } else if (dtz < 0) { // losing (or 50-move rule draw) - int best = 0; - for (size_t i = 0; i < rootMoves.size(); ++i) { - int v = rootMoves[i].score; + // Make sure that a mating move is assigned a dtz value of 1 + if ( pos.checkers() + && dtz == 2 + && MoveList(pos).size() == 0) + dtz = 1; - if (v < best) - best = v; - } + pos.undo_move(m.pv[0]); - // Try all moves, unless we approach or have a 50-move rule draw. - if (-best * 2 + cnt50 < 100) - return true; + if (result == FAIL) + return false; - for (size_t i = 0; i < rootMoves.size(); ++i) { - if (rootMoves[i].score == best) - rootMoves[j++] = rootMoves[i]; - } - } else { // drawing - // Try all moves that preserve the draw. - for (size_t i = 0; i < rootMoves.size(); ++i) { - if (rootMoves[i].score == 0) - rootMoves[j++] = rootMoves[i]; - } + // Better moves are ranked higher. Certain wins are ranked equally. + // Losing moves are ranked equally unless a 50-move draw is in sight. + int r = dtz > 0 ? (dtz + cnt50 <= 99 && !rep ? 1000 : 1000 - (dtz + cnt50)) + : dtz < 0 ? (-dtz * 2 + cnt50 < 100 ? -1000 : -1000 + (-dtz + cnt50)) + : 0; + m.tbRank = r; + + // Determine the score to be displayed for this move. Assign at least + // 1 cp to cursed wins and let it grow to 49 cp as the positions gets + // closer to a real win. + m.tbScore = r >= bound ? VALUE_MATE - MAX_PLY - 1 + : r > 0 ? Value((std::max( 3, r - 800) * int(PawnValueEg)) / 200) + : r == 0 ? VALUE_DRAW + : r > -bound ? Value((std::min(-3, r + 800) * int(PawnValueEg)) / 200) + : -VALUE_MATE + MAX_PLY + 1; } - rootMoves.resize(j, Search::RootMove(MOVE_NONE)); - return true; } -// Use the WDL tables to filter out moves that don't preserve the win or draw. + +// Use the WDL tables to rank root moves. // This is a fallback for the case that some or all DTZ tables are missing. // -// A return value false indicates that not all probes were successful and that -// no moves were filtered out. -bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score) -{ - ProbeState result; +// A return value false indicates that not all probes were successful. +bool Tablebases::root_probe_wdl(Position& pos, Search::RootMoves& rootMoves) { - WDLScore wdl = Tablebases::probe_wdl(pos, &result); + static const int WDL_to_rank[] = { -1000, -899, 0, 899, 1000 }; - if (result == FAIL) - return false; + ProbeState result; + StateInfo st; - score = WDL_to_value[wdl + 2]; + bool rule50 = Options["Syzygy50MoveRule"]; - StateInfo st; + // Probe and rank each move + for (auto& m : rootMoves) + { + pos.do_move(m.pv[0], st); - int best = WDLLoss; + WDLScore wdl = -probe_wdl(pos, &result); - // Probe each move - for (size_t i = 0; i < rootMoves.size(); ++i) { - Move move = rootMoves[i].pv[0]; - pos.do_move(move, st); - WDLScore v = -Tablebases::probe_wdl(pos, &result); - pos.undo_move(move); + pos.undo_move(m.pv[0]); if (result == FAIL) return false; - rootMoves[i].score = (Value)v; + m.tbRank = WDL_to_rank[wdl + 2]; - if (v > best) - best = v; + if (!rule50) + wdl = wdl > WDLDraw ? WDLWin + : wdl < WDLDraw ? WDLLoss : WDLDraw; + m.tbScore = WDL_to_value[wdl + 2]; } - size_t j = 0; - - for (size_t i = 0; i < rootMoves.size(); ++i) { - if (rootMoves[i].score == best) - rootMoves[j++] = rootMoves[i]; - } - - rootMoves.resize(j, Search::RootMove(MOVE_NONE)); - return true; } diff --git a/Engines/Linux64/mcbrain/src/tbprobe.h b/Engines/Windows/mcbrain/src/syzygy/tbprobe.h similarity index 87% rename from Engines/Linux64/mcbrain/src/tbprobe.h rename to Engines/Windows/mcbrain/src/syzygy/tbprobe.h index 7c0bbe7..3fcb3d8 100644 --- a/Engines/Linux64/mcbrain/src/tbprobe.h +++ b/Engines/Windows/mcbrain/src/syzygy/tbprobe.h @@ -3,7 +3,7 @@ Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) - Copyright (C) 2017 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) McBrain is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ #include -#include "search.h" +#include "../search.h" namespace Tablebases { @@ -51,9 +51,9 @@ extern int MaxCardinality; void init(const std::string& paths); WDLScore probe_wdl(Position& pos, ProbeState* result); int probe_dtz(Position& pos, ProbeState* result); -bool root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score); -bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, Value& score); -void filter_root_moves(Position& pos, Search::RootMoves& rootMoves); +bool root_probe(Position& pos, Search::RootMoves& rootMoves); +bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves); +void rank_root_moves(Position& pos, Search::RootMoves& rootMoves); inline std::ostream& operator<<(std::ostream& os, const WDLScore v) { diff --git a/Engines/Windows/mcbrain/src/thread.cpp b/Engines/Windows/mcbrain/src/thread.cpp new file mode 100644 index 0000000..a72e91e --- /dev/null +++ b/Engines/Windows/mcbrain/src/thread.cpp @@ -0,0 +1,204 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include // For std::count +#include + +#include "movegen.h" +#include "search.h" +#include "thread.h" +#include "uci.h" +#include "syzygy/tbprobe.h" +#include "tt.h" + +ThreadPool Threads; // Global object + + +/// Thread constructor launches the thread and waits until it goes to sleep +/// in idle_loop(). Note that 'searching' and 'exit' should be alredy set. + +Thread::Thread(size_t n) : idx(n), stdThread(&Thread::idle_loop, this) { + + wait_for_search_finished(); +} + + +/// Thread destructor wakes up the thread in idle_loop() and waits +/// for its termination. Thread should be already waiting. + +Thread::~Thread() { + + assert(!searching); + + exit = true; + start_searching(); + stdThread.join(); +} + + +/// Thread::clear() reset histories, usually before a new game + +void Thread::clear() { + + counterMoves.fill(MOVE_NONE); + mainHistory.fill(0); + captureHistory.fill(0); + + for (auto& to : continuationHistory) + for (auto& h : to) + h->fill(0); + + continuationHistory[NO_PIECE][0]->fill(Search::CounterMovePruneThreshold - 1); +} + +/// Thread::start_searching() wakes up the thread that will start the search + +void Thread::start_searching() { + + std::lock_guard lk(mutex); + searching = true; + cv.notify_one(); // Wake up the thread in idle_loop() +} + + +/// Thread::wait_for_search_finished() blocks on the condition variable +/// until the thread has finished searching. + +void Thread::wait_for_search_finished() { + + std::unique_lock lk(mutex); + cv.wait(lk, [&]{ return !searching; }); +} + + +/// Thread::idle_loop() is where the thread is parked, blocked on the +/// condition variable, when it has no work to do. + +void Thread::idle_loop() { + + // If OS already scheduled us on a different group than 0 then don't overwrite + // the choice, eventually we are one of many one-threaded processes running on + // some Windows NUMA hardware, for instance in fishtest. To make it simple, + // just check if running threads are below a threshold, in this case all this + // NUMA machinery is not needed. + if (int(Options["Threads"]) >= 8) + WinProcGroup::bindThisThread(idx); + + while (true) + { + std::unique_lock lk(mutex); + searching = false; + cv.notify_one(); // Wake up anyone waiting for search finished + cv.wait(lk, [&]{ return searching; }); + + if (exit) + return; + + lk.unlock(); + + search(); + } +} + +/// ThreadPool::set() creates/destroys threads to match the requested number. +/// Created and launched threads will go immediately to sleep in idle_loop. +/// Upon resizing, threads are recreated to allow for binding if necessary. + +void ThreadPool::set(size_t requested) { + + if (size() > 0) { // destroy any existing thread(s) + main()->wait_for_search_finished(); + + while (size() > 0) + delete back(), pop_back(); + } + + if (requested > 0) { // create new thread(s) + push_back(new MainThread(0)); + + while (size() < requested) + push_back(new Thread(size())); + clear(); + } + + // Reallocate the hash with the new threadpool size + TT.resize(Options["Hash"]); +} + +/// ThreadPool::clear() sets threadPool data to initial values. + +void ThreadPool::clear() { + + for (Thread* th : *this) + th->clear(); + + main()->callsCnt = 0; + main()->previousScore = VALUE_INFINITE; + main()->previousTimeReduction = 1.0; +} + +/// ThreadPool::start_thinking() wakes up main thread waiting in idle_loop() and +/// returns immediately. Main thread will wake up other threads and start the search. + +void ThreadPool::start_thinking(Position& pos, StateListPtr& states, + const Search::LimitsType& limits, bool ponderMode) { + + main()->wait_for_search_finished(); + + stopOnPonderhit = stop = false; + ponder = ponderMode; + Search::Limits = limits; + Search::RootMoves rootMoves; + + for (const auto& m : MoveList(pos)) + if ( limits.searchmoves.empty() + || std::count(limits.searchmoves.begin(), limits.searchmoves.end(), m)) + rootMoves.emplace_back(m); + + if (!rootMoves.empty()) + Tablebases::rank_root_moves(pos, rootMoves); + + // After ownership transfer 'states' becomes empty, so if we stop the search + // and call 'go' again without setting a new position states.get() == NULL. + assert(states.get() || setupStates.get()); + + if (states.get()) + setupStates = std::move(states); // Ownership transfer, states is now empty + + // We use Position::set() to set root position across threads. But there are + // some StateInfo fields (previous, pliesFromNull, capturedPiece) that cannot + // be deduced from a fen string, so set() clears them and to not lose the info + // we need to backup and later restore setupStates->back(). Note that setupStates + // is shared by threads but is accessed in read-only mode. + StateInfo tmp = setupStates->back(); + + for (Thread* th : *this) + { + th->nodes = th->tbHits = th->nmpMinPly = 0; + th->rootDepth = th->completedDepth = DEPTH_ZERO; + th->rootMoves = rootMoves; + th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th); + } + + setupStates->back() = tmp; + + main()->start_searching(); +} diff --git a/Engines/Windows/mcbrain/src/thread.h b/Engines/Windows/mcbrain/src/thread.h new file mode 100644 index 0000000..505dd27 --- /dev/null +++ b/Engines/Windows/mcbrain/src/thread.h @@ -0,0 +1,126 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef THREAD_H_INCLUDED +#define THREAD_H_INCLUDED + +#include +#include +#include +#include +#include + +#include "material.h" +#include "movepick.h" +#include "pawns.h" +#include "position.h" +#include "search.h" +#include "thread_win32.h" + + +/// Thread class keeps together all the thread-related stuff. We use +/// per-thread pawn and material hash tables so that once we get a +/// pointer to an entry its life time is unlimited and we don't have +/// to care about someone changing the entry under our feet. + +class Thread { + + Mutex mutex; + ConditionVariable cv; + size_t idx; + bool exit = false, searching = true; // Set before starting std::thread + std::thread stdThread; + +public: + explicit Thread(size_t); + virtual ~Thread(); + virtual void search(); + void clear(); + void idle_loop(); + void start_searching(); + void wait_for_search_finished(); + + Pawns::Table pawnsTable; + Material::Table materialTable; + Endgames endgames; + size_t pvIdx, pvLast; + int selDepth, nmpMinPly; + Color nmpColor; + std::atomic nodes, tbHits; + + Position rootPos; + Search::RootMoves rootMoves; + Depth rootDepth, completedDepth; + CounterMoveHistory counterMoves; + ButterflyHistory mainHistory; + CapturePieceToHistory captureHistory; + ContinuationHistory continuationHistory; + Score contempt; + bool pvDraw; +}; + + +/// MainThread is a derived class specific for main thread + +struct MainThread : public Thread { + + using Thread::Thread; + + void search() override; + void check_time(); + + double bestMoveChanges, previousTimeReduction; + Value previousScore; + int callsCnt; +}; + + +/// ThreadPool struct handles all the threads-related stuff like init, starting, +/// parking and, most importantly, launching a thread. All the access to threads +/// is done through this class. + +struct ThreadPool : public std::vector { + + void start_thinking(Position&, StateListPtr&, const Search::LimitsType&, bool = false); + void clear(); + void set(size_t); + + MainThread* main() const { return static_cast(front()); } + uint64_t nodes_searched() const { return accumulate(&Thread::nodes); } + uint64_t tb_hits() const { return accumulate(&Thread::tbHits); } + + std::atomic_bool stop, ponder, stopOnPonderhit; + +private: + StateListPtr setupStates; + + uint64_t accumulate(std::atomic Thread::* member) const { + + uint64_t sum = 0; + for (Thread* th : *this) + sum += (th->*member).load(std::memory_order_relaxed); + return sum; + } +}; + +extern ThreadPool Threads; + +#endif // #ifndef THREAD_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/thread_win32.h b/Engines/Windows/mcbrain/src/thread_win32.h new file mode 100644 index 0000000..d69e817 --- /dev/null +++ b/Engines/Windows/mcbrain/src/thread_win32.h @@ -0,0 +1,71 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef THREAD_WIN32_H_INCLUDED +#define THREAD_WIN32_H_INCLUDED + +/// STL thread library used by mingw and gcc when cross compiling for Windows +/// relies on libwinpthread. Currently libwinpthread implements mutexes directly +/// on top of Windows semaphores. Semaphores, being kernel objects, require kernel +/// mode transition in order to lock or unlock, which is very slow compared to +/// interlocked operations (about 30% slower on bench test). To work around this +/// issue, we define our wrappers to the low level Win32 calls. We use critical +/// sections to support Windows XP and older versions. Unfortunately, cond_wait() +/// is racy between unlock() and WaitForSingleObject() but they have the same +/// speed performance as the SRW locks. + +#include +#include + +#if defined(_WIN32) && !defined(_MSC_VER) + +#ifndef NOMINMAX +# define NOMINMAX // Disable macros min() and max() +#endif + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#undef NOMINMAX + +/// Mutex and ConditionVariable struct are wrappers of the low level locking +/// machinery and are modeled after the corresponding C++11 classes. + +struct Mutex { + Mutex() { InitializeCriticalSection(&cs); } + ~Mutex() { DeleteCriticalSection(&cs); } + void lock() { EnterCriticalSection(&cs); } + void unlock() { LeaveCriticalSection(&cs); } + +private: + CRITICAL_SECTION cs; +}; + +typedef std::condition_variable_any ConditionVariable; + +#else // Default case: use STL classes + +typedef std::mutex Mutex; +typedef std::condition_variable ConditionVariable; + +#endif + +#endif // #ifndef THREAD_WIN32_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/timeman.cpp b/Engines/Windows/mcbrain/src/timeman.cpp new file mode 100644 index 0000000..b575039 --- /dev/null +++ b/Engines/Windows/mcbrain/src/timeman.cpp @@ -0,0 +1,134 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include + +#include "search.h" +#include "timeman.h" +#include "uci.h" + +TimeManagement Time; // Our global time management object + +namespace { + + enum TimeType { OptimumTime, MaxTime }; + + constexpr int MoveHorizon = 50; // Plan time management at most this many moves ahead + constexpr double MaxRatio = 7.3; // When in trouble, we can step over reserved time with this ratio + constexpr double StealRatio = 0.34; // However we must not steal time from remaining moves over this ratio + + + // move_importance() is a skew-logistic function based on naive statistical + // analysis of "how many games are still undecided after n half-moves". Game + // is considered "undecided" as long as neither side has >275cp advantage. + // Data was extracted from the CCRL game database with some simple filtering criteria. + + double move_importance(int ply) { + + constexpr double XScale = 6.85; + constexpr double XShift = 64.5; + constexpr double Skew = 0.171; + + return pow((1 + exp((ply - XShift) / XScale)), -Skew) + DBL_MIN; // Ensure non-zero + } + + template + TimePoint remaining(TimePoint myTime, int movesToGo, int ply, TimePoint slowMover) { + + constexpr double TMaxRatio = (T == OptimumTime ? 1.0 : MaxRatio); + constexpr double TStealRatio = (T == OptimumTime ? 0.0 : StealRatio); + + double moveImportance = (move_importance(ply) * slowMover) / 100.0; + double otherMovesImportance = 0.0; + + for (int i = 1; i < movesToGo; ++i) + otherMovesImportance += move_importance(ply + 2 * i); + + double ratio1 = (TMaxRatio * moveImportance) / (TMaxRatio * moveImportance + otherMovesImportance); + double ratio2 = (moveImportance + TStealRatio * otherMovesImportance) / (moveImportance + otherMovesImportance); + + return TimePoint(myTime * std::min(ratio1, ratio2)); // Intel C++ asks for an explicit cast + } + +} // namespace + + +/// init() is called at the beginning of the search and calculates the allowed +/// thinking time out of the time control and current game ply. We support four +/// different kinds of time controls, passed in 'limits': +/// +/// inc == 0 && movestogo == 0 means: x basetime [sudden death!] +/// inc == 0 && movestogo != 0 means: x moves in y minutes +/// inc > 0 && movestogo == 0 means: x basetime + z increment +/// inc > 0 && movestogo != 0 means: x moves in y minutes + z increment + +void TimeManagement::init(Search::LimitsType& limits, Color us, int ply) { + + TimePoint minThinkingTime = Options["Minimum Thinking Time"]; + TimePoint moveOverhead = Options["Move Overhead"]; + TimePoint slowMover = Options["Slow Mover"]; + TimePoint npmsec = Options["nodestime"]; + TimePoint hypMyTime; + + // If we have to play in 'nodes as time' mode, then convert from time + // to nodes, and use resulting values in time management formulas. + // WARNING: to avoid time losses, the given npmsec (nodes per millisecond) + // must be much lower than the real engine speed. + if (npmsec) + { + if (!availableNodes) // Only once at game start + availableNodes = npmsec * limits.time[us]; // Time is in msec + + // Convert from milliseconds to nodes + limits.time[us] = TimePoint(availableNodes); + limits.inc[us] *= npmsec; + limits.npmsec = npmsec; + } + + startTime = limits.startTime; + optimumTime = maximumTime = std::max(limits.time[us], minThinkingTime); + + const int maxMTG = limits.movestogo ? std::min(limits.movestogo, MoveHorizon) : MoveHorizon; + + // We calculate optimum time usage for different hypothetical "moves to go" values + // and choose the minimum of calculated search time values. Usually the greatest + // hypMTG gives the minimum values. + for (int hypMTG = 1; hypMTG <= maxMTG; ++hypMTG) + { + // Calculate thinking time for hypothetical "moves to go"-value + hypMyTime = limits.time[us] + + limits.inc[us] * (hypMTG - 1) + - moveOverhead * (2 + std::min(hypMTG, 40)); + + hypMyTime = std::max(hypMyTime, TimePoint(0)); + + TimePoint t1 = minThinkingTime + remaining(hypMyTime, hypMTG, ply, slowMover); + TimePoint t2 = minThinkingTime + remaining(hypMyTime, hypMTG, ply, slowMover); + + optimumTime = std::min(t1, optimumTime); + maximumTime = std::min(t2, maximumTime); + } + + if (Options["Ponder"]) + optimumTime += optimumTime / 4; +} diff --git a/Engines/Windows/mcbrain/src/timeman.h b/Engines/Windows/mcbrain/src/timeman.h new file mode 100644 index 0000000..6fa8f01 --- /dev/null +++ b/Engines/Windows/mcbrain/src/timeman.h @@ -0,0 +1,50 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef TIMEMAN_H_INCLUDED +#define TIMEMAN_H_INCLUDED + +#include "misc.h" +#include "search.h" +#include "thread.h" + +/// The TimeManagement class computes the optimal time to think depending on +/// the maximum available time, the game move number and other parameters. + +class TimeManagement { +public: + void init(Search::LimitsType& limits, Color us, int ply); + TimePoint optimum() const { return optimumTime; } + TimePoint maximum() const { return maximumTime; } + TimePoint elapsed() const { return Search::Limits.npmsec ? + TimePoint(Threads.nodes_searched()) : now() - startTime; } + + int64_t availableNodes; // When in 'nodes as time' mode + +private: + TimePoint startTime; + TimePoint optimumTime; + TimePoint maximumTime; +}; + +extern TimeManagement Time; + +#endif // #ifndef TIMEMAN_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/tt.cpp b/Engines/Windows/mcbrain/src/tt.cpp new file mode 100644 index 0000000..7408ea8 --- /dev/null +++ b/Engines/Windows/mcbrain/src/tt.cpp @@ -0,0 +1,657 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include // For std::memset +#include +#include +#include +#include "uci.h" +using std::string; +#include +#include +#include +#include +#include +#include "position.h" +#include "thread.h" +#include "bitboard.h" +#include "tt.h" +#include "misc.h" +#include "tt.h" +#include "uci.h" + +#ifdef _WIN32 + +#include +#undef max +#undef min + +#endif + +//https://stackoverflow.com/questions/236129/most-elegant-way-to-split-a-string +template +void split(const std::string &s, char delim, Out result) { + std::stringstream ss; + ss.str(s); + std::string item; + while (std::getline(ss, item, delim)) { + *(result++) = item; + } +} + +std::vector split(const std::string &s, char delim) { + std::vector elems; + split(s, delim, std::back_inserter(elems)); + return elems; +} + +TranspositionTable TT; // Our global transposition table +#ifdef _WIN32 +int use_large_pages = -1; +int got_privileges = -1; +#endif + +#ifdef _WIN32 +bool Get_LockMemory_Privileges() +{ + HANDLE TH, PROC7; + TOKEN_PRIVILEGES tp; + bool ret = false; + + PROC7 = GetCurrentProcess(); + if (OpenProcessToken(PROC7, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &TH)) + { + if (LookupPrivilegeValue(NULL, TEXT("SeLockMemoryPrivilege"), &tp.Privileges[0].Luid)) + { + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + if (AdjustTokenPrivileges(TH, FALSE, &tp, 0, NULL, 0)) + { + if (GetLastError() != ERROR_NOT_ALL_ASSIGNED) + ret = true; + } + } + CloseHandle(TH); + } + return ret; +} + + +void Try_Get_LockMemory_Privileges() +{ + use_large_pages = 0; + + if (bool(Options["Large Pages"]) == false) + return; + + if (got_privileges == -1) + { + if (Get_LockMemory_Privileges() == true) + got_privileges = 1; + else + { + sync_cout << "No Privilege for Large Pages" << sync_endl; + got_privileges = 0; + } + } + + if (got_privileges == 0) + return; + + use_large_pages = 1; +} +#endif + +/// TTEntry::save saves a TTEntry +void TTEntry::save(Key k, Value v, Bound b, Depth d, Move m, Value ev) { + + assert(d / ONE_PLY * ONE_PLY == d); + + // Preserve any existing move for the same position + if (m || (k >> 48) != key16) + move16 = (uint16_t)m; + + // Overwrite less valuable entries + if ( (k >> 48) != key16 + || d / ONE_PLY > depth8 - 4 + || b == BOUND_EXACT) + { + key16 = (uint16_t)(k >> 48); + value16 = (int16_t)v; + eval16 = (int16_t)ev; + genBound8 = (uint8_t)(TT.generation8 | b); + depth8 = (int8_t)(d / ONE_PLY); + } +} + + +/// TranspositionTable::resize() sets the size of the transposition table, +/// measured in megabytes. Transposition table consists of a power of 2 number +/// of clusters and each cluster consists of ClusterSize number of TTEntry. + +void TranspositionTable::resize(size_t mbSize) { + + if (mbSize == 0) + mbSize = mbSize_last_used; + + if (mbSize == 0) + return; + + mbSize_last_used = mbSize; + +#ifdef _WIN32 + Try_Get_LockMemory_Privileges(); +#endif + + size_t newClusterCount = mbSize * 1024 * 1024 / sizeof(Cluster); + + if (newClusterCount == clusterCount) + { +#ifdef _WIN32 + if ((use_large_pages == 1) && (large_pages_used)) + return; + if ((use_large_pages == 0) && (large_pages_used == false)) +#endif + return; + } + + clusterCount = newClusterCount; + +#ifdef _WIN32 + if (use_large_pages < 1) +#endif + { + if (mem != NULL) + { +#ifdef _WIN32 + if (large_pages_used) + VirtualFree(mem, 0, MEM_RELEASE); + else +#endif + free(mem); + } + + size_t memsize = clusterCount * sizeof(Cluster) + CacheLineSize - 1; + mem = calloc(memsize, 1); +#ifdef _WIN32 + large_pages_used = false; +#endif + } +#ifdef _WIN32 + else + { + if (mem != NULL) + { + if (large_pages_used) + VirtualFree(mem, 0, MEM_RELEASE); + else + free(mem); + } + + size_t memsize = clusterCount * sizeof(Cluster); + mem = VirtualAlloc(NULL, memsize, MEM_LARGE_PAGES | MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if (mem == NULL) + { + std::cerr << "Failed to allocate " << mbSize + << "MB Large Page Memory for transposition table, switching to default" << std::endl; + + use_large_pages = 0; + memsize = clusterCount * sizeof(Cluster) + CacheLineSize - 1; + mem = malloc(memsize); + large_pages_used = false; + } + else + { + sync_cout << "info string LargePages " << (memsize >> 20) << " MiB" << sync_endl; + large_pages_used = true; + } + + } +#endif + + if (!mem) + { + std::cerr << "Failed to allocate " << mbSize + << "MiB for transposition table." << std::endl; + exit(EXIT_FAILURE); + } + + table = (Cluster*)((uintptr_t(mem) + CacheLineSize - 1) & ~(CacheLineSize - 1)); +} + + +/// TranspositionTable::clear() initializes the entire transposition table to zero, +// in a multi-threaded way. + +void TranspositionTable::clear() { + + std::vector threads; + + for (size_t idx = 0; idx < size_t(Options["Threads"]); idx++) + { + threads.push_back(std::thread([this, idx]() { + + // Thread binding gives faster search on systems with a first-touch policy + if (int(Options["Threads"]) >= 8) + WinProcGroup::bindThisThread(idx); + + // Each thread will zero its part of the hash table + const size_t stride = clusterCount / size_t(Options["Threads"]), + start = stride * idx, + len = idx != size_t(Options["Threads"]) - 1 ? + stride : clusterCount - start; + + std::memset(&table[start], 0, len * sizeof(Cluster)); + })); + } + + for (std::thread& th: threads) + th.join(); +} + +void TranspositionTable::set_hash_file_name(const std::string& fname) { hashfilename = fname; } + +bool TranspositionTable::save() { + std::ofstream b_stream(hashfilename, + std::fstream::out | std::fstream::binary); + if (b_stream) + { + //b_stream.write(reinterpret_cast(table), clusterCount * sizeof(Cluster)); + for (unsigned long long i = 0; i < clusterCount * sizeof(Cluster); i += (1 << 30)) { //1GB +#ifndef __min + #define __min(a,b) (((a) < (b)) ? (a) : (b)) +#endif + unsigned long long j = __min((1 << 30), (clusterCount * sizeof(Cluster)) - i); + b_stream.write(reinterpret_cast(table) + i, j); + } + return (b_stream.good()); + } + return false; +} + +void TranspositionTable::load() { + //file size: https://stackoverflow.com/questions/2409504/using-c-filestreams-fstream-how-can-you-determine-the-size-of-a-file + std::ifstream file; + file.open(hashfilename, std::ios::in | std::ios::binary); + file.ignore(std::numeric_limits::max()); + std::streamsize size = file.gcount(); + file.clear(); // Since ignore will have set eof. + resize(size_t(size / 1024 / 1024)); + file.seekg(0, std::ios::beg); + file.read(reinterpret_cast(table), clusterCount * sizeof(Cluster)); +} + +enum { SAN_MOVE_NORMAL, SAN_PAWN_CAPTURE }; + +//taken from stockfish-TCEC6-PA_GTB +template inline Move test_move(Position &pos, Square fromsquare, Square tosquare, PieceType promotion) +{ + Move move; + + if (MoveType == SAN_MOVE_NORMAL) { + if (promotion != NO_PIECE_TYPE) { + move = make(fromsquare, tosquare, promotion); + } + else { + move = make(fromsquare, tosquare); + } + } + else if (MoveType == SAN_PAWN_CAPTURE) { + if (pos.ep_square() == tosquare) { + move = make(fromsquare, tosquare); + } + else { + if (promotion != NO_PIECE_TYPE) { + move = make(fromsquare, tosquare, promotion); + } + else { + move = make(fromsquare, tosquare); + } + } + } + //if (pos.pseudo_legal(move) && pos.legal(move, pos.pinned_pieces(pos.side_to_move()))) { + if (pos.pseudo_legal(move) && pos.legal(move)) { +#ifdef SAN_DEBUG + sync_cout << "found a move: " << move_to_uci(move, false) << sync_endl; +#endif + return move; + } + else { +#ifdef SAN_DEBUG + sync_cout << "invalid move: " << move_to_uci(move, false) << sync_endl; +#endif + return MOVE_NONE; // invalid; + } + return MOVE_NONE; +} + +//taken from stockfish-TCEC6-PA_GTB +Move san_to_move(Position& pos, std::string& str) +{ + std::string uci = str; + PieceType promotion = NO_PIECE_TYPE; + bool castles = false; + bool capture = false; + Move move = MOVE_NONE; + + size_t idx = uci.find_first_of("+#"); + if (idx != std::string::npos) { + uci.erase(idx); // erase to end of the string + } + idx = uci.find_first_of("="); + if (idx != std::string::npos) { + char promo = uci.at(idx); + switch (promo) { + case 'Q': promotion = QUEEN; break; + case 'R': promotion = ROOK; break; + case 'B': promotion = BISHOP; break; + case 'N': promotion = KNIGHT; break; + default: return MOVE_NONE; // invalid + } + uci.erase(idx); + } + else { // check the last char, is it QRBN? + char promo2 = uci.at(uci.size() - 1); + switch (promo2) { + case 'Q': promotion = QUEEN; break; + case 'R': promotion = ROOK; break; + case 'B': promotion = BISHOP; break; + case 'N': promotion = KNIGHT; break; + default:; // nixda + } + if (promotion != NO_PIECE_TYPE) + uci.erase(uci.size() - 1); + } + idx = uci.find_first_of("x"); + if (idx != std::string::npos) { + capture = true; + uci.erase(idx, 1); + } + + char piece = str.at(0); + PieceType piecetype; + std::string thepiece; + + switch (piece) { + case 'N': piecetype = KNIGHT; break; + case 'B': piecetype = BISHOP; break; + case 'R': piecetype = ROOK; break; + case 'Q': piecetype = QUEEN; break; + case 'K': piecetype = KING; break; + case '0': + case 'O': + castles = true; piecetype = NO_PIECE_TYPE; break; + default: piecetype = PAWN; + } + + if (castles) { // chess 960? + if (uci == "0-0" || uci == "O-O") { + if (pos.side_to_move() == WHITE) { + move = make(SQ_E1, SQ_H1); + } + else { + move = make(SQ_E8, SQ_H8); + } + } + else if (uci == "0-0-0" || uci == "O-O-O") { + if (pos.side_to_move() == WHITE) { + move = make(SQ_E1, SQ_A1); + } + else { + move = make(SQ_E8, SQ_A8); + } + } + if (pos.pseudo_legal(move) && pos.legal(move)) { + return move; + } + return MOVE_NONE; // invalid + } + + // normal move or promotion + int torank = uci.at(uci.size() - 1) - '1'; + int tofile = uci.at(uci.size() - 2) - 'a'; + int disambig_r = -1; + int disambig_f = -1; + if (piecetype != PAWN && piecetype != KING && uci.size() > 3) { + char ambig = uci.at(uci.size() - 3); + if (ambig >= 'a' && ambig <= 'h') { + disambig_f = ambig - 'a'; + } + else if (ambig >= '1' && ambig <= '8') { + disambig_r = ambig - '1'; + } + else { + return MOVE_NONE; // invalid; + } + } + + Square tosquare = Square((torank * 8) + tofile); + const Square *pl; + int piececount; + + switch (piecetype) { + case PAWN: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case KNIGHT: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case BISHOP: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case ROOK: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case QUEEN: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + case KING: + pl = pos.squares(pos.side_to_move()); + piececount = pos.count(pos.side_to_move()); + break; + default: + return MOVE_NONE; // invalid + } + + if (piececount == 1) { + if (piecetype != PAWN || !capture) { + move = test_move(pos, *pl, tosquare, promotion); + } + else { + move = test_move(pos, *pl, tosquare, promotion); + } + if (move != MOVE_NONE) { + return move; + } + else { + return MOVE_NONE; + } + } + else if (piececount > 1) { + Square s; + while ((s = *pl++) != SQ_NONE) { + Square ss = SQ_NONE; + if (disambig_r >= 0 || disambig_f >= 0) { + if (disambig_r >= 0 && rank_of(s) == Rank(disambig_r)) { + ss = s; + } + else if (disambig_f >= 0 && file_of(s) == File(disambig_f)) { + ss = s; + } + } + else { + ss = s; + } + if (ss != SQ_NONE) { + if (piecetype != PAWN || !capture) { + move = test_move(pos, ss, tosquare, promotion); + } + else { + move = test_move(pos, ss, tosquare, promotion); + } + if (move != MOVE_NONE) { + return move; + } + else { + ; // don't return, we just need to keep trying + } + } + } + } + return MOVE_NONE; +} + +//taken from stockfish-TCEC6-PA_GTB +Value uci_to_score(std::string &str) +{ + Value uci = (Value)atoi(str.c_str()); + Value v = VALUE_NONE; + + if (uci > 32000) { + v = VALUE_MATE - (32767 - uci); + } + else if (uci < -32000) { + v = -VALUE_MATE + (32767 + uci); + } + else { + v = uci * int(PawnValueMg) / 100; + } + return v; +} + +void TranspositionTable::load_epd_to_hash() { + std::string line; + std::ifstream myfile(hashfilename); + Position pos; + Move bm; + int ce; + int depth; + generation8 = 4; //for storing the positions + + if (myfile.is_open()) + { + while (getline(myfile, line)) + { + std::vector x = split(line, ';'); + + //extract and set position + std::size_t i = x[0].find("acd"); //depth searched. Is after the fen string + StateListPtr states(new std::deque(1)); + sync_cout << x[0].substr(0, i) << sync_endl; + pos.set(x[0].substr(0, i), Options["UCI_Chess960"], &states->back(), Threads.main()); + + //depth + depth = std::stoi(x[0].substr(i + 4)); + sync_cout << depth << sync_endl; + + bm = MOVE_NONE; + ce = -1000000; + + for (std::vector::size_type j = 1; j <= x.size(); j++) { + if (bm == MOVE_NONE) { + i = x[j].find("bm "); + if (i == 1) { + sync_cout << x[j].substr(i + 3) << sync_endl; + std::string stri = x[j].substr(i + 3); + bm = san_to_move(pos, stri); + if (bm != MOVE_NONE) + sync_cout << "move ok" << sync_endl; + continue; + } + } + if (ce == -1000000) { + i = x[j].find("ce "); + if (i == 1) { + std::string stri = x[j].substr(i + 3); + ce = uci_to_score(stri); + sync_cout << "ce " << ce << sync_endl; + continue; + } + } + } + + TTEntry* tte; + bool ttHit; + tte = TT.probe(pos.key(), ttHit); + + tte->save(pos.key(), (Value)ce, BOUND_EXACT, (Depth)depth, + bm, VALUE_NONE); + } + myfile.close(); + } +} + +/// TranspositionTable::probe() looks up the current position in the transposition +/// table. It returns true and a pointer to the TTEntry if the position is found. +/// Otherwise, it returns false and a pointer to an empty or least valuable TTEntry +/// to be replaced later. The replace value of an entry is calculated as its depth +/// minus 8 times its relative age. TTEntry t1 is considered more valuable than +/// TTEntry t2 if its replace value is greater than that of t2. + +TTEntry* TranspositionTable::probe(const Key key, bool& found) const { + + TTEntry* const tte = first_entry(key); + const uint16_t key16 = key >> 48; // Use the high 16 bits as key inside the cluster + + for (size_t i = 0; i < ClusterSize; ++i) + if (!tte[i].key16 || tte[i].key16 == key16) + { + if ((tte[i].genBound8 & 0xFC) != generation8 && tte[i].key16) + tte[i].genBound8 = uint8_t(generation8 | tte[i].bound()); // Refresh + + return found = (bool)tte[i].key16, &tte[i]; + } + + // Find an entry to be replaced according to the replacement strategy + TTEntry* replace = tte; + for (size_t i = 1; i < ClusterSize; ++i) + // Due to our packed storage format for generation and its cyclic + // nature we add 259 (256 is the modulus plus 3 to keep the lowest + // two bound bits from affecting the result) to calculate the entry + // age correctly even after generation8 overflows into the next cycle. + if ( replace->depth8 - ((259 + generation8 - replace->genBound8) & 0xFC) * 2 + > tte[i].depth8 - ((259 + generation8 - tte[i].genBound8) & 0xFC) * 2) + replace = &tte[i]; + + return found = false, replace; +} + + +/// TranspositionTable::hashfull() returns an approximation of the hashtable +/// occupation during a search. The hash is x permill full, as per UCI protocol. + +int TranspositionTable::hashfull() const { + + int cnt = 0; + for (size_t i = 0; i < 1000 / ClusterSize; i++) + { + const TTEntry* tte = &table[i].entry[0]; + for (size_t j = 0; j < ClusterSize; j++) + if ((tte[j].genBound8 & 0xFC) == generation8) + cnt++; + } + return cnt; +} diff --git a/Engines/Windows/mcbrain/src/tt.h b/Engines/Windows/mcbrain/src/tt.h new file mode 100644 index 0000000..6fdf90f --- /dev/null +++ b/Engines/Windows/mcbrain/src/tt.h @@ -0,0 +1,116 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef TT_H_INCLUDED +#define TT_H_INCLUDED + +#include "misc.h" +#include "types.h" + +/// TTEntry struct is the 10 bytes transposition table entry, defined as below: +/// +/// key 16 bit +/// move 16 bit +/// value 16 bit +/// eval value 16 bit +/// generation 6 bit +/// bound type 2 bit +/// depth 8 bit + +struct TTEntry { + + Move move() const { return (Move )move16; } + Value value() const { return (Value)value16; } + Value eval() const { return (Value)eval16; } + Depth depth() const { return (Depth)(depth8 * int(ONE_PLY)); } + Bound bound() const { return (Bound)(genBound8 & 0x3); } + void save(Key k, Value v, Bound b, Depth d, Move m, Value ev); + +private: + friend class TranspositionTable; + + uint16_t key16; + uint16_t move16; + int16_t value16; + int16_t eval16; + uint8_t genBound8; + int8_t depth8; +}; + + +/// A TranspositionTable consists of a power of 2 number of clusters and each +/// cluster consists of ClusterSize number of TTEntry. Each non-empty entry +/// contains information of exactly one position. The size of a cluster should +/// divide the size of a cache line size, to ensure that clusters never cross +/// cache lines. This ensures best cache performance, as the cacheline is +/// prefetched, as soon as possible. + +class TranspositionTable { + + static constexpr size_t CacheLineSize = 64; + static constexpr size_t ClusterSize = 3; + + struct Cluster { + TTEntry entry[ClusterSize]; + char padding[2]; // Align to a divisor of the cache line size + }; + + static_assert(CacheLineSize % sizeof(Cluster) == 0, "Cluster size incorrect"); + +public: + TranspositionTable() { mbSize_last_used = 0; mbSize_last_used = 0; } + ~TranspositionTable() {} + void new_search() { generation8 += 4; } // Lower 2 bits are used by Bound + void infinite_search() { generation8 = 4; } + uint8_t generation() const { return generation8; } + TTEntry* probe(const Key key, bool& found) const; + int hashfull() const; + void resize(size_t mbSize); + void clear(); + void set_hash_file_name(const std::string& fname); + bool save(); + void load(); + void load_epd_to_hash(); + std::string hashfilename = "hash.hsh"; + + // The 32 lowest order bits of the key are used to get the index of the cluster + TTEntry* first_entry(const Key key) const { + return &table[(uint32_t(key) * uint64_t(clusterCount)) >> 32].entry[0]; + } + +private: + friend struct TTEntry; + + size_t mbSize_last_used; + +#ifdef _WIN32 + bool large_pages_used; +#endif + + size_t clusterCount; + Cluster* table; + void* mem; + uint8_t generation8; // Size must be not bigger than TTEntry::genBound8 +}; + +extern TranspositionTable TT; + +#endif // #ifndef TT_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/types.h b/Engines/Windows/mcbrain/src/types.h new file mode 100644 index 0000000..a659037 --- /dev/null +++ b/Engines/Windows/mcbrain/src/types.h @@ -0,0 +1,485 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef TYPES_H_INCLUDED +#define TYPES_H_INCLUDED + +/// When compiling with provided Makefile (e.g. for Linux and OSX), configuration +/// is done automatically. To get started type 'make help'. +/// +/// When Makefile is not used (e.g. with Microsoft Visual Studio) some switches +/// need to be set manually: +/// +/// -DNDEBUG | Disable debugging mode. Always use this for release. +/// +/// -DNO_PREFETCH | Disable use of prefetch asm-instruction. You may need this to +/// | run on some very old machines. +/// +/// -DUSE_POPCNT | Add runtime support for use of popcnt asm-instruction. Works +/// | only in 64-bit mode and requires hardware with popcnt support. +/// +/// -DUSE_PEXT | Add runtime support for use of pext asm-instruction. Works +/// | only in 64-bit mode and requires hardware with pext support. + +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +// Disable some silly and noisy warning from MSVC compiler +#pragma warning(disable: 4127) // Conditional expression is constant +#pragma warning(disable: 4146) // Unary minus operator applied to unsigned type +#pragma warning(disable: 4800) // Forcing value to bool 'true' or 'false' +#endif + +/// Predefined macros hell: +/// +/// __GNUC__ Compiler is gcc, Clang or Intel on Linux +/// __INTEL_COMPILER Compiler is Intel +/// _MSC_VER Compiler is MSVC or Intel on Windows +/// _WIN32 Building on Windows (any) +/// _WIN64 Building on Windows 64 bit + +#if defined(_WIN64) && defined(_MSC_VER) // No Makefile used +# include // Microsoft header for _BitScanForward64() +# define IS_64BIT +#endif + +#if defined(USE_POPCNT) && (defined(__INTEL_COMPILER) || defined(_MSC_VER)) +# include // Intel and Microsoft header for _mm_popcnt_u64() +#endif + +#if !defined(NO_PREFETCH) && (defined(__INTEL_COMPILER) || defined(_MSC_VER)) +# include // Intel and Microsoft header for _mm_prefetch() +#endif + +#if defined(USE_PEXT) +# include // Header for _pext_u64() intrinsic +# define pext(b, m) _pext_u64(b, m) +#else +# define pext(b, m) 0 +#endif + +#ifdef USE_POPCNT +constexpr bool HasPopCnt = true; +#else +constexpr bool HasPopCnt = false; +#endif + +#ifdef USE_PEXT +constexpr bool HasPext = true; +#else +constexpr bool HasPext = false; +#endif + +#ifdef IS_64BIT +constexpr bool Is64Bit = true; +#else +constexpr bool Is64Bit = false; +#endif + +typedef uint64_t Key; +typedef uint64_t Bitboard; + +constexpr int MAX_MOVES = 256; +constexpr int MAX_PLY = 128; + +/// A move needs 16 bits to be stored +/// +/// bit 0- 5: destination square (from 0 to 63) +/// bit 6-11: origin square (from 0 to 63) +/// bit 12-13: promotion piece type - 2 (from KNIGHT-2 to QUEEN-2) +/// bit 14-15: special move flag: promotion (1), en passant (2), castling (3) +/// NOTE: EN-PASSANT bit is set only when a pawn can be captured +/// +/// Special cases are MOVE_NONE and MOVE_NULL. We can sneak these in because in +/// any normal move destination square is always different from origin square +/// while MOVE_NONE and MOVE_NULL have the same origin and destination square. + +enum Move : int { + MOVE_NONE, + MOVE_NULL = 65 +}; + +enum MoveType { + NORMAL, + PROMOTION = 1 << 14, + ENPASSANT = 2 << 14, + CASTLING = 3 << 14 +}; + +enum Color { + WHITE, BLACK, COLOR_NB = 2 +}; + +enum CastlingSide { + KING_SIDE, QUEEN_SIDE, CASTLING_SIDE_NB = 2 +}; + +enum CastlingRight { + NO_CASTLING, + WHITE_OO, + WHITE_OOO = WHITE_OO << 1, + BLACK_OO = WHITE_OO << 2, + BLACK_OOO = WHITE_OO << 3, + ANY_CASTLING = WHITE_OO | WHITE_OOO | BLACK_OO | BLACK_OOO, + CASTLING_RIGHT_NB = 16 +}; + +template struct MakeCastling { + static constexpr CastlingRight + right = C == WHITE ? S == QUEEN_SIDE ? WHITE_OOO : WHITE_OO + : S == QUEEN_SIDE ? BLACK_OOO : BLACK_OO; +}; + +enum Phase { + PHASE_ENDGAME, + PHASE_MIDGAME = 128, + MG = 0, EG = 1, PHASE_NB = 2 +}; + +enum ScaleFactor { + SCALE_FACTOR_DRAW = 0, + SCALE_FACTOR_NORMAL = 64, + SCALE_FACTOR_MAX = 128, + SCALE_FACTOR_NONE = 255 +}; + +enum Bound { + BOUND_NONE, + BOUND_UPPER, + BOUND_LOWER, + BOUND_EXACT = BOUND_UPPER | BOUND_LOWER +}; +#ifdef Maverick //MichaelB7 +enum Value : int { + VALUE_ZERO = 0, + VALUE_DRAW = 0, + VALUE_KNOWN_WIN = 10000, + VALUE_MATE = 32000, + VALUE_INFINITE = 32001, + VALUE_NONE = 32002, + + VALUE_MATE_IN_MAX_PLY = VALUE_MATE - 2 * MAX_PLY, + VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + 2 * MAX_PLY, + + PawnValueMg = 142*10/11, PawnValueEg = 207*10/11, + KnightValueMg = 784*9/10, KnightValueEg = 868*9/10, + BishopValueMg = 828*9/10, BishopValueEg = 916*9/10, + RookValueMg = 1286*8/9, RookValueEg = 1378*8/9, + QueenValueMg = 2547*7/8, QueenValueEg = 2698*7/8, + + MidgameLimit = 15258, EndgameLimit = 3915 +}; +#else +enum Value : int { + VALUE_ZERO = 0, + VALUE_DRAW = 0, + VALUE_KNOWN_WIN = 10000, + VALUE_MATE = 32000, + VALUE_INFINITE = 32001, + VALUE_NONE = 32002, + + VALUE_MATE_IN_MAX_PLY = VALUE_MATE - 2 * MAX_PLY, + VALUE_MATED_IN_MAX_PLY = -VALUE_MATE + 2 * MAX_PLY, + + PawnValueMg = 142, PawnValueEg = 207, + KnightValueMg = 784, KnightValueEg = 868, + BishopValueMg = 828, BishopValueEg = 916, + RookValueMg = 1286, RookValueEg = 1378, + QueenValueMg = 2547, QueenValueEg = 2698, + + MidgameLimit = 15258, EndgameLimit = 3915 +}; +#endif +enum PieceType { + NO_PIECE_TYPE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING, + ALL_PIECES = 0, + PIECE_TYPE_NB = 8 +}; + +enum Piece { + NO_PIECE, + W_PAWN = 1, W_KNIGHT, W_BISHOP, W_ROOK, W_QUEEN, W_KING, + B_PAWN = 9, B_KNIGHT, B_BISHOP, B_ROOK, B_QUEEN, B_KING, + PIECE_NB = 16 +}; + +extern Value PieceValue[PHASE_NB][PIECE_NB]; + +enum Depth : int { + + ONE_PLY = 1, + + DEPTH_ZERO = 0 * ONE_PLY, + DEPTH_QS_CHECKS = 0 * ONE_PLY, + DEPTH_QS_NO_CHECKS = -1 * ONE_PLY, + DEPTH_QS_RECAPTURES = -5 * ONE_PLY, + + DEPTH_NONE = -6 * ONE_PLY, + DEPTH_MAX = MAX_PLY * ONE_PLY +}; + +static_assert(!(ONE_PLY & (ONE_PLY - 1)), "ONE_PLY is not a power of 2"); + +enum Square : int { + SQ_A1, SQ_B1, SQ_C1, SQ_D1, SQ_E1, SQ_F1, SQ_G1, SQ_H1, + SQ_A2, SQ_B2, SQ_C2, SQ_D2, SQ_E2, SQ_F2, SQ_G2, SQ_H2, + SQ_A3, SQ_B3, SQ_C3, SQ_D3, SQ_E3, SQ_F3, SQ_G3, SQ_H3, + SQ_A4, SQ_B4, SQ_C4, SQ_D4, SQ_E4, SQ_F4, SQ_G4, SQ_H4, + SQ_A5, SQ_B5, SQ_C5, SQ_D5, SQ_E5, SQ_F5, SQ_G5, SQ_H5, + SQ_A6, SQ_B6, SQ_C6, SQ_D6, SQ_E6, SQ_F6, SQ_G6, SQ_H6, + SQ_A7, SQ_B7, SQ_C7, SQ_D7, SQ_E7, SQ_F7, SQ_G7, SQ_H7, + SQ_A8, SQ_B8, SQ_C8, SQ_D8, SQ_E8, SQ_F8, SQ_G8, SQ_H8, + SQ_NONE, + + SQUARE_NB = 64 +}; + +enum Direction : int { + NORTH = 8, + EAST = 1, + SOUTH = -NORTH, + WEST = -EAST, + + NORTH_EAST = NORTH + EAST, + SOUTH_EAST = SOUTH + EAST, + SOUTH_WEST = SOUTH + WEST, + NORTH_WEST = NORTH + WEST +}; + +enum File : int { + FILE_A, FILE_B, FILE_C, FILE_D, FILE_E, FILE_F, FILE_G, FILE_H, FILE_NB +}; + +enum Rank : int { + RANK_1, RANK_2, RANK_3, RANK_4, RANK_5, RANK_6, RANK_7, RANK_8, RANK_NB +}; + + +/// Score enum stores a middlegame and an endgame value in a single integer (enum). +/// The least significant 16 bits are used to store the middlegame value and the +/// upper 16 bits are used to store the endgame value. We have to take care to +/// avoid left-shifting a signed int to avoid undefined behavior. +enum Score : int { SCORE_ZERO }; + +constexpr Score make_score(int mg, int eg) { + return Score((int)((unsigned int)eg << 16) + mg); +} + +/// Extracting the signed lower and upper 16 bits is not so trivial because +/// according to the standard a simple cast to short is implementation defined +/// and so is a right shift of a signed integer. +inline Value eg_value(Score s) { + union { uint16_t u; int16_t s; } eg = { uint16_t(unsigned(s + 0x8000) >> 16) }; + return Value(eg.s); +} + +inline Value mg_value(Score s) { + union { uint16_t u; int16_t s; } mg = { uint16_t(unsigned(s)) }; + return Value(mg.s); +} + +#define ENABLE_BASE_OPERATORS_ON(T) \ +constexpr T operator+(T d1, T d2) { return T(int(d1) + int(d2)); } \ +constexpr T operator-(T d1, T d2) { return T(int(d1) - int(d2)); } \ +constexpr T operator-(T d) { return T(-int(d)); } \ +inline T& operator+=(T& d1, T d2) { return d1 = d1 + d2; } \ +inline T& operator-=(T& d1, T d2) { return d1 = d1 - d2; } + +#define ENABLE_INCR_OPERATORS_ON(T) \ +inline T& operator++(T& d) { return d = T(int(d) + 1); } \ +inline T& operator--(T& d) { return d = T(int(d) - 1); } + +#define ENABLE_FULL_OPERATORS_ON(T) \ +ENABLE_BASE_OPERATORS_ON(T) \ +ENABLE_INCR_OPERATORS_ON(T) \ +constexpr T operator*(int i, T d) { return T(i * int(d)); } \ +constexpr T operator*(T d, int i) { return T(int(d) * i); } \ +constexpr T operator/(T d, int i) { return T(int(d) / i); } \ +constexpr int operator/(T d1, T d2) { return int(d1) / int(d2); } \ +inline T& operator*=(T& d, int i) { return d = T(int(d) * i); } \ +inline T& operator/=(T& d, int i) { return d = T(int(d) / i); } + +ENABLE_FULL_OPERATORS_ON(Value) +ENABLE_FULL_OPERATORS_ON(Depth) +ENABLE_FULL_OPERATORS_ON(Direction) + +ENABLE_INCR_OPERATORS_ON(PieceType) +ENABLE_INCR_OPERATORS_ON(Piece) +ENABLE_INCR_OPERATORS_ON(Color) +ENABLE_INCR_OPERATORS_ON(Square) +ENABLE_INCR_OPERATORS_ON(File) +ENABLE_INCR_OPERATORS_ON(Rank) + +ENABLE_BASE_OPERATORS_ON(Score) + +#undef ENABLE_FULL_OPERATORS_ON +#undef ENABLE_INCR_OPERATORS_ON +#undef ENABLE_BASE_OPERATORS_ON + +/// Additional operators to add integers to a Value +constexpr Value operator+(Value v, int i) { return Value(int(v) + i); } +constexpr Value operator-(Value v, int i) { return Value(int(v) - i); } +inline Value& operator+=(Value& v, int i) { return v = v + i; } +inline Value& operator-=(Value& v, int i) { return v = v - i; } + +/// Additional operators to add a Direction to a Square +constexpr Square operator+(Square s, Direction d) { return Square(int(s) + int(d)); } +constexpr Square operator-(Square s, Direction d) { return Square(int(s) - int(d)); } +inline Square& operator+=(Square& s, Direction d) { return s = s + d; } +inline Square& operator-=(Square& s, Direction d) { return s = s - d; } + +/// Only declared but not defined. We don't want to multiply two scores due to +/// a very high risk of overflow. So user should explicitly convert to integer. +Score operator*(Score, Score) = delete; + +/// Division of a Score must be handled separately for each term +inline Score operator/(Score s, int i) { + return make_score(mg_value(s) / i, eg_value(s) / i); +} + +/// Multiplication of a Score by an integer. We check for overflow in debug mode. +inline Score operator*(Score s, int i) { + + Score result = Score(int(s) * i); + + assert(eg_value(result) == (i * eg_value(s))); + assert(mg_value(result) == (i * mg_value(s))); + assert((i == 0) || (result / i) == s); + + return result; +} + +constexpr Color operator~(Color c) { + return Color(c ^ BLACK); // Toggle color +} + +constexpr Square operator~(Square s) { + return Square(s ^ SQ_A8); // Vertical flip SQ_A1 -> SQ_A8 +} + +constexpr File operator~(File f) { + return File(f ^ FILE_H); // Horizontal flip FILE_A -> FILE_H +} + +constexpr Piece operator~(Piece pc) { + return Piece(pc ^ 8); // Swap color of piece B_KNIGHT -> W_KNIGHT +} + +constexpr CastlingRight operator|(Color c, CastlingSide s) { + return CastlingRight(WHITE_OO << ((s == QUEEN_SIDE) + 2 * c)); +} + +constexpr Value mate_in(int ply) { + return VALUE_MATE - ply; +} + +constexpr Value mated_in(int ply) { + return -VALUE_MATE + ply; +} + +constexpr Square make_square(File f, Rank r) { + return Square((r << 3) + f); +} + +constexpr Piece make_piece(Color c, PieceType pt) { + return Piece((c << 3) + pt); +} + +constexpr PieceType type_of(Piece pc) { + return PieceType(pc & 7); +} + +inline Color color_of(Piece pc) { + assert(pc != NO_PIECE); + return Color(pc >> 3); +} + +constexpr bool is_ok(Square s) { + return s >= SQ_A1 && s <= SQ_H8; +} + +constexpr File file_of(Square s) { + return File(s & 7); +} + +constexpr Rank rank_of(Square s) { + return Rank(s >> 3); +} + +constexpr Square relative_square(Color c, Square s) { + return Square(s ^ (c * 56)); +} + +constexpr Rank relative_rank(Color c, Rank r) { + return Rank(r ^ (c * 7)); +} + +constexpr Rank relative_rank(Color c, Square s) { + return relative_rank(c, rank_of(s)); +} + +inline bool opposite_colors(Square s1, Square s2) { + int s = int(s1) ^ int(s2); + return ((s >> 3) ^ s) & 1; +} + +constexpr Direction pawn_push(Color c) { + return c == WHITE ? NORTH : SOUTH; +} + +constexpr Square from_sq(Move m) { + return Square((m >> 6) & 0x3F); +} + +constexpr Square to_sq(Move m) { + return Square(m & 0x3F); +} + +constexpr int from_to(Move m) { + return m & 0xFFF; +} + +constexpr MoveType type_of(Move m) { + return MoveType(m & (3 << 14)); +} + +constexpr PieceType promotion_type(Move m) { + return PieceType(((m >> 12) & 3) + KNIGHT); +} + +constexpr Move make_move(Square from, Square to) { + return Move((from << 6) + to); +} + +template +constexpr Move make(Square from, Square to, PieceType pt = KNIGHT) { + return Move(T + ((pt - KNIGHT) << 12) + (from << 6) + to); +} + +constexpr bool is_ok(Move m) { + return from_sq(m) != to_sq(m); // Catch MOVE_NULL and MOVE_NONE +} + +#endif // #ifndef TYPES_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/uci.cpp b/Engines/Windows/mcbrain/src/uci.cpp new file mode 100644 index 0000000..b21e97c --- /dev/null +++ b/Engines/Windows/mcbrain/src/uci.cpp @@ -0,0 +1,371 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include +#include + +#include "evaluate.h" +#include "movegen.h" +#include "position.h" +#include "search.h" +#include "thread.h" +#include "timeman.h" +#include "tt.h" +#include "uci.h" +#include "syzygy/tbprobe.h" + +using namespace std; + +extern vector setup_bench(const Position&, istream&); + +namespace { + + // FEN string of the initial position, normal chess + const char* StartFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; + + + // position() is called when engine receives the "position" UCI command. + // The function sets up the position described in the given FEN string ("fen") + // or the starting position ("startpos") and then makes the moves given in the + // following move list ("moves"). + + void position(Position& pos, istringstream& is, StateListPtr& states) { + + Move m; + string token, fen; + + is >> token; + + if (token == "startpos") + { + fen = StartFEN; + is >> token; // Consume "moves" token if any + } + else if (token == "fen") + while (is >> token && token != "moves") + fen += token + " "; + else if (token == "f") + while (is >> token && token != "moves") + fen += token + " "; + else + return; + + states = StateListPtr(new std::deque(1)); // Drop old and create a new one + pos.set(fen, Options["UCI_Chess960"], &states->back(), Threads.main()); + + // Parse move list (if any) + while (is >> token && (m = UCI::to_move(pos, token)) != MOVE_NONE) + { + states->emplace_back(); + pos.do_move(m, states->back()); + } + } + + + // setoption() is called when engine receives the "setoption" UCI command. The + // function updates the UCI option ("name") to the given value ("value"). + + void setoption(istringstream& is) { + + string token, name, value; + + is >> token; // Consume "name" token + + // Read option name (can contain spaces) + while (is >> token && token != "value") + name += (name.empty() ? "" : " ") + token; + + // Read option value (can contain spaces) + while (is >> token) + value += (value.empty() ? "" : " ") + token; + + if (Options.count(name)) + Options[name] = value; + else + sync_cout << "No such option: " << name << sync_endl; + } + + // set() is called by typing "s" from the terminal when the user wants to use abbreviated + // non-UCI comamnds and avoid the uci option protocol "setoption name (option name) value (xxx) ", + // e.g., instead of typing "setoption name threads value 8" to set cores to 8 at the terminal, + // the user simply types "s threads 8" - restricted to option names that do not contain + // any white spaces - see ucioption.cpp. The argument can take white spaces e.g., + // "s syzygypath /endgame tablebases/syzygy" will work + void set(istringstream& is) { + string token, name, value; + + // Read option name (no white spaces in option name) + is >> token; + name = token; + + // Read option value (can contain white spaces) + while (is >> token) + value += string(" ", value.empty() ? 0 : 1) + token; + + // provide user confirmation + if (Options.count(name)) { + Options[name] = value; + sync_cout << "Confirmation: "<< name << " set to " << value << sync_endl; + + } + else + sync_cout << "No such option: " << name << sync_endl; + } + + // go() is called when engine receives the "go" UCI command. The function sets + // the thinking time and other parameters from the input string, then starts + // the search. + + void go(Position& pos, istringstream& is, StateListPtr& states) { + + Search::LimitsType limits; + string token; + bool ponderMode = false; + + limits.startTime = now(); // As early as possible! + + while (is >> token) + if (token == "searchmoves" || token == "sm") + while (is >> token) + limits.searchmoves.push_back(UCI::to_move(pos, token)); + + else if (token == "wtime") is >> limits.time[WHITE]; + else if (token == "btime") is >> limits.time[BLACK]; + else if (token == "winc") is >> limits.inc[WHITE]; + else if (token == "binc") is >> limits.inc[BLACK]; + else if (token == "movestogo") is >> limits.movestogo; + else if (token == "depth") is >> limits.depth; + else if (token == "d") is >> limits.depth; + else if (token == "nodes") is >> limits.nodes; + else if (token == "movetime") is >> limits.movetime; + else if (token == "mate") is >> limits.mate; + else if (token == "perft") is >> limits.perft; + else if (token == "infinite") limits.infinite = 1; + else if (token == "i") limits.infinite = 1; + else if (token == "ponder") ponderMode = true; + + Threads.start_thinking(pos, states, limits, ponderMode); + } + + + // bench() is called when engine receives the "bench" command. Firstly + // a list of UCI commands is setup according to bench parameters, then + // it is run one by one printing a summary at the end. + + void bench(Position& pos, istream& args, StateListPtr& states) { + + string token; + uint64_t num, nodes = 0, cnt = 1; + + vector list = setup_bench(pos, args); + num = count_if(list.begin(), list.end(), [](string s) { return s.find("go ") == 0; }); + + TimePoint elapsed = now(); + + for (const auto& cmd : list) + { + istringstream is(cmd); + is >> skipws >> token; + + if (token == "go") + { + cerr << "\nPosition: " << cnt++ << '/' << num << endl; + go(pos, is, states); + Threads.main()->wait_for_search_finished(); + nodes += Threads.nodes_searched(); + } + else if (token == "setoption") setoption(is); + else if (token == "s") set(is); + else if (token == "position") position(pos, is, states); + else if (token == "ucinewgame") Search::clear(); + } + + elapsed = now() - elapsed + 1; // Ensure positivity to avoid a 'divide by zero' + + dbg_print(); // Just before exiting + + cerr << "\n===========================" + << "\nTotal time (ms) : " << elapsed + << "\nNodes searched : " << nodes + << "\nNodes/second : " << 1000 * nodes / elapsed << endl; + } + +} // namespace + + +/// UCI::loop() waits for a command from stdin, parses it and calls the appropriate +/// function. Also intercepts EOF from stdin to ensure gracefully exiting if the +/// GUI dies unexpectedly. When called with some command line arguments, e.g. to +/// run 'bench', once the command is executed the function returns immediately. +/// In addition to the UCI ones, also some additional debug commands are supported. + +void UCI::loop(int argc, char* argv[]) { + + Position pos; + string token, cmd; + StateListPtr states(new std::deque(1)); + auto uiThread = std::make_shared(0); + + pos.set(StartFEN, false, &states->back(), uiThread.get()); + + for (int i = 1; i < argc; ++i) + cmd += std::string(argv[i]) + " "; + + do { + if (argc == 1 && !getline(cin, cmd)) // Block here waiting for input or EOF + cmd = "quit"; + else if (token == "q") + cmd = "quit"; + + + istringstream is(cmd); + + token.clear(); // Avoid a stale if getline() returns empty or blank line + is >> skipws >> token; + + // The GUI sends 'ponderhit' to tell us the user has played the expected move. + // So 'ponderhit' will be sent if we were told to ponder on the same move the + // user has played. We should continue searching but switch from pondering to + // normal search. In case Threads.stopOnPonderhit is set we are waiting for + // 'ponderhit' to stop the search, for instance if max search depth is reached. + if ( token == "quit" + || token == "q" + || token == "stop" + || token == "?" + || (token == "ponderhit" && Threads.stopOnPonderhit)) + Threads.stop = true; + + else if (token == "ponderhit") + Threads.ponder = false; // Switch to normal search + + else if (token == "uci") + sync_cout << "id name " << engine_info(true) + << "\n" << Options + << "\nuciok" << sync_endl; + + else if (token == "setoption") setoption(is); + else if (token == "so") setoption(is); + else if (token == "set") set(is); + else if (token == "s") set(is); + else if (token == "go") go(pos, is, states); + else if (token == "g") go(pos, is, states); + else if (token == "q") cmd = "quit"; + else if (token == "position") + { + position(pos, is, states); + if (Options["Clear Search"]) + Search::clear(); + } + else if (token == "p") + { + position(pos, is, states); + if (Options["Clear Search"]) + Search::clear(); + } + else if (token == "ucinewgame") Search::clear(); + else if (token == "isready") sync_cout << "readyok" << sync_endl; + + // Additional custom non-UCI commands, mainly for debugging + else if (token == "flip") pos.flip(); + else if (token == "bench") bench(pos, is, states); + else if (token == "b") bench(pos, is, states); + else if (token == "d") sync_cout << pos << sync_endl; + else if (token == "eval") sync_cout << Eval::trace(pos) << sync_endl; + else + sync_cout << "Unknown command: " << cmd << sync_endl; + + } while (token != "quit" && token != "q" && argc == 1); // Command line args are one-shot +} + + +/// UCI::value() converts a Value to a string suitable for use with the UCI +/// protocol specification: +/// +/// cp The score from the engine's point of view in centipawns. +/// mate Mate in y moves, not plies. If the engine is getting mated +/// use negative values for y. + +string UCI::value(Value v) { + + assert(-VALUE_INFINITE < v && v < VALUE_INFINITE); + + stringstream ss; + + if (abs(v) < VALUE_MATE - MAX_PLY) + ss << "cp " << v * 100 / PawnValueEg; + else + ss << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2; + + return ss.str(); +} + + +/// UCI::square() converts a Square to a string in algebraic notation (g1, a7, etc.) + +std::string UCI::square(Square s) { + return std::string{ char('a' + file_of(s)), char('1' + rank_of(s)) }; +} + + +/// UCI::move() converts a Move to a string in coordinate notation (g1f3, a7a8q). +/// The only special case is castling, where we print in the e1g1 notation in +/// normal chess mode, and in e1h1 notation in chess960 mode. Internally all +/// castling moves are always encoded as 'king captures rook'. + +string UCI::move(Move m, bool chess960) { + + Square from = from_sq(m); + Square to = to_sq(m); + + if (m == MOVE_NONE) + return "(none)"; + + if (m == MOVE_NULL) + return "0000"; + + if (type_of(m) == CASTLING && !chess960) + to = make_square(to > from ? FILE_G : FILE_C, rank_of(from)); + + string move = UCI::square(from) + UCI::square(to); + + if (type_of(m) == PROMOTION) + move += " pnbrqk"[promotion_type(m)]; + + return move; +} + + +/// UCI::to_move() converts a string representing a move in coordinate notation +/// (g1f3, a7a8q) to the corresponding legal Move, if any. + +Move UCI::to_move(const Position& pos, string& str) { + + if (str.length() == 5) // Junior could send promotion piece in uppercase + str[4] = char(tolower(str[4])); + + for (const auto& m : MoveList(pos)) + if (str == UCI::move(m, pos.is_chess960())) + return m; + + return MOVE_NONE; +} diff --git a/Engines/Windows/mcbrain/src/uci.h b/Engines/Windows/mcbrain/src/uci.h new file mode 100644 index 0000000..ebed83a --- /dev/null +++ b/Engines/Windows/mcbrain/src/uci.h @@ -0,0 +1,91 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#ifndef UCI_H_INCLUDED +#define UCI_H_INCLUDED + +#include +#include + +#include "types.h" + +class Position; + +namespace UCI { + +class Option; + +/// Custom comparator because UCI options should be case insensitive +struct CaseInsensitiveLess { + bool operator() (const std::string&, const std::string&) const; +}; + +/// Our options container is actually a std::map +typedef std::map OptionsMap; + +/// Option class implements an option as defined by UCI protocol +class Option { + + typedef void (*OnChange)(const Option&); + +public: + Option(OnChange = nullptr); + Option(bool v, OnChange = nullptr); + Option(const char* v, OnChange = nullptr); + Option(const char* v, const char* cur, OnChange = nullptr); + template Option(T v, T minv, T maxv, OnChange f = nullptr) : type("spin"), min(minv), max(maxv), on_change(f) + { + defaultValue = currentValue = std::to_string(v); + } + + Option& operator=(const std::string&); + void operator<<(const Option&); + template operator T() const + { + assert(type == "spin" || type == "check"); + return (type == "spin" ? T(stof(currentValue)): type == "check" ? (currentValue == "true") : T(0)); + } + + operator std::string() const; + bool operator==(const char*) const; + +private: + friend std::ostream& operator<<(std::ostream&, const OptionsMap&); + + std::string defaultValue, currentValue, type; + int min, max; + size_t idx; + OnChange on_change; +}; + +void init(OptionsMap&); +void loop(int argc, char* argv[]); +std::string value(Value v); +std::string square(Square s); +std::string move(Move m, bool chess960); +std::string pv(const Position& pos, Depth depth, Value alpha, Value beta); +Move to_move(const Position& pos, std::string& str); + +} // namespace UCI + +extern UCI::OptionsMap Options; + +#endif // #ifndef UCI_H_INCLUDED diff --git a/Engines/Windows/mcbrain/src/ucioption.cpp b/Engines/Windows/mcbrain/src/ucioption.cpp new file mode 100644 index 0000000..ede37b9 --- /dev/null +++ b/Engines/Windows/mcbrain/src/ucioption.cpp @@ -0,0 +1,217 @@ +/* + McBrain, a UCI chess playing engine derived from Stockfish and Glaurung 2.1 + Copyright (C) 2004-2008 Tord Romstad (Glaurung author) + Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish Authors) + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (Stockfish Authors) + Copyright (C) 2017-2018 Michael Byrne, Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad (McBrain Authors) + + McBrain is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + McBrain is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +#include +#include +#include +//Hash +#include +//end_Hash +#include + +#include "misc.h" +#include "search.h" +#include "thread.h" +#include "tt.h" +#include "uci.h" +#include "syzygy/tbprobe.h" +#include "polybook.h" + +using std::string; + +UCI::OptionsMap Options; // Global object + +namespace UCI { + +/// 'On change' actions, triggered by an option's value change +void on_clear_hash(const Option&) { Search::clear(); } +void on_hash_size(const Option& o) { TT.resize(o); } +void on_large_pages(const Option& o) { TT.resize(o); } // warning is ok, will be removed +void on_logger(const Option& o) { start_logger(o); } +void on_threads(const Option& o) { Threads.set(o); } +void on_tb_path(const Option& o) { Tablebases::init(o); } +//Hash +void on_HashFile(const Option& o) { TT.set_hash_file_name(o); } +void SaveHashtoFile(const Option&) { TT.save(); } +void LoadHashfromFile(const Option&) { TT.load(); } +void LoadEpdToHash(const Option&) { TT.load_epd_to_hash(); } +//end_Hash + +void on_book_file(const Option& o) { polybook.init(o); } +void on_best_book_move(const Option& o) { polybook.set_best_book_move(o); } +void on_book_depth(const Option& o) { polybook.set_book_depth(o); } + +/// Our case insensitive less() function as required by UCI protocol +bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const { + + return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), + [](char c1, char c2) { return tolower(c1) < tolower(c2); }); +} + + +/// init() initializes the UCI options to their hard-coded default values + +void init(OptionsMap& o) { + + // at most 2^32 clusters. + constexpr int MaxHashMB = Is64Bit ? 131072 : 2048; + + unsigned n = std::thread::hardware_concurrency(); + if (!n) n = 1; + + o["Threads"] << Option(n, unsigned(1), unsigned(512), on_threads); + o["Hash"] << Option(16, 1, MaxHashMB, on_hash_size); + o["Analysis Contempt"] << Option("Both var Off var White var Black var Both", "Both"); + o["UCI_Chess960"] << Option(false); + o["Ponder"] << Option(false); + o["OwnBook"] << Option(false); + o["Book File"] << Option("book.bin"); + o["Best Book Move"] << Option(false); + + o["Contempt"] << Option(21, -150, 150); + o["MultiPV"] << Option(1, 1, 256); + o["Variety"] << Option (0, 0, 20); + o["Clear Search"] << Option(false); + o["Large Pages"] << Option(false, on_large_pages); + o["Minimal_Output"] << Option(false); + o["FastPlay"] << Option(false); + o["BruteForce"] << Option(false); + o["NullMove"] << Option(true); + o["LMR"] << Option(true); + o["MaxLMReduction"] << Option(10, 0, 20); + o["UCI_LimitStrength"] << Option(false); + o["UCI_ELO"] << Option(1500, 1500, 2800); + o["ICCF Analysis"] << Option(0, 0, 8); + + o["Skill Level"] << Option(20, 0, 20); + o["Move Overhead"] << Option(30, 0, 5000); + o["Minimum Thinking Time"] << Option(20, 0, 5000); + o["Slow Mover"] << Option(84, 10, 1000); + o["nodestime"] << Option(0, 0, 10000); + + o["Clear_Hash"] << Option(on_clear_hash); + o["SaveHashtoFile"] << Option(SaveHashtoFile); + o["LoadHashfromFile"] << Option(LoadHashfromFile); + o["LoadEpdToHash"] << Option(LoadEpdToHash); + o["NeverClearHash"] << Option(false); + o["HashFile"] << Option("hash.hsh", on_HashFile); + o["UCI_AnalyseMode"] << Option(false); + o["SyzygyPath"] << Option("", on_tb_path); + o["SyzygyProbeDepth"] << Option(1, 1, 100); + o["Syzygy50MoveRule"] << Option(true); + o["SyzygyProbeLimit"] << Option(7, 0, 7); + + o["Cerebellum Options"] << Option(true); + o["Book_Enabled"] << Option(true); + o["BookFile"] << Option("", on_book_file); + o["BestBookMove"] << Option(true, on_best_book_move); + o["Debug Log File"] << Option("", on_logger); +} + + +/// operator<<() is used to print all the options default values in chronological +/// insertion order (the idx field) and in the format defined by the UCI protocol. + +std::ostream& operator<<(std::ostream& os, const OptionsMap& om) { + + for (size_t idx = 0; idx < om.size(); ++idx) + for (const auto& it : om) + if (it.second.idx == idx) + { + const Option& o = it.second; + os << "\noption name " << it.first << " type " << o.type; + + if (o.type == "string" || o.type == "check" || o.type == "combo") + os << " default " << o.defaultValue; + + if (o.type == "spin") + os << " default " << int(stof(o.defaultValue)) + << " min " << o.min + << " max " << o.max; + + break; + } + + return os; +} + + +/// Option class constructors and conversion operators +Option::Option(const char* v, const char* cur, OnChange f) : type("combo"), min(0), max(0), on_change(f) +{ + defaultValue = v; currentValue = cur; +} + +Option::Option(const char* v, OnChange f) : type("string"), min(0), max(0), on_change(f) +{ defaultValue = currentValue = v; } + +Option::Option(bool v, OnChange f) : type("check"), min(0), max(0), on_change(f) +{ defaultValue = currentValue = (v ? "true" : "false"); } + +Option::Option(OnChange f) : type("button"), min(0), max(0), on_change(f) +{} + +Option::operator std::string() const { + assert(type == "string"); + return currentValue; +} + +bool Option::operator==(const char* s) const { + assert(type == "combo"); + return !CaseInsensitiveLess()(currentValue, s) + && !CaseInsensitiveLess()(s, currentValue); +} + + +/// operator<<() inits options and assigns idx in the correct printing order + +void Option::operator<<(const Option& o) { + + static size_t insert_order = 0; + + *this = o; + idx = insert_order++; +} + + +/// operator=() updates currentValue and triggers on_change() action. It's up to +/// the GUI to check for option's limits, but we could receive the new value from +/// the user by console window, so let's check the bounds anyway. + +Option& Option::operator=(const string& v) { + + assert(!type.empty()); + + if ( (type != "button" && v.empty()) + || (type == "check" && v != "true" && v != "false") + || (type == "spin" && (stof(v) < min || stof(v) > max))) + return *this; + + if (type != "button") + currentValue = v; + + if (on_change) + on_change(*this); + + return *this; +} + +} // namespace UCI diff --git a/GM/Karjakin.xgm b/GM/Karjakin.xgm deleted file mode 100644 index 4120560..0000000 --- a/GM/Karjakin.xgm +++ /dev/null @@ -1,2044 +0,0 @@ -FVmeEUxg;Ln^@Osm?Twn>@vxBRjb?>kcCKtkU]xyTMgxLBbZKSZSBSm\M[o_V_w_Vxndngn=M_wRZldZbwsIYscVRmtOEqiETc[MVtxTN\TVT[\TKd]RZrsKB\ZBZ]UN]nuZBsrbjyqB;xoDTUM;MqyMNuYNcyqHPYPGPoOcN|GRENKE Rapid WCh|Pelletier,Y|2010.08.08|C41|1-0|W -EUxgDTnf;LwS@Ol\HP\UOUgV=MVLCLSnU[sd?Hvx@tk?=dZHkZkMmk\muwu@wpF[sdEUuc[R\ULUvxU]ds;LtXIQXO=Osm:;wtRDm^OFgm<`qi`Yh`YPcbF=tT@ArtGW`WPWbc=amga_cuDKTUW^e^;=um_OUS=EtwHXjZEHgqQYScX`xy?@o_OQcS`ipiQPqgPhgXHX|9th Masters Final 2016|Carlsen,M|2016.07.15|B50|1-0|B -FVl\@OmeEU\UOUxg;LjbGOn^UKtffmW^e^L]g]V]ceEFogMhvuKZulDTlcZdmd]def=mrsT[b[FVn\mpfdVdcd>?swhVdcBJyiCS\Upkcbklg_?_w_V_ig_MbcltgGtscls[GHJRHPM_PO_XOWXaW_aF_GFMGO;DOQRZQNZbUcDEYQM?QI?HNPHAP@AV@XVAX@AVIA2VA@A[^A:S[c@^>:BEL@\>f\eLTBDTKDEKTlcfhE=hPeP|Alushta-100|Pavlov,Ma|2002.04.19|B90|0-1|B -@Om]HPld?HtXIQXaEMnf;EweCKxn@smFVd\?>rt=^fg:>SMGWM>L>uvJCv^C^gn>Z\T^LRJZb|FIDE World Blitz 2014|Meier, Georg|2014.06.19|A07|0-1|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwBRdZKBl\U]\TCSTKEKkt<`ZTR[b[KETEOEwn`NtmLTul=FvsBK[TKTr:>:qi@IgqHPn`GW^WPW`g:BqwW_svTMlLETm[NELUENULNE|NH Hotels|Beliavsky, Alexander G.|2006.08.23|C92q|1/2-1/2|W -EUm]DTld@OxgFNjb;Et_=Kul?M_h>@nfO^smGWweT\enKDhMDMvxCSm^W^gm@jb[MxgDLk[MDtk?>\TCSn^BRwn=FvxR[b[:rur;JkdEUrb=JrN]g]V]wmE>rJIAJC>EvrW_r:_hqhO?pL|41. Olympiad Open 2014|Pancevski, Filip|2014.08.04|B51|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQwvEUtk;EnwBRdZKB^ULUl\U]\TCSTKBK[SKDkt:;rsNZk=?XONOk\S\e\;krsksus?;s;M;\TETgVONVeNv|World Cup|Shirov, Alexei|2007.12.10|C92q|1/2-1/2|W -FVl\@OsdEU\UOUxg;Ln^U[meL]g]V]dsDTwn?Fvx>@jb[Lsm:;o_CS^VT\m^@wSNV]VLVgWT\vx:@jb[dmdOUw\DLvxGOgmd\U_t_V_nmOW^oHXwvFOewEVmMVGM[X`[C`gCLgpwp?@xyOkoek]e_N\ru>vuvGMLg@`vu]_g_`_uM_oM=AH=EHOEBolyxIYBDltxoOVDTV_pUtwop\eTdwuU\e^poum\nYaovmjdi^pidaivo_VovjrvorydTV_T\p^nwyqoxqyxoyw|World Rapid Final|Carlsen, Magnus|2012.07.07|C65|1-0|B -FVl\@OmeEU\UOUxg;LjbGOucHXnfBJsdMmtxmo>SjkSwofa`RL`@KS@UCKUuL]wS]Surfo|68th ch-RUS 2015|Artemiev, Vladislav|2015.08.16|B90d|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQmeDLdsEUsm;EtkKDwvE?nw<`qi`YutU^e^OIbZ=OrbIXgXOXm\XOtr:=[S?EbeON\fETe=>=SLCLog=;ZR@AkbTCRJCMbTDKTK;KvuK;rRMSfWYPl\S]W]V]RD;kDBkjB;|FIDE GP Tashkent|Dominguez Perez, Leinier|2012.11.22|C95k|0-1|B -EUxgDTph@Owp;Lvx<`meFNsm?Fqi`Yn^=Dld>@h`YPgaU^aPIPe^PXiaLVaXO`o_`fuYHPYafwmwVe^VT\p^?=tfFTxpDKwmKkrye_f_=m_mkmpgmfgpfnpinfipfnpi:=yvnoaoTovsCKs[=<[s@SLENtkFXdS`fphfpvwaiwxN`nw`g]g^gS]XO]gOkru:bwpi`umkOgvOdme`npwnjvgj\gm\TmsbcsdcdedTdwSdvxpv^og^lpiU]SU]eUEemLDIYE=lWipWlpilWip|5th Final Masters|Anand, Viswanathan|2012.10.13|D16c|1/2-1/2|B -FVldEUm];L]VLVxgVgpgDLul=anf?Tk[TM[S@OtbLTsm>@mcCKvtBJbkJSwS:jtsjBd\U]c]T]u]aY]M@wnDTdSMFvx;Lt_BJVLCLSd?>wvT]u];onQYxoHP\LRSLS;SnmE?ZTOFTJScJD?NDNGNmEFOh`Y`i`PX_XOXohckpgkcgpckpgkc|FIDE GP Beijing|Wang, Yue|2013.07.15|C42u|1/2-1/2|W -EUxgDTnf;LwS=DvxBJSLDLm]@O]TLTkc<`tbTDqi`gugFNb?>?l\?F\UOUsm:wuFph_eqp=EpwFOwneVgV|20. Amber Blindfold|Ivanchuk, Vassily|2011.03.22|E36|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?ph?PnwBRwpCK^ULUl\R[b[:rurU]rZF[T@IBJiEDQOD<>E<@OP@AGOpiX`g`L=AIELIF|Premier|Sasikiran, Krishnan|2002.12.31|C95m|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLm]V]g]O^d^>^ldEMne^>t_=OuYHPYQK]d]O]ru]HQH@H_M<>enPXqaIQphEKumKUMTUdT]dnmn>=]BXaha=UnfHPfdPYohU=Bo=UdTUToTOW|66th ch-RUS 2013|Inarkiev, Ernesto|2013.10.08|C89i|1/2-1/2|W -FVl\;Lme@FxgGWn^EMsdFPwn?FdU>@^WrtFGucW^]VLVgm^L\TLUcbMTbTDLTBPaBZapvwGEtTEiTUpfof@hxohpovifvufnulnw|Rapid Match|Short, Nigel D|2008.05.04|B23|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?Pph<`wp=EunCKld:=nwBRruE@sd;L\UNUwn<`vx:unV]f]K]nN>N`N@?N<]K@me;EdnMU^ULU\c?>tXIQXa=Ke]V^gmBRjZ[MwvHXahMhnhE?mw?PwfNONMNruNVvhKTxyVXh_XVuEVFE=@H=UTD_DFDURGWfW|20th TCh-RUS 2013|Svidler, Peter|2013.04.10|C65j|1/2-1/2|B -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[?Ftk>@smO^wp^mgmPejbBRf^U]d\CSucS\m\e\c\R[b[:rkr=:vx:Zws?;pwL[o_Zbxy[Ls;L;\SbrS;F?;SV_TLrt^V]eSetLwpLtyqHPeUtvU^vhqy@H^nHQVNGNnN?TNnTKnghvgwvfpgQXyqXaqpKTpqfmwnmtnutfuwTMqpMTpq|Amber Blindfold|Kramnik, Vladimir|2008.03.27|D43|1/2-1/2|B -FVl\@Ome?[tm[mum>@sdDTphEU\UOUwpNM?@MU@AxtIQUE>@EWqpn^pqmnKSt@gm:=m\M;jmKEc[T[b[FN[SLFtb?>ucEOwtCKdjFUj[U[b[@A[dW_f_V_ogOUd]NPck>N\VPYmn=>tv;V]VA@e]YGkcNFvtHXtLUfceFEnf_fefGWLtIQqaXatLEIfcWGce>NLFDFGFePIHVHFHPH@Hg_HOxoONofNU_WQYf_|CCM4 Ordix Open|Rublevsky, Sergei|2004.08.08|B42g|0-1|W -FVl\@Ome?[tm[mumDTxg;LphEU\UOUwp>@vxCKsdwtIY[TKTqa>Vtl:>rtUcbZcZlTVnm_ZE_WEWTWHPW_BR_]nvtv>vxpvr]MRZ|FIDE Candidates 2014|Mamedyarov, Shakriyar|2014.03.18|B52g|1/2-1/2|W -@OphFVwpEUmeDLxg?Mvx>@l\U\e\IQsdBRul;Jjb=Fga?>wuJTtfRZaW?umng[C:=C[=][RLTtlgURdV^df@HlT]mTUmUf^UR^]?OqaQYxpRJ]EOGE]GO|6. World Blitz|Svidler, Peter|2010.11.16|B07|1/2-1/2|W -FVn^@Osd?Tw\>@xgEMvx;EmeDLjZIQtf?>qiT[\jE?dn?Pld[RnhRDulMUruVhnOUkc\ele|78th Tata Steel GpA|Tomashevsky, Evgeny|2016.01.19|C50p|1-0|W -@Ol\DTsdEU\UOUxg;LnfBJwnFVvxUKdZ?Fme>@ZK=Kgm?=jb@vxGW^WFWo_CKdne^FUhWPW^gBRvoUOtfCgogRZc]O^ru?OxyOP]n@Af]>@phEUjbH]u]PQwxDLxpQPyxLTxwTS][^mwoS[d[mgog@@]TMT\UNUjbBRsd<`qi`YSn?>g]T]nY]dkdOYuYLVrs=EwuELYnV\ne>Vel:>u]RZs[CSls\MseIQtmM\mt@Aes\MtmV^se^Vo_VF]UM\[S\fSTLCmfFfeWCkUVfV_VkbWG|20. Amber Rapid|Gelfand, Boris|2011.03.12|E54|1-0|B -FVl\@OmeEU\UOUxg;Ljb<`nfGWsm=Ful>@gVEUVe[dmdU^e_=uvu;LuvIQwn?=_YOUYhGWn\voMJ_eGYeTYgTJgLJT>FTZFHphW_h_HpofQYZTYaTN?@N]phfohpowLC\TaiTLCSnOW^TV^gXNUtk?Mo_IQXiA@rtHX[SLRkOX_i_M_f_R\O=>=vx\mwu^flW<;ph;:TNUNWNKUtTU_Nf_nfn=]xp]TnmT?mE:;bZ?OZRBJSJOJEm@Xm=;B=]DT]mX`us`]mvQYpiJPRJCKvFBJsrJSFnSLng]UgfPWipUVfmW^pi^`ipVn|?|Grabliauskas, Virginijus|2004.03.06|B48|1-0|W -EUm]DTld@Oxg;LjbFNk[CKtX?FnfIQXaHXahO^gm^hqh=Dwe@tXLVdUNU^U=EldCSc]OU]SECSbFNrsCKuZUDXfKCb\V\w\MU\w?=vuD>wJ<:Z>=>JC:jCL>;k[Hd[SdVphVMsrjkusklstlkSKkKfK;KrsKJtl@?sCIYLSJ:xpMVCE:;SJ?Ho_V]lD;kpwkqEGH@GE]OD<|SportAccord Blitz Men 2013|Nepomniachtchi, Ian|2013.12.15|A22|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMm]V]g]O^dU^lD_nxyMPtu:>DE>NECPYue^_wrYWeu_o|39th Olympiad Men|Onischuk,Al|2010.09.24|C88|1-0|W -FVn^@Osd;LxgEU^UOUwSUdkd?Mvx>@wv=OrsIQSe:;e^tQ?GsvFOQ_RLih>N_XOHhaLRg]N>o_G?_VMTxy@IXOHQ]gI@aZTFOF>Fqa?>VNQHe]HOgXDLZ[>=nVRC|World Blitz 2015|Aronian, Levon|2015.10.14|C47|0-1|W -EUxgDTnf;LwSFNvx?Mm]@Ol\>@sdBJSLCLul@vx=RtmT\xy:=uvIQe]U^g^LF]UNEwOHOhYRJmQ@IQHFPvmP_Y_IH_YHIrwOWmXJPXaGOYOIHOYH@n\=<\jW^UM@IY_PQaFIAFV?O_PQPwO<>O?|2. ACP World Rapid Cup|Grischuk, Alexander|2008.01.07|C73|0-1|W -EUm]DTld@OxgFNjblnWgnfgyvnys\cstfdtyaO^fdf>@jbCKl\dsO^sm^mumKS\TFOmlMU]n>LkVOVn]VOphL>wpHPtuJRceR[b[:ZemDBusQY|Aeroflot Open|Berkes, Ferenc|2005.02.21|A09u|1/2-1/2|B -EUm]DTld@OxgFNjb?MtX;Esm=Dnf>@]TMTwnNVvxTMqiIQXaV^g]HX]SMqxyD;o_^gmgXagqO^yx;hwghXq`ETS]QY`o@AnwEywMTtTKsmt?wnwLFvmDLTRFVOJR[k>;k;B;bZ;D`uDEdmNDmvUNulNWOVDUvmE=KJCHO>EKBCJBTJCOVELVOLEOHE>HI>GIACJTFJCQICJF=JC=FCJF=JC=FCJ|Renova FIDE GP Zug|Nakamura, Hikaru|2013.04.18|C11m|1/2-1/2|W -@OxgDTnf;Lm]EUwS<`smT]f]FNqi`Yvx?Mld=Dwv>@SnOEgaYnun:;jZBJagCSZSJSk[NV]VLVgVMVtk?>neEKmgK\eU>=U^VOrsDEvn=>^l>nln;>nlIQsuENktNLg]O]d]LUle>^eg\MgdM\dg\MgdM\dg\MtfMWutWaghaWhgWaghaWh;@ItTUN]UNOT@wnEMk[RKmeBJvx;LdZKBtfMUfB:BwvB:ZT?>rtIQqiCKTc;d\bfofL[\S;StD[eD<@I@me=XphXFsmDTm^;LxgQI>AaQOVQLGH\SAILTIif^|30th ECC Open 2014|Mamedyarov, Shakriyar|2014.09.19|C42m|0-1|W -@OxgHPl\?Hsd>@n^DTm]=RweO`vxT]dUFNUF@At_RTF@sdBJSZIQtmFGnfOEZl:=wuETe]V]f]L[lsTEjb[UuvDLgVMV]VUdmdW_ogETk[TZslZdldGPh`Pedt=UvuecuUNUtwcfwofVrvVOoT?GbZOkZRGEv>@IqakrxqrOaYU^To^sonsenvEUpwelw\O]\ULUvnlu>AIA|WYB12|Szabo,K|2001.10.30|B09|1/2-1/2|W -FVl\@OnfEU\UOUsd;Lme@vxDTul:@wn?>k[RKvxBR[SEUmeU^e^;En\RZqi=FunIQtkDLwsKDktETSLCLtmTN\N;k;:;sd;:veMbeVbkVLF>rZ>LnS|FIDE World Rapid 2014|Tomashevsky, Evgeny|2014.06.18|C88|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUul;E\ULUZdEKbZ:phOETEFEgvPFRj:@tXIQXOFOnfDT]cCKwn@vx@Akc@xgVPdO=Old?>wnCKvxVmgVFru:>weU]f^T\e\C^v^F^d]^_leJRkcHPuw@HwuM;uwOMwu_g|GRENKE Rapid WCh|Lorenz,Rog|2010.08.07|C10|1-0|W -FVl\@OmeEU\UOUxg;Ljb@smBRaYKvn:=\N>Ntl_mlmN^if^fnf=mfm@GmdKSdeGNe^HPYPIP^fNUfeS[o_OW`X|Karjakin-Nakamura m|Nakamura, Hikaru|2005.04.29|B90n|1-0|W -@OxgEUphFNwp?Fvx>@meCKsmuE>EpgE=ai=>fXLCvu:Lh`DE=ELEXQHQ`XEFaQI@QaC@wnEMvxBJtfCSjZS[dU:;c]LRUOHOo_JC>fsum[ZR[RCg]VphAHgUIYw\Ya\@VOUOnhDT]TFTul=Kwn:@vx?>wvEMtXIQXaDLah^e^U^JwLTxqknrunjuEPIEDT\D\jpqipxwx^\xBQYBf\`iq`Wf]IP]MPXMmXOm=OG=DG@D=@I=mW^mRIPRKPWKoW`omHPmu^gu]`W]TWNTKNGKBG@BJgoqi@IJ\IQ\tQItD|World Blitz|Ivanchuk, Vassily|2009.11.18|C47|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb<]UNUdU=Utm?FrtFOtl@wpUKxnDTvx;Lm]T]f]<`]VMVu=?=sdK\t_VOqi`Wwt\kdU=UpUkeh`WNU^etrt:<_fOFbZNEtuE>ndL[dSBJSB<=u=F=^C>ZB@n^FVwn;LmeEMvxBRdSIQwv?>tmOEmdETnw<`qi`gugTZdmL[guZTmfDLSdTNjb[JrsN]dnJTk[R[b[TNn]N]ph:jf]V]uc=:\TMT[T>FskjbcKPXkcbZckHVKcZbcu:Rus@HvuRTkCFCsCbjCcjlwpQYpgYagYHQcGTMhaXaY`MPG?PH?WHXWNQHusltstXtxptTNEHQE=TM=aQHaXHA`YV_X`MOY>_D>ELT`YAHYTO_T]DV]f_qpw|FIDE World Cup 2015|Eljanov, Pavel|2015.09.29|A05|0-1|B -FVn^@Osd;Lxg?[dU[TmeIQwnEMUO=Ovx@uc:;\TMEc\LFk[DLjZ;=tuFUwvBJe]V]f]?>gULU\l>NvNEN[SJSZSNfxy=>qifhTLCLSL>FutFDlTh_ts_^s;@ITM^FMUDB;CBryqFNUNGNCFrZLDZ\p`\diaIPqpPOFEHPpoQY`YPYonOWnmd\me\tEHWOHIOPIEPWeftdfndlnul\umW`EH`WHXWOXT|World Blitz|Polgar,Ju|2009.11.18|C48|0-1|B -DTn^;Lxg@OsdHPm]T]g]?H]c>@wnEMvxBJtfCSjZS[dUOU^ULRf]Rclcv^D<^]>=xq=>m[TD\e>=e^=E[mDtmQ=dVGOV]=Ewt`n]TENc[|Amber Blindfold|Mamedyarov, Shakhriyar|2008.03.22|E12|1/2-1/2|B -EUm]DT]TFVxgV^g]?T]cTKsd@Ft_;Lnf>@um@cC=>\UNUdUOUwSU[SZ:;CD;Kxn[evwekZckecZFO_M>@wn?>k[RKvxIQtkEMm]V]g]BRdU;EUKEKogKZutZktkOYwvY_nwQYruR[b[=Xl\VpUENuwNU\UO=UMVSbZSRZ\RWwuCS\^agME@IxhgXhXWX^a|World Rapid Final|Bologan,V|2012.07.07|C88|0-1|B -EUxgDTnf@OkcHPtb=Dbk?Hl\U]f]T]g]>@wnDVsbOYphY_h_V^vx^_wv;LblHVng_qxwV]k]L]l]FV]l@gVypFMWEMPE`PQ^U>vtvQmvumlTE?=UL]ep^lkLD=>D<2>@hW?>xy=DgaMUug:=ruN_m_U^e^=uguV_ueOEedDVdcCSagVNg]NcjcEVwrPW]W_gpwToweHPWM>=MC=ECRoKc[VeleEeRLgoypefrwf^pg^vgp@HL;GW`WPW;EK]kcW_|World Blitz|Ponomariov,R|2009.11.17|C65|1-0|W -EUm]DTld@Oxg;LnfFNsm=DjbCKwe@vx?=tf:@wnBJmeEU\UFUsmJR[SLBbZDLSLBLm\um>F]gOKe]aiphKNgViqxq@Hng?AqxUgwgGOVPN^PF^gFWHGmpgpxpGNf^NE]U|Premier|Tseshkovsky,V|2003.01.04|B23|0-1|B -@Om]DT]TFNxg?Tnf>@jbCKwn@wn?>k[RKvxBJxyIQmeDLtfEUfK=KgmKDmcCKumNl\NPpyPNypWY_WYXpgXWg`WX`_^mvNGNwtU\e\XW_fm\t\WYqa@GfmJRbZR[\[GOmfYVfgVTgfTdfmdimlQY[_OV_[VW[KiaZRNVlca]K;HXRJ]Ec\Ya;CEuJBur\UaiCGW`UViqGI`hVWrRWPX`|World Cup|Navara, David|2009.11.27|C88f|1-0|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vx?>tfFOulBRwtwne[u=>=fm[Lne=EmdHPogQYdvL]vh]LhvE<\kL=e\=G\S@sdU]dnCSgmBRqi@p`YGxuIYgqY`i`HXog@Hqw?AfoE?ohNEZc?NnoG>wfN_clT\e\[Tk[T]rtAidUEZUD>AlZiq|Tashkent FIDE GP 2014|Andreikin, Dmitry|2014.10.27|A46s|1-0|B -FVn^@Osd;LxgEU^UOUwSUdkd?Mm]V]vx>@d]IQld=OwvtfLFusCKfmOPgaWeaPesPF>FvFMFrs:=mf=UxwURskRbklGWwnFMftbZd\@GphDLneGNjbKSlnNE\TMFtkFOogQYqiBRh`Y`i`W`g`S[b[Z[kd[cnjcsjRsxRBE@vxU_f_=]\N^fuc]mcCfoxyGNCFmkd^;JFN@A^XkON^OWwoIQ^W?WXN:>N]WOph>^]gJ[om[UgV^ZrsAIs;QY;@sm?>ga<`pg`Nm^MF^OFOap=Ekc:;g^N`og`WrjCSjoO=ulS\c\W^g^E`vw;CoW=XlZ>NZlN>lZ>@xg=OwnOPvxg^W^vpLRd\EN]UNitkMVkV>VurV>rkRCwr:r|Aerosvit|Rublevsky, Sergei|2007.06.20|B46e|1/2-1/2|W -FVl\@Ome?TxgEMnfTKwn>@vxDLsd;Ekc?>tbKDrtE?d^=F<=@neFPtX:>qaGOXtNVaYPFtbFL]VLVgV>VewVvuvETruCLvm?=YQHPm_DFbk=?uMTN_hL^\TNT|FIDE World Blitz 2014|Ipatov, Alexander|2014.06.19|A01|0-1|B -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[?Ftk>@smO^wp^ovoV^g]LVucVeonFXiaXarw=XpiIYyxY`i`eV]NX`x`PYnuGNwyY`ulaXd\U\m\?olsVeyx:?x`owsl?o\momlmwomuowumwo|Aerosvit|Shirov, Alexei|2008.06.13|D43n|1/2-1/2|B -FVl\@OmeEU\UOUxg;LjbHPn^UFwn?HsmBRkcIQvx>@tkPXgvL]n`<`u`:J`u=Evg]gmgFPph?=gvP?rs?NktNTunJKc[R[b[TetfK[ve[swsEene=esCedC;@IxpX`qiQYi`Y`pwdl;jm>Fmuwpu]pwfmwomeFB^fov][BEe^|World Cup|Zhang, Pengxiang|2007.11.27|B91m|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@k[RKtkEMw\;LmeBJqi@tkU\w\LFvxELgVLU\e:FR\Ahg>?BJG=gf?HJKLZKJZcJB=GfgHQBJQHJBcughunBCn\CD\ehgH?DYQH?QIGAC;?F|FIDE Candidates 2014|Anand, Viswanathan|2014.03.29|D30r|1/2-1/2|W -FVn^@OxgO^me^OgVEUe]?Msd>@wnDTdST]SM=Mu]?>t_HX_h;LVLMLogfhofNrtBJo]:>woIYjbYanwNvtv>vovOEk[GO[SJSwSEVvo@GphGNhaXaofWPbZPYSn|WYB12|Andreikin,D|2001.10.26|C42|1/2-1/2|W -FVn^@Osd?[xgEMw\[dmd;EvxETgm@mwENwfN\f\TN\fOYjZCKuUY_U\=EfU_U\UEFtf@AruF>kcHXxo?@p`IYvx>Fon:?qi@Hc[HIxpY`i`?;[RKRURF>ur>LnmNTd\IipoTNRdLJZRDTdeAHew;AweiyowyqmtN]f]T]wuA@]T[e\e=edneJg]LVvxVeTLFV]SeTc\JLk[TJ\LCLSMJ[M@gVEUk[RKm]U^tf;EV\DLfXKD\f?>w\E?Xa?PahIY]U<`umLUdUOUmU`NU=D=vxYahMN\f\:<\f=XMTCKT]XfofkCwoCS>FS;ow;@wo@:ox:JF>JN>:WPxoNK:>Kkowk[wo[\onPG>:GN:>NE>:EM:?\lnwMV?>VU>=UN=>NW>Fl\F>WPwoOW>@PQ@?\T?@TRowRj@?jrworR?@RBowBH@>QI>?IP?>HGwnPH>VG?VN?:noHGNKX`i`W`KQ`hon:jnwjrwnryQAGNA>NU>=UL=og^evmHPweTeSK>Fys=>sSFfSR<;jrevRUfemtedtkdfUM\dkjdlZR><[SLRcZA@yIE>rtFOIiBJkb<;d\U\e\R\t\JSZ:;:\D`Vm^VgigOVDTVA^OAOgO@pb[|Aerosvit|Svidler, Peter|2007.06.23|D45l|1/2-1/2|B -EUxgDTnf@OkcHPtb;Em]?Hwn>@vxCKl\U\c\O^bk@Iqa\^>SD\SE\DES^`gq`WSUHQmnDlUgl\gc\DcbDEbgWsqwsuwfQfnfuZkbN]g^ZlbMl^f^]WMbW]bM]SM?SD^[DN?MECpgBR[ZCBg^KSZjBJ^US[U\JL\U[cjRckRSLT|74th Tata Steel GMA|Radjabov, Teimour|2012.01.20|E15e|1-0|B -FVn^@Osd?[xgEMw\DLvx>@me;EdnMU^ULU\cIQe]V^gV[Mt_=Fnd?=cUEV]VMV_VOUu]Ud]dGOV]CKjZ@tfTfofOQum<`vxGWqiW^i`^gwgBJrw?gwg:?giQNm[NU`XHP[`?Wf^UTxqWG`NToigoaqxavxqvaqxavxq|65th ch-RUS|Svidler, Peter|2012.08.04|C48j|1/2-1/2|B -FVl\@OmeEU\UOUxg;Lsd<`nf=Ejb>wn?Mc\>PvwPYqaW_[SLFf^FdmT]m[K=|GMB|Acs, Peter|2003.01.16|B67s|1/2-1/2|W -@OxgDTph;LwpHPld?Hm]T]d]EUvxO^nf>@gmGWsd@gVEUVe[dmdU^e_=uvuIQuv;Lqa@t_YX<=^O?OpU@?U^>EtTEN^pNjTSCKwt=MX`L=SXjktw=NpUMUXUklUEBRECN=C;OM;EB`fpgf\BZKSZBS[|FIDE World Cup 2015|Andreikin, Dmitry|2015.09.22|D79g|1-0|W -FVn^@Osd?Tw\EMxg;EmeDLvx>@jbTK\j?>gX>FxyIQXiE?o_@ulDLgVMVmgVDwe<`tm?>qi`YvtO^yw=Omd^dldDVdlHPlnYgpgU\e\CS\cBRuE>FEFOFg_VHclRZleLTeS:;wuFCS\HktmC[me;=el[dls=;\Skb|39th Olympiad Men|Heidenfeld,M|2010.09.21|C10|1-0|W -FVnfEUm];LwSV^l\BJSLCLul=Xo_XPsd@O\ULUxn:;vx?tmO>V_FMnhM_hY_MdZ<;rtHPY_?Fkc;SmvA@vhPX_YMhYh>OZTJRhnEndS;xp@AtyAQiaGOh`Y`aXQypyOXdnFOnh>HoqHWhWOP>?PH?oHPh`\cokcu`hPWkKunKkn\koWPh`\cokcu`hPWkSWNhoulSRlcohNOR:OW:>c\>FWOFVOPhoPYVNY`op`WNQW`po\eQye\yx`aov\evoe\xh\eopewpqw\hp\wpow\qpa`oO`apoa`OQ\eQqe\|20. Amber Rapid|Ivanchuk, Vassily|2011.03.22|C18|1/2-1/2|W -FVl\@OnfEU\UOUjb?Mw\UK\n=XxgXpyxpisd;Lk[ZROMkbMDRJCKSLELnSKTSLUKL>=>cS>@vx;JTLCLl\FNsd:;g]@vxO`qi`VgVHVtfCKum@vx?=k[O^\U^duvNUneBJmcdStkSMgVEWeWMWrtFOcRWFvm:;V`DMRcIY`OMOcTF@k[RKw\DLmeBRrsEU\cR[b[;JvxJ[tXKD^U[UdULUXOHOga@Aug@wn;Lt_?>VLCL_M=MvxFZT:>ngM_ldW`Te_Wg`O`qi`OwvFvevIYveO^rt>NtlWXeVGOVe^MlnN^eT^nunYaTeM^nfXYog^hfN@IN`YQxqhwqxwhg_BRjZOW`XQX_Xh^eT^Xk[R[ZR[dRJX^TeLTJBT\etDTB:2T]:U]eUWIQW^em^l|GpB playoff|Bologan, Viktor|2004.07.27|C42|0-1|W -@Ol\DTsdEU\UOUxg;LnfBJdU=UkcUWtkFVme?Mjb>@gmWPul@sm;LrtO^m^W^ucDKwu:=gm^W[SLRc[KDkbHOf^U^m^W^[^CKd\RCngCT^LDVbTVTLTKTjZOXtrXOu=?=rj=]gnOXxw]mjbX_ZR_;wvmkSKBKRJ;BngKSbeS\eE\dvukmEmdmumT\mnFNgLGWo_@GLSNVS\GO_VOVngPXp`W_\nBKn\KB\nBKn\KB|Tal Memorial|Eljanov, Pavel|2010.11.12|E06|1/2-1/2|B -EUxgDTnf;LwS=Dm]T]u]@O]_DKsdEjZSZcZNVogENxqV^g_NUqiD_f]_DipU\`X\epi^f]fefXPGPi`D=ZR=R`XRdXP|Renova FIDE GP Zug|Morozevich, Alexander|2013.04.21|E34|1/2-1/2|B -FVm]V]u];L]ZEUxg@Osd?[g]BRjb[dkd^g>fm]Zlutlc]_feg^emofmjtwc\^e\efeMU_]jq]UTUwWUNaYqyW_yuefuUbZOW`WUW_\NM\aWUd\UXf]MLa_XY_OLCOPYy\Tya]eaZTLCJ|FIDE World Cup 2013|Ali, Sebbar|2013.08.11|B01|1-0|W -FVl\@OmeEU\UOUxg;LjbutBRsdHXdS<;gv>Gk[L[e]V]f][L]KDKtf?TfhLVvgGHruNEgVOVuUESnS=U^UA?xy?_og_]hv;Bvn]UwuT]utIYSe]Te\UM\SHOtuT]n^OG^nMOS\GD\SO_neDGS\GF\UFEecX`U^Yacl`gpgaiutEHln_?nw?@g_V_^g]TgU@=UgHktsklsrlWru=@wnWXnw@HusXWsSWe|It|Dominguez,L|2005.04.03|B90|1-0|W -FVn^@OsdEU^UOUw\@meGOvx;Ee]@A]VOVtXNWXF=F\e:=rvET^TFThVWele=>VhT[ndUdkd[dv>?>hD|12. Karpov Int|Rublevsky, Sergei|2011.10.11|C45|1/2-1/2|B -EUm]DTld;Lxg@Onf<`qi`gugFNsm?M]TMTph>@wpCSvx=Kgn?=kcTFtkOErs:;wuFOmgKRjbRKg]=@nfIQXaEUgVU]sm?>wnFTf]T]Vg]krskdvxHXahLTmc;LcT=FT^O^e^X`gvQYog>=ve@meDLvxIQdnMU\c[Me]U^gV;Eo_^gVg?>t_E?_M=Mnhfgf]fuM=Mn]MJwsO^qi^hsvhW]WPWvfJjfnIPxoPOc[jr[SrtoftunmW_fnumnmOVmeHXd\QY\TVUk[X`iaUVTLVMLCMDe^|SportAccord Rapid Men 2012|Ivanchuk, Vassily|2012.12.14|C65|0-1|B -FVl\@OmeDLxgIQsd?Me]V^gm=Fnf>@ul?>kcMDtkBJwnEU\T?mcFNZdPYjZYnlnHX[SJSZSW_SKD;aXQXh_X_tlNWkt@Gux?@x@G@lkE?tm?Pdu_fof@HcRWEnpOIyxI?uo;_f_^foefmpmHOeVEiV`OG_WPam_?E`QG>x@E?_V|WYB12|Rohit,G|2001.10.25|B50|0-1|B -FVn^@Osd?TxgO`m]V]dZT[ld]dkd[Fqi`O^VO^weGWVO^Ovx>@ulEUd\;LjbU]tk@AruuvLRnuEZlZ>ZuZFM\TMTvtTKg]DLwv:>]WA@WM>vtvOUvnKDMC|EYCC B14|Ragger, Markus|2001.09.02|C59|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMmeBJum;LwvLFe]V]g]FPnwDLxy?sdIQXaEMfm;JnfJTweTeme<\N=ENFEFXiLVvxA=mcVephOUi_U_h_=Uog^gwgekc]k\xoFE]cCKrt\bc]bS]L@w\DLk[RKmeEU\cBRrs;JvxR[b[J[tXKDXOHOga@Aug:RaW?@dn@wv:;smKSbTEWgVLV]VOETBHVB;=;mgVrurFVvuWNgXIQXNGNjZSZrZ;DZ`?Ol\DK\UKoxyQY`^ET^VOWV;@IuxNUc[T^neo];DI@e^U^DFWGFN@H[S^fqi]mNVHIyqfnxrGHSKm[Vn|FIDE Candidates 2016|Nakamura, Hikaru|2016.03.21|E15o|1/2-1/2|B -EUm]DT]T@Oxg;LjbFVk[V^g]BRnfR[wS=D]cDVu]VXb[:r]r?Fvw>@SLCLqiXYsdO`dnFOtkOkrk@UMCS\nS[dZTMme;EvxEKld[dZdIQd^MDulwvU_nwE`gm>Nph_ixpNPog`WpyKUm\=FkbFalpa=pmU_bk=Uru:>mfU=e]_UfmV]k]PN]BiX^XQXvN>NBo=FuvX`vNFNg`W^wp^pypN`\f`^px^smusjfULUuUjrxprkU:@I:^HP^fDVfeIHe\Vdpgkmgpmk\UdOh`H@U\Odpgkmohmugpumhomkpgkmqimugpum\TmkT<@H<\H@phkmiadVhgVdgpmkaY@HpgkmYQH@gpdOc[mQ[SOVSKQqpwqywnyCofCpfoVh\ThoTop`ne`[o][cem@I]TcgTDgomdovd\vN\SNUDTUETLEeSTedTMdhMEhiEFifFGf_GF_fF=fX=]Z>?Z_?@QYF=_\@H\dHIdlC;2PXIAldA@d\@?\w?Hwr|FIDE GP|Smirin, Ilia|2002.06.01|C54|0-1|W -FVmeEUxg;LphGWwp@Ovx?MsdV^e^W^gXLFdSMTl\DLSdIQXi>@\ULUdZTMogCSZdS[dZFWi_=Rkc^gpgrtR=ZTJST^U^u=>=g^=mkVmn^U@IwonfomWatDfV|SportAccord Blitz Men 2012|Ivanchuk, Vassily|2012.12.17|B09|1-0|W -FVn^@OxgO^me^OgVEUe]?Msd>@tX?>wnDLo_=Kvx;EdZKDZdCSjbO^d^U^nY>?YG?GVG@GuYG@Y>E?_W^LT^aT]WO?POG@AaY:?rvDEYnIQn>E`wo`X>EXUv>MqxqUE>?P?oWEW|3rd ACP Blitz Prelim3|Vasilevich,T|2004.06.02|C42|1-0|W -EUm]DTld@Oxg;Lnf<`qi`gug=K]TKTsmFVf^U]mcTKw\?Fvx>@tX:@un?=wuHPe\\c@Hph=mum:=qa>ExpE=NE=E^CMDqaXWrtdtvtA@gVEUVe[dmdU^e_=uvu;LtmIQqiCKut@nfDT]TO^tm;J\UJTw\hd>^dh^>hdIHYQHPQI>Ad\AIahJR\jIBj@BH@>HG>:GchacN:yRZyxPQxrNKrvZbvnK;ah;@habjnJQPJZ@NZuN^|76th Tata Steel Masters|Naiditsch, Arkadij|2014.01.18|E04n|1-0|W -FVnfEUm];Lxg<`]VLVsmVgmg@Oqi`Ng]?MphNEwp>@vxDT]n=Dnd:=dUOUuUESUCSwxwDRpgMVC^VO^\=;ldBJwnRS\SJSjbS[b[T[d\[cgU?>ne>Fo_IYf^YahaOa^V@AtfGOfTOVTFV^e^aFruFOumHP\T;[^gPXU^X_TL[\g_\TmUTtUStw_`wx`WAHWNOkSckrLDxtNEtuceuvD<2v^ehHQ@phEU\U=Uwp;Lme?=sm=skFIh`TbkK=DtbDK_VW`usRSZSIYSLKLsjYVd^`hbMAqjqV^e^hqMqNXwtLS^VXgq_ga_XaPXOP_t<]LyqSTMLDSTD>QAOIFNWFvWPvwPH=OEO]VOEVME?wg?PgWPaWwaPMNP?NF?PF>PVwoVP|World Cup|Shirov, Alexei|2007.12.11|B33r|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMwv;LqiBJn\L]dUOU\UDLU\]gug=nmZbmlLTeUNU\UT\xw=:wnD=phbcia:butQYnmHPmnGWog@Gfm=KtwGFmXFEXmb:mfEDg_:>fKDK^WPWnfcbwuV^uv>@vxKSf]@:]fbjxtjltl:rlqrwqjwg|World Cup|Matsuura,E|2007.11.24|C88|1-0|W -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vxBRtf?>sdFOdZKZuZFlmLRnuRcucNce]FE]UDLfXOXgXLU^UEUmfUef^HPXg=U^[:>tTUM[SMETVESVS>nSCnkwrknC[@Hg]nm]cZcrsck[kmk|ch-RSCU Blitz|Nepomniachtchi, Ian|2011.01.09|B92|1/2-1/2|W -FVphEUwp;LmeGWjb@Ok[?MsmV^l\MVrs>@\UOUe^Uduc@AxgdscsW^m^@xgVPwn=FdOFOld?>vxDLwvvuvOQqxQm`EUNEFIQvfmEFE=EjbEmfnmun^CS^]ut|2nd ACP World Rapid Cup|Gelfand,B|2008.01.06|C10|1-0|W -DTxg;Ln^@OsdHPm]T]g]?H]c>@wnBJvxEMtf@vx?>meBRdZTBl\;EtfE?ZdDLqi?PwvIQfB:Be]=FnwB:umOIruFOvfP_]VMVmMOMuMIXgXQXdZ_N\TN]ZK:;fbFk[GW^WPWjZX`i`W`[SLSZSFGB:;:K:@?M=?F=;FOweGE:KEDKZNcZdOFTLCLSKDEKCFMeJ|Tal Memorial Blitz|Movsesian,S|2008.08.30|C55|0-1|B -FVn^@Osd?[jb[RxgEMk[RKw\>@vx@ulLVgVHVsm?>wnDLvx=Om^OH^h=mv=exwecru@?v[?>f^ck[dkowoO^of^duy>FyQBRfedSbZSDQYDNe\CKYQFMQOMFOQFMQOMF|2nd FIDE GP|Kamsky, Gata|2008.08.06|B90e|1/2-1/2|B -EUxg<`nfFNl\DL\UNUsd@Own?Mkc;Etk=Fg]`ndnHPulMbkbFbvx>@o_BR_WbMnh:>WPGPw_MVrwO^h^U^l\VU_?>?\ULUwt?G]NGFtD@GN=GO=CRZcZEKDFOFZRK\RJFECR\KxoEMohMTJBT[RL[\LF\eFUK:h_|Helsinki vs. Tallinn Match|Pakarinen,Pekka|2001.10.28|A45|0-1|B -@OxgHPm]?Hnf>@wnEMkc;Etk?>l\FVsdV^gmE?qiIYulfvuW`en`ndn=Oum:>rvOgyqHQmuQ_vy|VI World Blitz|Ponomariov,R|2010.11.18|A05|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LqiIQtmCKjZ_YOYnYLT]fV\kc\fof>NywGOYn@HZRNMRKBKrB=En`EG`YGFd\H?tkCLBJLCJrCLkd?HrJL>wuMuYuFCu`>L`WQYc[T[d[Ya[dL>W^C;d]>P^eOWJBHOBEONEU;:UVNOVS:=SU=>UM>N\TKT]TPGTUX`l\`ipiW_f_NMUMG\e\OWMFW_FO_h\Nh_NW_gOXgfXaf_W`|18. Amber Rapid|Aronian, Levon|2009.03.20|C67|0-1|W -HPm]?Hn^DT]UEMsd@Oxg>@wnCSdSO^vxBJSb^Ol\FVUNGNbs;Lsd]xqpaipyxKyqKxqyx]yqXYSnum>^YQqy]on`oh`imqyxqixpia^NQXphaZhgZrgnRZnmZbmlbjlkrskj|SportAccord Blindfold Men 2012|Morozevich, Alexander|2012.12.18|A00|1/2-1/2|B -FVmeEUxg;LphGWwp?Mvx@Osb>@l\U]tXMTblIQXmBRjbV^gvRZpypvMEypGYul:=csVP_tT[b[^eneYn[SW_tmEWvg_hohWelenesuewpwO^m[PVgv]eveV\ut\m|67th ch-RUS 2014|Zvjaginsev, Vadim|2014.12.04|B09n|1-0|W -DTn^HPxg?Hm]T]g]@Osd>@wn;L]cBJvxEMtf:;jZogN\xyFV]o\ndnMU^UOUld>=tlRDlcDLumV^g^UOn]L^rv^_mn=Eoh_QnFEFvFQtFvtXcC<>vwIYCJYah_X`qi`YJSYI_X|Tal Memorial Blitz|Carlsen,M|2008.08.29|A29|0-1|B -FVnfEUm];LxgV^gmGWl\@OsdGvn:ytIYqiHXbZX`i`Y`ph>AkbGNduOUudU[b[M[rs[FmcRcscFMtxAqnwDTSLCLdn<;c;M;n_;_f_^fofNUxpqpwpU^po^eZRBJ|65th ch-RUS Playoff|Potkin,V|2012.08.13|C11|1-0|W -FVl\@OmeEU\UOUxg;Ljb@wn:;jZEMvxleT\ehD=nk=Evs>;kS\ZhaGHSKZ\aoHGKSRZoaG@aOZbSREGOa\dav;NV>?ON?@NE@IEL_VK]IP]VqyCSP@LT@TL>nSRnjRKjoLTojTdjUdTU:KS:>S\>n\cneckemkbme[cg_MU_WU]i`TdeJbkWO]eOGemJnd]`W]UWOksG?2mu2nuUu|World Blitz 2015|Safarli, Eltaj|2015.10.13|A29|1-0|W -EUm]DT]TFNxg?Tnf@Ojb>@l\TK\UNUsd;Lwn?>vxvtv@HvfKDph]ElcOMxpEFfgMEgeEL\ULKclDVkcV]egKMl\GWgeFVUgMN\lVvc[NV[T]TeUVrlTvxpirwiaW_UE|World Blitz 2015|Wojtaszek, Radoslaw|2015.10.13|D27|0-1|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvuIQtm?=wnHX_YOYnY;EutEVkc<`Y`V`qi`oyvGWmfoipiW_f_X_v^=?tm:=mn?>ng>^g^=md\@Grwmlw_GP_`PG`_GF_aljaQjkQIFM^]kcIQMEQIEMIQMEQI|2nd Norway Chess 2014|Carlsen, Magnus|2014.06.09|C67r|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBRrsR[b[IQvxl\E?tfKfof?PumDLSd=EduMU^ULU\TU]f]V^|Blindfold World Cup|Topalov,V|2007.10.19|C84|0-1|B -FVl\@OnfEU\UOUjb?Mw\UK\j=Fsd@vx;Lf^W_rsL]bZ?:tm]gugKZdSRJe]ZKwtV]S]NG]WK\m_M_g_\MphMW_WJOWTOLT]LtstDL^VIQtvGN]KNFVN:?K]?=]^LTvs=MsCFNC;@G;CGO^gOPqaNVxpPICDM=DLIAgfVUfgU]gf]U|World Team Ch|Arencibia Rodriguez, Walter|2005.11.08|B42g|1/2-1/2|W -FVn^@Osd?TxgO`m]V]dZT[ld]dkd=Oul[Mqi`Vg]>@wnVPphBJiaCStXOVo_V>aYFrvFTwoEMkeTK]c;ElkGOg`ETcTMTkbLRbTKM^VMeTFehxwhewx?G`Nehxwhe|49th TCh-ESP Honor 1|Socko, Bartosz|2005.08.28|C58f|1/2-1/2|W -EUm]DT]TFNxg?Tnf@Ojb>@l\BRsd=Fwn?=vxU\ulCKf^IQ^VOUd^g`@`dgOXts`^nd^]dS]uwuMOgiOVSdXOigVNdU>=UO=uguNOuU|20. Amber Blindfold|Giri, Anish|2011.03.20|C42|1/2-1/2|W -@OxgDTkcHPl\?Htk>@phEU\U=Uwp;Lme?=smulHdld>DrtDSdkUgpgYWg^WNnfBR^p=MqaIYxqNEpiFNiwSBvuBLumL[tuEFjb[Uf^UOc[M][RKRutFMmlT\l\<\t\]\e\O^wp^TkdRZd[M]qx@H[vTEpwEVvtVgxpgmtlmcwn]TldH@ngTMdkMe\Tcmk;@I;_I@TLewpqmg_gw\LD\Dg:@H:ZDTqxNVZcTtxptLcgLZgfHOfKOHK[ZLpwLtwntlnfltf^tl^fltfntlnwltwptLpqLl[KlZKkH@k[Zl[;@I;BljBTV^TfjlqpI@f]lj]djUpqUjqxjsxpsud<@H@gVEUk[RKm]U^tf;EV\DLwnKD]UEKUMD;\KBKf_KSvx?>u]IQwuHX_f>Nqa=M]M;MaXQXf]MD]ONOd^OQphX`uv@wnOQvx@Ars:>[SLFSJCJf^FP^WNWd^P_xy_nlnW`nfQPgmKUfhU_og`Wm\_e\MDM^M>NMWPWkdNPhae_sk_pkpPpypWlwoldaF?<>G>AI>^I@^>@I>^|UKR Ch U20|Gasanov, Eldar|2002.03|B33|1/2-1/2|W -FVxgV^g]EUme@Oph?Tld>@e^U^wp?>tX;EsmIQXOEOnfT?ul=FqiO>MTKLTFLDF^Sn|XIV It|Vaganian,R|2004.12.26|B04|1-0|W -FVl\@OnfEU\UOUsd;LjbUdkd?Mm]>@xg?>wnV^gmLRvxDTbZ=Xo_^gmgXFne<`f^T]d]RLtf:=us@AeS`gpgBJSLCLslM;ruFaxyailpipyp;BpoGW^W=Uut>:|Aerosvit GM|Rublevsky, Sergei|2006.06.18|B46e|1/2-1/2|W -EUxgDTnf;LwS=DvxBJSLDLkc@OtkFNjZCKme?Fsm>@gVLDo_xyUYfNYiN>@H>FHQFC]oCFiYFno_qiYUwqUEvw_MwOM]OwQHqg]OwvKSZSJSnVOLVNLDNVEGVfIQvnT\c\S\e\D\ld\cnvclg]lmyqHI]gmkfFIHFGHGd\klvfGOfbl\br\lrJOHJBH?B:?F:BF=Br=FrvFEqylovuEFumowyqPXm]wo]^FO^]of]MOHMEH?E]QY]Z?GZ[ft[CGNCKNEKPt_qyX`i`Y`P`_Q`aQtyqtDqy|KO|Zhao, Xue|2006.10.30|E32|1/2-1/2|B -FVnfEUm];L]VLVtm@Omd?Msm>@wn=FxgVPvxO^m^U^gm@AuvDLruGWo_^gmgFfxyMTk[TKn\W_uMfvwv<`gX_gpg?gMege\e:?qiK=i`=Xd]P_eWBJ]T?=TK=:vuHPuEXO`XOdW^:>^g_NECNXgL>vypvnpwnljZXNL^ltwntvned[C;AH;>HG>@n^;LmeEMxnBJjZO>tf>De]T]n]DN]nLVkcIYqiJRvxNTul@vt:Btk;>o_IQuw>Nqi@Gmv?AvaG>yxQYdu>=xy=ihNOhX>Gwy;AudA;klGHlmHIXhOGhiGO|Aeroflot Open|Psakhis, Lev|2002.02.07|C18b|1/2-1/2|W -EUm]DT]TFVxgV^g]?T]cTMsd@]TFPmd:ZvtZ\TKLTtsXfuvfQcT\dkdPVTcV\K]?@xgEMvxIQmeDLqi?>jZTKwv;EtfKR\jE?rsR[fm?Pdn[mumMUnh|42nd Olympiad 2016|Harikrishna, Pendyala|2016.09.12|C50p|1-0|B -FVl\@OmeEU\UOUxg;Ljb@wn?>k[RKvxDLm]V]g]O^d^>^ldEUne^>uYHPYQ=FtXF?Qa;ErvGOXQ?Gv>G>eWK]WEV]m:>QfEWwvV^og^emeWexoCKf_@Gv>G>bZ>E_fEMf_|5th Final Masters|Aronian, Levon|2012.10.08|C89n|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMmeBJum;EduDLl\MU^ULU\UOUwvKDufUfmfJRnwR[b[:rkrDMfmCKe]V^gVEOrd=Dmk:vtDFtr:@I>^HP^eIHo_rwewiwxwHOwnONneNUh`UT|63rd ch-RUS|Tomashevsky,E|2010.12.21|C88|1-0|W -FVnfEUm];LwSV^xnBJSLCLl\=X\UXpyxpqul@FsdGWULFLdU[lQ_l]IY]gU]gaPXaWYaWH>FHWF>Rm_mWM<=emCpM>=>vtait<>F@rt:@wnEMVLCLvxOUuv=ad\U_t_a_vd<`n`_`qi`Pog:>g^?wrwP^xqIQwg>;dm;kgokson^PldPWnFsCmfBRfhWXhvX_qy_Wvf@IyqWPfgMU\ULUgUDLUNCFNFPeFTe^TV^eVRewRV|UKR Ch U20|Semenov, Dmitri|2002.03|C29q|0-1|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vx?>tfFOulBRwtRZsmKEk[ZcmcIQqiE?cTCKTcFiaFEnw:ZksN]f]L]g]V]cTKTsCOFwiEMtTMKCD=DTDZbrbFb^VbkD<@IaYHPYPIPo_QYipkdp^PH@vxGOwtCKe]V]g]L]nf@tk<`g]L]f]GO][YS[b:<^V`nwvn\rsSEsuEDVOFOvFDLqi\GuMLTbTo_T\BJ>p`Y`i`;=xo=eLDGUovehDF>=FVUGVX\dXTh`[R=ETDENRd|Eurasian Blitz Chess Cup|Moiseenko,A1|2016.06.18|E20|1/2-1/2|B -FVl\@Ome?[tm[mum>@xg?>sdDLnfEU\ULUe]V^gV>FwnO>o_>DvxGOV`;Lrt=Mjb@l\U]rsIQblBRjbRZk[ZcscLRcsDTnf=Df]V]g]T]l]DGsSW_]WMDwvRLtk:RpL@gVEUVe[dmdU^e_=uvu;L_nIQnhLVqiCKuvwSDLSn:=WfLTnS>NtmOYruY_mt=uvuNMuvHXSwCKT[kDBkjph>=VMjmMV`uBJ=DT]meVUucU^euJRuy^VyiV_DLRTLMTRiy]Hyw_XcuHVMLV]wgXage]kLKR:KS:;S\;:\cktcj:;ec;:c[t_ZbaX[c:=u`_Vjs=?`g?>bjVOgu>:chXah`ai`[ih[k:=ucOksk|GpB Playoff|Kramnik,V|2004.07.27|C67|1-0|W -FVn^@OxgO^me^OgVEUe]?Msd>@wnDTVg;LvxT]g]?>tfBJngMVqiVD]n<>DKULrt>nh;@HKTn>;_>ViaVUt\PXaXUXogE>xo>VTMV_M_XUonHPp`IY`YUY_DYi\]LgnmPGmdGN]_OWdmgL_]LUD_iamfa`][CS[]JR_DRZD_`p][UL[]L>]MNFM]pk_MFOMT>Y][k[T[OX[MX`e]YGfeW_enG\no`WM[W^[d^ed[\U[TedTM_gofS[MTZbTFbj|WICC qual Moscow 25'+10|Touzane, Olivier|2002.04.13|C42t|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDl\U]\TE?ulHXws?PbZX`gvOIktIXm\P_nwBJrj:>ha>@swHIbt`Njk@ptXIPXtGWZRW^e^N\wvPGtXiokopo|KO|Zhao Xue|2006.10.30|C95|1-0|W -@Om]EUxgDT]TFNnf?Tjb=Fl\U\w\>@vxBJk[TMtkCS\n@I>fdDETH]fg]T[TIPgdPWpgWVg`V]dg]T`YDLgGJRqaXaYaS[b[R[GF[cFvT]o_ckvs]dh`L\_WdlsklkaYkdYQ\`WOd]OG]V|Europe Blitz Ch|Huzman, Alexander|2002.10.02|D26|1/2-1/2|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LnfFVtbCKwS@vo<:sk?>yvIYg_E`]g>fvfTfof`gfg:b|1st Asian Clubs|Wang, Hao|2008.12.29|C45k|1/2-1/2|B -EUm]DTld;LxgFNnf@Osm?M]TMTk[TMjbNVd\V^\UL[b[^gpg>@uc=Ftb?=ruCSwS:;SL@wp:bZCSZ^VkjZlTZS>;SK;K^ZKMusMmZ:m=:jkVsCDMCGIQjBQXBbTdbj=;GF;kjkdipiVkOGkHFNMUyqHVNVUVqyV^yx^fwo|18th Amber Rapid|Ivanchuk,V|2009.03.26|D43|0-1|B -EUxgDTnf@Om];Lld<`qi`Y]TFVp`YPk[?FtkV^g]>@]LCLd\BRjb=;`XOY\UR[UMFXbZXOkOYOu]:Rsm;BmcRZrZBZw\ZBvxBExq?>\nPWwx@AnwWNcmNU][EWwpWo[]OExwonw_>N_`NPm^P`i`ETqhnv^ovx|KM FIDE GP 2015|Grischuk, Alexander|2015.05.22|D43n|1-0|B -FVmeEUxg;LsmGWn^@O^U=UldGNTCKTJOUXtk\cmKSjZUdZS\mtmdnxyn]rs@=mf]Nog^gpgMVwuV]f]N]yp]Nst:@jbCKkc\UCF^VOVDVEK\e@wn?>k[RKmeDLvxIQdZKDl\EUulU]tmCKZk;EphE?gaF\TKSbZBJZSLSlcFNcUE@gVLVkVxpIYqiYah`Vewe\e^eNLogLDdnO]f]>Fum=>]UFfeSDVpwVqmlfgwvqxvmxfmvgivwiywpfi|GMB|Cmilyte, Viktorija|2003.01.20|D97f|1-0|B -EUxgDTnf@OkcBJtk;Lm]<`wn`gngT]f]=Kvx:=wvFNld?Msb>@bl?>lfM;ph;BgpNVumKRfWIQvnV^xyCSogS[d[R[rt[SjZSKg^U^tw>NpiOUWfUfnfNFipL]f^F^p^Kcm_cN^p=EwtGWk]E]_D]ED<@ItwHPZRQYpLEM;D>NdbNFD;F>bc>Fck|World Cup|Mamedyarov, Shakriyar|2009.12.04|E12n|1/2-1/2|B -FVn^@OxgEUgVU^m];Esd?[tm>@d^[m^mEV]VO`wn`VvxDLmgVgng[`DTvwHXum>Vg_|It|Azmaiparashvili, Zurab|2005.04.08|B19|1/2-1/2|W -FVn^?TxgEMw\@Ovx>@meDL\c;EldTKwv?>smMUclIQmwKDwhE?qi?Ptf:bJ:JmcNP[m_Nm[J:hn:;l\ET[TNT\lTJcR;slsJ[R\PNnt@ItjLTjtGW^WNW\m[UtnWPm^U[sc?Fc\PWnhWPhwF?wmPYmgYWgmWYmgYWxy?FyxQYiaIP^hWOh^OW^hWOh^OW|19. Amber Rapid|Smeets, Jan|2010.03.14|C24|1/2-1/2|W -EUm]DT]TFNxg?Tnf@Ojb>@l\TKk[BR[S;EtkRZwnKRsmU\ulEKvx@jb=Fl\?=k[TKtkBR[SEMwn;EvxRZkdMUsmNVusV^g]ETd[FV\UOUm\VX\Kn_GuUSLUVGOVWOPqaQYWXPGXYCSYWGNW?\taYtyh`NV[dVM?OMDYQyx`_xydVDKV]KD]TLE^VyYTMDLM[LDVNEL_`YyOGD=QIL>[d>GNG=FIA2|VI World Blitz|Kramnik,V|2010.11.16|A09|0-1|B -FVn^@OxgO^me^OgV;LVLELwntfN`qi`i\TipTME`gV`in`O`u`i`V`pwMD=exwIY`qNdnNVa_EM_\LEn_VX\tMLtrLD_nXWgpE>n]WUpg>Gg^UV^eYaenPXneDEo_X_f_airyVU_fUYenYa]ga[yiBRiARZgmKSfT[`nfEUA@tmDLjb[RphEUwp?>xgU]dnLTvx;LmXIQXtCSga<>XPYOwya]tX]VXOVOi`>;gU;?pgOVUVMVg^VOys?;scOFe];:cs:J`nJLnSL<^eGPS\@?sy?>yAF?WP>F\GFOAy?MyvOXvNM?NKX_KS@tkUdkdBJxgFMwnGWme=Olk:>vxNU[SJSkSLFe]V^gVONphFLn\LFwtMV\UNUSUFU]V@Gd]CKbZDT]kU[kd[Urs>NZRKRdR?@gVEUVe[dmdU^e_=uvu;LuvIQqa<`tfCKwn:=aYLVjZBRkc`Wd\V`n`O`_U`fUfWvnDLry>Va_VRKRmRCKR[DT[mOYk[Wf[TY_nuKSe]f\m[_Uuc?gc\S\t\>nTL;D[RDFdU|Alushta-100|Khudyakov,A|2002.04.19|A09|0-1|B -@OxgHPm]?Hld>@tXDTnf=KucKDsmCKwnWPaipy|Amber Blindfold|Gelfand,B|2008.03.15|A11|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphCKwpU]rt@ph;LwpEU\U=Ume?=sm@vx=KbS?=kcLBSB:Bgm`nunT]f]=@k[RKw\DLmeBRtkEU\c<`qi`gugU]dnR[b[:rkr;JvxJ[nhHPrkKTwr@HktTFgn[Jo_JTcj=DnoFMtk?:_VMVk]TeleV]o]Dh^VOYVNHQNGY_jU:?Ughg|Tal Memorial Blitz|Tkachiev,V|2008.08.30|C78|1-0|W -FVn^@OsdEU^UOUuYU[YV=gVEDvn=@wnFNvx?=rtTFgVO>_h>MuZMWVe;LwuIYf^WhqhU]d\YahaFaphaF\TNVm\n`NOo_BJSJOJumPX_WF@\M=MTMJMVgMhmph_^V>LWOHAlm_^sv^Upq|SportAccord Blitz Men 2012|Wang, Hao|2012.12.16|D23|0-1|B -FVl\@Ome?[tm[mumDTxg;LphEU\UOUwp>@vxCKsdjbUOwu=Fml>=gm=EpiE=m\IQlZL;k[;EipCpxpFNf^=<[SE?Zl?P\fPFbZBRSJ:JljNjrjFLdUOUfUL[U[T[us@l\U\w\=Fsd?=unBJ\eIQk[TBtk;EvxCSd^@gVEUVe[dmdO^wn;EvxEOngwvCKe_=M_YOYgY^OYgO^ph:=f_MEg^W^og^WumDLxoGOv>=>rv>vovEFmnFnvnWl_;BJ;BKSk[@GjbGNB]HXnfIYfoNWofWNfoNWofWNfoNWof|EYCC B14|Papin, Vasily|2001.09.01|C67|1/2-1/2|B -FVl\@Osd;Lph?[wp>@dU[RuZ:;jbOU\UCSZuLFk[RKtkEMm]GOnf]VMVvx>GndBJbZSZuZFWZj?=wuWMdZCkd<`utV^jmJRTZR[d[MWZK;K[RKCrsCsts>=ml=URD`gpg^gD_GNf^W]^UNis;|SportAccord Blitz Men 2013|Radjabov, Teimour|2013.12.14|B31|0-1|W -FVl\@OmeEU\UOUxg;Ljb?TnfTKk[=Oul<`wn>vxOPm\`i\KBKgvi`n`P`[SLRvg=Mqi`Ef^U_t_V_e]ES^VMPrtSE]U<;wuGOVNEMgaPXaWMblD;BD_HPWM|37th Olympiad|Dukaczewski,P|2006.05.21|B87|0-1|B -@OxgDTkcHPl\?Htk>@phEU\U=Uwp;Lme?=smb[R[s[=m[mKS\S>Sm=S>=>|World Rapid Final|Topalov, Veselin|2012.07.06|A30|1/2-1/2|B -FVn^@OsdEU^UOUme;LxgUdkd?Mph=FwpV^e^F^tf>@vx<`rs:=g]^PutL]d]CKl\?>\TM?tbBRbd`WskW^TK^pxpDKdD?[DlPNlu[dkcd]f]N^og^]u]=]cKHPwo@H|Europe Rapid Ch|Djuric, Stefan|2002.10.01|C47|1/2-1/2|W -EUxgDTnf@Om]<`qi`gugHP]T=RtmRTmd?Hsm;LwnFVvx>@wu?>f^L]d]V]^UOUn\:=\cTLuvUOgeOEe\L\c\>vrv@?mgIQvuEVgVHV\e=MphMKkcKMuvVOiaQYxpO=vV=OVRBJRTO=T=U>ve\vF_W?HldHOWPGPUmFf\eTMmoOHogfgpgMVd\VMh`Y`g`HO`gM[en[vg`vojboTbZ|World Blitz 2015|Gelfand, Boris|2015.10.14|D30|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb?TnfTKk[>@wn=OulOPsdU_f_Ppyw<`luL]gapLtk]ndnLQapV_og`iwoKfnx:>ulfovoipop>NpyDLloCKxn?>n]NVrxGOow@AkdLT[TKT]lVnxpQilviNpxnjvpNnwsBJsCjlCGnFGcFncCT\e\ldxvnvpv>vypvnpwn>CL>;wpdbLMbjpi;@vx<`ld=OSnIQqi`WgmLRmcRcjcBJtbMbrb?>wvOPxyPNbrWingNvuv>vrviNgC:;CJ;cvfckyxklJCltxqHX]UNWCJtlqxltxqtlJn@Hd\QYfVHPoglmqxPOVfYaxwDLUL|64th ch-RUS|Galkin, Alexander|2011.08.13|C47y|1/2-1/2|B -FVl\@Osd?[me>@tmDLxg?>jb[Rk[RDn^IQwnEU\ULUvx;LrtU]dSD;bZO^e^]emdenun=FtsBJSbCSZSJSblFClf=urCLqi=]rRF[v[][xqLCne@Ie=[ZRZSZ=RCcRBZbflbjlrc\|World Cup|Timofeev,Arty|2009.11.26|B30|1-0|W -EUxgDTnf;LwS=Dm]BJSLDLgVLDl\U\sdFNuZFneIYmoAQphFNZkO=WGV^em=OGCOko_kdmldV_^SMCDM^D@m\DN\MN]tfFMVM=Ow\@Hdn]nvnPVftV\c\H@tkOPum:>nF>FMF?>rvIQvVPGmM@IqaGPMeXaogaiVnI@p`PGeMW`MQ|3rd ACP Blitz Prelim3|Grabuzova,T|2004.06.02|A01|0-1|B -EUm]DTld@OxgFNjb@rtD_ph_Qwp?=vxO^mcLFwvEZueU\t\^M\TFUqiHOgVQHV`CKpUNUTU:@Hfd=>v>jrdrOg]UGO>FH?UM\MFNM>rv>HNfgWvdl^[S^Ude?GbZHNeWPWfeNDedD>deGNe]>HxwNMwnMT]aUGneH>ed>DdeD>ed>MogM\a_\M_aGPa_P>_a>Ga_TU_aUVd[MC[dCTa]GUg_VMd[T^]e^oedoid@gVEUVe[dmdU^e_=uvu;L_nIQnh<`uv:=tmOUqi`hYLVvwV`n`W`YhCKwv^fmf=mt_\ts=mvt\txtmotDgUDBopBbUghYg^stpltulq|TCh-ESP CECLUB Final|Shirov, Alexei|2008.11.01|C67s|1-0|B -@Om]EUxgDT]TFNnf?TjbBRl\>@sd=Fwn?=ulU\vx;Ef^NVn\EK\jIQqiueWenelrkrDLe\LUdU>N[SHPbZKDg_CKr]?OF?HFOHPVUE`USmM`NSCNMVM>^CB^]Mh]eh_yrBJPWJOW^qirjoxjrxoebOGbjohrxGF^WFGW^GF^WFGWPGOPH_VjphaH@V_xwaYpo|Hotel Bali Stars|Mamedyarov,S|2003.11.29|D45|0-1|B -FVl\@OmeEU\UOUxg;Lpht\HX[SJSZSESur@sb=KbSLBSBKBqi`Wkc:Cs\`V_mjsSjZxq>Gqi`_h_Z_ih_ZSKZ[KJRZhgQYghYahi[_iq_WJZHXqiWgi`gh`WaiZBG>BIX`WN>?NO?>ON>=NMheMVemIaiqVW`h|World Blitz|Carlsen, Magnus|2009.11.18|D15|1-0|B -FVldEUm]V^t_@Onf?Fd\>@sdDL_h@wnEMk[RKmeBRtmDLvx?>dZKDl\;EZdE?wv<`qi`gng?NdnDKrsR[b[N]n]K]mf]fof=DsrDKum:Be]BrvrIQ\TKDmeMU^UV^UMD=ew^gwg=ErB>^p`E>xo>;Bj^>op;^c[@gVEUVe[dmdU^e_=uvu;LuvIQqa?=wnLVtmCKaY<`ruDTkc=EmtEuvu:=uv`Wd\^ftfWloglsjbsjnuVLvoLRc[R\ftT[b[BR[RKRyv=;p`jcunRZn\c\vf;c_p\Np_csfvsrtkrjvnN\nmZbkdjmdmOEofETmdTc_e\efebjeljr2drcrlkGW|FIDE World Cup 2011|Polgar, Judit|2011.09.03|C67w|1-0|B -FVn^@OxgO^me^OgVEUe]?Msd>@wnDTdSMFvx;Lt_BJVLCLSd?>wvvuvO`_hWele=Xqi`OvVXPVDOYhV:>e]T?DE>NrtIQE:UVkuwkVUV>VwvGOvVOVoh?TxwV^ho^fovRZwn@GneGNvdHPp`NUdkQY`YPYkdT]d]fn]d|16th Ciudad|Topalov, Veselin|2003.06.06|C42u|0-1|W -@OxgHPm]?Hnf>@wnEMl\;EsdFVvx?>k[BR[SV]g]ETtkIYrt<`qi`nunRZwuO^d^>^kb=Fnl^VSKDL]gVWg]WV]gVWbTWTgmMUlsZbs[H?[cU\m\TSclFNu]STle:Ztl@IecZ:ce:ZecZ:ce:Zec|SportAccord Blitz Men 2013|Wang, Hao|2013.12.15|A08|1/2-1/2|B -FVn^@Osd?[xgEMw\DLvx>@me;Ejb[R\jIQdnMUnh?>k[RDtkE?wv?Pe]V]^U>vuvOUg]k[RKfKBKbZE][S][wu[RngN`g`O`rs`OqiLTxw=]srIQdn]ZrZRZl\>=ndZcwnnm>N_hHPmlQYh_:=srE>rB=;Br>?p`?Hlm;=rBNM`XMemlO@_VHIV_=EBCeidUENUf@F_DN^lk^]kligfugeDFemlc]e|15th ETC|Kritz,L|2005.08.03|C42|1-0|W -DTn^;Lxg@OsdHPm]T]g]?H]c>@wnEMvxvtJRl\Sctuc\umCSphIYqaS[b[\[ml>vsv[vxpvslnRZn^sl^_GW_[HO[KOVK[VO[KlTK;OV;CV]CHTlHC]eCKempwltwptlKMlkMJkSJ:mvUMSE:REMRZMKZjKSjlSwpqwelnengnvnqpnvpxvnxpnvpxvmxwmuwxuvxpvnpxngxwW_h_g_wn_`nf`af_ai_XYaXPipo_ai_WiqWOqy2PHyr|World Blitz 2015|Tomashevsky, Evgeny|2015.10.14|A29|1-0|B -EUxgDTph;Lwp<`vx@OmeFNsm?Fld=DjbBRuZ>@n^CSZSRZ^UNUe]T\m\`gt_LBSZD\Z\U\pg:=wvFM_M=MvFB:;@?kc?Fc\M\xw>MwnIYneFN;=HPqa\kelk\ogMWh`Y`g`\flef`d\NF=A`oeno^ne^oeno^]UFMne^OA@phEU\U=Uwp;Lme?=sm@vx=F_hO^sm^hqh?=uZFDwvLBSwNVd\V^g]T[vu<`wn`n]n[mumU\m]CSZlBL]=:=jZL[l^SZrZHPn][eZjDK^LK[]g[cLZcZjZekZR=uxq\dg]keRjIYoge[j:@H:<[eh`Ya]neonxuef^HOxneunxutphtlhalmqhdlh_ou@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphCKld<`wp=Eun:=nwP?qi`Yrt?I^ULUd\V^g]^fvf>fofDh\UOU]WYPWhUfwgfpxpIXg`EemweUpoQY`a=>tdUjaXjkXmkria@Ihn>NwhNOdgOgogrbgpBR[RKRn_b[m[R[_PIPpg[ch^ck^mPWghGOhgHXghWNaXOXhgNUgfYafgU]g`]emselsblt||Sasikiran, Krishnan|2004.05.09|C95|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMmeBJum;EwvDLnwE?qiOIe]=OdZKB]VMVZT=>le>=xo=U[^@?^]U]d]<`ohQYhaGQ]o`nPYneYu?Fp`QGahHXuce^bZG=_W^Ucl=GofFOf]OF]HFEhoEDH]DEluEDofDEfmEDmdDEd[E<[Rd]>?]^?@^gGVgh@GfXVEXfGOh_JRf]OG_XE?X`?E`_GF_XFG|WCh 2016|Carlsen,M|2016.11.15|C88|1/2-1/2|W -FVl\@OnfEU\UOUsd;LjbUdkd?Mul=FtkV^d\>@m]^eweMVxgVklk<`kC`gpgLVe^:;CBGW^U@AvxW_xyFOB]DLU^ONwx_fof;CxXVgrwCE]TE=XW?W^WNVTVgVbZHPW^=:wr:R\TAHypHOphIQqaPXaYOF^pFGrwGFwrFGrw|6th Tal Memorial|Ivanchuk, Vassily|2011.11.25|B46d|1/2-1/2|W -FVmeEUxg;LphGWwp@Ol\?[tmV^gX^fm[fovmL[uZ[L\UOUqaIQpU=UXg@qoBJZ_CSrwS[dZNjZTEM_MDMTC?OwrjUCRUgogLVg_:?R\V\e\?;rROP_gP`kcW_h_`ame@GgoayelyilkidogdgngGFklFE_WEDWOHORYDEYQENQYOWg_;go>?EU|UKR Ch U12|Maletskij, Igor|2000|B09w|1-0|W -EUm]DTnf;Ll\T]\U=RtmRUf]U]sdBJxg]=w\FNun@Ovt=Dp`?F`XOEtsCS\cETcl?smPavt=Oog^gpgHPf^apuxp_df_NhnLT^VOFg_ES_WPWn_T]fh?>_UFTUO>=yYAYh@T?OY?@x@S>YO=FOUFEmg:=UOEFgaN_aWFNWHNVH>]e>D_ntmelmln]lk=@O@GWDJW_@Q_gQ`V_`qgoJT_hTehqeoqhoehgkdg^d\]WeT^VjZVMc[ML[SLK\[KDZRWfT^fl[TlrSKDCTSC;RJrc^O;:KC:BOE|2. ACP World Rapid Cup|Grischuk, Alexander|2008.01.07|C16|0-1|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvBRnwDMldCSmcR[b[:rkrEKqiU^e^=Dul@sd?=wnD_]gFVph_WvxV^gaWidUOUkH@H\U=Uul;Ll^Um^fm=ru=uwuiNapNfpf@ld=Dsm?=kcCKtbBRd\RZ]TKTut;LbTE`c[O^\U^dn\`gmgL[T[D\[dHdtl=UruUTgmdml\T\um:yu>=g_GO_XOX]`PY`XYutuMNc]Nf]gDLgaU]d\]eaWfVumVnmuem|It|Itkis,B|2001.08.03|B19|1-0|W -FVl\@OmeEU\UOUxg;Ljb@p^CSZJ=Xog?;tsS[b[;[umXTdj[KJ\T\e\P^g^LTyw]N^VIQwgBRjdKcdURZgcZcme:Zed@IUKZ[KU[CdgHXnf_fgfN]stCBtmBjmdjrUOIPO^rtde]N^mtxmcx`fgQYgOPHcmYam^ai^M`_MW_WOWN_efiqWXHQf_qy2X`yw_fwvf_vo_^on^Wng`_ge|It (active)|Delchev, Aleksander|2005.11.19|B90|1-0|B -FVnfEUm];LwSV^xnBJSLCLkc=XnhIYqaXPtb?bsb<`umJRl\@FrtPMbs>@sdFPhn?=\ULUdSMEtTDLSd:Jn_P_f_EWmfWOvm=;dZ;[mdJ:jb[Sdk`nphn\TS\SZTRZc[OWyt:BtdWifv@IvuHPumi`dfGOmvBHkt`iog^gfgipgfpjvdHGTNjodmowmvwp_WPWvmpxtkxwN_LTmlT]lWI@WPGHf>S>P>@I>YI@Y>@I|TCh-ESP Honor Gp2|Bauer, Christian|2006.09.17|C16o|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vxjlTKqa>YlpHQpXYXaXQHUNHPypBRNEKTphT[VNIQE>PHXQ|2. Governor's Cup|Areshchenko, Alexander|2001.11.19|B92|1/2-1/2|W -FVl\@OsdEU\UOUphUdkd;Lwp@tfE`]U`gpgLVgnCKo_VErt?>ngEO^VOEul;Fwv<;UMDMVMFfvfETZuGWuU@A`g=EfFE=tv=@ME|Keres Mem Open|Zaitsenkov,Aleksei|2001.07.25|B34|0-1|B -@OxgDTkcHPl\?Htk>@ph;LwpEU\UOUkH@HutCKtkGOm]T]g]L]k]f]rtaitxiaxt|FIDE World Cup 2013|Eljanov, Pavel|2013.08.18|A30f|1/2-1/2|B -FVl\@OmeDLxg?Fph>@wpF[sm?>jb[?vxEUn^BRkc;JtkU]ul<`qi`ExqCSgx=;rsRZcZS[sr:Bo_[bkb?brbJ[lu;MmgV_^V_hqy>VgVMVumLTZRELpL[LmpLFxgVDgaFPaWOYpnDLngPVgLVLypL[WhYOwo@?pqBJqpHPpw?FwvOEvuGWokEVkcIYhnVLcsFOsrPXumLVrwYanxVLxgLRmu[LwxJKulKCxXCFXYFfgaL[lmR\e\fbYWONWTbiaWiqmu]eW]NM|WY ol|Jones, Gawain C B|2002.08.21|B50|1/2-1/2|B -EUnfDTl\@OxgU]me;Lf]T]phFVjbIQk[?Mwp>@vxBJsmgaWIm^MF^OFOagV^gm^elu>vuv=Ep^<>ogOXvwXm^I@IweI@tmLVewELxpVg[SJS\SLU|ClubCh-EST|Kanep, Meelis|2002.03.09|A70|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLmeIQdZKDl\EUgmBRrsR[b[CK^ULUZd;LdSD;wv:vr:rkrP_rkELh^LPph_ixpi_pw_N\TPYcUYuwpueTKDK^MKDM>el>DlD[SDTUCHPSK@HC;TLpxNX;VHIVDL^KCXgxwgqwxqgxwgqwxqgxwgmwx^vxqvoqiowi`wW|World Blitz Final|Ivanchuk, Vassily|2012.07.09|C96|1-0|B -FVnfEUm];LwSV^kcBJSLCLumJRtb?bsb@Ol\=M\TMFxn>@bsHPsdOYvx_nDLnx;Cxg>;qxckmvOEokCkts\esk;kvmkrxqe\dnr:n_:;phIQia;sgVEV]VPXaXQX_NHPN]\eqpe^posy]Lypovpxvnxhmvhqvo^gnvqyvmyumdutd[t\[b\TL[TdbZguZSd\SR\TRJT[|?|Gontcharov, Vladislav|2004.03.06|C16h|1-0|W -EUxgDTnf@Ol\U]f]T]we;LvxHPel?Hme>@jbBRwvOEsmETrs@G>^ltxotuonuMnoML^]GNonL\]=WU=AS[d[\lnwlkA>NE>^Uu[vkswosrv[rj^nurnjrjoxjk[?ENxqNUqikciqU]?M]fqxceMTfnT[e][T]\TMnfMF\txqfoFMt\qioniq\]MT]UT[Ueqxeuxqnwqiue[TeEp`_hihEGg_wnT]ne]Ve^|Sportaccord WMG Blindfold|Kamsky, Gata|2011.12.15|A60|1-0|B -FVl\@OmeEU\UOUxg;Ljb<`nfGWsm=Ful>sd]de]<;rjW_wpFGnu=]lcGEjn>=yvHOulX`cdBJdcJStkELnN`gpyLTk]O]N>=>v>;Bc[TKbZ|TCh-RUS|Jobava,Ba|2007.05.03|B96|0-1|B -EUm]DT]T@OxgFNnf?Tjb>@l\CKsmPQ>ZOXZLXPLDQYDVPh|UKR Summer Youth Games|Gordenko, Dmitry|2002.05.18|D27|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxEUtXU]dZKDut;EldCSZk]dtdN\Jr]yq@HJn^OngLT[T]TbZU]_;]ZgWTfWSZ^SRBJRWf]WXH?XQ?FQt]V;V^Vt@wnEMk[RKmeBR[S;Evx?>dZKBl\DLrsMU\ULUulEKZKBKtX<`^U=UXOHOga:NMCRZ^VNVCMbdsrZbqaX`wtdtrt`h|20. Amber Rapid|Carlsen, Magnus|2011.03.18|C84|1-0|B -EUm]DTld;Lxg@Onf<`qi`gugHPsm?H]T>@wnBRjZLVg_VEf^FV_fU]d]V]f]?>]fOUfgU[vx[lrsl]gfETn\=Dkc]WfgW]g`@Atk:=xyIY`aAI\U]W^W=UWPGPmgHQwvU=kO=<>Xf>^\dCFst^Vd\FE\_EW_QI@f]WXQXVX]TKTtuXVuM@GMLYayxVvxqvsLTscTRckRXkoX`oj`aPXa`GOqhOWhgjrgfrufnurnertemtT`[WPp`TUmdUM[]MOZROgd[giRJiy[R|6th EICC|Halkias,S|2005.06.19|D43|0-1|B -EUm]@OxgHPld?HtX>@nf;Esm?>wnDLjZBRX_OYvxY_f_=DphEKne<`usLTgV`iwvT]d]DM_WFNWPIPmgiWeWNWseKEruHV]VEVgV>VvVMVeS:@wnBRsdpXVOf^bf^V>VvfOXaXVXfhXVw\UOxpVT\eOUpoUdhiIYePAHPYdSYnSMicMWcSTSnSHOSEDTonOVneWME`KSqaS[aYT\elMW`nW]|UKR Summer Youth Games|Luzhinsky, Vitaly|2002.05.19|B85|1-0|W -FVl\@OsdEU\UOUxg;Lme?TucUdkd>@phtfV^g]L]f]ULe^L^p^>^ZRKRsSRKSW=FWGFGl^DL]KBKwuIQuM:>^eKSn^Gc^VS[ePc@d[>VMEVNPeCKe]LT[TKT]TNvxp@:pi:>TWvVW`>Y`YVYipYRpgAIqiIPECPOCKOGg`RX`_XRKCGOCKOGogRZ_WHPWVZRV]Rb|2. Governor's Cup|Miroshnichenko, Evgenij|2001.11.19|B57|1/2-1/2|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;L_nLVqi?=uvOUnhGWhYCKtX=>d\U[vmDTmd@GwnIQXmHXiaW_aXQXY_X_yIG@ryVPIQvQIG>IA>EyIELIQLC|11th Karpov|Naiditsch,A|2010.06.03|C67|1-0|W -EUm]DTld@Oxg;LjbBRnf<`smT]d]FNqi`Ywe?Mkc>@tk:usYPePIPse=Kwt@tX;Egm@Aog=>mwOYwfEK\eGOXaY_d\DLumPmoOWtTUTfT?>T[IQ[dW_rvV^o]AIg^e^]o>NvnPWov_gnfNPph^LvoQYxwPMfVMuVvuUwxW`xyUWvFWXolI@lo`\Fv\eqaX`yqeWvVWPVFPMFVMPVFPMFVMQVF`PdmQIm_PO_VOGFG@GomIsm_GN_f|Piterenka Blitz 2012|Grischuk, Alexander|2012.12.29|C77|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBR[SEUmeU^e^;En\RZqiIQue=FgaETegTNaWFTWH@HtQHQgOQIdU>?OaIHaOHI\eDLOaIHaOHIOaIHaO|Baku FIDE Grand Prix 2014|Svidler, Peter|2014.10.13|C88k|1/2-1/2|W -EUxgDTnf@OkcHPtb=Rbk?Hl\U\c\>@wn;Lvx?=uc@n^]fofvx>MkcN`ndL]qi`Ers:;muGOxq@Ah`MGwoGXokXNum=>c[T[k[;[s[EL[sIQmkQYkoY`oaA@i`NXqhLUdU>ZaYZbsc]cjcbchqcC\TCGTL?@k[RKw\DLmeEU\cV_OY_`E`g`Y_ah_nxpn]ws:=pwHXl\QY`YGWo_X`ho]g\T@Hsugqwpqg[S>nTLCLSLgmcZ`hphHQumnmZSQYoB=eSemehoedbZdLZRLdonYPnmdbBKPGmlG>lkbikl>ERJELJBLClmibKTbZTfZjmdjbdmCLmlLUlkbJkcU^fT^_c\_h\SJBTB|Tal Memorial|Shirov, Alexei|2010.11.08|C78k|1/2-1/2|W -EUxgDTnf@OkcHPtb=Ksd;EdZKLl\U\c\FVbkV^gVEVkV?HZd>@rsCKwnJ\>;on;V\SX_S\_hnuVrulKS\Srjltjpewp:wO:b|Tashkent FIDE GP 2014|Vachier-Lagrave, Maxime|2014.10.24|E15d|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb<`smGWk[?Mtk=Onf>UF>FyaFNf^NLtsLlkO@]V?ogF[rtOEVE>EvuE>xo[dtdGfB<\t\G\jb@GB;\S;BS\B;\S;BS\|68th ch-RUS 2015|Khairullin, Ildar|2015.08.14|E34|1/2-1/2|B -EUm]DT]T@OjbFNk[BRtkCKnfKT[T?Txg;Esm:;rj>@l\tk>;kt;>tk>;|65th ch-RUS|Dubov, Daniil|2012.08.05|D22b|1/2-1/2|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;Lwn?=uvLFtmIQru<`n`O`qi`Vvn@Ip`V\mtCSu]=]d]S[ia:=kc\MtkDLjbBRb[R[yrMSnf=>f^FP^gP_g_>n]Uno_^olkVln^_LUrRn^_WS]V]^]aY]eRSecSUcsW^[c|GMB|Jonkman,H|2003.01.14|C67|1-0|W -FVnfEUm];LxgV^gmGWl\@OsdGbZ:@wn?>k[RKvxIQmeDLdZKDl\EUgmCK^ULUZd;LngN[SLFtfeYaha;qRLT\e\qxLB>^\c^aB@wnDLvxEUe]V^gmIYjZ<`kcFNtb?`gL]gp>OaY]ndnV^YQ_gpw^enxfnwvef|AZE vs World Rapid|Radjabov,T|2009.05.08|C00|1-0|W -DTn^;Lsd@OxgHPdU?HUOHOwS=Kun>@vxEMld<`SLKLmeCSqi`gngS[d\OHgnFNtXGWo_:>p`NV`WPW^W?Wn`LErv>?_VWwvwE`i`HVw?@?kc?GxpGNXfVOpgNVf_VNg^O]_m]omto]tQBJQm]omto]tQ]OQfOFe]F?fX?HXfH?fo?FofF?fX?H]UNGX_H?^W?F_hF?hq?Fq_F?_t?Hjb[btbHdbtdVtXVqXaqVa=VqWXqV=KVdXWdOKROVRmV]m_GFWX]HXYFEYXEFXWHdW^dO^eFEelOHlsHdsjdvjbEFbZvd_hdmhqmvq_vdZbdvbkv[kl[vlevae^aO^WOdWXdHXYFE_XE>X_>E_QHV`XEFXPIPYPFEPWVdW^dv^ev[elEFQXFEXmEDm[T[leJRe]DE\TMT]TRZT[Zc[cEMc\ME\TEDUMDETUE=UN=>ME>=NM|16th Ciudad|Topalov, Veselin|2003.06.06|A29|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb]O_gqg`gmgNU^UEGlWKEgXGOWOEOXN=EvwOUn`UO`W<;|Corus A|Dominguez Perez, Leinier|2010.01.17|B90n|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=EcCUKCJ`gpg?Fsd>@tm@ArtFawp?Ovx:?xyOQdnV^e]LV]VEmg_mkn]KUJSkS]SDLS]UFogHXg^X_f_W^p^ahtl?_w_h_VN_M^LMbLEBR]LFLlLAHLJQYypbFqiHOJ:YXpg|GpA|Kosteniuk, Alexandra|2006.10.28|B97|1/2-1/2|B -FVphEUwp;LmeGWjb@Ok[?MtkV^nf>@xnMVkVLVe]V\sm\MvxrvO^g^W^n`>=woFE`E=Evw?:bZHX_n@HxpGNntBR[R:RtcR:ZREFwrNEqiIYpqESiaHPaXPXo_CKRK:rKCMCcrCMmsMWsdS\duF>rc\clc>;udDL|ISYG-M14|Chadaev,N|2002.06.23|B06|1-0|W -DTn^;Lxg@OsdHPm]T]g]?H]c>@wnBJvxCStfEMjZS[dU2L>v>]L|20. Amber Rapid|Giri, Anish|2011.03.20|A29|1-0|B -FVl\@OmeEU\UOUxg;LjbIQnfHXe]V]g]UFwS?Hvx>@]LFLsd=uwuLRf^DLSnRcrsctst@mtPVn_JRsrFO_Yd]>FxyVg]\F>ud>=jZgV\]Veo_=;dSMPUMDMLD;@smT]f]IQXaEMxg;Lwn=Km\KDvxOU\frtNGk[CKuZHOZbIHo]PXbkGPxy>NmcDG\TGFTLFD[S=>]dNFkmW_tuFNc]NF]lBRSJPlmlDLlcX`wSL:cU:UuU>@gVMVmg<`\UOUwnVOvx=Muc:=wu`NcZM[Zl[KjbU_u=_nln?=qiDTf^KctXOXgXN\nfckrtCS^VIQX^kV^TVfof=UTJUmJDmjtdBRf^RZxqjkDUkcdtcbUK\NtsbcsrZbK:S[:DN\|4th ACP World Rapid Cup|Drozdovskij,Y|2010.05.27|C10|1-0|W -@Om]HPld?Ht_>@nfEMxgOY_hYhqh;EsmFVul=FwnGW]VMVf^ETvt@m]V]d]<`ldLRqi`YwvDLSeCSjZBJtbMbrb=MbrMOp`YPgV?=ewR\w\S\unLT]TPenfIQru=>TLOafgelgG@IuE>@Em@?G\?omoahxw:>oghq\]qy]x|ISYG-M14|Mamedov,Rau|2002.06.21|C47|0-1|B -FVl\@OmeEU\UOUxg;Lnf@gX:=XNToxyONucNcjcoTtX?wrw=?n\@Aw?T?\UIQULQX|TCh-ESP Honor Gp2|Timofeev, Artyom|2006.09.14|B82|1/2-1/2|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;L_nIQqi?>nhLVtmNiaNPmdPhrvDTjbGOaY@Gqa=>aq^gc[hXqmXYvwgL[SL^bZYimMifwo>FZRQYM=Ya=Aaidmfho_^pmdhfAIG@IYfn_`F^`h@GRJCJYIGNhHJS\SNWIYW_Ya_gaQ^`QOghHIiqOQqy2QypyIy`PyYnpYTPKkcKCdVhgl\g^TDCDVD^eD;pl;Bl\SK|RUS-UKR Blitz g/3|Kobalia, Mikhail|2003.12.14|C67|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`sm?TuZ=Enf>@m^TK^dUdkdGWqi`YZaYPwnV^e^W^n\@AgmKRtk:=ruLVvxV\m\Euwu=uxquU\RURd\RWaFWGFVGEqh?>VdIQia>Nd[CK[?AIaYEGYPNP|UKR Ch U12|Savinov, Vladimir|2000|B94i|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUul;E\ULUtkU]ktCKtm:;wtDMphE?ga@sdBJSnFVdZZKNWskIQK\]fofO^kcWNceGWtkNGe=>=vr=UwuUuru^XgXFXumQY\MHQktGNMCYaCMainwLFl\V^[SJS\SFUSKXFmkipkp@IKCUftfQfxyFDpkD;M>IQkHQXHFX`wn|FIDE World Cup 2015|Onischuk, Alexander|2015.09.16|E20|0-1|B -FVn^@Osd?[jb[Rxg>@gVEUk[RKm]U^tf;EwnDLvxKDo_EKumKUdUOUl\UfmfGOV`BRph@A\TCSbZSZrZ<`n`OW`nR[Z[DR[C=Uwt?=t\:;C;=;\ZR=fbIQxp=OZ:;:b:AI:ZO]n\UT\GTFZ\LTG@IA@NHP\JAHqaQYN\FDpwD;JS;Dwn]OS>DK>SKMSCHQ\UOHnwT\|Corus A|Sokolov,Iv|2006.01.27|C83|1-0|W -FVn^?TxgEMld@Om]TKwSDLSe<`]VMVvx>@unOYsb;Eb\=O\KBKelY_nf`igVOXphEVf_X_t_Vgxyiwrw:jws?=^VgmsujklWIQVN@?yp=Uh`m^uw^d|12th Karpov Int|Efimenko,Z|2011.10.12|C24|1-0|W -FVl\@OmeEU\UOUxg;Ljb@wnEMvx;El\FVsd?>k[V]g]EVtkDLjbBR[S<`og`Ef^:H?LFTF|FIDE World Cup 2015|Svidler, Peter|2015.10.01|A08|1-0|B -@OxgHPm]?Hnf>@wnEMvx;El\FVsd?>k[DLjZIYtbV^gmE?[S?IZRBJSLCLrsIXsKLTmc<`]TOEKMHdn`Y`ME=VUC<>TL@HbM>Ac]VRM_:?_Xd]f]RX]UXWCk|SportAccord Rapid Men 2012|Leko, Peter|2012.12.14|A08|0-1|W -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[?Ftk>@smO^wp^mgmPepwewvwV^ucGWruFa`X=XyxXYcU?Gm\LFUEFPEUPFUEFPEU|15. ETC|Pantsulaia, Levan|2005.08.05|D43|1/2-1/2|B -FVl\@Osd;Ln^?TwnEMme>@jbBJk[TBrjL]tfCSxgO`um`fof]gng@l\U]rsIQblBRjbRZnf]fofV^gaO`\TMTe^=uwuW^p^LV^U@AtmHXmdXaqiTMi`<`u]QYhaAIUCVgxyg]l]:;C^IQyp;>^eDT]S`gpiMVdm?@f^QImX@?Sd>;dU;cUdg`ip?gelc;swghpy;kdUkl|VI World Blitz|Kramnik,V|2010.11.17|B09|1-0|W -EUxgDTnf;LwS@Okc@m]T]g]=DsmL]k]O`ph:=]H@H\n`VutDtwtE`m\`n\VGOtlnultuYV\=Exp?=f^Ee\fefof=mpxYgtDmpxwpqDFHQ^VQXVOXOFDOXD\qywoyrogrj\DCSDT|FIDE World Cup 2015|Mamedyarov, Shakriyar|2015.09.25|E21|1/2-1/2|B -FVldEUm]V^t_@Onf?Fxn>@_h;En_EKsmd\K\m\U\n\F[vwIQix>M\cESxnM\c\S\wxDTqaX`jb[RrtCSkc\Nn_NEtT:YX?@UO|SportAccord Blitz Men 2013|Mamedyarov, Shakhriyar|2013.12.15|B12|0-1|W -EUm]DTld;LxgFNjb?M]TMTnf@Od\>@k[TFtkU\sdOEw\EVgVLV\nCKdSFOvxFjZFNsbNW_hIYqa^fk[TFblWNlfUewtP^f\HX\MGWog^gpgXahqA@xyegMCaitl@plpipypgd[SdlpildipYaCMFXrwLSMSaipyd\SM\twtXtMSW_SBNVZRVMBSMLS]LCq_t_]giqgq_qyqCJqiJR|Sportaccord WMG Blindfold|Wang, Yue|2011.12.15|C43|1/2-1/2|W -FVl\@OmeEU\U=Usd?[tm[dmd;Lxg<`nfUMwnOUvx>@vx?>meBRdZTBl\;EZdE?tfDLfB:Be]<`]U?PgmIYwvP_og`ExyYanwOY\TMTm\LUdUEN\M>?MSBJUDJKu=?=vu=EjZ@?DN|67. Blitz 2013|Eliseev, Urii|2013.09.01|C55|0-1|B -FVl\@OmeEU\UOUxg;LjbGOnfeI>FIYM[vnZdngFHp`:?gpd^Vg[\YV?gyrghpqhiqi^oihH`ho\GVOGO]OLTrtCLOFT\F[`@f^@=tv=>ogLEvu|Human vs Computer|FRITZ|2004.10.09|B80|0-1|W -FVnfEUm];L]VLVtm@OmdVExg?MweETsm>@vxDLkc?>qiBRdkRZjbTeleZcuc=FcdF?wv:xqS[bZLT]WPWhWHPWM?MvtJRlc@Hph:>tvRBvnOWrtBFtvIQqpHIpoMLvtQYc[U]tT]fnfLyfF>FTVyqogqygfyxfmxomuowumwomuowum|Keres Mem Open|Fomina, Tatyana|2001.07.30|C10|1/2-1/2|W -FVl\@OnfEU\UOUsd;Lul@meGWdUNUf^UN^W?Wtf@AjbFMgmNUm^=aphailuIYngWgug:?gpi`og`PrvLFh`ULpiFUiYPY`YLSfT?=TMDMvtA@^dUdtd@GdDGOg_V^e^Swxw=>D\CS\]ONwp>@meIQwv[Rk[;EtfRDqi?>\cE?e]]eGPeUpxCK><;@wvO^bkEqaHQgXMWphQXaX=XmgX`enWhoh`hxyR\c\U\vwhiyxihxyhiyx|FIDE Candidates 2016|Giri, Anish|2016.03.13|E15o|1/2-1/2|B -FVldEUm]V^t_@Onf?Fd\@phIQXOUOwpNWul?>vxF?rtDLdZ?MZT=FjbQYqi:VwuGWlTBJumEGhn<>TMPYn_U_f_VUmUGUMDUmtT^fTWfnWXYGXWmjWVnv2Vv>v|Sportaccord WMG Rapid|Le Quang Liem|2011.12.09|B12|1-0|W -EUm]DTld@OxgFNjb;Lk[CKtX@weM_mgEUvx:@vx@AsdGOtfL]bZ@ulDTxg;LmeGWsmnw?OphOQwpXYmwL=rsCKe]V^tk=GvuGX]TXgpg`gldM?|UKR Summer Youth Games|Grekh, Andrey|2002.05.17|B42f|1-0|W -FVl\@OnfEU\UOUjb?Mw\UK\n@vxmcBR[SL]g]V]bZDLcTLSTE=EZSEStmRZul>@phDLjb[Rwp?>vxEMmeIQo_CSqi;ExqvwvBJmo=DqxU]yCDCd^O^h^CFvnmg=vuUmcmFTyqTfulfmgm=@rtJR]TKTul@wpDLxg?>vxIQn^EU\ULUdUOU^UV^gv=Ume;Lt_USjZSRp^=bT?TcT=DjZCKTcaWyv]SDEZR>=S]HPewNUme:;d\UCrsC:s[=>v>M>\T>DTKBKl\DJ[K;KRKJT]gTZgXGOXIEFwp:popZKpgFG\TKEe]GHTLEKIOHOLDONg`NE`XEDXPDEqaKUaYU_PX_YXYEN]UNU|41st Olympiad Open 2014|Hracek, Zbynek|2014.08.09|C45k|1/2-1/2|B -@OxgDTkcHPl\?Htk>@ph;LwpEU\U=Ume?=sm@rs?@sd?>k[T?rsN`gX`=e\N\l\@Agw=?VNXF\c?>wvFMc\:JNFJ:SUMOtb_g\]OGU=:=F=2go]oGoxo>=qaIYph=]vNAIbFPF|38th Olympiad|Nakamura, Hikaru|2008.11.25|B90k|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMmeBJdZKBl\;EZdE?ktDLtfBfofCSe]V]u]=FwuO^]^F^d^>^uM^fxofNruJR\SLSnSR[b[:;M=NKg]<`=;K;us?N]N;SNT@?of?Ff]FMqi`NTNGN]\SXskQY[SMDSKDC\]Ya]^Xh^_HP_VPXVNX`i`h`NV`hV_ClcUK[SL;wn;EclOQf^ETvxKZktQPwv<;rs>?^W`Ws[WeneTe[Z?gmgevlPvgpgIPZ`MFxp=MbZMN`^PX^`BJtXFX`XJSZSHPph;Bg_V_h_BKqaNO_fKRo_R[f^|World Cup|Shirov, Alexei|2007.12.09|B96l|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>meDLtXIQXaEMum;Ep`E?`XQXaX?Nyx@?qaMUk[RK^ULUgVN]o_]nvnKxrx=KmvU]XOKOdU>V_VOVnmVUxXUNvxNfxf]fmfchJBmlHPlcOWhf>Gc[BDfVD\[S\]Vv]aSKaZvfGUfhZ`heW_bZ_gZR`[KBgoeu[_|Hotel Bali Stars|Graf,A|2003.11.27|C87|1-0|W -EUxgDTnf@Om];Ll\T]\U=Uf]FVsd?[]VUuvuO`tf>@wSLVgV`VunngCKaY@GsSDEjZIQur>NS[\R[kRLruNVkSVT]TEuT[urZRLR[RrRd\RZSUGNU]ZRgfOWogRTfeNF]_BR`WFG_]TW]EG@E=W?=M?ge^gOM=@I=;OL^]RZ;:HP:BI@YPLPBZQY]V@HVWHQZ:PL:;QH;CH?WX?>XY>=Y`=@tm:;wtCSRKBKZu@jb?=k[TFulNVf^HPwvBJ^UOUe^FOd\UF\TL]g]V]^e@xy=Fo_]nunV_t_@A_XT]dSDTS]T]noFVXOVOoOHOwOAHrw:>k[>NONEN^VCpyp?=pgGWVOHOg^OF^VKS\T=UV^UYwoYUo_IY_wBJw_U=qi=Uh`JRjbR[b[Ya^gU=`X=Ug`NV_wFN`aV^e^UVXPV^aX^nwgnfPH|EST Ch sf|Parnits, Rauno|1999.03.14|B20|0-1|B -EUxg<\c<;m\ENtm[eog?Mg^W^qiA>mvevsvM?woDLvw?M\RNcRcCKjb;Ncm=Ep`IQxp<=k[MFm\=>wtOUpoFOdULU\VOV]V>Ft@me<`qi`Yp`YPgaMU\c;JaPIP^U[dkdOUugJTtbTcjc?>d\U_bt_Ntf>?gh=MxyGW`WPWo_V_f_N_w_?GhoMQ_gBJrvW_op:?p`GOvx?>xp>fe]fg`gONyqNfg`QO`<@I<`_gpoOMqxMPomPQxof>me>nogn>`WI@gp>npgnNgpNPpqPOW^Ooqho?egQXhoXmoh?=ldmu^fucfN@ANGcl]ULU\Ul^gW^fhaf^ah^fhqfmqxmuxp|6. World Blitz|Vachier-Lagrave, Maxime|2010.11.17|C65|1/2-1/2|B -EUxgDTnf@Om]<`qi`gug;EwnBJl\FV\UT]f]V]vxEVgW=Uwv?FnJ:JvVUEsmEWVW>@WSCKmg?=t_OU_V]ejbFOruOVgVU_S[GOVL_nxw=MLF@GF@wn?>vxDLd]LT]O=OldVc[VXnwJR[\@Iu]GW]=Xpwpa=p^W^\^IAxpCSZS=XpgXS^:AI:^HP^FI@F=@G=DGND@k[F=_M?>ghOYhq=FMDHPdnFOp`YHDVOV]VBRjbR[b[;SE;slsDEs;E>;D>?]S|Tal Memorial Blitz|Kamsky, Gata|2008.08.29|D02|1-0|B -FVl\@Osd;Lph?[dU[Rwp>@nfOU\ULFxnEMvxGWkc=>meRKndFPwvW_d^>Gum_gpyGUtkIQmuUGrt<`^m:>t\QYqi`iygMU\Zi`g`GoxyY`Z`>NunPFno?oktFWmwNL`XLltm|67. Blitz 2013|Belous, Vladimir|2013.09.01|B31|1-0|W -EUxgDTnf@OkcHPtb;Em]?Hwn>@vxO^l\U\ulEOc\T]g]=Dsd^dld<`og`Edc?>wuBJrs:;nwIYcKDV]cELbkVXf^OEKoHkskE?cT>=usXVTeVDohDhqh?ExoFNe[LZ[e;@wp:tmNVkcM^rt^mgmV^d\U]f]K]mwDVwfBRiaHPpi<=xpOYfU]Ti`YHnmIY`iCKmX=MiEVXaX>VUO@AuMTMtuMFuUVU\UHWEWPWjZAHOEFXEKW_h_X_K\HOpi_DiaOPUMD=ahPWc[R[ZR=R\RWNRL[cL]NM]cMVcmYahpV_m\aipi|NH Chess Tournament|Beliavsky, Alexander G.|2007.08.26|D43x|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxEUtXNvrE>YaNV]V>VrvQXaoVOoT:?Tl@HlTX`bZ_gpg`gxwOXvFH@TxXxwxSZFB?_BZ@GZJ_\xo\dJKGF[SLTKQFESKdcohT\KCEDQIDL|5th-8th|Naiditsch, Arkadij|2004.07.29|C91d|1-0|B -EUxgDTnf;LwS<`qi`Yvx=DmeFNsm@Okc?Ftk>@SLDLp`YPgVLDo_OEVPIP`XNVu`U]_W]fm^PWwWHPWg?>gfCSl\BJrwDLfg>?ia@H^hLN`NGNg?F?xp?Fpi:=i`=@h^@=wg=@go@=^mFMogMFm^=@kt@=tf=@fx@=gw=@xf@=`h=@wtS[tr@;hgHGjb[brb;KgnG>nm>=ml=>bRKLRr>GrwGHfmLKwrKLmdHG^mGHmgFMrvHGdVEVgVMVvVL@ph@k[RKw\DLmeBRrsEU\c;JvxR[b[J[tXKD^U[UdULUXOHOga:RugV^e^U^g^OW^\CS\dS[dLDqxq=aqxRJLDJQDhahohQPxq?=w_@wn?>k[RKvxDLm]V]g]O^d^>^ldEUne^>uYHPYQ>Vp`=Fo_K]d]Vf_WfetXF?Q?@?rv@_hBRxnRZn_DT]TFTkcZcmcTMwn;LvxHX_YOYhM=MnYMVYnGWd\U\n\@Hwv?OuYOPvu:ZrtZjc]jk]LCLu=@vxLBwsBSs[?=mwU^gmSMm^M^l^Q?wf@wpKZrsZkskR[b[GWm]W_h_;L_VL]ld=XpU@SeNV]TMTf^E`k[TFqi`Ywv:wv>vrvGWphCSxwluM[UMbkp^W^YV>FZEFEjZKLwtL\[S;MZR\ZSKBKRKZjtujkurkmrBELA>LKBGmn>NKTGEM;EC]exw;MCEM?NJTSJ:?T:fgEGgh|2nd Norway Chess 2014|Grischuk, Alexander|2014.06.07|D85x|1-0|W -FVl\=axgaYsdDLm]EMn^<`wn;Eqi@Ovx`igVYaphiwuwMVhaV]duO^ng^Own?Ft_>?kcETukIQkeTNrvHXaXQX_h:>eVF[vu[dne?HeWN?WX?PVPGPhVA?g^>VXV?>VD|Karjakin-Nakamura m|Nakamura, Hikaru|2005.04.29|B20|0-1|B -FVl\@OsdEU\UOUn^U[me;Ljb[JwnJTk[TNxgHPvx?H[SL]g]N]n`<`u`BJrsJSdS]N`u>@SdCKdUKStfDLU[=Euc?@og`Nm\N\e\OE\n?>tm:;vtBRnJ;KJR=;kc;CRb>:bkT\k]\cmdM_umEVjcLT]UCU^UKMw\V\c\:ZyvGOv^_mtm@GmeME^NZBdmEFNMFEMLBDLDEDmfG>qa>EaYD^W>nohMFUMFGMEGFE=4F=WOnfOXfghV=FXPFNVHg_`X_\ld\`HOT\PHNWHG`pGFpmFGmpGFpm|FIDE World Blitz 2014|Potkin, Vladimir|2014.06.20|A18|1/2-1/2|B -EUxgDTnf@OkcHPtbCKwS@sdENwv?>qiU\c\LR]UNWgVQ_u]_V]VR\n\<\ru=@sm^OnfDT]g;LweOY_hHPvxYhqhFOjb?>wv<`uZ`EZlBJru=DlsE`utCSgq`Nqg:;f^U]d]L]^V]gmgOFe^DKtu>=st@HtfIQxq=uvu;=utKDtvJR^sRZgxT\o_FTfn\dkdTbh`D\_W\nxnN\n]bkWOH?VNGNsP=]d]Zb`XQXqhk]|SportAccord Blitz Men 2012|Kamsky, Gata|2012.12.17|B04|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQqa?=wnHPtfO`yi@meDLvx;Ejb[R\jIQdn?>nhE?tmRmum<`muOYwvYhqh?Ium=Km[KDgqIOq`O`ru:=e]`OvfLT]TMT[vT\fn=uvu>=uv=MldD=vwCSjsMunvumvnO`sl=XwvmnvnXYnuYqxwqywnypuwpqbZBJZSJSnv`fofqlwWltvntkngHPWVktgotmogmvh`vaVSaOgnOd^VdengeughuxhgxwghwnSTQY|Human vs Computer|HYDRA|2004.10.08|C65|1-0|B -EUxgDTnf@OkcHPwS@vxEWSn=Dm]O^ut;Ll\LRrbU\c\DKsdRctl^mlumgngcRunR\n\Kkbjk[\[T[dUFVUF@AFWPW]VHVws:@tfKfefCKf_;JnfJ[vtBRc]LT]WEU\Ujb>MW_:@gVEUVe[dmdU^e_=uvuIQuv;LqaLFwn<`tfFWf]W]d]:=ld=MaY?>ya`WphBRru>=_pWNpfRZjbDL|39. Olympiad Men|Pashikian, Arman|2010.09.30|C67|1/2-1/2|W -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmDTmdd]L]f]T[ut[KbSOEldFV]VEVgV>VtmWES]VFngH]m]K]d]?@tmDTxg;LphEU\UOUwp[dkdT\e\UK\TK\vx=FuZFTrsBJmt?=ZlIQgmLRm\R\pCP^>NtfN`^`Y`fTMLTF=Es;@GF?JRaYOWvs\msSm\xpEDjZLQ?TQY;CDCSCGOCDONDHYAHFNUTBA@]T=DjbBRtmDTmd<`d]TD]VDTV]TMl\;L]d?=uZ`gngU]f]L]d]O`g`M]sd]`qi`_ruFNu=:=ZRHORS=eSCOVph_\d^GW^X\DCDVDXNDKxpecws@GNXGHXgKTgmcem\PXk[T][Sed\M]KMWHPWF|SportAccord Blitz Men 2013|Aronian, Levon|2013.12.14|E05|0-1|B -FVl\@OmeEU\UOUxg;LjbTWqa`ipiWXxoXWohWXh_XTiaT\_X\TXOTU>^DL^IUMOVMUV_@wnBRvxGWul@Asd@vxTKmeIQtmGWk[BJ[SJSZS:RSkUOdSV^e^RSkSW^md^gpgNigpipxp=USUOUdk?:wuUOjZ@Gn^HXogGNkdX`g`O`um`fpi:@moLVrs@XoWfW^WXWZRKTsCNMRJMLC;Vei`WU;AQY`geVg^VG|NH Chess Tournament|Ljubojevic,L|2007.08.28|B35|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvuIQuv;Lqa?=wnLF_YOYnYvxL]g]V]f]EF^VMV]VFVngV]wvBJcG]EGEKEe]EOvV=]VWDLxq]mqh;DbZDKrtO^g^>^[SLSZSJSWG^\ts\lGHmohioWHPlLp`WTiaLPYPTXskXPaYPXYaXTahKRh_S[_^T\^WRSkq\LW^[c^eS[emLl|RUS-UKR Blitz g/3|Najer, Evgeniy|2003.12.14|B90|1-0|B -FVl\@OnfEU\UOUjb?Mxg>@meDTkc;LtkBRwnRZcZ=Rgm@Z\=XpU@AULCL\_XFsm:;kc\VFOfT[KVLW_L]Ni]gKLT]_h]OLOqhi`xp>nvn`gpogn|Amber Rapid|Mamedyarov, Shakhriyar|2008.03.22|B09|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljbu=>=ru=>phIEuENE\T[LcmOW^WEWnSBJSw?Hk[L]f]V]dc]e[SJSZSHQcU>NUNWNmsNWo_`gxoemsmQmogWNh`m[wi[TiwTFwn;@kcVXvwCKtkkc\ftf>fsv=>vf>fwoBRP_;BogfvjZBJiaCSgeSZcZvr_NrZ|2. Governor's Cup|Efimenko, Zahar|2001.11.16|B17|1-0|B -FVn^@Osd?[jb[dmd>@wnEMog@sm=FvxBRjbIQwvYPul?=nwETc[TEf^U^e^R[b[M[r:=:lcNVvu[TgaP^uv^ImgO^vnTonoFTk]V]cCTBCB:BokHX|Moscow Blitz Final 2014|Seliverstov, Vladimir|2014.09.06|A46|1-0|B -EUxg@Onf@wu?>aPIPslE?rt:=lc?I\TM;]ULUdUOUuU=UcU>=U\IX\dGOd\@IqaXGtu=unu;V\^FTaYOW^CVkYPIPCkGVunV`kmTVxpVTng`VgUV`me`VecV`UGPIcN`ON\T\G\IPo_O`pg`qgnPO\UHXUgX_f_qgngBRgfOPf]PY]V|FIDE World Blitz 2014|Sandipan, Chanda|2014.06.20|D02|0-1|B -FVmeEUxg;LphGWwp@Ovx?Msb>@l\U]tXIQXO=Oblf]V]umBRjbRZl[LFgvW_rtDL\TM;vgFWtvOPv>E>[lPYl]W]g]_g]g?gpgYgmfgfof;Ve]VOxo>Pon@GwtGNt\PYneYu\[NWqiuc[CcUCBUpBZpwemwiZ[W^mnOX[ciNcdN@xgEMmeBRjbDL\j;JdnJDnhhW:=gaGOn`@A`YA@ueDGY`@AvuMU^ULUehV^o_B;uwHPWQGH_W;hWNhaQGA@`a>NG=NM=CHCwOMOaOCGOX@Ht_GOXhOW_XWGhaGNXQHGa_NO_DOFDL^fLUFNUCNFCUFNUCNFCS\MSUG>xwMWQ_IYUVFV_VYawn>EV_EL_fLUneWMftM\el\RtXR\Xa\flef\el\flmf\mtU^aX^WiaW`tl`hkc|Eurasian Blitz Chess Cup|Grischuk,A|2016.06.18|C50|0-1|B -HPl\?HsdDTph;LwpBJme:;jZEMn^FVqaIYpiHQi<;@um@HxpGOdU?GkcJRtsCKsk<;ks=EsvECmk;?gxL]xnFU^U]WkmGFndCEdS?>v^WQ^nOWogE=wyHImXIHyvW_h_QGXhV_nF_hF>=avyaO>NOXN^XmphGVSMmXhiVeywe_^_X_M^_fUMfcwocZomZEipRZ^dZbpoYadSaiohEWmUiqUWqy2MEyvhivyihyvhivFWUbjE=2F=U=jr2=EHOEMOWMKW_|Vugar Gashimov Mem 2016|Giri, Anish|2016.05.27|A36i|1-0|B -DTn^FNxg;Lsd@OwS=DSLDLun?Fm]>@]UNU^ULJnJCJt_yv:=p`YOqiF?XgIYfXY`i`CVaWLVnltslksrkjrsjksrOVGBkjrsjksrkjrsokstkcuyjrtlrylcyrBCrRcdRSCBSKde>=e^T\B:=D:BD@mfHQRmX_n_QX_iXafoaFvf@Afh`WmQWOQYE>Yn>PkcJRjZONiXNWXgPYnfW_gV_fof?@hiY>wW@?|MTO|Arizmendi Martinez, Julen Luis|2003.07.24|C18j|1/2-1/2|W -FVn^@Osd?[xg>@gV?>VeO^wn[?e_^Om]EUvxDLne?Mdn;EnhHPwv>vuvE?qimQ?IldM?Q?I?ia?Nog@?xo?FhwFMwf>AryNHelCKyuHNuyNHn_HN_NENyuO@uy@Fp`LTohGOfpNG`XOWp_A?wSDLSJ:>V>?>vx>FqiQPxoPQohQPhoPQohQPho|FIDE Candidates 2014|Andreikin, Dmitry|2014.03.25|B46c|1/2-1/2|W -EUxgDTph;Lm]@Owp=K]TKTvxFrsV^g]=N]WFEwu:@l\CKkc@jbTKk[BR[SRZtkKRsmNVul<`gVO^V`RmvnGW`V;EVE=EruW_um_fl^?onfom^Vmufg:>VYEFg`FfphHPYX>^X_^_h_uwywfnwgIY|MTO|Avrukh, Boris|2003.07.29|D27g|1-0|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQqakc\Mn]>vovLEd\MW]WEWjZOEt_DLZRBJvmGOunHX_h@Gc[GN[SLS\SJSnSEVSnVLn\NFaXOX\ULRhDRLULCLldFOmfWN|4. ACP World Rapid Cup|Jakovenko, Dmitry|2010.05.29|C67|1/2-1/2|W -EUm]DTld@OxgFNjb;Lk[CKtX?Fnf>@smMF>OFMO>MF>OFMO>|World Blitz|Karpov, Anatoly|2009.11.18|D15|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@k[RKw\BRrsDLmeEU\cR[b[;JvxJ[tXKD^U[UdULUXOHOga@AugFkcMVrjOUg_U[jbVMvnHPtkAVRENog^dRJNGaodUJb>NbeUOe]O@f^@O^VO@oaNL]EG>E=>GphLN=EG?ho?>EDNJaXJjofjbf]bgVN>?DG?>GH>?NF@FHFg_X_?F]VFGqaGF_XFGVMGHMNH@NO@IOGW_X_PX_X||Kiriakov, Petr|2004.05.09|D31|0-1|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQqaruCKT]LV]V=unu>Vu`W`aYVWyaW_ph_Wa`^fofWY`]@?]EYTE=?F=ph>:ho:jov`hvwjk_ghpwxknxqV^g_^V_gV^g_^V_g|Tal Memorial|Nakamura, Hikaru|2010.11.07|C67w|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=EcC:;CJV^qi`Ye^W^gmLVJB;=B]EN]^?Fw\YP\U=U^ZUEvxPesd>@d^E=o_ewxwVeZ\e_\N_Nwn=Uk[?;rjIYjlFO^OHOm^@Gtk;@p`@Pl\Y`i`PQk]QqngOWghqj`WUW\dGF^TN]f]FMTJWXh_jpdDX`_W`]DtpoWXMFJT]=tvFGX`=@`ioWv^Wgiqgb^_GFT^FN^oNV_`@?oi?gixgc`pc[phbjqiVWxgj:ga[a|19th TCh-RUS 2012|Kokarev,Dm|2012.04.15|B97|1-0|W -FVl\@OsdEU\UOUn^U[me;Ljb[Jk[L]dnDTn]V][TJTxg@tkTcgmRZo_GOmcNcumCSnucNug:;moFTwt=Msr;@jb;E\TO>qiDLxnHX_q>Hk[GWmc=]NHNjNDFNL>GuEFEyIOILEGPTLIOE]?A[S:=]TAYT\Yytk=mkcyA\wPGbZGFc[AqwtqoLDmlD<2ltDM^fME|Sportaccord WMG Rapid|Wang, Hao|2011.12.11|B12|0-1|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu?=uv;L_nIQnhLFwnFWhW@me<`qi`Yp`YPga;Eug@Agh[TjbCS\jBRxpS[aPGPdZTBo_=Ftm[bkbV_haMUm_U^ahB;Zd^elePX_;:;j\;kpyIQwvFTdZTohokovF?;yxolrvE?Fnlnvn?Pnk;=ZTOUTN=>N]P_]L>fkS_ixwUOLVi_SRAIbZQY`YX`\GIQGP_PYPfiwpQXVgXPRXPQX`O`pi`oihoeZRe[h_|Qatar Masters Open 2015|Salem, A. R. Saleh|2015.12.21|C65j|1/2-1/2|B -FVl\@OnfEU\UOUsd;Lul@qaIYwnMF[S?=]ZPpvtponY=UywoqwxF?Y`GWxyUT|Qatar Masters Open 2015|Ezat, Mohamed|2015.12.20|B48|1-0|W -@Om]HPld?HtXDTnfT]XOHOd]>@xgEUsdFNwn;LvxdnCKtlFCwtLFl@ulDFsm@xg?>nfEU\UOUwnDTvx;LjbCKrtFw\?Hd^[U^TOWogHQg_CK\UNUTcQHc]H]f]FMyvA>vV>V]VMNue:@ei@piIU]IBpqBJqoJKNUKJo_JRU\VN_^RW^NtmNQWoLT|WYB12|Khairullin,I|2001.10.28|A00|1/2-1/2|B -FVn^@Osd?[xgEMw\>@dUOU\U;Ejb[Rk[RKUcBRrsEOmeDLvxIQqi?>wvKDe]V]u]R[b[vgvOUcsDFecj:vgF^[SU_SLCLsv^PgaPXch:jhXQXagGOg]LT]NjlN_X_v^HXia@GaXOXogT\xqGOqiltiq\d^\OVqiVU\ng`Xdl>v\T|World Blitz|Jakovenko, Dmitry|2009.11.17|C65|1/2-1/2|W -EUxgDTnf@OkcBJtk;Lm]T]g]=D]LCLwnFVsm?Ml\>@ulDFvx@wnEMk[RKvxBR[SRZme;EqiETtfDLSLCLut?>wuKDrs=FnwIQdnMU^UOUfTFTl\UOnhDMs[TB[sMTtk:lkDMsr:;kVMVgV;khnkce]cbrsTMVEOE\TM?sCEOCKbrKLO^LJZbJ:^mnhGWTLW_LD_h:?@?|FIDE World Blitz 2014|Najer, Evgeniy|2014.06.19|C84|0-1|B -EUm]DTld@Oxg;LnfFNsm?M]TMTk[TMwe>@vxBJtk=DjbCSbZ:;ZSJSunNVf^LFeSFPphU^gX<`n\^fm^O^X^`g\DMDSeDKofKf^oGWktfKwvW_ePIPvV;:r:?:xw:jo^jq^T_htfKDVFDMFNM_f]@GNv_mTegp|FIDE GP|Svidler, Peter|2008.04.27|D47h|1-0|B -FVl\@Ome?[tmDTxg;Lnf>@wnEU\UOUvx@ldEW]TO^g]^T]WPWsmFNmc;Ec]:@k[RKw\DLmeBRrsEU\cR[b[;JvxJ[tXU]dnKDumLTnhIQXQHQmQO`QP@APYAHqi`QgV=Fo_:Jwg?AswCShnJOghH?hXA@wg_WNJhgJrxoQ`Y`[lWOlf`=gf]fofS[XU=>e][cUTckndrb|GpA|Radjabov,T|2006.10.27|C78|1-0|W -FVn^@Oxg;LsdEU^UOUwSUdkd?Mm]V]un=Fg]FnvnBJSZCSZc@]W:>WfLRogRclc>NZSJSrB?;c[DTyuT[d[M[tb[bBb@?u]?>nmHPbBIYqaNFflCFp`|40th Olympiad Open|Volokitin,And|2012.09.05|C47|1-0|W -FVl\@OmeEU\UOUxg;Ljb@vxRZul?=wuE>m\K\e\LRu=:=\TRcn\N\l\>G\G@Gt\=uxqGNaYHPYQu=ph=:gvNEveELqp:=\dLSo_V_e_=>_USLpgF=h`LSdeS\eu\SUdSLdZ=FuecRk[R\ec\fcfF?fe?QZdQXeUCSbZSZ[SLCdZIYTLC;`YPYSKDKUEOWEC|Tal Memorial Blitz 2014|Leko, Peter|2014.11.14|B90|0-1|B -FVmeEUxg;Ln^@Osm?Twn>@vxBRld?>^UOUm^TFwvGW^hRZnw=Mtm=>\TMUhnIQrBHXg]W_]lE`qi`YlvCKe]KT[T?TBDT]u]U]n]>vogOUD<@Ixovu]cYP<=Uf|63rd ch-RUS|Khismatullin, Denis|2010.12.18|C41x|1/2-1/2|W -FVld@Om];L]VLVxgVgngEUwe?Fvx>@wvIQt_FMumM_m_DTsb=Kkcp`>vrvKRc[Rj[TjR_[RDvs:@wnEMvx;EjZFVZRBJl\?>sdIY]VEVgV>Vk[O`rb=aqi`Oo_V>tmO^d^>^ne^>ug:;_WNmd;>|FIDE Candidates 2016|Aronian, Levon|2016.03.19|A07|1/2-1/2|W -FVl\@OmeEU\UOUxg;LjbUcBJgWJKphKCcUC;wr>LOGDKUcLSWIMDGD|1st Asian Clubs|Dzhumaev,M|2008.12.27|B90|0-1|B -FVl\@OmeDLxgV^e^O^sm^TnfEU\ULUkc?Ftk>@wn;LvxEtm[UcRCKR\?Mp`W`rxIYqiHXi`YayiA?o_^gig?gng:?gpUO\MDMxwEFm[O^w?F?]UBR[b?Fkc^Of^O^bkKSk]RZpiFG]K^OKDGFDROURmFOipU_pgMUmdOPdV_eVMetcZSZjbteMFeV|3rd ACP Blitz Prelim3|Grabuzova,T|2004.06.02|C11|1-0|W -FVl\@Osd;Lph?[dU[RuZ:;xgV^gVLVZRCKUOHORdErvNWkVOVxqWPm]^eneCpqpGWe]W_f^_h^PhovVMVP@;@pgV]g^@?^]EN]^DTjbBRbZ?G^fNVfnV^woGono|SportAccord Blitz Men 2013|Grischuk, Alexander|2013.12.15|B31|1-0|W -FVn^@Osd?[xg>@w\DLvxEU\cU^gV=]V\;Jjb[Fdn]=cjJTk[TZjc=n^?F^VOUw\<`sm;EXF=FvxEK\cBRqi`gmgRZcUKUjbA=phUKrt=exp:RwvRStlIQv^ec^nSUgmcem^KEo_HPpoQYiaec^dUed^egopgfnfcf^MfcM@l\;Lk[TFsmU]f]L]tk]gugBR[SNVqiFTweT]vt]ktk=]kl@d\DTsd;JjbdUOGnla]lT]^vo^Vk[HX[SV^UD^_ofGFTVFMV>MD>FDKFI_ZIHZbf]X`]\bZ\UKSHCSJCsZjUVjosrJCrsC:srW_VW`hqh_hW`hprxBR`hojhqRZxs:BsSBJSWjlWgJS|Tal Memorial Blitz|Ponomariov,R|2008.08.30|B12|1-0|W -FVn^@OxgO^me^OgV;LVgEUwn?MvxIQwv>@sm?>mwU]whOUtm;dmL]vf?MrRDTph]WRJWfmf;@f]V]dnDLwp?>vx=a^VM?wv:=utJDnhDSqiHPh^?HrjSd^d]dtda_jn_]d]=][SLSpC>;CLH?vsBJsc]ZVNGNnN@HLU;=UC=MNM?McdMbdLJRLDHOCLZ[DBRZBR[sxpbTRSsSLSZbS\OVpgIYgnPX\GTKG\V]nm]VmnK]ngVMghMVhg]kgfktfnX`i`Y`nutXul|2nd Sanjin Hotel Cup|Wang, Yue|2005.07.13|B33y|1/2-1/2|W -EUxg@of@HpiLEdSESZSHIumOYxpYHtw?wnw=?mo?owo[eoGF=GUevpwvgwog]\VDFVE]lfml[U\=DmdHY^V[l\NFNE?I@?ND;N=;D=Ll[VN[UNFYOiN|SportAccord Blitz Men 2013|Kamsky, Gata|2013.12.15|A48|0-1|B -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmO^sdDTd^U^g]?=ut;L]LTLl\@k[RKw\DLmeBRrsEU\cR[b[;JvxJ[tXU]dnKDumLTnhIQXQHQmQO`QP@APYAHhW@duNVufV^gnMqxyq_l\DEru?>nwLFktFWmk_;fWEWphIYwpYah`WEyxU\c\CS\SJStXEMXaOUahMPut;hohS[tTPMxq=;kcUdc\^fjbd^p^>^T<;<\@wnDLvx?>jb[Rk[RDe];E]UIQgmDKtkK]ULCLneEKmcLTcRNrs=]^CDCRCT\CTNFbZ]UZRUTRKBKsKFExwGOK[|FIDE World Cup 2015|Mamedyarov, Shakriyar|2015.09.25|C65h|1-0|W -@OxgDTnf;LwSHPvx?Hm]BJSnEU]TO^sdHdkd^duvdnvn=Rl\RT\UTUf^USnf<`jZSYg]:@_WFVWNGNw?cR>Ntl=?wtW_RLULlL_fofKUphUFbZOo|19th TCh-RUS 2012|Tregubov,P|2012.04.10|B48|1-0|W -EUxgDTl\U]nf;Lf]T]weFVvx@Owv?Mel>@meIQjbBRsmtm:=k[R[b[V^e^]elZO^[S^mv>=>gmL]SKDFZ>]nxyF>srIPrBMhoh>fBCndurfmCFP^F^d^r:@I:^HPqamtyqem^_mu2_GIAG?AI|Keres mem op|Miezis, Normunds|1998.06.14|A60|1/2-1/2|W -DTn^;LxgFNsdBJphEMwp@Ovx?Fm]T]g]@tfLRkc=DdnCSZSJSum?;qiHPfXNVXOFOndV]dUD=UO=OrR:RmR;@xiEUiofmZl^VOUd\UFVNGNnN@ANElmrv>?vnmu|Alushta-100|Arzumanian,G|2002.04.19|B30|1-0|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLvxJDrsIYgnHPtfBJbZDNwvJR[S?[fm>@SLCLnw=Mdj[mumMbjd:;vu;csc]cmjbjdjcTut?;t\;sphsrjdTc|ETCC|Shirov,A|2007.10.29|B33|1-0|W -FVn^@Osd?Tw\DLxgEMvx>@meIQdn?>nh;EldE?e]V]g]?PqiTKwv=>jcELQf>NhWNOgYLEfXDTXfTDfKDKvfBJrvKSfgSVvfPFWFVFgOFOfh@AhgOPYPGPge|5th Kings Tournament|Ivanchuk,V|2011.06.15|C53|0-1|B -FVl\@OsdEU\UOUxg;Lme?Tnf@vxGWtmTKulU[lsBRjb[JdZKBk[CSZdR[b[J[dS[USBLBgV=Oe]DTrJOFn\T]sj?=wr|2. Governor's Cup|Korobov, Anton|2001.11.21|B89|0-1|W -FVl\@OnfEU\UOUjb?Mw\UK\j=Fsd@ogDTbZ;LZRKEme:=tmEOuZBJSM=MZ\?=vt@GmdHXtl=@wnEU^VO^o_^dkd=Dum;LvxL]d]@kVCSwvFg_=EyxFGmdA=jZEUTU=UxuUunuGFulFMkcMTdkTUleL[en[LkdUTneTUdkL[ed[LdeL[ed[L|67. Blitz 2013|Dreev, Aleksey|2013.09.01|E34|1/2-1/2|B -FVn^@Osd?[xgEMw\DLvx>@wv;Ejb[Rk[RKmeBRrsR[b[?>\cE?dnOYtX=DnhYhqh^f^DM^_M_h_GOcb?PphPFbBuEgvFWveWMqp@GB:IYeTEF:=MW=;CSpwFB;@f_:=jb[M_fBJeI@AIWFaqia\We\lelMVrsUjsrj\wxVkrskbsC=ulu?=uZ=MiaLTZlM=CDA@fTbTDT\STD@?aY=ED@un@wSLRSnUdkdRcrsctltNUd\U^sc=MvxCKme^Cgm:=ngC@wn?>k[RKvxBR[SEMmeRZtf;EutETqiIQrs@vx:ph=EulLRkcO^lkRLwt>Ndn<>c[BJ[SJSkSNQqaW_f_E`gq`imfQNqwIYSUHP_WLFUSFWn_M_f_^oxoW]SCNKCUKkwmkm_m>noxihxwho|Tal Memorial Blitz|Kamsky,G|2008.08.30|D13|1-0|W -FVl\@OmeEU\UOUxg;LjbHPn^UKk[<`wn`gngBR[R:Rvx?HgnL]tmRJsd>@bZ=:wvDLrjKEusETnuCSZSLSjJ:JdU?:m[H?[T?TstJMqa@HaYIQtkMJu`S[YPGPvtJMtr:?xyM=phQY`i]gklT]rJ=;iWPWlL|ch-UKR|Sharapov,E|2003.11.12|B91|0-1|B -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmDTmdrwNV]W^nwonogo>EWfENoaAHaX_PX=PF=RU]d]V]f`NMRVMV`VHOVg]ep`FUqhUfkcONhofliaIQaYNOohlfgmOVhgfUm^V]ZRUd^mdUmwUOg_OU_gUOc[]\g_\[_WOEWNETNGT^GP^hwf[d`XdmfUmtXQemUfhwQIwfIA2|17th TCh-RUS Premier|Eljanov,P|2010.04.07|E06|0-1|B -DTn^;LxgHPm]T]g]?H]cFNl\@Fsd>@wnBRdZGWvxW^\TFUn\L[unEMn^Fo_^g]gcm?Fvn=MkVMJtl>Ef^@?wsELsc?=cdFXmcJZphCKV_XFcmBJ_fIYfoFOdc=mnmN\^VOX|FIDE World Cup 2015|Yu, Yangyi|2015.09.17|B45n|1-0|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=MnflLEF]\AI\lFXLZIFlD`ho_XOZLO]xy]_DF>Fqi_Ve]VOwnOQneQ_eW_tLtMWt_;:_w:;yx;Dw_WM_tD=xwMWUMWMtLFEwn=FneMWL^FO]UEF^_Ff_fWfefOVfgVUg`U^`a^_kc|4. ACP World Rapid Cup|Grischuk, Alexander|2010.05.28|B90|0-1|W -FVn^@Osd?[xgEMw\;Lvx[dmd@CDVeleNWruBRkcOPwmWemg:>v>?>qi>NgaP^D=@I=Renuv^]aW]kWaNVRKn\vVMVag\eKMV^gVesVG^fof_fM_kdGVfnVgnv2gvdvxqvRjZsl_\RVqxVfxqlc\Sf_qx_ZSWIAW?c@?oZ\of\Ufo@GofAIfoGNofUWf]NU]mW^xqQYmXHPiaIHXhHOhMOWMEW_EM_fMbfmbkmuko^VqxVv|67. Blitz 2013|Malakhov, V.|2013.09.01|C65|1-0|W -FVn^@Osd?[xgEMme>@tm?>phMUunU]ds[msmDTjZ;Lm\CKwpBJvx:;nm=DwtBDLMUOMOXOHODTS[T\[c\[><[c@wnEMl\;EsdFVvx?>k[V]f]BRrsR[s[CKtf:ce:ZjbWRxwQYwnI@p`@?tmR:`YPYmt:>ng>vtf?>\TKT|World Teams 2013|Movsesian, Sergei|2013.11.26|A08|1/2-1/2|B -FVjbEUk[?Mtk@Onf>@xg;El\DLsd?>m]V^gmE?wn?PqaIQ\TMDbZOIphGW[SIOucO`n`W`d^fvufhaYP_yw=XSLCLcC:?CLheds`hrbXYut_n|Eu Blitz Ch|Popov,Val|2002.10.03|B00|1-0|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBJvx?>dZKBl\;Ltf<`Zd`gngL]phDLgpIYxyHPo_O`fxV_h_=aqi@HdnaOrj]njnBxwx`QurQWnkW]xwJR[R>Frv]WkKYayqO]wgWhv[hn[vnhKsGWgf:?voPX_XH@fg]VqxVRg_RVsvLTvf?G_aW_fgG?a`FGom@Hgo_gpwHPmfCKbZhYfmYhmfhYfmY_xy_N`aN]aQPHXPG_QIHPIC?Amf_OoqVhCKAYK;PI;CIAZRYXfoh_RJ]nJBnhoh_hB:2X@:@A@C;@H;CHQ|SportAccord Rapid Men 2012|Kamsky, Gata|2012.12.15|C84|1-0|B -FVnfEUm];LxgV^gmGWl\@Osd\SGYSLCLnJ<;JLUKgVMV]VN\wv>VLgYagoaoxo\coxHXf^W^tfK\rt;Cvn=etv\fnfefvfclxoIYfvDToflekcCLvtLMc[T[b[VFf]FCdjCSt@vx?>k[RDwvMU^ULUdSD;l\BJSdU]dsJRtk=KsmR[b[:rurK[vs[?kb;MbM?MgXMDrbCKX^O^m^NLUN>UL>N|36th Olympiad|Kaidanov, Gregory S.|2004.10.25|C77g|1/2-1/2|W -@Om]EUl\DT\UT]xg=Uu];L]UOUtmU[vu@meDTwn;Lvx@me;LuvCSnuT\f^U^e^FVldV_t_O`smgedLemLNGN>NmlDL_WNOtw@Xw_XW_aLTa\OLp`WUjZCKiaBJlk@wp?=vx;Lo_:<_VOVmlCSp^IQ^pLFleS[fB[dkdMDefDduedLfVLEBK|IV Open|Gonzalez Marrero,J|2004.03.26|D23|0-1|B -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[O^iaIY`X?Ftk>@sm=Dm^P^wi^PuU?=UcCKTKBKjbKSiwP^wnDQX=UVFCM\TM^vwNVn`@vx@Akc<`smFTtk`gmgGOrtT]g]V]n`=Mo_BRug:>giHPtvOW^W>vwvM_kt_MvNMTtQPW`W?@QHAHiQ|WICC qual Dubai 25'+10|Korensky, Sergey|2002.03.01|B92o|0-1|B -FVl\@OnfEU\UOUxg;Ljb?Msd@wnL]g]V]dsDTo_T\vxGW^VMTxy=Ee\N\n\K\kc\Kc[TFtk?=ucEUcUKUsm:@vx=KjZBJsb;EmeOYkHYHf^EOwvHN^VOYumYHZRKDSKDEblHWlfWfmfESvs:@wnBJvxCStf:;ogEMdUOU^ULVf]FNjZSZrZNUg_=>ZrV\]H@Hu]H@wv>f]f\fnef\rj;[phjJ>NvNGNJM[]|18th European Teams|Hracek, Zbynek|2011.11.04|A29|1/2-1/2|B -EUm]@OxgDT]TFNnf?Tjb>@l\TKk[BR[S;EtkNVwnV^gmETvxKDsd=Mph@sdFNn^NU^VO`uU=KU:tsPX_hGWg_VPw\@?uUPFyuX`haFUuUH]UW?HWGHP_WPQWO|42nd Olympiad 2016|Bomo,K|2016.09.02|A05|0-1|B -DTl\@Osd;Ln^EMphBJjZFNo_MU^VU]dsOEmeHXxgX_h_?QwpA@vxCKxy<_WQtrtNVtv=?^h?OgLRLwgOQh^EOyxEl\IYsdXW\ULUuZENkc@FtbYahaHPrtGOdnNGyxAabMDMtDPXZL:Y`><`gyq_qEnf?Mvx@vx?=n`DLktMFbZBRtmR[m[FD|TCh-RUS|Alekseev, Evgeny|2008.04.03|B91|1/2-1/2|B -FVldEUm]V^t_@Onf?Fd\DLsd>@\UOUdULUxn;LndHX_hGWo_^gugW_f_@gVEUk[RKm]U^tf;EwnDLV\KD]UEKUMD;\KBKf_KSvx?>umIQwu@ph;LwpEU\U=Ume?=sm<\TMDc[OQ[SEV]VG>k]A@SKBKTKD;o_`gng@Xe_E]TQa:CG>uE|78th Tata Steel GpA|Adams, Michael|2016.01.27|D02p|0-1|W -FVn^@OxgO^me^OgV;LVLELwnN\QIOH_WKSIA2HAWOS[d[T[OV\cV]RZ>PAHPsZbkb[b]THOTLOViacULDUgDEV]EF]dsjguF?uc|Tal Memorial|Gelfand,B|2010.11.05|C42|1-0|W -FVl\@OmeEU\UOUxg;Ljb@u]IY]_XRxp?=ZdRb`YPYDTGOdSbRTY=;_[HXSB;[BLRZL[Z[Yy@HyrHPry[ZyvX`g`Z`|68th ch-RUS 2015|Jakovenko, Dmitry|2015.08.20|B90j|1/2-1/2|B -@Om]EUxgDTld;LnfFNsm=Dwe?Fvx>@]TFTk[TMtkBJrtCSjZDKf^LVgVMVphU^m^O^e^@^VOUdUNUm^=F^MUpM@Xa:yu>AQPA>PQnvumox]Wh`m]xyWhyq]_qiQI>f_DfohY`Y|2. Norway Blitz 2014|Aronian, Levon|2014.06.02|D10|0-1|B -FVl\DLxgV^g]@OsdEU\ULUme?T]cT[e^O^tm^mum;Lnf>@rujb[MngMVdUVkmkNUgU=U|Corus A|Tiviakov, Sergei|2007.01.20|B22|1/2-1/2|B -FVl\@OsdEU\UOUph;Lwp@vx=FulCKnhgCGCv>=>mg>f|UKR Ch U14|Zavgorodniy, Sergiy|2001|B17b|1-0|W -FVl\@Ome?[smEUxg;Ljb[mgm>@nf<`ul?>\UOUqiUfldfwi`wmtm=UvwL]mf]Sdl:=ruUNogDLwoNPyYIQbZS]lmGOuy]NyuLTmdCKZR=MRKBKk[>=[TKTYWPGWYMUd\ND\^DSuySd^\Ue\G@Gfteug_V_t_HX_fuyYyduonufnfGPyt=]fg]_ghT\hiOW`WPWph_^ipWVpoV]tu]dog^]uydmyqmeqy\dyue\ut\ctscj|It|Zavgorodniy, Sergiy|2001.08.02|B51|1-0|B -EUxgDTnf@Okc;LwSFNtk?Mvx>@l\LR\UNUwvBJSwsm:vtvL]vF@?FB<=BJ=UJR]gxpgvpxvgxpgvpx|5th Kings Tournament|Carlsen, Magnus|2011.06.21|E43|1/2-1/2|B -FVn^@OsdEU^UOUxg;LwSUdkd?Mm]V]vx>@d]BJSn<`ld?>qi`Wne=EeWEWtfLRusWswsGWjZ@GxwGNwnNUne:=gmW_d\UN]UNWf]CKp`_hohWPmgPGh`G@gm>?sw=>]dM_dR>felKRwgfnruHXle?>\TnVe\Vn\enV|UKR Ch|Kuzmin, Gennadi P.|2003.11.08|C47u|1/2-1/2|B -FVn^@Osd?[dUOU^U>@qaEMw\GWld[RxgIQjZBJm]V^gxDLxnLU\U@In_=OaY;L_P?>P_O]tf]uruLVvxV`um`fofRKxo:;UG>=wu|RUS-UKR Blitz g/3|Najer, Evgeniy|2003.12.14|C61|0-1|W -FVnfEUm];Lsd@OwSV^ogBJSLCLg^U^xn?Mqi>@vx=Fn_?=tmLTuv@tm?>vtN?qa=Ed^EWZl:=mdLFpiWY^OHOux@Af^YaiEa_dm_oE>=>lcFPxPGPcGogyv>=mQ?NGNPXQH|Summer Sport Games|Miroshnichenko, Evgenij|2003.05.25|B60d|0-1|W -FVl\@OjbDLm]V]u]EUxg?F\ULUph;L]u>@wpO^vxFOgv_YO]mg]KY_>Fk[BRucEMtkR[ru^TcUMUuU=U_UFnk][bUKTc]dnlKUbjgVGOVLCLdrcrwrLUpU@?rj|4th Open|Khamrakulov, Ibragim S.|2004.03.27|B28j|1/2-1/2|W -@Om]EUld<`qi`YucCKt_FNnf?M_M=MwnYnxn>@smDTvx;LnhNV]VLVcl:=ruMNhnHPn_NLwv?>_eVEe_BRjZT\mgETurTcrbLM_nO^n]cTvwTebrMOruIYue\ele==wr]NH@N_Uuxpahohum_n>VpoVh|Tal Memorial Blitz|Grachev,B|2008.08.29|D00|1-0|W -EUm]DT]T@OxgFNnf?Tjb>@l\TK\UNUsd;Lwn?>vx<`tm=MdSMFmd:=d]L]S]O^rt=MulMPxyPQyxQPxyPQyxFMph`iwuMFnS>=Swi`uvQOwnK]g]OolDFDtD`nvnon]n^Mn_IQ_UM^Ud^dkdCKDB=eBDefxofVDLKSLJVTJRTdRSdbqaHPop@HSK|Tal Memorial Blitz 2014|Gelfand, Boris|2014.11.13|D27|1/2-1/2|B -FVn^@Osd?[jb[RmeDLtmEUph>@wp?>k[RDxgU^d^O^e^=fd=][R:Rpw\NrsRBioOEoe]\d\N\g_\eleGOxo@GofETstTNwiN]i`HP|Corus A|Mamedyarov,S|2006.01.21|C76|1-0|W -FVl\@OkcEU\UOUtk;LsdD<>ETDEUDFU:;D:BD=BK@]TFTjbBRd\U\e\?=unLVgVDVwuUOENO>?>noA@gOPapyNieM>NONGNML<=L:|Blindfold World Cup|Topalov, Veselin|2007.10.19|B30|0-1|W -@Om]HPxg?Hld>@t_EMsmOY_f;EphEOwpO`mw`fwfFNvxGWuc@Aru=FwvYOf\O^gm^mumNV]VMVvuV^cbFG\RDLbM?>nf@l\U\w\=uvuTFunCKkcO^tk;EgVEVkVhX|Dortmund (groupe B departage)|Kramnik, Vladimir|2004.07.27|D27l|1-0|B -FVl\@OmeEU\UOUxg;Ljb?sCRSgXes|XIV It|Naiditsch, Arkadij|2004.12.29|B90|1/2-1/2|W -FVl\@OmeEU\UOUxg;Lsd<`nf=Euc`gpgUKtm>^InNIH?@H]MV|21st ECC|Greenfeld,A|2005.09.19|B60|1-0|W -FVl\;LmeGWph@Owp?TsdEMnf>@xnBJvxTBdU@Atmdn>NmdA@n]NQYuMT]WEW^WCSwvBEvNQNWNENug?>iaS[drNnstngpgXaxqGXgY>=rO=Utv;Ev>E?>UeE?EKN@GNLEOLTO`qpaipi`oipouTRudRBGNZRNUBCUTRJdSCSTSJB|Rapid Match|Short,N|2008.05.03|B23|0-1|B -FVn^@Osd?[jb[Rme>@tXIQqaRdkdEUXO=O^UDLUL;Lump`NUyiL=`XQXaXOWih=NXPGPd\ULn`W?`N>NxiNOm[Og[?:?hg?gixgOxnPXndLgrsX`sSOWd^g^e^WgSCgbCSbdvmdgmngdnmdgmn|TCh-RUS|Najer, Evgeniy|2007.05.06|C72|1/2-1/2|W -FVmeEUxg;LphGWwp?Mvx@OsdV^e^W^ga@wv=EdnFTxyOYndNGd^T]ldIQd]U^Xf^gagGUgVUpypEUpxYOVLULrtLEf_OU_VDLun?Wvw:?jbQYwWEWxpBRbZHXqiX`i`W`tv@Ine`PenPWvyIPVM?OMVOGyvW`ne`WenW`|30th ECC Open 2014|Jones, Gawain C. B.|2014.09.15|B09k|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphBRwp<`unDMldCSnw=KrtR[d[U]mcOEpi`iwiP?gaHPagQYtlLTvtT[lLK;b[M[c]V]k]?N]k[btsbkskEVgV;Vks:riwrswsN]LK>:xpVTKO@HO_PX|3rd ACP Blitz Prelim3|Sasikiran,K|2004.06.02|C95|1-0|W -FVl\@OnfEU\UOUjb?Mxg>@ul=FmeDTph;Lwp?=vxUOsdIQgm@wvETgm@wnEMl\;EsdFVvx?>k[V^gvE?[SIYjZN^L=;f^QH[J;cJTuftfNLTc|67. Blitz 2013|Morozevich, Alexander|2013.09.01|A08|0-1|B -EUxg@Onf@sm?>ulLTwv:fvfGUfv;ckd?TvtTbtv@IvrUSdvcersSUsrU^ljecjm\dmj^\jlbTrtT]lu]VuYc;Yu;:ug:=tl\cgn=:ltcbtl:;n`brxwIA`Yr:wx:^lt^eYGdlGFAIFT;s|SportAccord Basque Men 2013|Leko, Peter|2013.12.17|A47|1-0|W -EUm]DTld;Lxg@OnfFNsm=DweCKvx?Fkc>@tkwvFMd\T]f]M_mwLFgVU\c\FPV`_XePIP`VOEVEDEn`XOwfEZumCJ`uZuvuOXml==tu^gumXFflFXlf@vx:@wn?>k[RKmeDLvxIQdZKDl\EUulU]tm;EphE?gaCKZk;s;:;wsE=nuOEskETls;:ul@Isv=Ovu:@o`N`g`ONugP?qi?EgwIHwsGOpvHGvgGFsv@:xpN@gx:;vr;krk@;kjTJxnJ[jsDMm[;[s[M[ntFMpoETon[bnubtutTJtkMFktJ[lsFNtmNGslGHlu[jucjd\THPmvQYvoYaogahghdnhqPHc\n_qh_P\NH?hgP_N\_ign?F\@i_nmF?@\?>\c>Fc@_P@IPaIWapmnp_nmF=ml_nWNndlc|It|Harikrishna, Pendyala|2005.04.06|C97b|1/2-1/2|W -EUm]DT]T@OxgFNnf?Tjb>@l\TK\UNUsd;Lwn?>vxBJk[U]f]L]g]K]tk=O=@H=]H@]=@H=]H@|SportAccord Rapid Men 2012|Wang, Hao|2012.12.14|D27|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb<`nfGWul=Ok[`gpg?M[SLFsm>@qaBJSJ:Jtk@Ag_ONyx?OmgV_gXN@f^JLlcLKcjOPaYPQ^UFUwp_g|8th ch-Euro|Narciso Dublan,M|2007.04.11|B96|0-1|B -FVn^@Osd?[xg>@gV?>VeO^wn[?d^>^vx;Lng^>ldEUe_U]meLVgnDL_YHPYhGWo_VGd\L>wvBFvF>FphOEqpE;po;LgaFNugMFapHGh`FO`XOHiaQYjZG>gnNnonH?ng|40th GM|Ponomariov, Ruslan|2012.07.16|C67d|1/2-1/2|B -FVl\@OmeEUxg;L\UOUjb?Fn^UKwn>@vxBRtmmnZbfWbjWM>EOGrwnmjr2|ch-RSCU Blitz|Nepomniachtchi,I|2011.01.09|B92|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQwvEUtk;EnwBJqiKDdsJRsmDMldCKphfpf[cl\T^]UC[vt[m\^mktskj^e=;suckes;:sl?TlTks2usjsxq:jfpslTljlqxlt|4th FIDE GP|Svidler,P|2009.04.28|C92|1-0|W -FVn^@Osd?[o_;L_VLVxgVgug=Fwn[dkdO^gf^OfF>Fd\A>tkF?kOHOyw?Hw_EMm]OW_o>^vt:;lduw>FogfgwgENgfHO]UNEfFOFmfFOf_IQ|5th Kings Tournament|Radjabov, Teimour|2011.06.18|C63q|1/2-1/2|W -DTldFVm]V]d]EUxg;Lsd<`tf?FuZFO]TU]vt`Eg]L]u]O]Z]@Of_>@nfCK_MKT]_?>w\EN\SNES\EN\SNES\EN|Vugar Gashimov Mem 2016|Safarli,E|2016.06.03|B13|1/2-1/2|B -FVldEUm]V^t_@Onf?Fd\@nhDTwnUdkdT]V]HPvxNUulULwu=Rn\:lj>?js?>cZLZrZXSsSJSZrDEusEUd\S\sCUERJ>:h^EC^O|18. Amber Blindfold|Anand, Viswanathan|2009.03.21|B12|0-1|W -FVl\@OmeEU\UOUxg;Lsd<`ucUKnf`gpg=EjbGWtm>ZKBKc\QYg_YytyIQ_VLV\lV`og`Oe]>EneW_eWESbZSLlLCLf^=]m_FM_t]ZyvM?g_Z]WP?[vn;@lcPVn]VetseouwoednFOmdJR]SRZc\MqUM@AME@f]V]dn?>wpDLvx=a^VM?wvJDn]a_v^_Xo_X=xyBR[R:RucRU]lDNe]N]l]U]cC]^p^=]rv]oCso_^I@AsW_mvwmUW^?b^ULUIlA@wvb[vu>VlcHPcU@HUgGWus[TypHOsSPXqiONSRNMRJMEJREDRSDMSsT]suMTutT[tjkpgkcgpdmnYcs>nmen>skpy]fYPenypW_PYnepyko>=f]=U_gYgogUXgoiae^X`^f`@oj@hf_he]fec_gc;|It|Felgaer,R|2005.04.01|B33|1-0|W -FVn^@Osd;Lxg?[dU[Tw\O^un^Om]T]tXEMvtEvNGNYGE\N<;OA>AGFBRFM;BMTB;TM;BMTB;|66. ch-2013|Motylev, Alexander|2013.10.07|C48|1/2-1/2|B -FVl\@OnfEU\UOUsd;LjbGN?A?k[JRtkR[b[ZSog?=r:=:vm:=k]=:yr:r]r|10. Petr Izmailov Memorial|Rublevsky, Sergei|2006.07.16|B46|1/2-1/2|W -@OxgDTkcEUnfHPtb=Ksd;EdZKLl\U\c\FVbk?MZdV^gX>@ul?>wnIQXiEKo_Vo`GFxy|FIDE GP Beijing|Morozevich, Alexander|2013.07.06|E15d|0-1|B -FVmeEUxg;Ln^@Osm?Twn>@vx?>ldBRkcU]d]L]g]T]rsDLmg]KtkKDul<`su`gng=MphDKxpK]kt:=gnMTlsIQtmOEutTKjbETmRKRc[RB[T]Tsc>FbZBRt\=]wt]\c\CK\lFBnuHPqaQYtsBEskRJunE]kjJRpw]MnuR[ZRKRjZ[KZ\T]wpLTlZ@HZ>KkulMO|It (active)|Garcia Fernandez, Carlos|2005.11.19|C41y|1-0|W -EUm]<`qi`YldDT]TBRuc=En^U^wS;LtfGWp`YGcZ@O`WOUsmHPWPGPm\?Hvt>@\KUKTKEL=>=E=dV=?G?C;2V;u=?G=;|FIDE GP IQT Final|Chepukaitis,G|2002.04.02|D00|0-1|B -EUxgDTnf@OkcHPtb=Dbk?Hl\U]f]T]g]>@wnO^kd^ovoH]d]D_ov_]sd;LdS]=ngBJgLCLSd=]unme]MvmMP^T>fmfYaTJaiJTPQoq`WT^QNjZHPc[PYZRX`f_W^e^YaRJ`hJBN>qj>?_VhpB:2?:j:px2:AahA@ho@xoxVMiq^Vqy2VNyQMEQmELm[\T[^LM^]|Tal Memorial Blitz|Karpov,Ana|2008.08.29|E15|1-0|W -FVkcEUtk?Mnf@Oph<`wn`Wme;Esm=FngV^e^U^gp>@xg=FsdCKphf^F^d^>^nf]NkcN_h_^Nxp?=wuNPpgPQghQPhgPQghQPhg|18. Amber Blindfold|Kamsky, Gata|2009.03.22|B52|1/2-1/2|B -EUm]@OxgDTld;L]TFNk[BR[SL;tbO^nf^Td\CK\UNUsd@g]FOrt?>ng:BdZTZuZBDgnIQ]NGNnY>FbFDFZl;El<=GsmOUtkFOkOGOrtLVvnV\t\HXphYah`=MmgCS\TW`i`MJyraigqJZngBJTtUKghK\qgNVtuV^gm\mumiqmMOFruqy2MEF>E=|11th Karpov|Jobava, Baadur|2010.06.02|D15e|1/2-1/2|B -FVnfEUm];LwSV^l\BJSLCLxn=XulXpyxpq\U@FsdGWtmqMULFLjb:;dZErtML\jLCmRKLtLCLvmW_xtLOj\_fofOomuogulgWlsFP\LEFL>FOtLOHDNH@R[WwskwG>;@IN?P?;MGokcoGcd|Aeroflot Open|Ni, Hua|2005.02.22|C18v|0-1|W -FVn^@Osd?[jb[Rxg>@w\DLk[RKmeBRtXIQXO=OdZKD[SO=vxEU^ULU\cnlK]e]>f]Zf>ZBOUlPUfpi>?g^Swia|GpA|Stefanova, Antoaneta|2006.10.27|C78|1/2-1/2|W -EUm]DT]T@OxgFNnf?Tjb>@l\U\w\=uvuTFunO^sm^M\e;Ek[CKtk@wvO`XF=Fqi`On^U^d^YahaO^v^NVuY@nfEMweIQXa=>xnFVvx;EldOYnhYhahGWuc@ArvEOogOYhaPXao>PclPGp`V^g^W`^VGFeP`hqh<`l^FN]UNOW]ULU\fWPfUPWpgEGUfWPgnYahaXa>APXA@XOf`ON@PNUPQG_QaULnf_w`owrjbBRoeCSf]rxa^xp]dp@^F@@wn?>k[RKmeDLvxIQqiEUwv;EnwE?tk?PdZKDZTCKTc;>lTKTbTP?TK>:tDFDKDGOpi?Pgm@?m\C^e^:^D=|Tal Memorial Blitz|Svidler, Peter|2008.08.29|C93|0-1|W -FVn^@OxgO^me^OgV;LVgEUwn?MvxIQwv>@smLFe]FPmwDLneP_t_M_ld<`qi`Ywh_hoh=KulYgpg?>xp:=k[BRjbR[b[KDlmCKv>=>rv>:mf@?[S:@wn?>k[RKmeDLvxIQtkEUwv;EnwBRqiKD^ULUdSD;l\U]gm:Jo_OI\TV_v>=>m^ET^T>STJCJk]IXiaXN]oPW>YWNYVNGVFGPF>PW>GW`G@`Y@AY`AH`YHVY`V_`Y|XIII TCh-RUS|Kasimdzhanov, Rustam|2006.04.22|C92u|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQgmEUngBRtkU]dnR[b[:rur;Jld]dkd=ente=m\KDwu=FteOEg`J;rBHPqiQY`E;EeTD;B:ET[TFT:;T\u=>=;V=uxq@?VA?FdOFNOX\^ANW>EWXECXOC:^VphLT:AOWANO>AOFAVFEVOe\OKdlKBELB:LS:CSZCBZcBK\[Kfckfn[c|Aerosvit GM|Volokitin,And|2006.06.28|C92|1-0|W -FVl\;Lme?TjbBJnfEMxgTBsd@Own>@vx?>k[LFtkFPe]V^gmDL]ULU\UFnk=EcKD=kl=DEH?gW>=EL?HLC=AWYIPYAHACFP^pqAHFT^nkt[ctbHITKnjb?I@?QOW`WjlK=@I=alWQtIHa`HO`WOWqhW^ia^eaYeltblsYQsjQI|FIDE Candidates 2014|Aronian, Levon|2014.03.30|B23c|0-1|B -FVl\@OnfEU\UOUsd;Lul@vxg^W^cmEOm^O^e^FNjZCUZRU\piNGnfGDRKBKiw\wvw?wrwDFwvFNktT\tbNLb[IQf_>V_`QY`_LNxp@I_gKSgfYahaN`py`a[MVYMhai^VYWfnW?npiNpC?=C^I@ho=?o]@IvsNisxiN^aHQa^QHxrNi^piWrvWNvf?Wp^WYypYXpwXWwvWY^pYaf^ai^niYpCYanoIQoGHVGFVhvuN`uth_tkQXFv`Wvxa`CFXQqi`xFaWYa_YX_?QY?AXQAQYQ]x|WICC qual Dubai 25'+10|Capezza, Marco|2002.03.03|C45k|0-1|B -@Ol\CKmeFNn^DTph@qiEMtfOEe]T]n]ET]SCJSMLVkcV\M\HdrtJ\c\dH^V:<\U^mtmRUf^Ucrt?MlcNcw\c\t\MV\l=evuA=utecmdVdldcdkd=>yvFo_JR^VRZe]Zb]TFEd\HPp`EFsvFNvrbcrscdsCGOCBOVBbdl_VIY`YNVTLVY\TlkbhYqLKPXTL|8th ch-Euro|Prusikin, Michael|2007.04.12|C10l|0-1|W -FVl\@OmeEU\UOUxg;Ljb=Mph<`wp>o_MTqa>fuc`NcSTKvmLRmlNclmcUrxBJSKDKmfUpxpKSpxswGWfgLR^V>=gfRce]cRfeR\wrDLrj\KjnLUnq=@gVEUjb[Rk[RKm]U^tf;EwnDLvxKDo_EKumKUdUOUl\UfmfGOV`BRruR[b[@A_W\G>?GNENWNZckcbcv^c[NF?>wOHO`O[]^]>F]`|Young Masters|Vallejo Pons, Francisco|2006.02.08|C83|0-1|W -@OxgHPph?Hwp>@vxEMmeDTld;Lsm:;jZFVn^IQm\CKgm<`og`N\fMUd\U\e\O>fU>Mkc=EmsGWsdW_tkPXdn?Gum;?ruL]k]V]h_NU\UG_n_?_^VHVwvMGme@Hv^EUuvUMpi_^v^VqxyqViWMO^nQYg_X_npH?ei_gigOaWi?FgCFOCLGMLga_gYOFYIMGi`FMIP_OP^Owpxw_^P_OPIBJypOXpyKSZSJS`iX_xPMDPpT\c\S\iN_wpxwgxpgwpxwg|6. World Blitz|Vachier-Lagrave, Maxime|2010.11.16|A05|1/2-1/2|W -FVl\@OsdEU\UOUnf;LulweA@eWEWSK?MZB;`P>PYPyinmuvgovwW_wpPWpgMTiyfnyvov2|Kiev Diawest|Deep Fritz 8.0 256MB Athlon 1200 MHz|2003.06.21|B48|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQwnHX_YOYnYd\DTkc>Lvo=ERKBKr:L:yr:Cn`OW`WEGh`CTL>V]VG>|FIDE GP|Wang, Yue|2008.04.25|C67w|0-1|W -FVl\@OsdEU\UOUxg;Lme<`tm=Ert`gpgU_uZ_NwiHPd^?FiNENk[>@qaGW^TFTtTBJaY:>YPIPmd?Gg_GIyI@IdVPXnfX_V_>@Zc@xvmNcjcIP[SLRmlxtltRctlcT_DJSDMTNldPGd[NX[SGNMhNUSKXgKCgve]veCDW_h_eo|World Blitz Final|Morozevich, Alexander|2012.07.09|B61|1/2-1/2|W -EUxgDTnf@OkcHPtb;Em]?Hwn>@vxO^l\EKbkU\c\<`sb=Ert:trGOrtZ]nm]_ph_Mm]FV]\>F\T@Ht\V^xpMVT@wn?>k[RKvxIQtkEMmeBJdZKBl\;EZdDLumE?e]V]g]?PruO^d^>^ne^>ePGP]gFvn:>uvPXqiLTn^CS[TBT\SJSg]N\^F>FvFDFbZFGZS\S]W@IdHGHWHSEHYIPYhMUhnPWnhWPhnPW|23rd ECC Men|Grischuk, Alexander|2007.10.06|C88i|1/2-1/2|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQwn?=_YOUY_UFqaLVaYDTjZd\GWya>Ntk:?ruM@m]=DsmBRvx?=neRZun;L]TFVf^U^m^OUTKDKe\ENphLRgXR\c\UDrsKLXNDNsSGW^TNXogV^g^Hdwud]u]=]nf]uxpX^T^L^f^W^Sk^fb[Zbknus[Mskpg:Z\TZ\qakngn\lnfljTLjlMbldf]dbLDb:]U@GUMIY|SportAccord Blitz Men 2013|Giri, Anish|2013.12.16|E15|1-0|B -FVn^@OxgO^me^OgVEUe]?Msd>@wn;LVLCLvx?>tXNneWeue=FduM_ah_hqhO`eWN^udHPWg^]ru]uwuIYgnF[us:;nm;>jb[Kk[KJbZJ\[SU]du\l|3rd ACP Blitz Final|Macieja,B|2004.06.05|C42|1-0|W -FVl\@OmeEU\UOUxg;Ljb@wnEMk[RKvxBR[S;En\ETmefoONohPFU]N\]\GOxo@GqaQYh_FPphPV_V>VbZGNg_VT\TKTuUHP_WPWUW@l\;Lk[TFtkU\u=?=w\OEsmEK\cBR[SRZcuLRunGOp`NV`X@rs=Dqi?>unGWwuEVtbCKnS>Nm]|WYB12|Alutis,Martins|2001.10.22|C45|1-0|W -FVl\@OmeEU\UOUxg;Ljb@ul?>vx;Em]TKsmMU]VEV^U=UgVUVne=lchMelDLuULUceHPgXMVXgVkwskjgXj\em\`s[O^X^U^mv^fofKfxy=][]f]lu`_ph_f|2. Governor's Cup|Vorobiov, Evgeny E|2001.11.18|C24|1-0|B -FVl\DLxgV^g]@OsdEU\ULUme?T]cT[tm;Le^U^jb[FmXFphLRwp=EutA@tfBRrsR[b[;LwpDMvxL[]SMFfX[LXOFOdUOVwv@vx:=g_FV_aO>h^>M^dEKf^GWjZBRme=>kbDLrvKEdUEOUOHOaiW_n`LDphMGbtGXipOHqaXN`N>Nh_V_p`H]xpNOwgIQvw]Vpo@IonDMtmCKmtMDtmDMmtMDtm|19th TCh-RUS 2012|Caruana, Fabiano|2012.04.11|E15d|1/2-1/2|B -FVnfEUm];LwSV^l\BJSLCLxn=XulXpyxpq\U@FULGWsdqMtmMLn_A@rt:;]ULMdnHXlDMDtDGOE;kEVG@V\Xp\kponuekuvkevu?[BJekuvkevuIYjbekuvkevu[dmdYaJQoqd[ai[MW_M_e_f_^fuvqyvniqnfyvf]qy2Qyvy|Blindfold World Cup|Harikrishna,P|2007.10.20|C18|1-0|W -FVn^@Osd?[jb[dmd>@ogEUtXU^u=?=g^=Mwe;ExgETvxO^XFMNFT^Te\N>rvNvVNVgVGOVeTNbZ:=wv@Gv^=UxoOW^aIQofGOk[DLZRU=a\BJp`HX`WOW\^QYqaXa^a=Ad\AQfoWXa^YaopXW^VWOV^aipqOW^VW`eo`_oe_g[SLS|Corus A|Caruana, Fabiano|2010.01.19|C69g|1/2-1/2|W -FVl\DLxgV^g]EU\U@OsdLUme?T]cT[tm^enf>@we;Ljb[FvxBJdnO^n]FOe^U^]LCLul=ert:;m[?=cTeltl=>wu;STc;lmSc]Z;:phcSiaIQZ]SC][C[d[:;[d;CmuCS|RUS-UKR Blitz g/3|Potkin, Vladimir|2003.12.14|B22|1/2-1/2|B -FVn^@Osd;LxgEU^UOUwSUdkd?Mvx>@m]V]d]IQld=Owv<`qi`gugOgpgLFSe:=e^CKtmGW^lFPxwPalu?OjZBRrsOPg_Ppuc@IcUpqsSDTSKT]d]M[m[=U[TqivVUE]UidUMaPTfdeVWeMKMEMWRMO_WPFf]OLWOLtwnFLRUL]U]HO|Tal Memorial Blitz 2014|Morozevich, Alexander|2014.11.14|C47|1/2-1/2|B -EUxgDTnf@Om];LwnE\f?MfUNUxwA>tdIYrt>^mf:>jZJRdeCKqiHXfmX`i`^`tv>@phYaha`awn@`mdENefNWfg`_g_M_vx_XxuW^ux^Wxua^nw^a|76th Tata Steel Masters|Harikrishna, Pendyala|2014.01.12|D37j|1/2-1/2|W -FVl\@OsdEU\UOUphDTxg;LmeUDwp?Fgm>@m\@ldEW]TO^g]^T]WPWsm;LmcT^og^Oc]FNtm:neLVelV\un>Mkc\VruVPxy=KqileTDnY>?vmM>Yn>MnYM>wx>OYn?>xwBJd\U\c\DEmdKDus>]g|10th World Teams 2015|Bruzon Batista, Lazaro|2015.04.20|E11h|1/2-1/2|B -FVnfEUm];LxgV^gmGWl\@OsdEnuA;mdU\dk;krtE@me<`\jRdkd?>qi`NjN>NgXN>o_;EXgMU_VEVgV>Vt_VN^VOEe]GOVOEOue=FbZ:?d\U\e\OU_V?w\wFGw\NP\eU_V_G_rw_MecMUcULUwsCKsSPMZR@GRKBKxoMLldLdSKdeKC|21st TCh-RUS 2014|Jakovenko, Dmitry|2014.04.11|C77b|1/2-1/2|B -DTnf;Lm]EUxgT]f]<`ldFNqi`Ywn?Mvx=DgaYnun@OaWM?sm>haU]VNLDGX]enfZjfg>FkcjkueTegekoqho?h`KSaYDLXGFNG=?=e=N^`X^f=@sdU\]=?=w\IQXa;EvxBJjZETg]HXahT^d^O^wu^hqh@?og?>h`FOrsCSZSJS\nO]f]FnejZofFMe^=>feU\ed\UdeU\ed\U|It|Kalugin, Sergey G|2001.08.04|B22|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeBRrsEMqi@]TMTjb?=k[TMulTV>GVXn\XWGPW_\NahPY_]Nch_YPqhcj]MPWMQW^QYjnYanwa`|KM FIDE GP 2015|Jakovenko, Dmitry|2015.05.25|D46k|1-0|B -EUm]@]gPWwuFM_MEMgaW^og^PaPIPtm?=ZRPXrZHPZ[@m\@Ae]O^gVMV]V=Fog?=uv^TtfLVvdV\n\TZdcZkwvk\c\EA:]esrRcrjc]jr]lrslbsres|Canarias en Red final|Rabiega, Robert|2004.05.09|B32l|1-0|W -FVldEUm]V^t_@Onf?Fxn>@d\DTsdU\]U=KnhKkrtF=tlkbutbRw\CS\SOUvxU_f_=OS\Odldvu[^ltdluU^vxpvtEO@?OI?HIX>?UEtwpwlt2wptLpiL\ip<:BKH@Kf\LX^?>E]GWfc@AckA@kc@AckA@kc|Sportaccord WMG Rapid|Grischuk, Alexander|2011.12.10|B12|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWsm=Oul>qiOQvt`gmgL]g]V]k]BRlcR[cUMVUV>V]V[btm=UVdCSwnQKusDTyt<=e]S[n\[dmlKL\ULUldT]f]UpdcpocbofbjfmjbmRbcW_c\RW]UWis;=DtsDMsK|GMB|Kosteniuk, Alexandra|2003.01.26|B96l|1/2-1/2|B -FVmeEUxg;LphGWwp@Ol\?[tmV^gX[mumU]e^IQ^VLVXgVgpg>@vx@wn;L]cBRjZEMtf@meDTph;Lwp@vxBRld?>kc<`jbU]d\OEqi`gmg:;iaTFaYCSulETrs=EtmTN\S;SwtSTlj>;tTFTmRLRc[N_nwRL[T;:YQHQph_PjUE>wiPFUc@Hga:RcuRbaWFWiW>FsCbdu`FX`XQXCDL[WN[eTLeTNU]eDGHPLDTJGEJDU@DS@IPOo_X_h_V_EedDIWOXeUSdURXaxoDHogHhg_d^W^h`_f`h^ghXRrahrjXVg^VXjoX`^W`XoghpWipqf_XHiWHpgiqxW^pqihxohgon^enmeWqnW^mtgctm_Vnfcsfb^UmdV^bZ^fZ[stdktD[SU^kc^eSKfmc[D\[SenKL\]ST]^LMmdTUngUT^VTKd\MOVSKD\TOg|6. World Blitz|Eljanov, Pavel|2010.11.18|C41|1/2-1/2|W -EUxg@vt;EwnEO`XOUyI?WuyUfl^fUg_U_n`WX`Y@IYPI@PI@GywGFd[FEtsK]ZS]^I^:GD|Blindfold World Cup|Polgar,Ju|2007.10.17|B98|1-0|W -FVld@Om];L]VLVxgVgng?TunTFnlEUwe>@vxIQwulmNEfQHQmQMhqh>Nh`T\eWNKWlDTQa@HaXH?uv:>XQ?@v>E>QX@?rvO@lI@FvFKkFf|Tashkent FIDE GP 2014|Jobava, Baadur|2014.10.26|B10v|0-1|W -EUm]DT]T@OxgFNnf?Tjb>@l\TKk[BR[S;EtkNVwn?>vxV^gmEV\U:m^O^u]bM]^V`phCS^_M_h_:;f^S[tD`O^VEWVO[cn\ck\jks2jsWsUMsWwu;=ME@IuUWNUYIP_WNWYW|Aeroflot Open|Inarkiev,E|2004.02.24|D27|0-1|B -FVl\@OmeEU\UOUxg;Ljbf^>MGgUf^VM\VN\VgOf`i`V`OWefWX`OXPfNvwA?n_N^_e^feTO^wp^T[TfbTLCKsw?@m]T^uvGWd\DTld:@phDTl\T]g]MUwpU\c\OEvxETkd;E]cTZdH@HsdETut=Dwu@wnDTvx?>CcELceO^k[T\e]M[tkGO]u^dkd[dg]=MrsMT]LTLng:=phLTgpU]f]T]ugdRsCRKgY@AYGOWGW>?CG]TG?=?WTKTqaHPp^?>wvT[vsBRog>=xp=mpiAHjb[bsCHACDb?D\mE\@f^T]d]NV^UL]g]V]qiOUuYUOYaMqxyD_a_q_mg_twt?=tu@wvOEsmBRjbRZk[ZcmcEKt_KZgVu`LRvsRL`aGOayPX_mIQo_X`_WNWpU@AypH?svLVxyVev>:>rw>Vc]ZKmdW_h_VYyxKU\U?Tp^EU^eYienT]d]iy|Renova FIDE GP Zug|Topalov, Veselin|2013.04.30|A64|1-0|B -FVn^@OmeEU^UOUxg;LwnHPe]V^gX?HvxL]n\DLX^>@tX=KsdUdkdwvDLgLCLv>:>ru>NXfKZuEBREBN^BR^\fQGORB\^BH@AHD^>QHA@HO>NDBZKOFT\FTKUjZUdZRNVB:@GRJVTJBdS:?G?B:2?H:CHQCKTVKL\dLOS]Oa|World Blitz Final|Mamedyarov, Shakhriyar|2012.07.10|C41|0-1|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQqanSHXaX`fifQX_n@HSLCLn]WEk[GWvmW_fv>Vph=?h_?_ogHOv^V^g^_^jZX`rwOH]n^VnhHPw_EWhWPX_`X`W]LT]ST[d[DTSBT[BLVTL[|5th Final Masters|Caruana, Fabiano|2012.10.09|C67w|1/2-1/2|B -FVn^@Osd?[xgEMw\>@me;LtmLR\cDLdnRcjc[TnhIQmfTfof=KunO`qi`fvmGWnfK[mnW_fm[mgm_hyw@fK=MugO=gW=KruKBum<>Wg>VphMLxp?>wu@?U_LgpgHPiaIYml|Baku FIDE Grand Prix 2014|Kasimdzhanov, Rustam|2014.10.07|A33e|1/2-1/2|W -@Om]EUxgDTnf;Lwn@t_LFgm=KucKD_hWIwvFWneWheI@IqhHPcuIHh`?AunCSjZS[d\QY`XO`rtMV]VDKph@wn?>k[RKmeDLvxIQdZKDl\EUgmU\e\CKul;EmcE?wu=Fog?NtfOEnwLTZdN]ljDMdUF=rsE?ct?dn`oxo?onx:?Uf?_iN@Ixi_a|GRENKE Rapid WCh|Howell,D|2010.08.08|C96|1-0|W -EUxgDTnf@OkcBJtk;Lm]<`wnFNvx?M]TMTsm>@l\=FgVLVkV`nun?=VOFO\UT[mg=UruUuwu:@meIQjb[dkdMU\c?>wvU^e^=Rue;JgmNao=efBedoTdtrtRmtwOYT[mephNP[sebsCY_xybjBojn|SportAccord Blitz Men 2013|Le, Quang Liem|2013.12.15|C65|1-0|W -FVl\@OmeEU\UOUxg;Lsd<`nf=Ejb>ts_fofHPmt?QyvA?nwLFwpFWc\BJg_V_f_>Gd^O^p^WM\G?G_WQtWPIPutM^e^=e^VebVNGFtuDLu]bivn;D]`iQqaD=sl=>lc>?`]?HcZQY]_YUnoFN_GHQGCN^o?^aCBQXBJLT|World Blitz|Ivanchuk,V|2009.11.17|B69|1-0|W -FVl\@OmeEU\UOUxg;Lsd<`nf=Ejb>@tkFNmeL[umELpLCLd^NVe]T]f]MU\ULU^TV^ogHQg_QHkdJRwuIYmv=Fvo?@nfUFp^P^e^=uvu:=unGOXO?OtmOMmdFyuMuruEKurKZdv@GrtL=tDG?DEZKEMK\MU=Gvd>:gV:jnv\VdVIQV_QX_XjkUSGXSXk[XV[kVU?GUmk[ogHXvoX`g_[^mUGOUX^ZX`OW`XWOogZrXSONSKNG_Wrwg^wr^_rRf^RZKMGFMQFGQIGOICZ\CKOG_V\TV]TR^VGFKCF>WORZ]UZRUNRJNWJROG>?WORBC;|UKR Ch U20|Shkuro, Iuri|2001|B90j|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBR[SEUmeU^e^=uwu;EneRZqiKTxwCKwnT]g]V]djO^nwETe^>^jd<`i`]dog^\tfTcrscmfmdmum\ds[dbmEbrwoHX[\Zb\DrtldbjEGty|4th FIDE GP|Aronian,L|2009.04.17|C88|1-0|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[`gpgL]g_?Mtf>@f]V]dnDLwp=a^VMFut:=nhJDvxGWVOFOwvDUpU=Uv^aituIYogYahyO=yoiWuwBRrvR[b[=DoiDMiXM_XN_fvf]fN?@?^fWXxoUVwvVf|Premier|Harikrishna, Pendyala|2003.01.02|B33y|1/2-1/2|W -EUxgDTnf@Okc;LwS=Dtk<`qi`Yp`YPgVP^SLCLyxU]o_OUsb]fmeDRvn^Pb\UdkdRd\f:Gwx<@RvE]hfAYf^]UvhUEiaF=XOHO_WYW\MG?MWNW^\?Gnu=Dhf@AutW_f^OW^pEN\TDKTLNftkfxLDKDpxDKxyGHc[KoyCHQCgoh[SA>jZ>fg:QY:BYaZRfVBIaXICX`e]V^CLPXRJ_gJBgoL\^vSKow2\wvwKCwuldumkc|21st TCh-RUS 2014|Sjugirov, Sanan|2014.04.07|E13c|0-1|B -FVldEUm]V^t_@Onf?Fsm>@xnOY_V;Ed\DLndEV]VHPucEDNVgvuONnSE@phEU\U=UwpUYqi;Lme?=smOUkH@Hh`YQ`XQYm^L]utCKg]T]^hYapU=UtLUTL:aXvwTDiaXmaY@m]V]d]<`ld=OSe:>rsL=qi`gugOgpgCKtm=NwvN_ewHXjZ>vsvBRiaIQw\@HaXQXm_X_vsHOxw?AwnAYneYqswMb\UbMe\qYULMFwtYqtlqy\SyuLUFMSLOFUcuec\eu\nurnSruLUFOSnurnSruSn|FIDE World Cup 2013|Ali, Sebbar|2013.08.12|C47|1/2-1/2|B -EUm]DTldFNxg;LjbGWnf@O]T?Tk[TKd\>@wn@AvxBR[SLFtkO^sd=>\U^dkdFUd]PwuPOrtE@wvBRogtv>;mUY_Uu;:um:Lh_?_qiI@vt_?xqB:qy:ByqB:qy:B|CHN-RUS Super Go 2015|Yu, Yangyi|2015.08.01|C65j|1/2-1/2|B -FVnfEUm];El\V]u]@O\U?T]e>@xgEKsdKUdUOUjb?>elTKweIQvxDLkc<`tk`gpgKfofUflnfwnw=XxyXmk]m_ru>=e^=MwxHPuv_Xxo:=]fXYohCKypLTh_MNqaYV_QVkpxkcaY=uvucuxouyYPyQfQNVQ_VYofGP^PYy_Vyvf_T\P^KSVdvtd[tr_VBR[RrbRv\dV]S[]\brvhrw\c@GhMGNM[NVcdV_[M_fMTf_dmwg^g_g|World Rapid Final|Morozevich, Alexander|2012.07.07|C07|1/2-1/2|W -FVl\@Ome?[sm>@jb[MxgDLk[MDtk?>\TBRn^R[b[:rur;JwnJ[vx=FwtEUTMDMm\OE\MFMkbLTb[T[rkCKts<[s@?xw?FwvGOvmFMgvMDn`CLvl<:`ELEmd:Rl[DM[lMTphRjdcENcdKSe]V]l]N\]lHXo_X`srS[dmjrlrIYrl[clfT]f\]\mt\]^VOV_W]UtkUMkcMF|29th ECC Open 2013|Cheparinov, Ivan|2013.10.26|B51c|1-0|W -EUm]DTld;LxgFNnf@Osm=Dwe?M]TMTvx>@jbNVf^?=ulIQk[TK^UOUm\<`e^`g^gUdtkdU\KDKruL]k]V]gU=Ul^:=ueBR[RKRphRTwuCS^_QYqaHPxp@Hpx=:utT?_^?=tv:B^_BDvVD\egUV_VH@VS\dSCdgCg]egu=]xw]\og\lwvldvodTovTxvmxhuyhMbZMUZRU\mf\dRJdbJBbBfeBoe^omyimv^evuefuxfe@HenGWiwx]wv]\nfHOvhOGfoW_hi\loxlTxyTFypFNiyNnpiGNyxngiqgh|8th World Teams|Aronian, Levon|2011.07.19|D46k|1-0|B -FVl\@OmeEU\UOUxg;Ljb@sd?>tfL]k[TKf]K]ulDLg]=]ng>=wuBRdn]MldR[b[:rurIYqiN`i`Y`ru`gpgOIe]IX]UMPnhPOxpXNhnOXpwXYwp=MdcLU^UYXpwX=wv=aueayvmNXcdV^nhXgmfyQf^gX^]M=dvQOvVOoVfXN]^NX^]ok]T=<|63rd ch-RUS|Nepomniachtchi,I|2010.12.13|B90|1-0|W -FVl\@Osd;Ln^?TwnEMme>@xgIQvxBJjbL]g]T]tf]fofDLumCSe]:;k[QNGNMN>=NM=>MN>=NM|FIDE GP Tashkent|Gelfand, Boris|2012.12.02|B30j|1/2-1/2|W -FVxgV^g]EUme@Old?F]l>@e^O^phDTwpGWvx;Lsmrv@AkcFX^l]eneL]v>?>lTXmb\mdTBEi|23rd ECC Men|Karttunen,M|2007.10.03|B04|1-0|W -EUm]@OxgDTldFNjb;Lk[T\smCSbZSZuZ@^UNUwvMsbHPvVFWrv>VvVWHph:>V>H>xw>OqaIYbl@?wnMFnuO>ut>DlbFvgu?HkmvmtmD>mf>MulGWogHGluGOf_M>h`Y`g`W`u`>M`gMW_`WF`_FW_`WM|18. Amber Rapid|Wang, Yue|2009.03.14|D15|1/2-1/2|B -FVnfEUm];LxgV^gmGWl\@Osd@wp:>vxL=^TFT]T=Gm^EFTLCLrt>=u]GX^XFXtLUFLTXP]^P^p^DLTV?OVYOQYXHPXV@Gk]QYVYPYwtNW^pWPpwFWwJW]f]=]JC]ebZe]CL][ZRPetuenuvneL>GOvreJ>Y[^og`gYg^VxoVWofOFrjFMg^WYf_Ya_gMT^WT[ghaQqaJ\jr\nW^QJ^IJRrR[RIWRKW`KTaYTMYQneh_MF`WeW_WFGWXG@XP@AQI|Amber Blindfold|Morozevich, Alexander|2008.03.26|C11|1/2-1/2|W -FVphEUmeDTwp@Oxg;Lvx?Fld>@e]V]d]T]g]=K]c?=sb@gVEUk[RKm]U^tf;EwnDLvxKDo_EKumKUdUOUl\UfmfGOV`BRruR[b[<`n`OW`n@Axy=MfcHX\TMQcdQH_XW_n\HXuv_gpgDqv^q_wo:>]U_VdfV_fd_VdfV_fd|Corus A|Carlsen, Magnus|2007.01.27|C83|1/2-1/2|W -FVl\@OnfEU\UOUxg;LsdU[me@dn]nun=MtfCKrbIY`iBJSJDJnjJ[j\?=wuMLurLMph:Riw=:wnH?|10th World Teams 2015|Yu, Yangyi|2015.04.21|B33m|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphCKwpU]rtDMldLTm\M?[TKTbZ<`qi`Ekb:;iaE`ulOEZR=Ogq`NlZ>=pgBJts]dxp;[ZlN\e\[\q`OLaYPFle\]edLD`fFLfUDRdRLRbkT\kdRcgn]^og^nvn=@rt?>d\T]f]:<\ULUm\UC]UEOUMFM\MnMC=mtNog^XxoNLqaXNCMLloflkMH?>Odlnf?FOIFMIOldf_MLh`d\_fLKR:KC:RCKR:KC:RTcRSCJS;JB;S\df_ZbO^dg_gc]gf]S^mSMfebjmcBKelKLlkLUkjUVcTM^TC^oaYo`YPGPjkPXktV_C=|FIDE World Cup 2015|Eljanov, Pavel|2015.09.29|E15s|1/2-1/2|B -EUm]DT]TFNxg?Tnf@Ojb>@l\TKk[BR[S;EtkRZwnKRsmU\ulEKvx@nhTKjb?>\jE?tfMUfK=Kut?Pwv<`gmP_mwQYqiYai`ahwhO`tmHPe]K]m]V]ru@Hu]GWog`V]uW^g^U]u]_ixw>?hWPWpiW_wo:=vxHOldLT]U=U^U?AxyA@yu_gof@pumpxUMxvfovyofyiMEgofn|FIDE World Cup 2015|Svidler, Peter|2015.10.05|C54g|0-1|B -FVl\DLmeEUxg?Mph@OwpIQvx>@e]V^gV?>t_OY_fGOVP@IP_Y_f_M_h_U\ulOWl\@wxXamw@Xln:@rtUOtlNUk[OY|UKR Ch U20|Kuzubov, Yuriy|2002.03|B22e|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLm]V]g]O^d^>^ldEUne^>uYHPYQ=FtmF?rv>vQ?@?wv@\UOUf^U_]U<`qi_nun`gng;EsdBJjZT\t_DRgnEV_VHVn\:<\cuEA@EC>LWg[dkdPNgL@gV?>m]T]u];L]ZLVtf<`qi`YwSDLULCLSJ=;vxVgpg>fJCfgZL;_dn_Xnh:=LDO>DL>MLUgWUpMCpCYgCDIYiaXaru=?ueaiegWgDLi`xqYa|6. World Blitz|Savchenko, Boris|2010.11.17|C56|1-0|B -EUm]<`qi`YldFNucCKn^@O^VOExnDTn_YP_PIPtfBJsm;Lwn?FvxKSo_EKcu:@jl?EXgFOqa:=aYPGp`W`gmEFm^KUtmGNrtUdmdFGyxLFn`N`x`IQvnCKk[=E`xA=xuFWdr=>tLWFL\DL^mEUmgBRf^USrdR[d[LT[dFLgmL]nw]cbZcmdmScZRKRmROFRdGNurcK|4th YM|Kosteniuk, Alexandra|2003.09.22|B97i|1/2-1/2|B -EUm]DTnf@Oxg;Lsm@kc=KtkTFun?@vx?>]gPYjZBRrbIQumKTbcDL_fO^mtCKfTKTwv<`gm^Xog`ipyT\cb:=g_XNmgGOtmU]ypi`xyYTqi`Yh`YGvw\dmtdktkN_wo]e|3rd UKR Games Men|Rakhmangulov,A|2007.05.21|B06|1-0|W -EUxgDTnf@OkcHPtb=Dl\U]f]T]bk?Hg]>@wnDVsbOYphV^og^Vut?=blYhqhVhvuBJc[FV]c;LlfCS\SL]fwhpyqpxc]V]meJSt_@xgCKvx@k[@AulBJtk:=rtE>\UOUdUNUn\>Y\U=UogFMqi^gwgW_tw?@m\_f\fUXfWYPlnXWgWLFW?FU?@A@wvIYn>@I>PIPxoPGogHPktDLtXMDp`Y`i`DKg^KDvwGHXmUO^gDK`XOUg^KDbZD=^V|Corus A|Carlsen, Magnus|2010.01.27|C11i|0-1|W -FVl\@OmeEU\UOUxg;Ljb<`sm=Fph>gmUKZlL]luIYrtYanf]LpLCLugahoh=em^OA^TV^goeUiaAVk[>=tlK\l\Um\lmoxoPXaX=AopVHwyAypyHXlqX=qo=Uyp<=h`W`phUYT^YQh`Qfo_fb^T=F_^FGTNbjNXGO^_OF_^FE^]E<`WjoWVoqVWqY]^EdRPayqaPl\YahwE>sdAYwm=Mqy>?dZ?@rt:>tdaiphU\RJ\cZTcjJjMUjlGWdbP?yqYQmc?IbBIXcm>;BDU=DB=KBrKkl\@Irt;[\lkltl[smsXgvwgqwxqwogwflq`gsmgpTEf`|WICC qual Moscow 25'+10|Shaposhnikov, Evgeny|2002.04.22|C16n|1-0|W -FVl\@Ome?[tm[mum>@xg?>sdCKphDLwpEU\ULUe]V^gV;EVE@phLVm]K=vtFW]_HX_oV`og`VgoV`|Aeroflot Open|Khalifman, Alexander|2004.02.22|D20|1/2-1/2|B -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLg`JDvxBR[R:RbZ?Txy>@rsCStmRBZSDSdSLSo_V_m_=K_fS[utBbt\bd\d[dsKTKwtGW^W?>f]K]ph>fypfetl@G`nefpwGOnufVlnVWwpIQulWSpg]VleSRelONn^NM^ZRSg^VOZ\SV^gVUl^Um\LMEqaO]aYmog`on^gnvL\]Og^vw^ewoe^EM\LMVL\oq`gVMh`OVgfqi^gVO\LMEL\iqg^qmfgO]g_mo_homh_]O_fOX|KO|Carlsen, Magnus|2006.11.01|B33|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=McC:;CJW_wn_fof?FJZ`EZlHXqiMQvxX`i`Ufld>@e]V]g]L]d]FMw?;?n\EN\NQN]fMTfTNvxqvaqx|19. Amber Rapid|Gashimov, Vugar|2010.03.24|B97|1/2-1/2|B -FVl\@OnfEU\UOUjb?Mxg>@ul=Fm]V^gV;EV\EOsd?>tmDL\MFMqiBRp`IQwpMNrtCKdULUlLNpwJwvwO>bZ@?wn?FtdFEytHXo_^gng:BmvBDvhDdtd>OdDE>D<>E|65. ch-Playoff|Svidler, Peter|2012.08.13|B42|1/2-1/2|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQqa<`tf:=wnCKaYLVf]?>ru`WumO`yiDT]V`Vm=>=ifV`fh`Od\=MhbBRldHX|17. TCh-RUS Premier|Jakovenko, Dmitry|2010.04.04|C67|1/2-1/2|W -EUm]DTld@OxgFNjb;Lk[T\sm?Mn^O^m^U^gXGWw\=Ouc>FXiIQi_A>qaF?tfBJbZM_f_NV]VLVvtNtk:>cU>FUVNVu]?GklGPlm^fofVfp`fnmenfemfnmenf|FIDE GP|Bacrot, Etienne|2008.04.24|D15h|1/2-1/2|B -FVl\@OmeEU\UOUxg;LphelNWn^U[b[L[ld[evweom\Eudvuvwvoy\KBKpyW^y^>^vo=UcmUWmgWRrs^Zk[ZrscRjtmjbcbrbg]@xg@wn?>k[RKvxBR[SRZmeDLrsKTtfTbsrb[dZLSZK:rur;LKUOU^ULFrVEMVY;SV^PVF@?FDKS\c;Kp`KOcUPeqaIQxpHXaXQXphenDlnel@wn=OulOPvxwvIQZd]dld=Eum>=bZBJvsOIe]IXgXYXsuXFmnEMxwFEnmENogMEdkN\woJR[R\ZkdZSmkSXowXOkm=:dT:=]UOVRJCJTLEMLTGWT]=>]V>Vm]@GutW^g^GOwoVF][OVtxo]^bBHXBZ^WZRWORJ|Superstars Hotel Bali|Polgar, Judit|2002.11.30|B87|1/2-1/2|B -FVl\@Ome?[tm[mum>@xgV^e^O^mt=OnfEMsm^Tmc@usCKbZGW`u@Arj=aog:=dnDNuc]csc=Mc\a=wuW_foPXZRX`RKBKxw=Xur`gpgXYnxNXwnYqj:XNnwqYrBYP\dIQ:?N?B:AI:BP>oa?Pav>Sd\S>vdP?xi>YioY>wnQYoiME\ZIQBJ>PioEMZr?NryT\JB\eoeN]d]M]ytKSBDQItT]\TFPxeo\DFDxsDEsjnwj\wpS[oi\nionJoe[ceVJOVeckESOaeoH]oyIQS;aXpiXO;cOKcGks2G_QI|FIDE GP Tashkent|Ponomariov, Ruslan|2012.12.04|B33m|1-0|W -EUm]DT]TFVxgV^g]?T]cTMsd@FtXGOXf;LfTMTcT=KTc^fof@vt:iaVP_ePal\QYe_YX_UOWk[ap\TKT[T>feRLJD>=ef=EDSEFfeFESMEFM\F^nd^]ef]\dU\^fe^_UO`XOU_]||Dreev, Aleksey|2004.05.09|D20|1-0|B -EUxgDTnf@Okc;Ltk<`qi`Yp`YPgaFNmeU]aPIPwp]fpLCLof=Uf^O^l\UMugMhvnhgng^XgpXIia:=aYIOYPAyPG>Gpy=esd?MdZO`rwGPkbeiyxiYwvPGv^`O^fYXxwXWwxHXfeMFeiX`ieNVefV^bkWgfnGPkOFOn^O]xpPW^>ge|26th European Club Cup|Korobov, Anton|2010.10.22|E12y|1-0|B -FVnfEUm];LxgV^gmGWl\@Osd@tkTcgmRZo_GOmcNcumCSnucNug:;stS[b[;[^VOVwv[SgLF[mu[vLSvdkb?_SZIQts@IphN`ul_OsS`iSs=:bFOGFM:g|Superstars Hotel Bali|Shirov,A|2002.11.29|B32|1-0|W -FVn^@Osd;LxgEU^UOUwSUdkd?Mm]V]vx>@d]IQld=OSnphWiwvM;cZiEZuFWm^OP^dWfofEigpi`uZ`EZuQYugYahaE`go=MvwMOom`iwOHOf^;_mn_fxyipnpPpypf]rt]dtd>^\TKSdb^abJa\JL\lphljL<@HTLjlLDBR<;lD;SDBScRZcbHPh_OWqiBRbhPQhbQYbrZbrjYa_gaig_RZ_WihWOZBOVhgV]GW|World Blitz Final|Chadaev, Nikolai|2012.07.10|C47|1-0|B -FVldEUm]V^t_@Onf?FxnDLqi;E_q>@smCSjZBRnh=KhWF=ZSLSwnHPWQ@HQ`O`n`RZvxKLmsEK`n=FsbK\n\S\bll[LCogF[d[:Jg^>^wgGOrwESmdCFwvJNqhSEdmNKvwESmdKNwvIYh_Ya_qPXxyS>qxNKvw>YgWFExqYPWg^NdbP^goX`i`aiyxipwrKJ[SES`XOWqVHGo_ScbTcf_oNV|FIDE World Cup 2013|Eljanov, Pavel|2013.08.19|B12q|1-0|W -FVl\@OmeEU\UOUxg;Ljb@m\K\e\LRuENE\T?=wuENgmHPnSNESE=Ems:=uE=Esm@GxwGNwnOWphFOtlIYmsDLsdW_h_V_f_RcnwcT_hOVhVNVog|Aeroflot Open|Kulaots, Kaido|2002.02.05|B90o|1/2-1/2|B -EUm]DT]T@OxgFNnf?Tjb>@l\U\w\=uvuTFunCKsmf^UCteO@eTFT]TGOVeNVvm@FmfFLphJRg_R[b[V_h_HPTMC<|73rd ch-UKR|Kuzubov, Yuriy|2004.08.24|D27l|1/2-1/2|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LtmIQqiCKutjZBRwS>=yvFPhW^fmfCpf]piWQ@?]OHOvxiNSe=Ekc:=tk?H|12th Karpov Int|Bruzon Batista, Lazaro|2011.10.08|C67s|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwnFXQIe]GOXRHXneI@fpEKRm>=aXOXvV=UrvN@rtFVc[?>]VEV[T=FtsH?nSFEuZLSZSEWsu:;SJKTmc;NMENM|Aerosvit GM|Shirov, Alexei|2006.06.19|E15s|1-0|B -@OxgDTldEUm]FNt_;LnfOY_h?Fsm>@weHPunCKgVVg;Cyr>;nuCBgx;CxnOFumB:nxKJxn:AnxFMxgA:gxHOxnOFnxS[b[R[jJ:JrJCJd[JZxnM[ndZRmtFMonMLnuLKulKClsCLslLEluEMunMFnoF>on>Gno[FtuF[utGOonOHno[FtuR[ulFMogHQgo[RltMFogQIgoI@og@?go?>on>EnmR:mlFMtuM[utELts:Rst[dkdRZlmZjtljrltrtmtLStkSZkjZS|5th Kings Tournament|Radjabov, Teimour|2011.06.12|D12n|1/2-1/2|B -@Om]HPld?Ht_EMnf;ExgOY_XIQXaPXgmEOahFNwe=Fm^Yh^OFOqhrj<;qaFNt_TFwsCKaYFTsS=Eec;:gvBJcZLBSkNLZLBLveLRklEFh`RCe[T[b[:B\TKSlmC=og=LjkFG_hJR[RBJho>=n^]ekcGEg_S[oa=;avLRmeEece[ceuckus;c^VR\VN\fpxf`va`OaOHOxoc[ogOWNF[^sk^FkpJSpPSTPQFGQPTUYQDTPHG?QI?AgfUNHDNODLOGLTAI|UKR Ch U14|Tukhaev, Adam|2001|B09h|0-1|B -FVn^@Osd?[xgEMw\;Ljb[dmdO^uU_f>Nwv=UkcUSbZSRvnDTnm\clcT\c\RZ\TNJmuZjqijltlWluMJrxqlZiaIYf_BRMeZLd\RZehZbhHrw_fbjf]jr2]rwrHGrt|FIDE World Cup 2015|Onischuk, Alexander|2015.09.15|C65j|1-0|W -@OxgHPm]?HtXDTldO^XfT]d]EUph;Lwp=KucKcjcL[sbFnfBJblLBl[BSdZJR[e@meUOt_=gVO^VLCLe^BJSd?Y`<>qa>FumL>^VOW`_CLk[?@xoHXaX@XryFHyqJRdnLZ_aXYaY>YqYZb[RKRm]bTowRZ]aHPn_T\wx\]xw]rworkowktwotTowT?_PIPwnZbaybjYa?Ag_A:aQ|SportAccord Blitz Men 2012|Jobava, Baadur|2012.12.16|A01|0-1|B -FVnfEUm];L]VLVsm@OxgVgmgDLwn?Mvx>@kcO^tk=Fl\U\u]^O]\@yxVNGOldOVZSJSd[=[SCguvgpip=ES\Emp^IYvymj\]jZ]UZ:U]:=]\=M\TMNT]NK]TKcT]OXyr_grRXa^PgoRYahYWhpWopo|It|Olenin,N|2001.08.05|B45|1-0|W -FVn^@OsdEU^UOUxg;LwSUdkd?Mm]V]d]>@vxIQld=OSetu>^a=]TuE^_=D_oDMTfEFogxpgopxogxpgo|Piterenka Blitz 2012|Nepomniachtchi, Ian|2012.12.29|C47|1/2-1/2|B -DTxgHPld@Om]?H]T>@sm;Jmc=DphJTcTDTwpEMvx@sm;JmcO^tf=DphJTcT^Twp?=vxEUutFVwuVO>=WN=?OF?:NWohW`:BFOh_`npineBEe\]mKsmosxEMOHMEHQ_VTV]QXWPXOP>ayEGOX]VX`>LyuL>ueGH`g>YgfHBfmBR^fRTfnYnefVMfnZRmdRJnjTLU]|4. Zurich CC Rapid|Kramnik, Vladimir|2015.02.19|A11|1-0|W -DTn^;LxgHPm]T]g]?H]cFNsd@Fwe>@vxGW^WFWt_EUumCKwv=EeW?W_QHAructGFQXFNtnLDjbDGnhAHXQHOQXOHXQHAQXIYhwNMqi@IwhMEXf>Nh^AO^OGOmoRZohEGhXOHXhGWvnHGuvCJnmJ\hoV^g_PXphYah`W_f_X_oaNQaX_gmqGDxygoXWIHWoQOofHPqoDVypKSoOVOfoOMoWPHWXHGXWG>W<>F@dnMDuc]nmnN]nkDKc\=Oxy]N\NONkc:=yxNMwu=Ec\?=fTMOscO_qi@H\dHIdv_OvfONusKT[TE]fnBRnlIHcd=EsKNFlsGW^WPWskRZK[][b[E]dbW_bZ_gkmgpmfYaxpFOZj][jn[_fV_opxonVnO]no]eoaeuxpuUpqUTahHOh_ON_QNEQITFIWEMW`FVqpVUpqUmqyLTiamUyqT\aYCS`aUVqpVnpinfiq\daOMTYQfmqhdlOFT\FN\[NF[ZFBZcBGckGOkbOgbZg:Zc:gckgOksOPmdhaskPpdOaYOWYaks|Young Stars of the World|Khairullin,I|2005.05.18|B33|1-0|W -@Om]EUxgDT]TFNnf?Tjb>@l\TKk[BR[S;EtkNVwnV^gmETvx@wv@AjZBRkc|CHN-RUS Super Go 2015|Yu, Yangyi|2015.08.01|C65j|0-1|B -FVn^@OxgO^me^OgVEUe]?Mwe>@vx?>wvDTld;LVLCLv>=>qiO^ug:;kcT]d]LTt_;KsmM_g_KO_VONV_NO_VONV_NO|Corus B|Mamedyarov, Shakhriyar|2005.01.20|C42|1/2-1/2|W -FVn^@Osd?[jb[RxnDLphEU^ULUk[RKwp>@vx;LmeU]dZKDl\]dZd@gVEUVe[dmdU^e_=uvu;LuvLVtf?>jZIQf]HX_n@IkcIPvmV`nhOUd\U_qi_Ni`N]mdDTc[<`[T]Lrs:;og^gpg`NweGWyvPOg_NEvyOP_XQXsw>VyY;?wyVfYIPOyQOVhwfeleE]ULVTLCLUL@tfGWulBRkcW_fT@gVEUVe[dmdU^e_=uvu;LuvIQqa<`tfBJwn:=aY?>ru=uvuLVf]@In`V`un>=jZOU_U=UyaGWog^gpgDT|Moscow TCh-Student Final|Amonatov, Farrukh|2010.11.30|C67|1/2-1/2|B -FVl\@OsdEU\UOUxg;Lme<`nf=Ejb>bZCKyxHPvnMTiN?OxX>?rwFWNWOWZRKRmR?MRdTKX`V^`^WT^]MF\cTY]^FMdHYUe]ME^VU]f]E]cl]_woKol^=mnwmu|FIDE Candidates 2016|Caruana, Fabiano|2016.03.28|B67i|1-0|W -FVphEUwp;LmeGWxg@Ovx?Msd>@n^W^e^U]dUO^g]L]p^aYIQlnMLtfL\^UBfnfV^yrAIrBgXUE>EBE?W`q\@xgV^e^O^jb^mgm[FnfEUwnU\n\;LvxFMkc=Xph@me?=jb@l^JRc\K\m]FV^UV]f]\KULCLtXGOXfKUdU=UuZ@ulDFsdtl>=wu=FgnIAngA:gYS;YINGIWGNWINGIWGNWING|5th Kings Tournament|Nakamura, Hikaru|2011.06.19|E12u|1/2-1/2|B -FVn^@OxgO^me^OgV;LVLELwn@m]=Dsm?=vxBRgVE>o_RZne;Lun:BwtZcjc=:bkBrtr:rkrT]VL]fLFDFmwFbrkbcwfKSqi>LnlcZlZSZxoO^e^U^flGWofLSfmH?|5th FIDE GP|Leko, Peter|2009.08.12|E15q|1-0|B -@OxgHPm]?Hl\>@phEU\UOUwpUKvx;LnfFV]VLVgV=uwuHVsdDLf^tfN`uvHdkd>^f]`Wwp^vrvKEjZLT]o:;ZRCKRKBKqiIYvnKSpLS[d[T[nk[coB;[iaEOxoW^L^O^|Tashkent FIDE GP 2014|Jakovenko, Dmitry|2014.10.23|A08|1-0|W -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vxFOtf?>smBRulKErtE?ld?Nk[R[b[N_wv>FnwL]f]V]dkHXph_iwi@wn?>k[RKvxIQtkEMmeBJum;LwvJR[SLFe]V]g]FPnwRZdUOU^U>vrv@vxW^e^GYmf@AxyOFZc:;gxYGcZL]n\G>Zu;=u`=MfXFE`EMEXf>YxiYnwvn\t\]N\l?=yxKfofEmvt=eiomltlefxwA@l\IY\l@GlmN]oef^moGFeT^fTCfewv]NCReUR\N_olFNph_evne[ltUTjb[UtlUK\fTlflK\kc\Rc[R\[SNUbZUTne\ke^kZ^VZdVWdSWPS]lrT[PH[dHQdkQYkrqaDTYPT\aY\dYQ]NPONX|FIDE World Rapid 2014|Yu, Yangyi|2014.06.16|B82|1-0|W -EUxg<`gV`Wm]FNl\?M\UNUsdDLt_@FnfGOVeWeweM_f_OWvx>@wv;EulHPdZ?GZTET]T@?vVF@rv@Old?@k[=?VNBRjbR[b[:=qa?HdVO`N>=>VH@Hv>`O>;GEphU];:OU:ZUdZBdUBZUdZBdU|63rd ch-RUS|Vitiugov, Nikita|2010.12.16|A45w|1/2-1/2|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LnfFVtbCKwS@]WTfWf:qaHP`X?Hf`^f`fLgux>Vxhg^f\<\]\^WhfVRjZBJ\[|36th Olympiad|Mamedov,Rau|2004.10.20|C45|0-1|B -EUxgDTnfHPm]@Own?Hvx>@]T=DjbBRtmDTmd<`d]TD]VD=l\U\n\=uwu;EVd?dH@Hqi`gmg>M\wGyu?FuUWNf^RcjcKTU=A=bk=;gmL]nu;CrR]LR:HPphIYqaCEovL[kdOWd[T[mgFOulW_h_V_^VOF:AN`l^`g^gEegUGHA@HI@;FavwecVN_gU^cf;CIQ^gfgwngOCKO_ne[c\T_ge^gd^UaoNFdTUMT2:>E>PX>GX`GOaiOWQYcsiqs;Ya;AahAq|Europe Blitz Ch|Sakaev, Konstantin|2002.10.03|D20|1/2-1/2|B -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mul;B>v_evwmk|EYCC B14|Azis Azizis,Ektoras|2001.08.31|B19|1-0|W -FVl\@OnfEU\UOUjb?Mw\UK\n@wvIQgVLVvVOEVvBRsm:Bun?>kcEVqiCKtb=Dm^>=vwVLo_L[h`GW`WPW^h@IxyFNhY=@wxHApg@xrx@smFVwn=FulEO]VMVf^O`gq`qyqDLjZIYm\?n\LRcdR\m\OUdcU_gVFNch_P\fPV]VMTfWNWVN|EYCC B14|Laznicka,V|2001.09.09|B93|0-1|B -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=MnfwvO^neGWruMOd\^mumU]f]>vgvT]ewELveL^lu^eweP_ugOVmuHXk[=E\TEHxwHFwxX`i`W`g`aiTLFH`aHpxwVXaA;DAIXH|World Team Ch|Mchedlishvili,M|2005.11.10|B19|1-0|W -FVn^@Osd;Lxg?[dUOU^UV^UL^gugELw\=FgnFn\n@V]TMsm?>ph=Fe^U^gx=mUVOaXOXl]@GuwXOUMhP]N=EMEGNECO]wv^fslPplepme^RZC[]T[ZNMvfTf^fmqfeMTedqidkiqkbTSZ`qY`p|Match|Nakamura, Hikaru|2004.12.10|B01o|0-1|W -FVnfEUm];Lxg<`]VLVwn`gpg@Okc?Mtk=Fld>@smDTul:ruCSxyVPwxBJnw<=g_MTwiJRWlO^m^U^_W=uxuPac\S\lZ>=u=F=iwagwn=mZumkypkdu=T?ng^gpgde=R\dWOHPRDeug^dl|Eu Rapid Ch|Volkov,S|2002.10.01|C11|1-0|W -EUm]DT]TFVxgV^g]?T]cTKsd@Ft_;Lnf>@umwgGDyw_PlPIPmp?gwg>?g?@?pPDqPNqIstIQNQHQtm?GmfGOf_QYjZCSZROP_VPXVUYaUNai]UiqUMqy2MEyANMA=|Tal Memorial Blitz 2014|Kramnik, Vladimir|2014.11.13|D20|1-0|B -FVl\;LsdGWph@Owp?Tnf>@xnV^me^eueEMn_LVenHX_UDLUO=OqaX`tmmdOGZTMTruGDdrIYnk>?uM:>wu>FkbDKpUNUMP@IPXUNbkKDXYIPYAN@aYPXA@?@kOXYxp|UKR Ch U12|Gajduk, M|2000|B23t|0-1|B -EUxgDTnf@OkcHPtb;Ebk?Hwn>@vxCKl\@uZH@>F|Corus A|Van Wely, Loek|2007.01.16|E20|1/2-1/2|B -FVmeEUxg?Mn^DLe]U^gV;EsdEV]VMVu=>=d^wv:=_eBRxwO^vnCKrv^Mn>=>v>M>wnDMe_HX_iIQo_X`ioQYneGWl\Yakc>OjbKSe]LT]eRZcZS\e\OUphaiouMLZRUOudOYduYOufO^fW^m\dmwRJwqWfqgf`g]`oiqdeLKh`KJ`X]NefJSXPNHfeSZe\Zb\TbcT]cl]Vlm_WmnoyngWOHYOG|UKR Ch U20|Ivanov, Andrey A1|2001|B07h|0-1|B -FVl\@OmeEU\UOUxg;Ljb?Fnf>@wnBRsdnu>FucGYhHFHdOYXOXQXe]AI]UHEULCLktIPtfSep`e^xqECc\Csogskqh^s\NknNWsW`WPWfonlofLTiaXahaT\ah\df]lthodlonty|Eu Blitz Ch|Van Wely,L|2002.10.02|B85|1-0|W -EUxgDTnf;LwSFNl\@F\UNUvxBJSnU]f]T]n\CS\cLRwvRcjcIQmeGNLA@vxEM]UNVgX;EXN=FN?:?tbBRueHP\TKTd\CJwtEKtdV^elO`og`Vg^W^l^J\ru\jbkFGuwGUw?@?^_UGdbj\kVMV_VKEVAG@bg?FgfF=Ar\UpU@UrA|SportAccord Blindfold Men 2012|Bologan, Viktor|2012.12.19|A01|0-1|W -@OxgDTnf;LwS=DvxBJSLDLmeFNkc?Ftk>@jZCKsmu`@AfmNGvfETcT?TfhfofIQhgS[WeGNgwEUe\NE\JUYJ:A@RJYR:CENJBNJCJRJ_;@GwtGNtLJLB:2Ld]UNG:CG@UM[cMEdeCSeuxqckSc|Tal Memorial Blitz|Grischuk,A|2008.08.30|A17|0-1|B -EUxgDTnf@Okc;LwS=DtkBJSLDLvx<`meOEsmGOrtFVqi`Yl\?M\ULUm\MFf^UG\f>@p`YPfU?=gaFMaWG?ugPGUfMDghHPWa?F`XOXagIQf`@Ie]GN]UN`i`=?xp?_wyIHgmEOogQYhi:?yqCSpy?A`YAYiNFNUNDMkbYqyqX`bTMTtT`gNFHGTVgoqpG>pwO`VX`qwn_`X`q`jZS[ng`Vgo>FofPXf]FMmwX`wfMN]T`hZRVET]E;fUNM]f;LfgMVUDL;DU;LUD|6th Tal Memorial|Carlsen, Magnus|2011.11.19|E21|1/2-1/2|B -FVnfEUm];LwSV^l\BJSLCLul=Xo_XPlo@FsdU\tmFUxnU[vx?MohGWjb[ers:;dZEjt;Ste^emdA@xoIYwyHPsuENumLT]TMTZTSTytTSbZScZRDLty@;yt;StrU^rxNUxrUTd]T[]dcdkd[dovd[mk[TkSLSvmS[h`Y`ph\dmtT\rZemtu^gulmu2|Canarias en Red prel 3rd|Sellack, Helmut|2004.05.05|C18e|1-0|W -EUxgDTnf;LwS=Dm]BJSLDLgVLDl\U\sdFNuZFxw<\usA:ZRFMwn:JsC\DCSD\nuO=ulGOlc\[lDBSK>Gu]NV]\<:\Z:@xy;:gXIQ_WLVWOHOwOV`Og`fgfQXuv@HvhGOrwNVfgJ@vxDTldT]d];LVLCLsd:;ul?>kc=DqiIQtkFne;>eWEWlWO^d^F^kdBRwvM[v^>^WgDFxwFXjb[bdRbMRmM_m_X_g_^_wn@?nf_Out?FogFMfeONemNFtT|Eesti EST, Men Ch 2003|Paernits, Rauno|2003.05.17|C42|1/2-1/2|W -DTl\@OsdEU\UOUxg;LnfBJwnFVvxUOkc@rt:tlWN^mCSurLRld=KnuGOdt@AulF?xyKCwxEKkdRLdkLRkdRLdk>=rsN@p`T\e\S\c\K\m\@\lIL]I^\U^UCUf^Ucg]V]xh@]T=DjbBRtm?=md;LdOHOsdOdkd<`rs:@nfT]f]EMw\=K\c;LvxLRwvcTC=^X?>h_W_e_=:vr>=_e@HnvHOX^OF^X=EogF=xo=DX^DKrRQ?Rr?F^XFOrb:>ohO=hoKBbrB;ox;Ayq=Dqx<=xo=Fe_FO_eOHoxA>xoEFvn>:nvF>X^>=rbH?vrDKoh?Fhq:BetNVtcGW^XCUctV]tn]dkdJR[RKTn_U\rvFEbrTovuoaXiaO_POdrtdktlkOlmELi_OdmlS[lt=>_YBRY_RTphdO_Y>nqiOkts\jY_js_nslum[cPFLEFUkH|KM FIDE GP 2015|Tomashevsky, Evgeny|2015.05.19|A11|1-0|W -@OxgHPl\?HsdEU\UOUn^UKm]<`tf>@wn`gngDT]TK\^V;EgC\fof:;TLHVuE=ELE;Cvt?=uUGOyuVqd^IYjbCDtsYauyqVyaDEUE=Esl@H^TEUTeVDa\DKlmUX|KM FIDE GP 2015|Svidler, Peter|2015.05.17|A05|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLmeIQdZKDl\EUgmBRrsR[b[U\e\;EtkE?ZT?NTN?UD=DuMN\suE;Y`IA`W\@o_V_^V|18th European Teams|Borisek,J|2011.11.11|C96|0-1|B -EUxg@Om]DTnf;Lwn@rt?=jbO^uc^dtdW^gVD;VL^LwuFOqiIQcl;Mne=Eog:=eI@AI^LUdTMKk[OFTdJR[RKRusGW^URUbZFOsSUMd\M;lk=@gVEUVe[dmdU^e_=uvu;LuvIQqa<`tf:=wSBJSLCLf]OU_U=Uk[?=vwJRjb=:rvR[b[GWwx:jxqjl|12. Karpov Int|Bacrot, Etienne|2011.10.10|C67|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb@rt=Fvx:=nuGW^WNWuc@AcUTKxyIQU^W^d^=Umn?=gXA@wGFGXG@GtuG@p`LF`XQX^XV^nY|Amber Blindfold|Anand, Viswanathan|2008.03.21|B90|0-1|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWul`gpg=Ek[>rVOQcRZKVHQPHk=MaYPXi`FORLMLlcOkckKZkcCSyu;CnwLQe]XY`Y>YwnY>cUDLUcZKtTK\]ULUTUQq|Tal Memorial Blitz|Ponomariov,R|2008.08.29|B96|0-1|B -FVl\@OmeEU\UOUxg;Lsd<`nf=Ewn>mcT?wuUWrtESu=>=nvWUc]Sek[?Mvu<;jb=?umUYqiHX]N?@NTMTmj@?[TX`i`Y`|3rd UKR Games Men|Miroshnichenko, Evgenij|2007.05.22|B65g|1/2-1/2|W -FVn^@Osd?[xg>@w\DLvxEMme<`un;EduMU\c`YufETldTcjc[RfWRDtXIQXa?>qiYPgqPW^W=Mq`OEwvQY`fMQc[QI[SU]SLCLfw]dkdIWwhWIhY>NahETvuV^h_^engDK_f:=f]I^ghNP|TCh-UKR|Nechaev,An|2008.05.21|C65|1-0|W -FVldEUm];LphV^wpGWqa@OtX?Mnf@i_NGsmLFpwCKwnDTmc?;vwT\cmKSk[\cjcBRwpM_h_OLd\U\c\S\ul\dms;kltFUyvknvnGY|It (active)|Bosque Ortega, Xavier|2005.11.20|B15i|1-0|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=MnfvxP_nS_ipiDLSJE@clMOog`WweOPm\Welq;:\VPYvxGOV`YWq_W_f_en`O@?xPU]d]T]yp=MponeOIeP|Renova FIDE GP Zug|Mamedyarov, Shakriyar|2013.04.23|B19k|1-0|W -FVl\@OnfEU\UOUsd;LulSnOW^hV^gXLVvxN\n\V\og>PXi?Mg^MhqhW^bZ\Vi_Phl^K\rjA?me<;jn?O_YOwxwhqp`qi^pipnp=epl\ftfef`XfgwngGldCKdfGWYHWXHNXYfdDLdhVPnm;GIUOIA>FXIqickOEIXiqkcEOXIOUA:qickU[:BFMBH[ekleVIOiaHBa_O>MTZR_olcKRBRT]RZ]UZRUN>HNGRBGPHNQYBZPQcdoONTOMT^MedlQPZReURZVgZ\gV\ZU=^oPWoiVPZ\=M\ZMUZ\LTldUVdeWN\tVUefNMtrUVfeMUrxT\emPaxwU]w_V^_?\dmuap?=]\=<\c<;^[;@wv:;jZMDmwBJwfWIneO^gmCSZSJSm^U^ewS[rJ[dkdLFurFUd\U[JBD=vsIPwn[Ls;=;BJ;CJZ?=]UNU\ULFZBC[rVF@wnEMmeDLvx?>tm;EwvE?nw?PqiIQphMUwpRDunFxy`OvoOYrw:?yqN`ndGW[SJSZSHQSKY_f_?:wsA;mtQNscN@tk]_?Qh`Y`_`>?f_?HvfS>fiKSaYBRYPGP_qQX`XS[Xh[dhdU]dD@H>GoG=MGDMNDlk]ljNFH?]T?@VNjnF>@HNFnV>?PXF>2V>?>HP>:|Russie-Ukraine (match blitz)|Riazantsev, Alexander|2003.12.14|D45r|0-1|B -FVl\;Lme@FxgEU\UFUjb?TnfTKk[>@wn=OulOPsdUdld?>tkBJruGOvx=wu`Nd\@GqiN\e\Emum=mgmL=p`DTm^T[b[KDkdCSyp|TCh-RUS|Rublevsky, Sergei|2008.04.13|B87|1/2-1/2|B -HPn^?Hm]EMxg;Lwn@Osd>@vxFNqiBJtfIQum@IruCS^VMVgVLFng:;f_]UQYUNYaNG@GL=G?=N?@hVHVfVkoNX>OXgojZRjZVTO^TDZRgaRTDBJRag^MgmMWm^T\BRWf^O@GOUfwqx\txowmUftdonm^RV^OVWGFWO|Eurasian Blitz Chess Cup|Shoker,S|2016.06.18|A00|0-1|B -EUxg@Om]@tT?;wt;KqaNVn`IY`Z:ZR>NX`NncsphschaRSn>ckqhSc|FIDE Candidates 2014|Kramnik, Vladimir|2014.03.23|D02l|1-0|W -DTxg;Ln^@OsdEMm]T]g]FNwn?Fvx>@tfBJjZ=Do_LRue?=ruMU^VOEfoRLeiL]o]FTxyT]u]E?]eCSZSJSemia:Sh`YWr:AIgX|74th Tata Steel GMA|Van Wely,L|2012.01.27|A28|0-1|B -EUxgDTnf;LwS=DvxBJSLDLm]@O]TLTkc<`tbTRqi`Yl\U\c\:=ucYgpgFNb?>?sd=;rs?Fc[R[s[FMwsMDdZOExwCKwnDLnm;CmdA;suKS\SJSZkETke;:eVLDVGCKux:bdlbj[kjklkHPGXKMx`IY`pMmkdmjX^T^g^DM|6th Tal Memorial|Anand, Viswanathan|2011.11.16|E36|1/2-1/2|B -@OphDTwpEUo_;LxgHPvx?Hme>@ldCKul@\UOUdU=Uul;Ee\UMwuMFtmEV\nLT]SuvIQrt@A^h>vmvaXvmXOh^O=xyCKk[]Ne\?>mfT[\[=F[Z>=ogAIZ\=EjZED\UDtftNTtb|37th Olympiad|Tiviakov, Sergei|2006.06.03|B22o|1/2-1/2|B -FVl\@Osd?[meEU\U=Utm[dmd;Lxg<`nf>vxUEqi`Wf^WPrt<;k[EF[SL]g]V]dmOEul==]VWetD<;VH=EDE?EHEewxwbjp`BJwpjZfB|FIDE GP|Topalov, Veselin|2002.04.03|B53x|0-1|W -FVmeEUxg;LphGWwp?Msd@OtX@uZLFruFU^UNEZ\CS\cE`qi`gpg:;g^OFxp@AueBRcuMQeg?gug;?gnS[d[R[nlFMwsHPscAHiaQYcg?g^gYWg^W`og`EaYEGYP|Vladimir Petrov Mem 2015|Stocek, Jiri|2015.03.07|B09b|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKvxBR[SIQme;EdZKBl\DLZdETqiTNrsN]tfo_OISLELZK:JucI?ck?NKU=an`a=_WNTk]LU]U>VU]=XwuRZs[J:]o:>omX=m_=R`gTJ[CRde]|Sberbank GM Rapid|Naiditsch, Arkadij|2013.06.06|C84|0-1|B -FVl\@OsdEU\UOUphDTxg;LdU=UmeEf]T]jb@m^U^V\GWphMFt_@sdUDSLELqiT\kc\cjcCKm]umL]m]=]f]>ETLEL]BLSg^S[_W[c|4th Zurich CC Classical|Anand, Viswanathan|2015.02.18|A22|1/2-1/2|W -DTl\;Lsd@On^HPph?HwpEMmeOExnE?n_IYqi?N_N?LD;>pLPODE>;EBMU\UNULU;>nw?HwpO_BTV]TD_opyQOUpopv>Og>f]fDVHPV^g^e^pnsuf_yxPOuUONUSnjSVNVxw_fwvjqvuqiuliqlsqn|Europe Blitz Ch|Van Wely, Loek|2002.10.02|A37|1-0|B -FVl\@OmeEU\UOUxg;Ljb@gVEUVe[dmdU^e_=uvu;LtmIQ_n?=nh<`wn=Euv:=mf`nvn@IqaLVf]V`ruEU]O`OuU=UyvUVnwVNvuHXaXQXwnN>u]IPd\BRkc>N]=DThwRZ=GdUFUf>G@\U`]tk]U[TIY>^U^v^@G^Z:;kd?Tm]TM]UYaqiAYZRYWruW_jb_\d[M[b[;[UM\LME@jb[dmdEMgmNVm\;E\fETog=Ewv@Ak[TNd\DTfUFPldGOtf?GbZN_ZRCU\U:?RKBKrJ_eueOWJKT[K[W^e^PFd\FW\TWfTLE<^fIQvs@l\M[tm[MsdGOph@ArsM;stE>wi>YmfU\iN\cjcOWfXYgugL]gYHPYu]Nu=N=XF?GdU@\VD;Ve?>uZOUZ]U[]V[eV;=;neFbtlBRSJCJwr;KgmbFlLKLpL>=rJ=eJ:e=:=F=|19th TCh-RUS 2012|Svidler, Peter|2012.04.12|D97f|1/2-1/2|W -FVl\@OnfEU\UOUsd;Lul<[SL]c]V]ktGWtQAQvwW^g^QIwpIGyiMbSKBKsKbdljGojoDKihKSoOdLOG=Mhg<;G@;B@jBKg?MO?:LNjNONphS[:rKSrsNO^VO?VNSTstTMt\CS\]MN][?We]NM[kMDksDLskWwklLKlmS[]UKDUMDEm]wxhix`]U`\ih[c|76th Tata Steel Masters|Gelfand, Boris|2014.01.21|B90e|1-0|W -FVn^@Osd?[jb[Rxg>@gVEUk[RKm]U^tfDLw\;EvxKDf_EK_hOU\ULUbZphNGfTMT[TKvw:Cog>=wnL]nfype^CJh`]Stxpixh=mfmiw`X|Tal Memorial Blitz 2014|Inarkiev, Ernesto|2014.11.13|B90|0-1|B -FVl\@OmeEU\UOUxg;Ljb@smO`ru=;m\CS\m`fof;Kxy?=ldGOgxLRwgDTghRcxg:;mcS[dt[bkbZctkT\e\=unuN\gm\Gqi@AyqKMbZM[mg[bkockulGjgaks2lsjsoWbZWNZ>h`F?aP>P`PIPNLsjiaA@p`jGqh;sL;KGNKD?Fgh@GDC>=Cs=msyF?aYPXhgmlghljytjntd?FdtF[tD[FDdnjdtjbhgbctlF=lLcsgp=FLlsrldrb|15th ETC|Perez Candelario, Manuel|2005.07.30|B90k|1-0|B -EUm]DTld@Oxg;Lnf<`qi`gugFNsm=DphT]f]?MwpIYvxYah`LFgnFPmgM_gV_V]VPVt_OErvGO_qHXo_X_q_A@`X@X_XOXnY>FYXFMvnD=X_BRxy:@]T=RjbRTk[TDtk@mcV\c]=R]l?Glf\MtmRJflM\l[JRrsmML^srRKNG@GMKBKc[^UjZSZrZ>nd\UgZBGO\THQtwKT[TnlBIQ?|67th ch-RUS 2014|Nepomniachtchi, Ian|2014.11.29|A03|1-0|B -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLg`JDdnIY`iBR[RDSvx=Rn]S]bZ?[xyCSo_[drjV_t_SZ_Md[M[R[jo>@uY[FiWHPWPGPYPFHo?:?w?@?PM?@^VHGM=G?=X@GqaG>X`?TaYZb`P>EYQbjPGE<|Corus A|Shirov,A|2007.01.19|B33|1-0|W -EUm]DT]T@OxgFNnf?Tjb>@l\U\w\=uvuO^unTFtmFOsd^mgmOdkd@vxL]g]T]k]E]mg]Ee]BRusRZnSE`gm?=s[FPrZ:ZSZIYZu`EmcCKuYEiYPGP[\@I\DP^og=@xn;EntO>d\FM_hDLwnMhqh>M\TMWk[=XtcEOmwHPumIYyxCKvtO`mvKTcTWMwmXOxw`qwyq`yw`qwyq`yw|20. Amber Rapid|Topalov, Veselin|2011.03.13|B12|1/2-1/2|W -EUxgDTnf@OkcHPtb;Ebk?Hwn>@vxCKl\\UOUkH@HulFVsdEOjbUdldOUdk=OgmV^kOUOm^O^e^C^wt>=rjBRbZ=Mog^Wxo:=ovWNtdPXphHOjrOVruMunuGWg_X_|Baku FIDE Grand Prix 2014|Andreikin, Dmitry|2014.10.14|E15f|1/2-1/2|B -FVn^@Osd?[phDLjb[TmeEUwp>@unU^e^CKtfT]dund>NpwJwywIQXfNMgpO`qi`fof]dud=Ek[TNiaBRrsR[b[:bduLT[ST\pnNTn\bZ\dT^dVMN|TCh-FRA Top 16 Gp A|Govciyan,P|2006.03.30|C60|1-0|W -FVn^@Osd?[jb[RphIYqiDLmeEUtmU]dnLTxg;LwpRDmX=MvxO@ldGOXm@Fk[CK[SL=d]T]m[MEgaDM[MEMo_@vx?EH`WHI>NIHNKHpK;pqWXYQXPQIPHqaHAa[;KcHPZRPWRJ>=]T=@uYEeYne\n\;Dhv=]^]T]RJCJvmDVwr?<\eNTrt@tXEMsmIQXaDTnfT]f];Lw\MU\eOYvx=Dwv<`ahYhqhQYmwFV]VLVenV\n\U\wfDTuUTUfU?=ru@?UfCSu=:=xw`vuC^gv?Fog^Cl]BJvlF?bZSZurHVwo>;rZCUZj;KlfV]d]\dfUdkUdks2dsKsjJskoxkmJZ?Fxqmuh`Y`g`uephF>|It (active)|Malakhov, Vladimir|2005.11.18|A07|1/2-1/2|B -EUxgDTph;Lm]T]g]FV]LCLwp@Ol\:;vx?F\ULUuZ@tXENsdU]dZN`kc`nwv]eZdF[dn[vrvenBJIQXO=OJn?>pU;=n^OMU\Mbvn>Fqa=]^f]uxpb:f^:^n^@?jZurh`GOaYFEo_V_pgHXYP?Hg_HP^>E]>^]^_^PX\Nruc[us[Ss[^U[ZSKZ[UT[KTKQY`YXYKT|66th ch-RUS 2013|Svidler, Peter|2013.10.14|D85s|1/2-1/2|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvuIQtm;LkcHX_nO`uvGWog^gpg`VvoW_qaX`n_VgmfLFwpgVywVPoxPafTapxp?GrvFWv>@IT]W]d]CKph:C:h`:^ldGH`iHFihDLwvI@vn@GnoG>oq^shg>EqQsj|75th Tata Steel GpA|Harikrishna, Pendyala|2013.01.22|C67r|1/2-1/2|W -EUm]DTld;LxgFNnf@Osm=Dwe?M]TMTvx>@jbTMqiBJd\U\m\MFk[CS\mLVulDlelVgmgnw>VTVLV\tYatv=>xyaiv^>A^_JR_hMUh_UTyxRZsrZb_mTKrbipxpKLogAqpqVg|ch-UKR|Pavlov,Ma|2003.11.07|B90|1-0|W -FVn^@Osd?[jb[Rxg>@wnEMmeDLvx?>k[RDe];E]UBRrsR[b[IQgmEKULCL[SLTm\vnA?rx>Yi`YQc\CKbZMTdmFU\^?>`WHPWPIPxPQA^`U_f_V_nwA]wp>npinmP@me@=]=aY=UywefYQfV`_VW_`WYihYQ|ACP Blitz Prelim1|Timofeev,Ar|2004.04.12|B67|1-0|W -FVl\@OsdEU\UOUnf;LjbUdkd?Mm]>@xg?>wnV^gm=XvwCKd\LRtkDT]UFrx:?luRCuvMVkVFVyaGFa_CMmwWYQHPvdEFbZ>?dV?>Vd>?dV?>|20th TCh-RUS 2013|Ivanchuk, Vassily|2013.04.09|B46e|1/2-1/2|W -FVn^@Osd?[xgEMw\>@dUOU\UDLUc;Jld[RmeRKjZJTcl<`qi`Yp`YPiaGOtfTNaYPGe]?>vwIQlc=DgaMU^ULUaWNXZRKR]V>Vf_:=wpRKulXN_hNTyv@AcjT^hVOVv^U^jGDGruG>u=>=l^=m^gV^ghAIkc^fWfmd|4th Zurich CC Classical|Caruana, Fabiano|2015.02.15|C65j|1/2-1/2|W -EUxgDTnf@OkcHPtbCKwS@rtFVd\V]f]U\]T\cmc?>TK=Kwv:=nwE?ul>vtv?NbkHklkK[vtLUtuUcu=N=jc=CkVCRV>@H>VH@V>@H>V|5th FIDE GP|Kasimdzhanov, Rustam|2009.08.09|E15s|1/2-1/2|B -EUxg@gXHPeiIYrj@HjnEO^VOIXIHIp`?A`YI@YQ\bnjb\j:=:tX@Iig:CgOA@vrLTxpT]d]KSrs\bscblcSCBSRBCRZlvphvlqaCDhqDCOg@@wn?>k[RKvxIQmeDLdZKDl\EUgmBRrsR[b[CKulU]\TKSZKDKTK=Ko_<`mcV_w_`nln;EtkOU_wUdnoGOstdjk]KDtuj[cTET]T:jog[JToLT^VOVgUDGULGNLS>;S\N\e\;kusklstV^qaltwtJ[tw[eaYjlohl\hM\]w?@IMh]U?>T\>@ldDTjZBJf^T]d]PXahOYwvYhqhFNm\=;]UKSZSJS\f:rurETeST^S\^TrjC@n_BRwnRZvxDT]TFT_YOYnY=Frt@Z\@AjZ:>rv>Vn^]fmf?>fmEWvV>VmdVT\GWUGUTUe]A@pg@Gg^GNwvNMdkDLSLCLkbMEbkOW^eK]k]LTe\U]\S][SRHPvVEMVn[cnmMLmlc;|SportAccord Blitz Men 2012|Radjabov, Teimour|2012.12.16|B77|1-0|W -@Om]EUxgDTld;Lnf<`qi`gugFNsm=DphT]f]?Mwp>@vxCSge:;mcOEtfLFwt?@ogCSn^WPum=KrvFOxyIQd[U^[?@?]UNUmULMUc^gcgM=wo?@on@Ik[JRqaQYn>R[b[KM>=O=vuMFuU=DUSFvyqDMSKM[gwvFKCFMwg[TCcM]gwTMqyMVwnGOcf]ryqV]p^]fnYI@YPrxqi@?PWxtWEtw^pwJE=?GpUGP=>PI>fJwUp|19th Amber Rapid|Dominguez Perez,L|2010.03.19|D13|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxEUtX;ohGOg_V_h_;>_M@A^V]W\tWMVM>=vN:;weT\t\Zk\]ke]e;KbZKJe]A@xo@GNFG?FN?GNFG?Ff=M]MJMZRMJfb?FofFMf]MDqaJNbfNJfbJNbfNJfdDCdbCD]^HP^UJMUTMmphmnRJnVT]D;bc;BcCBJCHPXHPVW]^WV^]VWPQJC]^WV^gXahaCDQODEg`EFOwVnaYnp`apqaXqpXQphQIhXYQXpwrFGrBG?BHpoIAoOQIOwHX|10th World Teams 2015|Sutovsky, Emil|2015.04.28|C91c|1/2-1/2|B -FVn^@Osd?[xgEMw\[dmd;EvxETgm=FwvJBDC]U>EUME@me;EgaYnunETaWTNngHPWQ@Adn[TldTKnh=FjZBRtfKfofOEe]FaQ`IY`OEOgOaOwOAHOo?>iaN?xw?Ewn>FneEOrwO`on:>wv`OhyMU^UOUphFNyoV^emNOoiOgnpCSZSLSixgOxiRZi_UKmlK\ls>;sjOMplMJ_U;=U_HQ_iGOlo=Ui_UEoqJKvnEMqyK;yqS[d[;[]U[cnl\flLfWqlW]LM]ljsl[stchMOQHOK[e_eheKN^ftleUNfU]fiHOlsOWsjW`iy`g|WCh 2016|Carlsen,M|2016.11.24|C65|1-0|B -HPl\?HsdFVph@FwpDLn^EMxn@ZRGW^WFWxyEOqiMU\ULUk[=EdZ:=ZTEGtkV^TNGNuc^fo_OYyqHkckYOrtIYkV?>VN>NpgNLh`Y`i`WFn]Ltwt=MqhFL]LMLtLCLe]O>gn>Dhg@GgfGO`XOGneGHfgHGg`|Tal Memorial Blitz 2014|Svidler, Peter|2014.11.14|A00|0-1|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn@Zl?=kcEFd^M[h`OW^hW`og`gwg@Al^GOuw=?hY[mgO?O^VmfxyNUVOFOwOUpypA@pgfXOWIQYh@HWRHPRB@rtBRmcRZcTFTfT?>wnNcumK=mlM>gaScTU=U^UcdldLFdVJOV^>M^ZOkZ`krxqrOf]|Corus A|Smeets, Jan|2009.01.18|B90l|1/2-1/2|B -FVl\@Ome?TxgEMnfTKsd>@wnDLe]V^gmKRul?>qi@jb:un>:_h:>h_>:nu:>|2. Governor's Cup|Komliakov, Viktor|2001.11.20|B50|1/2-1/2|B -EUxgDTph;LwpFVmeGOvx@gaHXuYXaYP@AmQ?@PY@HQXA@XOW_p^N`^I@?OH?HYPHAog`iPYAHYPHAPYAHYPHA|Renova FIDE GP Zug|Giri, Anish|2013.04.26|E81m|1/2-1/2|W -EUm]DTld@OxgFNjb?MtX;EnfCKsm@wn=;\UCU]g?@gVEUVe[dmdU^e_=uvu?=uv;LqiIQwSLFp`HX_nFPnhPatf@jZBRsbOHgm=Fng@IucGWf^V]^W?Wd]H]rvWVg^ETc\]ko_MU\lk]xyV^m^T^bS]KSd@ng?=dnCgwgHPkb[bgbDLbc:@e]IQwe?>ywW^e^^_DL]g]^]DK]MKB:BruMPu=@IwuBD=MPXuUX`U]`]M]DTpgTRh`IPg_PO][RV[KVNZRHX_gOVKNVNg^NG^gGPgfQY`YPYfgYagpa`pq`gqiX`iqgoqyoh|Match|Nakamura, Hikaru|2004.12.13|B23e|1-0|B -FVl\@OmeEU\UOUxgGOn^UKjZ;Lsd@vx@AkcKEm\DLn`N`u`CS\b[drsBJo_ET`u:;blSZtbZcbTclul?GljA@jJ;xo<:bTdRU]RD]a:jogjle]ldg^dlaIln^UDRIA>EF>2n>A>E>UN|Pedro Zabala (6eme memorial)|Zhang Pengxiang|2004.10.12|B54|0-1|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vx<`tf`gngBRsdL]g`RZrtFXdsXfof]ctdDLsmcmum=Fws?=moKE`E=Ek[ZcscIYqiYaok@IcK:=knEMdc=EbZHPZRIHxqFXKCXhqyMeceECRJCkemksmusunuhfurfBrVGOVRHGRZBfZjGHjrfB^VOVrVHGVnB]njGOjs]ZseOHyxLTxoHQonPXeMQYMT|XIII TCh-RUS|Areshchenko, Alexander|2006.04.28|B92j|1/2-1/2|B -EUxgDTnf@Okc;LtkBJm]T]g]FNph?[ld[MwpLRul>@vxNV]WMDd\U\c\@wn;Lvx?=uckH>HskJR|Corus A|Kramnik, Vladimir|2010.01.31|E15|1/2-1/2|B -@Ol\DTsdHPn^;Lph?Hwp>@meBJxnEMvxO>tfL]rs>Dk[:;jZ@gVEUVe[dmdU^e_=uvu;LuvIQkcFTHX_YWPYhGWuMW_T]I?hY>FYO@G]VFVO`VF`QGHQ`FEME?Eqa:AphPYaX_g`OEOXOHOh`gn`YOXvnXQnfA?yq?>d\>Fc[CKf]FE]fEuqaurf^rj^ejbldbjo_BR_Wjo\TR[|Tal Memorial Blitz|Kramnik, Vladimir|2008.08.30|C67|0-1|W -FVphEUme;Lld@vxBJtk=>jZ>Y[SJSZS:rkrLFcRN@tXIQqaEMug;Exn?>nhMUhWQXaXHPXO=OWfU^g^EKphAvxAY^gOFgdFNwu=AuvGOdRNFvuYqRJFDpgV^g^LUuUDFJLqy|4th ACP World Rapid Cup|Shirov,A|2010.05.28|C69|1-0|W -FVn^@Osd?[xg>@gV?>VeO^wn[?e_DLd^>^me^>vxEUe];EneEO_n?Mt_=D_MDMogFm_M_n_HX_n:>xoEWeWFnoxOYWenmphYHwomoxoIQryHNldBRjZCKyv@?vV>FeWNHWeGOVfFfofOWd\?Fg_X`\U|40th Olympiad Open|Polgar, Judit|2012.09.01|C67d|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUul;EZdU]duCKtmE?bZBR\TKTlT:twHPWiT\e\:Rlm@HrRDRo_RTme?IipIO_WPXwvT[pgOEewEOh`O>wp[\pl>MvtLTxy\[yxT\trdSru]elp[TpoS]xp\duedleulu2guM^ofTUug]gfg^OgUOUpgUOghH?qi?FhgFM|Kiev Diawest|Shredder 7.0 256MB Athlon 1200 MHz|2003.06.20|C98|1-0|W -FVl\;LmeGWph@Owp?[tm[Tsd>@xgV^gaO`nfEUvxU]dZTFf]L]e^FamdaOqi`Q^VOVwvVOpU@Ad]O]u]DLvnLUrvW_h`=XnVXPog|Sportaccord WMG Blitz|Nielsen,PH|2011.12.13|B23|1-0|W -FVn^@Osd?[xgEMw\DLvx>@meIQdnMU\c?>e]O^gV;EVe[?ldCKwvBRnh^hv>=>qhNtf:>cl?Mf_EO_MNMeVOEVEMEleJeueHPem@Hrv>NxwQYm_NvwvENvmNO_OHOmfOXk[XWfePXefW`feYahaXad\U\e\R[\[GWZRKR[RW_RK_gpg`gKLai]UiqUMqy2MEgoLDytDCtkCDkVDTV>GVMG>MN>=f]=DNF|SportAccord Basque Men 2013|Le, Quang Liem|2013.12.18|C65j|1-0|W -EUxgDTnf;LwS=Dm]T]u]@O]_DKsd@qi?=h`FNxqCSjbO>qh>MVH@HvVEDiaLCruHOVYOH`XQXaXM^e^=uduC^ldDEufEmYa^Lk[HPa_mef`PH_GHG`VGHVe|SportAccord Blitz Men 2013|Mamedyarov, Shakhriyar|2013.12.14|E34|0-1|B -FVn^@OsdEU^UOUw\Udug=Ekd?Mxn>@vx;Lm]EWgWwvGOxo@Gv>G>tv>Eh^CKd\IY^dYavf:A]UA>f>P>ULELofLMjbMVdnHXn]OW]gVOphahqh>Lg]LC]SBJSMCLM@xgEMvxBRjbDLme?>\jIQdnMUnh;EldT?bZU^e^=DtfETulCSZSLSk[TN[R:RjN@wnEMk[RKmeBRtmDLvxKDwv?>[S;ErsE?nw<`qi`YwnIQgqYPq`?EngRZSLCLdjDKj[=D`fE?f`?EutKRvuO`g`EO`gPYp`YPgpOEmfGOtkPGkrE?[jQYjdY`i`DEogMUdZU]fo?NZKRKsKN_us_nxwndKCE;CS;S\Sftwotlohlm|SportAccord Rapid Men 2012|Aronian, Levon|2012.12.15|C84|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQwnHX_YOYnY?=Yn@Htf@JZ`gpgFXvx@AxyLFe]FU]VMVZ]V]f]Udn\XOtfdS\S;SrsSRf_O]_DRWbZIQs[]T[S?GDhAIwuTKSWGWypWTuEIPh;TXpiXRg_RZ;VZbipPWEGW^GHQYqaK=HI^WIGW`GH`WHGW^GIbjphjbhpbj|World Team Ch|Zhang, Zhong|2005.11.07|B97d|1/2-1/2|B -EUxgDTnf@Om];Lld<`qi`gug=KgnFV]VLVnSVLSKBKp`IY`XO^wpGWXOHOp^U^smOWyx?Qo_KSk[T\jZ>GtkAlk>DblNGmv;=vm=MktMelvDUve^etuYapxUdmdOdxXGNXPNUPKU^KSdkST\d[S^f|10th World Teams 2015|Sargissian, Gabriel|2015.04.26|D43q|1-0|B -EUxgDTnf;LwSFNvx?Ml\@Om]>@]TMT\UNUjbBRsd<`qi`YSn?>tm=Fg]YPnS><]nO^d^F^mdTMrt<=uZ^ZSZPewvCSZle\n]L]d]RZvuHPle\cuwc\e\U\]O=>wuMVOV>Vxw:;wn@?u]IYnmVWog;>tvWVp`Y`i`PXf^?Fvy>@SnBJjZCKm]FNwutswu>=\^DLUf=ufucs^]LT|TCh-RUS|Iljushin,A|2008.04.12|C11|1-0|W -@Om]DT]T;Jl\JTsdHPog?Hn^>@tfEMxnTNn]=K]WKkWF@Autk[rs[RsSR=F<:wnHQd^O^g^=afoa^tdQHdgTevweogo<\og\twoH]|2. Governor's Cup|Miroshnichenko, Evgenij|2001.11.23|A09|1-0|B -DTxg;Ln^HPm]T]g]?H]cEMwn@ld=Km\KDtXCS\mIQX_OEqi<;rt?@me?=jbUKulD\NV_VkpFO>OaOPOVOphgphb\@smCKl\@uc=FtbBRm\R[bk:rkrOUce[c\MFMecpq>=qp=@wn;Evx?>jb[Rk[RKdZDLZKBKl\E?qiIQwvHXe]=Ftk?P\TKT[TMTgVPV]VOEbZEVZRGOul?RJCJ\NFNlLNOog@ALC?;CU;CD>?EMOHDKAIKJQYJL?GL>X`i`Y`g`H?>?G?MN?_NV_`xoIPphPHog`PVFHOFBPXBJOGg_XSh`ST^VTt_WtwWXwvVNG?XOvwOPwv`XvnJ:?FPHnN:BF>XPNvH@vxPHxsBj|3rd UKR Games Men|Vovk,A|2007.05.22|C66|0-1|B -@Om]HPld?Ht_EMnf;EqiFV_q>@we=FxnOYp`YOsmCSul:;vtDT`XO>ia>De^MU^pEKf^V]d]K\mcT]n]=>n>H?]LbTLF@HFUT\UO\[sl[ZlmZauwaX|2. Norway Blitz 2014|Topalov, Veselin|2014.06.02|A07|1-0|W -EUxgDTnf@OkcBJtk;Lm]T]g]FNph?[ld[Mwp>@vxLVulktJR[RKRuvIQrs^hsc>vqh<>cgW^T^U^g_vwpwRvtf\fof>@wvEWmwO^bkL[wf^dumdnvnBRld[LfWPWjZFNkb?>rt@AgX=ObMOPtv>@o_HQXiPYxy@`me`anoQ?eJ<=MD=EJ<|World Rapid Final|Gelfand,B|2012.07.06|E15|0-1|B -FVnfEUm];LxgV^gmGWl\@Osd?aYEKZcPYwyYahoIHpiH`rxFGcu`xyxKUxX?FoaF>uZ>?TE?FXHFNHGNGEVMVZEGPEU|6. World Blitz|Andreikin, Dmitry|2010.11.17|C11|0-1|W -FVn^?TxgEMsd@Ow\DLvxTKmeIQdn>@nh?>\c;EqiMUwvKDldE?tm?Pul?me;LtfTKsmEUp`@OYaIYqi?@`XO>fKBKxg>MXP=OaOHOmsLFsdDLyx@He]V^gaFWaWMWvtWakcagxyYatkHPdZKSZK:;jZSZcZ@ph;LwpEU\U=UmeCKsm@f^T]d]NV^UL]g]V]qi?=m^OUtXMFrtDKwv@vx=EsmBRrt?=ulRZwuE>qi=Em\K\e\EutuCKld:RuUGOURLR\T>Ld[NEgmFTfTLT[TKTog@?xo?FofHXmsIYsdELp`YafeRcefc]n\FMfoLE\wELw\MEofE<\J<;J\;BfoBKofKRfoLE\GENG>DLofNc>ERKfoKDEW]SdsSMsmcjofT\fnMSnf\dkdSbfebsmwjcwfZbflclelbj|4th YM|Naiditsch, Arkadij|2003.09.17|B92n|1-0|B -FVl\@OmeEU\UOUxg;LphwW`VLVK]nf]VxwDlwnlkneAYAVAmRAOaYkqUgqaguMURKELZRayugyieniqnwOXwxqkxwkKgULURKULwnLKf^KTngTMg`Xt`WMFWPFNYQtQ^VNV|FIDE World Rapid 2014|Carlsen, Magnus|2014.06.17|B78|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwn=>v>^EMg_YT^]TU]^GW^>U]>@]_@H_`H`W`xpMVphVWc[LT[SWXjZXWldWXd\XWo_`ghgWVgfVWfgWV|SportAccord Rapid Men 2013|Wang, Hao|2013.12.13|C42|1/2-1/2|W -FVn^@Osd?Tw\CS\SDLSnEUdZTMmeU^e^O^xg>@vx=Dl\;Eul^TZTMTneIQwvtQHQlmDMmMTMWE>FEW?>W^LTruC^v^GW^aFNgXMFXNFaNTV^phaOkcAHuEHPEB^fof>fxwfdTNdlqiOVN_PX_nQYBRVOwolmofmuRUuyfoyqogOF\TXOTL|FIDE World Rapid 2014|Kryvoruchko, Yuriy|2014.06.18|C51|0-1|B -FVl\@Osd?[ph>@wpDLxg?>vxIQuc[?me;JtmEMruJTcl=]L=euvkowoKovwonZ\IPL=ef\nfnpU@I=GnkUjP^yxkp|WY ol|Gareev,T|2002.08.21|B31|1-0|W -FVldEUm]V^t_@Onf?Fxn>@d\DTsdU\]UFM_M=MnhMVw\BJjZ;E\c:;ZRCSRK;KvxT\c\Kku]V]f]EK\JLTlmdSHPqi>nSdn>T\@HdS>nSdn>wsIYst>;]UOU|5th Kings Tournament|Carlsen, Magnus|2011.06.14|B12t|1/2-1/2|W -EUxgDTnf;LwS=Dm]T]f]<`l\U\qi`YvxFNp`YPgV@Osm?Fm\>@SLCLt_DCucCScSLSVLS\LF@AwtOUFUNUtv?>ogA@xoGOv>:>rv@Gv>|2nd FIDE GP|Gelfand, Boris|2008.08.13|E35|1/2-1/2|B -EUxgDTnf;LwS=DmeBJSLDLsmHPvx?HjZCKf^@OwvU^e^>@un@we<`ulLVeI@AIWVgmg`gpgDTvtFOts:=qaCSumS[d\U]W^=>aYBRlZMJZE>NESJBf]NMyu?<]TMmumBDTL<=SCOVmE=ELED=CU|41st Olympiad Open 2014|Iotov, Valentin|2014.08.06|B01c|0-1|W -FVl\@OmeEUxg;L\UOUph@UMCS\cBRjbu]LT]_T\cZJSZSKSyuEVgV>VMEVUuUSU_]UWox?=r:WX]VXaV>|Europe Blitz Ch|Nielsen, Peter Heine|2002.10.02|C54|0-1|W -FVn^@Osd?[xgEMw\DLvx>@meIQdnMU\c[Mnh?>wv;EldE?e]<`]V>Vqi`gugVNt_M_g_?P_mO^h^N^v^U^mn=aphaFn`@?xw:>rvFMv^Me^nPV`_>FcleU_^Uj^IVPlPFnIA?FwnjNngNPA;PWgpWUpxUS;BSkBTFNT\NO\]OP]`PI`WI@W<@I@gVEUVe[dmdU^e_=uvu?=uv;L_nOUtXGOXmLVru<`kc=>yxBRut:=jbRZd\UFn_FWmfZclcW]f]=]_UDLUf>=f`V`wn`Vtu@Gu]=]nuOWvnLTulGOxsHXluIYc[T[s[]\[CW_CKOWuc_gpg^gnm\^|65th ch-RUS|Grischuk, Alexander|2012.08.03|C67v|1/2-1/2|B -EUm]DTld;LxgFNnf@Osm?M]TMTk[TMjbNVd\V^\UL[b[^gpg>@uc=Ftb?=rujcLpO]TMenp^og^WcU>FULS[LZWNneGOZSPX_XOX]HFGH]Mqg_QYe^X`]T`h^g[cT]N`gpYaSLGNLCNMC^MN^C`nf^aipinwi`hpCUNF|It (active)|Dreev, Aleksey|2005.11.19|D49|1/2-1/2|B -@OxgDTl\HPsd?Hm]T]g];L]lBJphEMwp@tmLVkcCS\SMUo_VEflNWl]O^p^W^d^H]md]d^dJSu]EOvx=RdUOU]U|Eurasian Blitz Chess Cup|Svidler,P|2016.06.19|A15|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljbrt?M[SL]f]V]bZW^m^M_tsN`ZRKUg]UOn`=]`gO^g^_mlm]^vw>EyiA=md^]SKDKRK]eKB;:ieEede=esreEwnEMo_HPYPMPngCS_WPKg^S[^VKSVNSKNGKCGPCBrsBJWO:Cs[CDPHJj[`DMOGjBH@|ISYG-M14|Lanin,A|2002.06.22|B90|0-1|B -EUxg@OnfDTkcHPtbCKwS@m]=Dsm?=vxEWgaW@HrwXY>VGWVUQ_U]HO\f_V]ei_fU_UeUVqypq_wyYXpwIYUEBREU_VURW_c[XWRTOHwpWXpiHQ[S|World Blitz Final|Jumabayev,R|2012.07.10|E15|0-1|B -EUxgDTnf@OkcHPtbCKwS@m]=Dvx?=smBRd\;JbkDCgVE>ngFNjbKSrs:Zut;Mm^W^pi<;kd=?dRT]f]HQ\TQtstJTtT;sRvMKnf@HTtKktDHAVPA@iN|4th ACP World Rapid Cup|Drozdovskij,Y|2010.05.27|E15|0-1|B -FVl\@Ome?TxgEMnfTKwnDLvx>@sd=Fkc;EtbKDulBJgm?>ngE?m^?PruPagnO^d^GW^mW_phaWm^_fltW]tf?gpW^p^DK\TKTbTMTt\@Avt:=\TFTtT?>qaHPxwAHwnHOnf=]jb]EfmONc[NMbZEDZR>;mdCKRK;Ko_V_h_KSe]JR[RST]TMT_WPW^WTSd]LT]USRUMRKaYT\Wl\dYQDLMVLQV]QL|Premier|McShane, Luke J.|2002.12.30|B50h|1-0|B -EUxgDTnf@OkcHPtbCKwS@sdEWdZ:^gWagi=XihXQruaWhg]VphW]gp;@nf?>wnEU\ULUe]V]g]=KucF[sdO^X_;Lru[dkdKcjc^duednvn<]LEL_VCSedRZrtLEd@wnEMvx@sd=F\U?=wnNUvx;LdS<`wvO^g]`nvn:@me;Ejb[dkdMU^ULU\c=DwvIQgVEVt_<`_VDVvV`uru:uv>VvV@?xwOEVSCKwn?FnmGOSsEV\cFMo_VLld<>swLRcjRCwsCTs[>F[]MDqaF>aY>F]\DM\[MD[sDMj\F>sv>vmvOWvmTE\cEOcuKSugMTmlOElcTKe]E?gU?Ed\S\c\EOUgBJ\[O>bZJR[\>O]UOEUMEO\]KB]VBKVWKTWN|VI World Blitz|Movsesian,S|2010.11.18|C65|0-1|B -EUxgDTnfHPm]@Own?Hvx>@]T=DjbDTk[TDtk@tXENsdU]dZN\XOFOwvV^p^]eBfO]fgenrt\jvn=OgO]OZTjNtl?=xpIQo_Njk[jsl\s^T^OFnkGW^T=UTN;KNDUE[SF=DJ=O\<@IJTEUknKSTNIP@tX;Lrt:@wS=F_hNVvxTMhaV^g]L]d]FNwvO`ahMhohRZSZNOmwOoxyokuc`oyxoeckekZc@uZTM>=M[=>[dI@JR>YQHQaiGvaA@ihIAhHQYyqGNqp@HpHAIkc|FIDE World Cup 2013|Andreikin, Dmitry|2013.08.21|C10c|1/2-1/2|W -EUxgDTnf;LwS=DvxBJSLDLme@OwvHPunCSf^U^e^X`>:hd:@dlqx`h@`|65th ch-RUS|Alekseev,Evgeny|2012.08.10|E32|1-0|W -EUm]DTld@OxgT]d];Lsd@vxO^dZK=k[HX_hIYqi^hohFMuvGOiaX`gm=DwWNWxq<>mwLFZTMT[TCKjlD;ne>e^UGTLf\]fFlTGjWeFfeljGTWGNWIH?]=|4th ACP World Rapid Cup|Grischuk,A|2010.05.28|D13|0-1|B -EUxgDTnf;LwSFNvx@Fm]BJSnT]f]FWwv?Mne>@eWNWsdLFgVTM>=MT=@sm^mnm?=wuTFjZGOmn:@xgEKsdKUdUOUwnDLelTKvx=Otm?>wvIQruFg]K]f]:>n\Fvuv>vmvO]\U]UcULUvdGOd]BJog@GxoQYqaHXphXa|4. Zurich CC Rapid|Nakamura, Hikaru|2015.02.19|C07|1/2-1/2|W -FVn^@Osd?[xgEMw\DLvx>@meIQdn[RnhMU\c?>tmRDwv;EqiETm[OE^UTcjcLUl\U]gmEOugFWF=FgCF=rB:BCBEWmgWevVDVgVePVL=>|World Teams 2013|Khenkin, Igor|2013.11.30|C65j|1-0|W -EUm]DTldFNxg?Mn^;L^VMDweGOvxOVgVDV]VLVeSGNv@OtfCKsmA>ogOEf_BRmwRZwf>NfWE?_D:JDVHPWQGFg_?EVHZbkcJ:p`FMc[T\_WLZ|VI World Blitz|Caruana,F|2010.11.16|D10|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwO`vnU]dZKDldCSZTET[T]dkd`Oqi=Frt>=ulBRlkOEe]:;gVEV]VS[b[R[d[@ld=DsmEWkcT]d]?@ulCKVL=Eog@]T=DjbBRtmDTmdVH>Hws?;gVHW]mWMVECEk[R[s[;[m[LT[T:ZrZEZTUZlUelteutkne@HqaIQ|76th Tata Steel Masters|Giri, Anish|2014.01.25|E05m|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBR[S;EvxRZtfETrs@sdUFwnFPvx@Ak[BJtkGWulPawv@m]=Dvx?=smBRd\T]g];LrtDCbkU\m\EWuvW^og^Uvo:<]LEp^O^uUENUuA@sdBJSLCLulEHyxonPHVHxHiY>EkcHpnep^em^_mv_^vm^]mn]^nm^pmfpX|FIDE World Blitz 2014|Laznicka, Viktor|2014.06.19|E59|1-0|B -EUm]DTld@Oxg;LjbBRnfHP]T?Hd\>@\UOUsmUDw\DNm^=uvuRZrsLR\SGW^XNTtmIQm[CKXiPXgmW_f_@xg=Fm]CKtkvxHPWiV^gmL=d\GWwuA@ld=G\TKTm\T]u]GVruV\]\FVdVMVkV>V\DVUut?=p`Uutu=uxpW_`XCJiN@?DG?>G_JwphweqaurN@rb@IbJaYPYXPJrhq|19. Amber Blindfold|Ivanchuk, Vassily|2010.03.15|B46|0-1|W -FVn^@OsdEU^UOUxgUdkdV^un=Fg];ErsDT]SEOd\HPnf?Hwn>@tkCKvxqiCLnw:=krLSsSFEvuOYSsH]r]T]fQEDsS>VSVDVuvYHp`HNwpNTme=>p^VHQmHO^U>VxwTEvVEVmnPXn^VPwp@H^gPa|ch-RSCU Blitz|Nepomniachtchi, Ian|2011.01.09|C45|1-0|B -FVphEUwp;LldGWm]V^xi@Oog@smIQi_NGXOFOg^U^nfLFh`HP`WPWun@AxyDLwxFU_UGUrwOXd\UNms=Fsd:=kcCKnmBJdnKSmdAIn_N@qi;EsmEK_hBRn_RZrtDTwnT]d]FMvxHX_YOYnYMhoh=Mh`@HulwGNGFGHAsb>?GF;:bS:jSMK@l\U]tXMTgmIQXO=OrsOMblBRmcTBumRZcRL=k[DT[TMDsSBTl[:B[UDMwsBJmk@AUKTKSKJKkKMbK[b[s[?G[ZGDZ[=L[SLRSRV^pi^eneHPRUDEUTE=ipW_p^_hqhAH^C@wn?>meDLtXEMvx=vu=MpwRZumP?nuMmum?EwnTLn`@I`NLNmUNUfUETogTeUDekDSIPxoPOonONSDNMDUkeqaMTaYetnmtcmlcRUfHPh`RL`XPYXQLFQIFPfWPAlmTLmnLEnoENWfNOf\OP\VPHd\GOVEHI\TIPEK|6. EICC playoff|Aronian, Levon|2005.07.02|C87|0-1|W -EUxgGkdCSvVGOuv:F>H>l]>HjbRZo_<>v>H>]LONL]NU]SU\S]\d]NdcNTcbpib[TZ[ZiaZSaYSLYPLE|World Rapid 2015|Safarli, Eltaj|2015.10.12|A45|1/2-1/2|W -EUxgDTnf@Okc;LwSFNtk?Mvx>@m]T]f]BJSeCSjb=Kun:;wvIQsmJRgVL]k]K]VL]KL;K;qiS[b[R[mg@xq=MpiOWi`W`ru?=mlMOn_Q_h_VDu]CSwuOMqhDTlcGWbZ@GZSJSurGOrR=;cjTLRBS[BI;:IQOFQMFMjc[dkdMNd\:=c[LD[SNO\U=;SJ;KJrOP]u|Aeroflot Open|Gershon,A|2002.02.06|D97|0-1|B -FVn^@OxgEU^UV^gV=Um]^eVe;LsdUWe_?[weWV_n<`t_V_n_`uvu>^LCLv^[?_eVele>^d^=etlefruGW^d?MqiumLTkcCLleM_mn>=el=]nNLENnT\dZ\cjc]Uld_Vd\ELc[U]\cVMnlLUZdUVlnV_[S_hclPXduM_uk]UkeIYiahae_X_nFah|38th Olympiad|Polgar,Ju|2008.11.17|C43|1-0|W -FVn^@OsdEU^UOUxgUdkdV^un=Fg];EtkHPphDT]c?Hwp>@vx?>wvEOd\CKme=p^=eleC^m^:=vu=]um]rxprvmkIQkcvncbBR^MnkMSGWpgkmqaPXaXQXgpX`SDmkbckjcKjnKJW_DNHGN_nj_UjrUKrbKEGFEVbrVLFNJRruRTueTVNOVfe\LV|ch-RSCU Blitz|Nepomniachtchi, Ian|2011.01.09|C45|1/2-1/2|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LjZFVtk@gVEUk[RKm]U^tf;EwnDLvxKDo_EKumKUdUOUl\UfmfGOV`BRruR[b[<`n`OW`n@AfcCK]ULT[TKTckDMur:;kdMFrsFOs;=;dlO]xy?OlZOKZEHPnuKCEN;=NJ=KJ:AHphCB:>Kkh`W`>^]O^pkpypIYucO]wv|GpA|Fressinet, Laurent|2006.10.28|C83|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwnS[F^[c>Zck^nkdnfdkZ]klfnlt]m|Tal Memorial Blitz 2014|Mamedyarov, Shakhriyar|2014.11.14|C42|0-1|W -FVl\@Ome?[sm>@xg?>jb[MulDL\TMDk[CKnfBRrsR[b[;Jwn=FTKDK[SJ[lcKRvxEMtb;\R:Re]V]f]OUwvFBb[U[]TMTkV[UgXBFV;|67. Blitz 2013|Glek, Igor|2013.09.01|B51|0-1|B -FVn^@OsdEU^UOUxg;LwSUdkd?Mm]V]vx>@d]<`ldLRqi`YwvDTSe:@meGOVOEOt_FM_MDMgVU]V\M_dn_aognha_Z\WN\TNUVLULTL>fhwO`qi_Vvf`fL^VSwfSkrv]f^N@AvfIQxqJRjZkmNV?@]gCSjZ@dZCKkc:@^O=OpU@An^IQ^WQXqaOWtX:>uYWIYIAIU^IAaYMFXmL=rvFMxp>Fwy=Gh`FD`XMFo_V_m_FM_mGVkcDGvwCKwG?GXPGFYQVPQHAHmQHGywM_^PGPQ_FnwonF_hFC|UKR Team Ch|Mukomilov, A|2000|D80|0-1|B -FVl\@OmeEU\UOUxg;LjbGOn^UKtfbZW^e^M_ph>^h_^nwuaixwn^_WBJSJCJWO^_OG=?u]_G\lG_]E?ne>=ef=UV>?Ia?HVWloW^HP|Amber Rapid|Morozevich, Alexander|2008.03.26|B90|1-0|B -DTn^;Lxg@OsdHPm]T]g]?H]c>@wnBJvxCStf:;ogEMdUOEldEVwo@gVEUVe[dmdU^e_=uvu;LuvIQqa?=wn<`tfCKaY@?jZBRya`ruOSn=u|74. Tata Steel GMA|Ivanchuk, Vassily|2012.01.29|C67|1/2-1/2|B -EUm]DTld@Oxg;L]TBRnfFNd\?Tsd>@wn=F\UNUvx?=g]FV]gVYdS<`qi`EkcO^tkEipiYigqTMSM=Mn`iaugMQgpQPwu^OkOaOpiLVxwPQihQPhiPQipQPpi|19. Amber Rapid|Grischuk, Alexander|2010.03.21|D16|1/2-1/2|B -FVl\@Osd?[ph[dmdEMwpIQn^BJxnCS\SJSvx>@qi@gVEUVe[dmdU^e_=uvu;L_nIQqi@p^W^mwBRd\CK\ULUlLX=_U:@w\DLk[RKmeEU\cld]dndOYdZ>PZKBKXaKSahYhqhPYe]V]g]YGbZSZrZ:=urEVZbGO]gVgpgNVrdIYdc?Gwu=?xpHXuE@HEG?GcfX`g`Y`[SOQfTQOSLCLbdHITKIHpxGEdLOGKfGYLtYPxpE]tDHAfc]=cCPQD@wn?>meDLtXEMgm:un:@tfTfofLRgX=MXNMNk[Rcrjc]jkNMsmCSmc]cucOEwtBRklMQe]R[b[:=lDEOceV]f]?>ngQ_ph_MDTOETUM[^VE?tT[vxpS[U=>=gU?NUNGNe\v^px^]\]=]TD[cDC]exoIYonednmdlmelke^ks^_@I_XsvXYvVY`VnCcnqcfqQ`XQOh`I@fbOGb:G?:B?GB:@I:>GOXYOQ|Sberbank GM Rapid|Areshchenko, Alexander|2013.06.06|B90|1/2-1/2|W -FVnfEUm];LxgV^gmGWl\@OsdRKDKtL>NLNUNrt_gpgGg[Fg`xwN\t\`uwpu`pw`uwp|66th ch-RUS 2013|Goganov, Aleksey|2013.10.06|C11n|1/2-1/2|W -FVmeEUxg;Ln^@Osm?Twn>@vxBRldTBjZIQ^UOUwv?>nwNcSUOtfKfofO>e]>MScV]f]Nvuv=>cuGOwe>vgvLFeIAIvgENqiNfxqCKulOWhwf_qxFUln_tgVM^ngHPVetrxqrZwhUOg_ZEeVENh^O^p`^MiaIH`XQYqxNjVgjsxpskpikn]Un^_h^`|World Rapid Final|Kazhgaleyev,M|2012.07.08|C41|1-0|W -FVn^@Osd?Tw\>@xgEMvxBRmeDLjbCS\j?>dn;EnhMUldIQ^ULUgVTowoEVe]V\qi:Jt_O^h^U^uYJOj\S\rvOWYn=UvwWO_VOonoGOV_@I_f>Foh@wn?>k[RKvxDLmeIQdsEUsm;EtkKDwvBRnwDMld=DrtR[b[CSd\S\^U\dULdkLEDEtsM[uc:;ck[Mkr;svsFqiE@gVEUVe[dmdU^e_=uvuIQuv;LqanSHXaXQX_nGOSLCLfB`Viy^fBfWlk[l^yxV\n]OWfXLTog=;]c^gvog`cT>noh;>X_@Gru\MjZ>@um`Yhqnm_mM^T^W^xv@>ZRGORJYGvwOPmfG\wr|FIDE GP Beijing|Giri, Anish|2013.07.04|C67w|0-1|B -EUxgDTnf;LwSFNvx@Fm]BJSnT]f]FWld?Msb>@blg`>Gph<=flFWlfWFfl?>wvFFrv=>lfOWeVGOxyMDh`FohM^hDFDnpHXfWNWgW@AWUDFUWQIW?I@?g@UxwAIqaXad\UMgYMQYWIAW<|SportAccord Basque Men 2013|Le, Quang Liem|2013.12.18|E46|0-1|B -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmDTmd@rtBJ\TO`dZvmEKRKB:ucHP_i>EaYO>YPIPtxPXp`W_i_X_f_GPcf?G_WPIyYGHxy>OYQO`WO`fOHf\mdEWKDWon\ofdlU\Qi|2nd ACP World Rapid Cup|Polgar,Ju|2008.01.05|B28|1-0|W -FVl\@OsdEU\UOUnf;Lul?Fjb>@xg\UDLU\>EogOXxoED[TXmonmdg_V_h_IYngDE\GYag`dO^VOFTFEFG\|2. Governor's Cup|Vorobiov, Evgeny E|2001.11.22|B85|0-1|W -FVl\@Osd;Lph?[wp>@xg[dmdIQgmEMmwLFn^BJjZ@vx;L\n?=me@vx=DbZtX<;XOHOedDVnfIYdcYa]L|14. Ordix Open|Petrosian, Tigran L|2007.08.19|B09|0-1|W -FVnfEUm];LxgV^gmGWl\@OsdEtj:JqaA:ytJKtl:JjdENdUNUmdKcrxJLnmL\xtcKdRKLl\L\Rd\LtxHPxsU\mlLKsuKSumSUmuMFusUSsuF?um?MmuIQumM?muSUusUSsuDLum?FmuF=d[=R]U|UKR Ch|Nalivajko, Evgeny|2003.11.05|C11|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb@ul=Fk[L]g]T]tk]klkOEsm?=wtDTqiCKmgGOnu:TUedxq>PBRdlRvPXphl\UeXPef\]vnPGiaGEaY]mngE]qpmkfvk;vu]ZueZSgWIAeESLEG;@WPLNh`N>GO>FONFbNVbZVFZSPWS[FG[MWPMVPWVM^VMUpqUT`XT[XQ[aWi|FIDE World Rapid 2014|Polgar, Judit|2014.06.16|B90|0-1|B -FVnfEUm];LwSV^l\BJSLCLuZ@c\?;yuE>ndGWrs;sdsVRumRZml>GsmGNia@GpwF[wn[mnmN\jbGNtkHPmd\eltZRdcRScjNUtde\jsJRdtRZtd\esrLTdtSCkOIQOkT\kdPXaXQXd[CIrkIq[vULkdLTtrW_h_X_vm_gmvqIrjIHjmTUmjH@jmUVmjVUjmUNmj@xjrNWd[W`[Z`iZ[ip[dxvrvpovyofbZgoZRfgRJ^fJBe^yigp|World Cup|Zhang Pengxiang|2007.11.28|C18|1-0|W -FVnfEUm];LsdV^jb@OogLFg^U^xiFWioWMphIYwpmnYah`WIts<;sjGWywQOdUOGl\DLU_HP\TMS`WPWnYXgpg^goeGFeVEDYgDRutI@wx?HgYSbkbRmjsHV]Vmfbkf_Yu@Ukd_fskfiumFExPigmqW_VN>NPNUNqaCSTKBKaONUtl;COVg^VAEFdOF>AHCJOd_glq^_qo>fHAJSAH_^omfnHBnmdmgoBr^V|31st ECC Open 2015|Bauer, Christian|2015.10.19|C10c|1-0|W -FVl\@OnfEU\UOUjb?Mw\UK\j>@sd=XxgXPme@Af^;LgaPOuYHPYXOXtXL]rtAHXfKEagETj\]gpgDLqaIYdnTNe]V]n]N_yxMVtu?>um=clLTxXHOf_V_XTBJTL=MLM_MvwMVkcJRc[R[b[|40th GM|Caruana, Fabiano|2012.07.20|B42g|1/2-1/2|W -EUm]@OxgDTld;LnfFNsm?M]TMTk[TMjbNVd\V^\UL[b[^gpg>@uc=Ftb@ruBRjb[dmd<`og`Nwn=aphaivo?_XCDPHDEXPEFRJ>:JB|2nd FIDE GP|Radjabov, Teimour|2008.08.14|B78e|0-1|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mnf@wn?>k[RKvxBR[SEUmeU^e^;En\RZqiIQue=FtfETen=gVKRVPGPfTFT\N@IdZTVNc=]Zk]^ngVSk\SWgWPWcjCKsSRdSW:Z\fZbj\^>fUOUWU>FiabRwuRU\UFvuvdvxwvdaYHXYPIP|67th ch-RUS 2014|Svidler, Peter|2014.12.06|C88k|1/2-1/2|W -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[?FsmU]d]V]mc]fu=:=tfOUjbFOvt>@w\Udu=?=cmdZtuZkutk\m\P^\m=mfm^gyvIQvfL]bZBJ[SJSZSgUTL]SLCUCtuSMunM\fcCJc;@I;:JS:;SJ;:JS:;\MnvSe;celc[M^vn^TmflengTN[CN=CK=NKCN=CKOagp=NKMe\oga=MEI@EB\UBEU\EB=Dia\UaY@?po?>op>=po=a`CUvuEFuvFGvf>O`aG@fbUGb:@I:BGYahY>h_>LBJLUJMI@MJ@?JBULBJLEJB?FBJOU_^UDJKD>^V>OKJESJBOEV_FOBRS\R:EK_`K:|Corus B|Nielsen, Peter Heine|2005.01.29|D43m|1-0|B -FVn^@Osd?[jb[dmd>@ugEU^U<`ge=UeUOUtm;Log`Nvt:=uv=Exn?=nhUFh^IQwSCKmf=:SJ:?JS?:SJ:?JS?:|65. Ch|Andreikin, Dmitry|2012.08.11|C68|1/2-1/2|B -EUxgDTnf@OkcBJtk;Lm]T]g]FNph?[ld[MwpLVvx>@ulqiIYwvM;^UNUmwYah`VPv><>uv>vsvP_vuO^wm^XxwXipi_iugi_ktKP|SportAccord Rapid Men 2013|Grischuk, Alexander|2013.12.13|E12|1-0|B -FVldEUm]V^t_@Onf?Fd\@cC=>\UNUdUOUwSU[SL[Ljb:;CJ;kxnF[vw[MrtLF_MDMph>Ewp?;yvIYnxYavnHPnl@HJnklnlEWts;@wn?=sdDR]gOYph@bl[Tg]?>ogBRjbT]l]Ufmf>fvofFyutuT\c[R[b[J<[SLDi<>=u=?F=A|23rd ECC Men|Simacek,P|2007.10.07|B22|0-1|B -FVn^@Osd?[xgEMme>@tm?>phMUwpU]ds[msmDTvx;Lqa<`uvCSgq`Ejb:;vuHPo_V_h_OYuvT\e\S\m\ENkcN\c\LRq`R\^VGWvn\M`qYhnehwrwM^aY^dYPIPq`@H`O>Apid^O^W^eh=ahaAaiE;Axpaqphqlws]esCHQ|Vladimir Petrov Mem 2015|Sakaev, Konstantin|2015.03.08|C65h|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQgmEUngBRtkU]dnR[b[:rur;JkbJDm\DS\K=KbtOIphGW^W@tkwvF?gVHPo_OYphGWmgYOVLCLgVLCeS>FkbFHb?=?nfO^utPXSeD=_X=XfXHXvwW_h`IYqi^mwom^ow^mwo|2. ACP World Rapid Cup|Gelfand, Boris|2008.01.06|D45|1/2-1/2|B -EUm]DTld@OxgFNjb;Lk[CKtX?Fnf>@smZlHP[MKMVMBCSKIHf^>LofH?^V?>f]>E]TC;kj;@wpNVf^U]mcTKtX:PM]L^fZRMmnvmUvn_^L[UR>L^][l]TLgRjneW_lvjme^m]^VJRvl]mlvfn|18. Amber Rapid|Carlsen, Magnus|2009.03.24|D43|1-0|B -DTnfHPm]?Hxg@O]T=RldRTk[TDtkBRsm>@jb;LwnEUvxO`qi`Vg]?=uc]=@I=;IH;hNPhV>OnwPXV_HP_;QY;qXWwvWgqxO`xKPXK]gfvwXa]UGWU=ah=XYaX@ai@Hfg|68th ch-RUS 2015|Khismatullin, Denis|2015.08.09|A13v|1-0|W -FVphEUwpDLme?Mxg@Fvx>@n^IQe]V]^ULTldFUd];LsdUdkdT]g]LRrsBJue=DpUMVd\?=]g@vx@AkcBRtkGOsm@sd?>k[TKdZN`ZKBKtk`gngL]rtDLph=MgpKSo_OEpi:=woGOxpE?_V>VkdV>um?Pmj@ApyPVtuCKowLTjkIQip>FumFBws=:[TKTd]M]k]T]sSBbpwbjmk:bypVewejkSkbek;AI;=HX=EIPh`QY`YPYqiX`EUYai`a`UWefpof^WO|63. ch-RUS playoff|Nepomniachtchi, Ian|2010.12.22|B90|1/2-1/2|W -EUxgDTnf;LwS@OkcFNtk?Mvx>@m]T]f]BJSeCSjb=Kun:BsmBFc[OEgVL]k]K]VL]dLFMFmcNVbZF[ZSJRnfdDeWU]fn[drjHPW^EO^L<`ne`NjZOUcTNWegUKZbd[TJDFJ[F[wrWlbR]eL^K\^eleRBeWgLWNqi?@m]V]d]IQrs=Otk<`qi`gugOgpgLFSeFPktCKwv:=xwGWeS@Isc?OcePav>=>S>ON>ENPg_PO]UaPegBRjZP?ESOGtk?ESLI@k]ET]TKTgcGFcSF^SR^_R:@GZR_\:>\l>nltnvtvwvT\RJMTvnGOLS\dogOVneV_SLQYLEHPE>_g>PW_PYgpedpid\Tf\SiaYuaXSLXOLD|4. Zurich CC Blitz|Anand, Viswanathan|2015.02.13|C47|0-1|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeDLvx;EdZKDl\?>ZdE?wvIQqi?NtfOIe]=O]UN_nwIXgXQXrtOPog=uc:;TMDKfKBKvuE>dn=McdPOULMLdfLtut;=n_X_fdKSdT@IwS>STS=mSwOMwvM]xqmovd]MtlowltwodvM]vd]Mtl|World Cup|Timofeev, Artyom|2009.11.26|C90l|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQmeDLwvEUtkBRqiR[b[:rkr;JusU]duOI[SLSsS@wn?>k[RKvxIQtkEMm]V]g]O^dU;El\BR]W^OkOEOUKDKWf<[SLFulIYe]?Q]VX`i`Y`VOFPg]`hmghovoP?yQAQf^UOtQO`ox`QlZEMZBMKBKDKwnNEgV=>V\:rwDEwOQ@Og@Fgh:ZngNUg`UN`gNUguZ]u`UN`gNUhHUgHFEFMWFGW]gUxoGPp`|24th ECC|Ivanchuk, Vassily|2008.10.23|B80m|0-1|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBJvx;LtfL]dUOU^U]gngKfofGWl\=XumW_rvqi`aNFaObZDLfBOdvfdtxqLTBEtfE>@I>GfV|WCh 2016|Carlsen,M|2016.11.26|C84|1/2-1/2|W -FVl\@Osd?[ph>@wpDLxg?>vxIQgvEU\ULUvl[Rm]V^k[RKjZ;Ltb@ga@IaWF=ugO@tfTcjcRDfmHPWf@^UOUwvGOld@Asm<`qi`YjZ=Dm\:=ZRCSRKUK\RLRrRYPucPecj=EiaFMgmOWmgEFtXFGvrIQXtBJaYW_h_V_kcGWd\WYRJK@_qEKjZBRnhHPwnFMvx?>ulIYwtAlmOEmvDMrsCKkcA@wpCKvx@gVEUVe[dmdU^e_=uvu;LuvIQwn?=_YOUYhGWqa@l[JR[LELneS[gVL>b[R[r:=:wv[dkdGOeWNWVeHXo_IQeT:Gum?>phG>of>f|Sberbank GM Rapid|Tomashevsky, Evgeny|2013.06.07|E46|1/2-1/2|B -FVl\@OsdEU\UOUxg;Lme<`nf=Ewn>dU]nxyPMU[MQwo=MveQq|Keres Mem Open|Metsalu,Tauno|2001.07.27|B64|1-0|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWsm=Ful>@vx?=^OFOo_V_t_OVumL]mfV_f_f]?GVYNEgGEL]U|FIDE World Cup 2015|Svidler, Peter|2015.10.03|B53h|0-1|B -FVl\@OmeEU\UOUxg;Lph@vx@AkcGWtkFOsmW_c[BJrtHXtLCLgV=>nY>Ne]JR[R:RulOV]VA@qiKZkrLTmcR:cTZTlTNQVNQYTV|It|Ushenina,A|2002.08.03|B92|0-1|B -FVnfEUm];LxgV^gmGWl\@OsdGc[R\m\U\S\=U\UOUtm?FvnBJjZA;ysGNscF=og=DqiIYrsHXsw;Ag^W^csX`srA@ia@;rsDh[SJSZS:j|Corus B|Ernst,S|2005.01.15|C11|1-0|W -FVl\;Lme@OxgEU\UOUjb@ulTKtfOYphNiwv=EgXYOXiEismL]f]K]ngDLmc?=ruO`g`i`c]=]ut`NvfIQxp:=lTBJtd=Eqa@ITKNMfgMNKcNcdcLTcdCKaYGOpiJRi`RZ`WEBgfBRfnRSnl]MogSRkcZcdcRZg_Z]_VOVldMOWV]=ckI@dc=MbZ@GcbGFZRMNVUNMU\M]\SKRSTOMkCFNbR]eRBedT[MeCKNVBFV]KM]fMede[Te]^Vf^VN^VFH]UT\VNh`UuHPNV\TV_TLumPQ_`QA`XYQXP|World Rapid 2015|Guseinov, Gadir|2015.10.11|B90|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb?Mn^UFwn>@vxGWsmFP^WP_m^_nun@tmDLxnEUnhU]dsRmsmLTwn;LvxHPmgO>um>MmQGOqi@wnO^ulDVsdV]du]mlm^mvm?=mtHQuf;Lyu@\UOUtmUOjbNVulIQwe=FvxTMd^O^e^GW^U@wp?>f^DTvx;LmeBJjZOEgvE?o_V_h_?NtfN]xy:;vl=pLKLohNH@>F@HF>H@>F@HF>|2. Norway Blitz 2014|Svidler, Peter|2014.06.02|B40|1/2-1/2|W -EUxgDTnf@OkcHPtbCKwS@wvBJl\U\c\O^bkEWsm^TmcTZkbKS\SJSnSZdSLdubF=KL:?:ru:jcTIQFaW`ah`gpgPXxpKL]ULTUMX`ME`gpyHOhV@IV]TXvxO=xXQXqi|FIDE Candidates 2016|Caruana, Fabiano|2016.03.17|E15o|1/2-1/2|B -CKn^?k[TFd]Paga=]tbFart]VZLCLtLaFugVUgUNULDBRwvF[b[R[qaHPvF:jFG?>GF>=FE=>EUjrxqA?DI?oUMoGIA>FMPrJAQG_qh_]PKJbhqF=QM]MKM=FMKbeK[em[_FNqiNVphm=aY=Aia|WICC qual Moscow 25'+10|Rossello Padron, Carlos|2002.04.20|A01|0-1|B -EUm]DTld;Lxg@OjbBRnf<`sm=Dqi`YuZFNgV?Mo_>@weT\esMV_VOEvxGOVOEOwo?GmwCSZlO^oGDGp`YPlp:?sl^Xf^Xg|49. TCh-ESP Honor 1|Van Wely, Loek|2005.08.27|D15|1-0|B -@OxgDTph;LwpFVmeEUvxIQn^U]gaHPun<`og`Eg_V_^V=FwvE`noOYh_>@p`;Lyw?>vu?g^W^um^U\fLR_X?wrw=EfWR\mvIQXtem|It|Nakonechny,S|2001.08.10|C50|1-0|W -EUm]<`qi`Yld@OucCKt_FNnf?M_M=MwnYnxnDTvx;Lsm>@cb?=wu:fUm]yqIYh_]_U_>:qh:j_e@?eT?FhgFMTejbetMTg^T[^]b:te[ce_:=_UYa\TclTLlm]VmnUF=uLDutD<3t@vx;Ejb[R\jIQqi?>dnE?nh?PldMUgqF`YXWhgFIwuIYt_D_xwYigpWY|25th ECC|Wegerle,J|2009.10.09|C65|1-0|W -DTxgHPn^?Hm]T]g];L]c@Osd>@wnEMvxogPXxoW_ZbQYqaXau]OXbc>;][TR[C;CcCEVd\RjwnaipiXa\TMTUMjZCFGOFNaXiaXWN>Z]>=WNnJ]M=;MmJnT\owml;KNUwvltvmtyKOyamdaqnuYaO_aiulqol^UM_OMFOQiqd]VGQIFO]\GXIaok\eX^g^OXaAX_e]km]dmndenp^V|SportAccord Blitz Men 2013|Wang, Yue|2013.12.15|A29|1/2-1/2|B -EUxgDTnf;LwS=DvxBJSLDLm]<`l\U\]ULDf^FNqi`Ywv>@nhFamephEGlkKZksW_h_V_fTZT[TMVgVLVmgGOslVLyxNGxyL]g]=]og>VtsVYyYGYlkCKvmY>kdQYstO=txHPnw>GwiG\iw\Gwi]\dHG>TKBKiE\Te]TRE>=>xPRbH@>@P@;Cmnbfnofe^VCL@?emowmuwoumowmu|Corus A|Topalov, Veselin|2007.01.15|B90n|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwn@sd=XxgXpyxpid^iQm];L^XQOf^V]XI@IgXI@uYOQYQHQXG@Io_L=G=?=^VMFVNFavuaO_WKUtQIQxPQYjU=UPOYXO?UWqaXPNFW?F?5PHumH?rxsvVM^>A>v>E>o_>GxoMF_WLTogHXWPGPg^DLl\FMjbBJmfMFf_F?_m?MmtMFbZFMtbPX^gOWbtXPtmM?mv?FvoPXofXPf_F?_D?Fg_FX_gXFg_FX_g|Young Masters|Dominguez Perez, Leinier|2006.02.04|C42m|1/2-1/2|W -FVnfEUm];El\V]u]@O\U?T]e>@xgEKsdKUdUOUjb?>el=FqiHPk[TKweBRvxR[f^UdtkDTb[:rldrwewGO^VT[d\FG\SKDVOIQS[Na`@IOGNv`gKTgd|World Rapid 2015|Kovalenko, Igor|2015.10.11|C07|0-1|W -EUmeFVxg;Ln^U^e^=uvu?TtfTfofGOsd@n^EMxn[TqiBJvxCSmeS\e\?>xqL]tf]nunT]dUOEf]V]ruDLU[LT[UJRnm:;kcVfdcdtdVnqxnmpwEVUM@GwJmUxoGNJ@vx=EsmKZulDTng:hVFOo_IQlmCKmoEFxwBJVOFOvN>NrvNvwvKSZSJS\VOJog|WY ol|Barnaure, Vlad-Victor|2002.08.22|B92|1/2-1/2|W -EUm]DTld@Oxg;L]TBRt_O^sbFNbS?Tnf>@wnGO_D=FvxLBSB:BDh?=d\U\ul^hqhCSjZSZrZT[n\BDln@AZrNVwu=?gv@]T=DjbBRtmDTmd<`d]TD]VD=l\U\n\;EVdO^dH@Hsm:NV>@PW@?WN?>NU>=U\=E^]EF\UFH]ZH@ZjofjbfobZofZ^fe^[ef[cfocgopU]@`V^`_gbh`]e_?^fpgem?>be`XeU>fUX|20. Amber Blindfold|Aronian, Levon|2011.03.24|E05|1/2-1/2|B -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDT[SJDvx?FbZ=Mtf>@g`:=f]M]uc=Mrt?=wuMOtlHPphIY`i@Hxp][c\[RdnBJusOKlkD>|World Cup|Timofeev, Artyom|2009.11.24|B33m|1/2-1/2|W -FVl\@Osd;LphEU\UOUwp@vxIQmeDLdn?>nh;EldTK\cE?e]<`qi`gugV]d]K]hW]VtQHQWQ@HQWHAcG>FWF=FGc?PgWFHiaPaWiH`i`O`phagxpg]cu:@wyAHu`HO`u]Nuc@PcNONruVkusk]sCLTo_P@|World Blitz Final|Bologan,V|2012.07.09|C50|0-1|B -FVm]V]u];L]eEUldLVef=FxgGOphHPg]DT]SBJSbU]d]T]fc@]TMTjb?=k[TMulTV>GVXn\XWGPW_\NahPY_]Nch_YPqhcj]MPWMQW^QYjnYanwa`^e|KM FIDE GP 2015|Jakovenko, Dmitry|2015.05.25|D46|1-0|B -FVl\@OmeEU\UOUxg;LjbBRn^UOwn?Tvx>@tfTBqi?>sdFowLVwtDLTRGOxo@GR:FEovGFvmCS:iaIQun>Gp`G>`XQXaXOXtTVE;>F>TL>FLPBCPXS[b[C[XHFMHPMTPXTKml[SXPKTPJEKnYTMY>STlmMDJBD;BH;GVSmlS[G>C<^VG=FLDFOG@|Corus B|Ramirez,Al|2005.01.26|B90|0-1|B -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmDTmd<`qi`gng;LdOHOld:=smOHgnFVucU]m^TBf]V]ruB;wv;Dn\LV\URZcCDCUCV\d]\kusH]vnk\s[]Vo_V]xq\f[ZfwqyGWnvW^vw^fCg]TwtTMphPXt\X_h_=<\@xn;E]UEVnhGWULCLwn@wvO^bk^MjZEWld@smOEucBRjbEVvtFayqR[d[L]f]Vewe^emgaXgX=XtsX_qy?>sr>n[SnoyxP^`XemTLCLSL_MxhMLhdLJrjHPdfow|Tal Memorial Blitz|Mamedyarov, Shakhriyar|2008.08.30|D43|1-0|B -FVl\@OmeEU\UOUxg;Ljb@phDLjb[RwpEU^ULUk[RKvxU]dZKDme;LZT?>l\]dnd:;qiL]tfCKT^O^e^^YG|World Blitz|Aronian, Levon|2009.11.18|C60|0-1|W -FVn^@Osd?TxgEMwn>@vx?>meDLdZT[jb[Rk[RDl\;EZdE?wvBJqiIQnwCSe]V]g]VWVDV^U;kmfVfofO^yxkKutKcbZJRUM@?tuc;uU;=ME^dUTdZTVZKwS|GRENKE Rapid WCh|Bologan, Viktor|2010.08.08|C90|1/2-1/2|B -FVldEUm];L]VLVsmV`xg?Mnf@Owe=Fqi`VgVFVul>@kcVXvwCKtk@tmDLphEUwp?>xgU]dnRmgm=wy:@ZuOIuvXQxyGOdn?GmRENvm:?_oHXnxQPk[OW`WNWmnX`i`W`nvIOo_OY_G?GwGYhyqPGxi@?i_?>qx>EvohWjbGIxqIQovQXbZ`YvoYu[SJSZSXhohahqiWfSLEL_Nu`|3rd ACP Blitz Prelim3|Psakhis,L|2004.06.02|C18|1-0|W -EUm]DTnf;Lxg<`smT]f]FNld?MuZ@Fwe>@vxFPqi`YZlGWwv=OgqP_mgHXgVLV]VMVewVMtfX`i`W`ph_iwi`ilmOPqw?gxq:?m]Y`wmgGvxIY]BNVBKU]d]Gofo?oqyPGKcGcjcomrwV]wOMVOw]ewtmltlelxt`uyqVkqiktc[tm|Simultan|Garcia, David|2003|D35m|1-0|W -EUm]@OxgDTldFNjb=DtX;Enf?MsmT\XOEOphCSwp@bZBJZR:U^|6th EICC|Eljanov, Pavel|2005.06.29|D11s|1-0|B -EUm]<`qi`YldFNucCKn^@O^UOUwnYPxg;Evx?Msb>@b\M_wvDTnwT]g]ETcu:<\V_VvV=OVv?=ugNVgOHO]gTewePetQUFruFWQte\jb=uvu\nuEBRtfKSgmS[b[R[d[@wn?>k[RKvxEUmeDLtX@SL:JrtUO]UNUwuULm=@=u=LSqaSeaXQXfWHIh_X_ogOYg^e^=MYhWhJMh^|World Cup|Navara,D|2009.11.29|C91|0-1|B -FVl\@FmeHPxg?HsdDLn^EU\ULUtXGOXmU]dS@k[;LrsK=Sb=Mb\ME[SL=m[=GgmOWuc@Acb?>vxF@wt:@wSBJSnNV]VLVgVMVsm=ZROWRJqxvnxpnvp^vo^lovl^vo|FIDE World Cup 2015|Onischuk, Alexander|2015.09.16|E21|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwU]dsE?smOIqiIXld]dkd=ObZBJm\XgugOgpgKDe]V]d]=\RN<[SLSZSJSvsS[R\X`w\PXVN`hqxY_>@Xaxwfd@AaXA@XQ@hdhwohH|GMB|Naiditsch, Arkadij|2003.01.15|C92n|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUul;E\ULUZdEKbZ@I>;UgpgOPxwPM;cMqrZQYZ]YacCW_]_ai_`IACHqVH@|FIDE WCh KO|Kobalia, Mikhail|2004.06.20|C99|0-1|W -FVn^@OxgO^me^OgV;LVLELwnLD|FIDE GP Beijing|Mamedyarov, Shakriyar|2013.07.10|C42m|0-1|W -FVn^@OxgO^me^OgVEUe]?Mwe>@vxDTld=DsbBJtXO^X_CSog^O_h;LVLMhqhDL]TLTxqS[d[T[rs[MblOYg_MQ_Wl]>VutXYg_O`]g:>_`Y`gV`]xq]Vt_VOk[ESeSJSsu>=_aOMa_MF_aGOa]IYqiFV]eU]h`V_`Y=>ec@Iue>v|14th Ordix Open|Meijers,V|2007.08.19|C42|1-0|W -FVl\@OmeDLxg?FtX>@nfIQXaEUgVU]Vg]fofO`aF=Ff^GW^VW_sd`fum<`e]`gpg;Jd^:=rtfW]UFVvoWfmdVFqaJTweTedeLU\U=UebF=bdUed[BR[S=]ST]k|10th Petr Izmailov Memorial|Morozevich, Alexander|2006.07.15|B50s|1-0|B -EUm]DTnf@Ol\T]f];LsdHPxg?Hwn>@vx<`\UOUqi`NwvUdkd:@eWNWtm?>gVO^mvGOVLCLsm=KucKJm^W^vo:;cl>@ge:;k[BRjbRZwv?ia>Mh`M\f\<\pw\Lvf=?Q_;CaY?HYPIP`XFWfiCDxpW]weNV_q]NeSN_pwLKSZ_iqiKJZcU]bZV^[SJMihH?SKDdtd]dZRM]hd?[d[][cU@HKC|Tal Memorial Blitz|Ivanchuk,V|2008.08.30|D43|0-1|B -EUxgDTnfHPwS;Em]?Hvx@Okc>@tkCKl\unEOwv>M\JCJnJ?>rt=@kcT]f]OUtkU_nf_efeEUwv?=mwBRwfRZphLRel:rvC?>_VOVnV>Ve]`i]VHGV_G>tl[TxqTxqiLy|6. World Blitz|Grischuk, Alexander|2010.11.18|A11|1-0|B -DTxg;Ln^@OsdHPm]T]g]?H]c>@wnBJvxCStf:;ogEMdU@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvBRnwDMldCKul=Drt@ogCS\SJSiojmGOc[R\f\S\h`Jbtb:bml>Gum=:wo:Bxq@?lj?FmkbjkjBCjRI?oj?ERBCTVFEV^>GWOGj^njcnfcjfbj\XPEMbd\jdljcOGcGPGDTGOMUOWU]W_T\lm]d_fdcf]|18. Amber Rapid|Radjabov, Teimour|2009.03.17|B31|0-1|W -FVmeEUxg;Ln^@Osm?Twn>@ldBRvx?>kcU]d]L]tkCKrt>Fm\]gngT]umjb[SwuDTum>=gnS>c[T[b[RZfWFBo_V_^VZbkrHPVOPWxy>fmlJCnwbjrd_gtr@Admf]rjBjlj=@mvW_|Young Masters|Felgaer,R|2006.02.06|C41|1-0|W -EUxgDTnf;LwS@OkcHPtk?HSLCLvx>@meU]sbOUf^U_kt=Db\FVt_V_qiIQwvbZAaem>FmeD=\MFIyaIaMG|FIDE World Cup 2015|Mamedyarov, Shakriyar|2015.09.25|E21|0-1|B -EUm]DT]T@OxgFNnf?TjbTKk[BR[S>@tk;Ewn=Fl\?=smRZvxKT\UNUulTMg]ET]WwnLVm]T]nSVLbMEMd]BJSnLFcmFWngCUgUMUldWfvnf`yv>nvn`qnVULVNLDNFDLFHIYHPLDm\KS\VDCVeJReTCD]Uq`PLD;UMA=LK;BKCB:ME`fCD|Aeroflot Open Rapid Final|Wang, Hao|2013.02.16|C45|0-1|B -EUm]DT]T@OxgFNnf?Tjb>@l\TK\UNUsd;Lwn<`vx=EdZKDk[:=tkU]f]?>rtD_tlEWgaWYn`O`qiYau`a`i`L]k]=]ph_M`XBRZd]\[RMbwrbFrsFXsC>:RJIY|78th Tata Steel GpA|Mamedyarov, Shakriyar|2016.01.31|D27h|1/2-1/2|B -EUm]DTld@Oxg=D]TDTt_HPnf?Hsm>@wnFNvx?=ul;Lg]O>]LCLf^NV_XHOmcTFXf>McTMCTCFCfTf^IYyqLD|Sportaccord WMG Rapid|Mamedyarov, Shakhriyar|2011.12.09|D23|1-0|B -FVn^@Osd?[xgEMw\DLvx>@meIQjb[dkdMU\c?>^ULUe]V^gVF]K=KfKLEK=FG=RHPuU^fUTPW`WGHxwHXwnEWnfIPR=XYTLWlLOPHOoYif]ie]TlZ=OHPO]PXopXWpoW`op`gpPQYqag^PXZuTSe]d]\dXT^]S[dlTD]f[bf_|65. ch-Playoff|Jakovenko, Dmitry|2012.08.13|C65|1/2-1/2|W -FVn^@Osd?TxgO`m]V]dZT[ld]dkd[Mwn;Lvx>@qi`OtXIQXaMF^VO^aF=FuU^XwvEMVMFMUMDMgXQXru?=n\@[SLFbZFPwnW_nYOYuY=OYn_gpgOgng?gtbgiyiNidUipUD:<\U^mtmRUmd?TruUXdmTKlZN`utA>qaKfwJfmvwXPaYP^|TCh-RUS|Rychagov,A|2007.05.02|C10|1-0|W -EUm]DT]TFVxgV^g]?T]cTMsd@FtXGOXf;LumLVf]@dSM;]dBJS]NGvtCKo_V\mo=Dp`JR]SD@dUEWU_T]g]L]k]^dumH]f]dsmk=M_esbvxbS]UMUe_U]k]S]n\:=wuWluvlWvuWluvlW|Vugar Gashimov Mem 2016|Mamedyarov, Shakriyar|2016.05.26|E15o|1/2-1/2|B -EUm]@OxgDTldFNjb?MtXT]d]=Kul;LXOHOnf?nmE>gwAIwtDPxqBJtlDLavLKrtKcvucKeTKLkc\T]TMTdnTflLCLtdfKc[ZJNVbZU]ZRKB[SB;SKDEdhHQJ:EMRJV_hg]eJB|65th ch-RUS Playoff|Alekseev,Evgeny|2012.08.13|D11|0-1|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvuIQuv;LtfHX_nOUfmGWqaW_aXQXyY?Wn]L]d]UOYyV]og^gngMO>^]d\TKT^\dk\Tkjc[|FIDE World Cup 2015|Mamedyarov, Shakriyar|2015.09.25|C67w|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=McC:;CJW_sd_fofUdkd?Fwn`EJ\LR\jENd\>@vxV^e^RcrsctstMbjbFbtrbTg]?wxwNGrRTKRbKTbRTKRbKT|GpA|Negi, Parimarjan|2006.10.29|B97|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb@sdFNwu=RjbOEtmRDdZ?=gnBJSeLVmdETZTDTd]TD]VDVldIYiaCSbZ:;ph=MumS[eJ[dkdVdruMLJSLTnedRml;m\<;wuCKf^UCnY>@phGNogOW^WNWe]Wltl@?]U?OlnCJn^J\^\DT[TMTxp;C\`IQqaPFaXQX`XFUpqOQh`CLkVTbg_bMqhUOYPMFutLEtDENDLFMVM=MPWNFXHF?LM?HMuO>uEH?`XQLEB>Mh`|FIDE GP Beijing|Topalov, Veselin|2013.07.12|B48g|0-1|W -FVxg;Ln^@Osd?[dUOU^UV^UL^gugELg^[Fm]>@tfGW^guvS[qaIYfhMV]VBR_WGWeW|UKR Ch U12|Blednov, Alexander|2000|C48m|0-1|B -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLg`JDvxBR[R:RbZ?Ttm>@rsRBxy]Nul=Mdn?=mdN]n]T]d[MO[mOFo_V_m_DN_m]V`iN]luCSZS]Sut=etLemsSHPSUmU^U@HphIYL\BD\^FMipVO^_OV_^VO^_OV|KO|Radjabov, Teimour|2006.11.02|B33|1/2-1/2|W -FVl\@OsdEU\UOUph;Lwp@vxTKmeIQtm?>rtGWgaUFag=EZaFPaYNGYiL]wv:=mfDLkcKRgmR[ds[Rf]V]jbPVc[RDm\V\e\DVsm]eneEemgVktskb[SbTSLCLia>^v^W^gvTo|29. ECC Open 2013|Maki, Veijo|2013.10.22|B35|1-0|W -FVnfEUm];LxgV^gmGWl\@Osd@wpO^\ULUvx;L]ZFOsm?>nf@l\TKk[BR[S;EtkNVwnV^gmETvxKD\U=USKDKkOHOsdUNulOWm\K=ru:JdUTeU_e_f_JLbZCKlc@wn@AqaGWgXN@meBRtmUKp`W_d^RZmd@clmKEnucUulIQXg_fmfMTfnU^e^=OyiONaYN`ih`_ruL]d]T]g]V]u]EV]UDLUu_avma_md:Rnf_Od[RS[dSkf]LT]MOohpkl|VI World Blitz|Mamedyarov,S|2010.11.16|B48|1-0|W -FVl\@OmeEU\U=Ujb?FsdUNxg>@tXDTph;Lwp_\@?\D>fDG?>GI>?IA|World Blitz Final|Gelfand, Boris|2012.07.09|B53|0-1|W -EUxgDTnf@OkcHPtb=Rbk?Hl\U\c\>@wn;Lvx?=uc@jb[MxgDLk[MDtk?>rtBR[SEU\ULUulDMgV=FVgMbnfbklk;EwnRZvxEKg]@wu=Fkc?>]VEVg]:=tkMTdZT[jb[M]NFNrtV`nfMVZTNFqi=utu`okVou|Canarias en Red final|Wojtkiewicz, Aleksander|2004.05.09|B27|1-0|W -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vx@AsdGWk[FOdZKZuZ=>ZlBJtk>PxylsPQbZ?G[SJSZSL]g]V]o_OayxW^e^G_k]_wnwaO]OQOtDNUs[>?[?O?^UHPDlAHph?MloMUqaU]xpIQwn]TnwPXaXQXwnTUpxHPnwX`o_UuxoulwnlTowTtwptf_`PQ|UKR Ch U20|Kovchan, Alexander|2002.03|B92|1/2-1/2|W -FVn^;LxgHPm]V]g]?H]LCLwe@Ovx>@sd:;qiEMrsOYtf=adnGW^WPWn]H]f]Y_]dsv>vwvUjvrjcrB?GdRcle]l^xo@HiaIYRmH@mX^Uk[U^Bj@Hof^UjnU^f_G?nj?;h`^UjBW`BDHPDEUpEMPGMQ;[QY[]_hp^|Tashkent FIDE GP 2014|Radjabov, Teimour|2014.10.21|C26k|1/2-1/2|B -EUm]DTnf;LxgT]f]<`wnFNvx?Mtf@Fsm>@ld=DwvFWmwWfofGOga`nunOWphHXapDHwm?Omg@Axo:@vyHDrxNVpvV^gmDGvp@>ovW_h_X_p_M_f_^fmgO_xhGWvw>?wp_gngWlpi?ghgl^ywfng?AHwGHPGOPXOW^W|ch EST 1/2-final|Keskel, Marko|1999.03.13|D35j|1-0|W -EUm]DT]TFNxg?Tnf@Ojb>@l\BRsd=Fwn?=vx;LulIQkcU]f]L]g]T]tkNVruwnfTdSHOpL>Hh`YaSDOVLUGWngW`g`HWUGWQ|Europe Rapid Ch|Milov, Vadim|2002.09.30|D27|1-0|B -FVl\@OmeEU\UOUxg;Ljb?Tnf>@k[TKwn=OulOPvx@l\U]blBRkc=>nf]fofV^g]LVe^W^tk<`um>Y]S:=mdVgpgMhqh`gwg^grwY`|5th Kings Tournament|Ivanchuk,V|2011.06.20|B09|1-0|W -FVn^?TxgEMsd;LdZ@Fwn>@vxBRZTMTmeCKgaL]nYFLag]gYgovL\me\ZvRZRed>EjbDTdeELl\RZedZBxoBEonE]dtLCtdCJdtJRtlRZld]EnvEMvnM]nvKS\SZSvnT\nvHPvnQY`YPYph]=dt=@ty@hyYhpnuSZYQZbQO\dutpoOKbZK;ogtlgf;Cf^|7th-8th|Bologan, Viktor|2004.07.31|C28f|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwnZR`gm[MT[T<`TXGOX`g`og`Nk[=>qaIYrbNFbdFvr;Cf]WP]dP>p`CGonGPnmPG`XENXOHOl\NWxHFEmdGNHxE=fo=ExvEHv^NEofHGfxENxqGE^_WP_]E]d]KR[RNWqDBJ]dPGD=GNe]Wid[iw[TOWg_NE=OENOANEAHwn]ULU\UneT]en]Vn`H?`i?[i`VO`iOPi`PXE>|Superstars Hotel Bali|Karpov, Anatoly|2002.11.29|C42m|1/2-1/2|W -FVl\@OjbDLnfEUm]V^tm?M\UOUsdUdmd>@xn;EnhEOul=Fwnd[M[b[BJlTOUrZ@AwtGWhYFXZbHPYhIYn\W_h^XQ\ULU^M_fof>fxyfnMCYatxaibhiphpnpxp?wpxwxyxQfxyfgyxEi|3rd ACP Blitz Octofinal|Baklan,V|2004.06.05|B28|1-0|W -FVn^@OxgO^me^OgVEUe]?Msd>@wn;Lt_=>nS>NSLCLvxO`wv`V_VNPvf<`umGOVMDMrv:>f>?>v>P>og`Wxo>Ym_Wldnle_MYaMhahnh@GofesjbGNfmHXhnsjphj\nd\cmfNMfmMDdnc\ntDKkc\wtjKDjdwSduDMufMNmdSng_X_h_NMd[ne[de^dmMNc[NFmdFMdcIYcZYaZR^ebZai[SLT]TMTRJU]f`elJBlZSKZL`oTUB;UN;DL:oiNWioW_qaOWKC:CDC]eoe|GpB|Bologan, Viktor|2004.07.23|C42s|1/2-1/2|W -FVn^@Osd?[xgEMw\DLvx>@me;Ejb[Rk[RK\cBRtm?>dnE?nh?PqiMUmXR[b[:rurIQXO=O^U;J\iE\^;>hYOMwrENcNMNYhP_rJ_Ul\N<[SLS\SogFaphaOloE?h`?NqaK\kc\Mtk;:jZ=V^OVvuv:;vV@vx?>e\V]d]LR\eCKf^GOtmNtdcmgmDT]UNFbZMVdlV]xyBJqiKSZSJSmcF^|vs World Rapid|Mamedyarov, Shakhriyar|2009.05.09|B46|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWucUKsm?Fwn`gng=Evx>wte=tlVe[m=MqiOVphHXm[MQ\Ge[s[>FGcQilTiQclQO[\IYTUVMxp;@jb[dkdMU^UOUtm=Od\U_m_V_rsHXqiIYwnX`i`Y`gq?>vx`hohO]xy_hn`]A`Y>VugAYghYXhgXPe]VWgf;LwWQaF?aA?FVLNLUVF=V>L>AO>FOA=E]UFb|19th Amber Blindfold|Aronian,L|2010.03.13|C65|1-0|W -@OxgDTl\;LsdHPm]T]g]?H]lBJphIYqiEMwp@vxLRdU:kc>Lwn;@wv@An\<`qi`gugV]U_LVgn]dkdV\n\OY_eCS\LYOtfBfvfO@LU@FUNFPjZ?>NU:;ZS;SU\=FuM@sm=Dmc;JphJTcTDTwpEMvx@]TMTjb?=ulTMd\IQrsBRqiRZwu|36th Olympiad|Purnama,T|2004.10.16|D46|0-1|B -EUm]DTldT]d]@Oxg;Lsd@weWeueLRvxR\tl=Kentraiph>^e^U^og_nxo^govgd|Corus A|Ponomariov, Ruslan|2007.01.23|B90m|1-0|B -FVl\@Osd?[ph[dmdEMwpIQkc>@n^BJjZ;EtfCKogETxnfoEO]NGNulJRof>Pc[TEru?Glc@I\TKT[TMUTLEKpiK\fTOYxyYhqhPhipG_^UNUwvV^cl_ayxhqxwa_uU:>To\MUMDMLDMUd\_W\U>Edn=@n]N]tf@Ih`W`Y`EDqiR:wx:@xh]W`WIWug@hgWAiWihiypiafTKTstaZtTDMTdMUpgLTgfZadbT\|1st Asian Clubs|So, Wesley|2008.12.28|B33r|1/2-1/2|W -FVl\@Ome?[tm[mum>@xg?>sdDLnfEU\ULUe]V^gV;EVE@gVEUk[RKm]U^tfvxBR[SEV]V=mfm^fmfKfVOfTSLCLng:vuvT[vfHOd^OW^O@HOYHQph<;qa[MY_;sxpstgL\wpgtlLSwSZSRZfeMT_nZbedldndQPgnPOogIYneToe\ohSKONKCNE\cEDdUDCUOhaOYCLcbLUbcU]YH]VclV_leaOHY_XYhX_hY_gYOW_emgpOY_gY_ph_eGWmvhpe_px_ixpi_|World Blitz Final|Ivanchuk, Vassily|2012.07.10|C83|1/2-1/2|W -FVl\@Ome?[tm[mum>@sdCKxg?>nfFtuWNutNEZlELls=>qaHPkc?HseGWjbLCewFfmnW_tdfnwnHQ\T>FnwQYph_hohPXaXYXc[R[|Alushta-100|Zavgorodniy, Sergiy|2002.04.19|B52|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvBRnwDMldCKulVkV=XckU_V_X_k[CptspL[c_`ch`^|39th Olympiad Men|Tomashevsky,E|2010.09.28|C95|1-0|W -FVl\@OmeEU\UOUxg;Ljb@ulTKtf=MwtOYphN`smKfofMQmwYOk[QYwmYQmwBJga?=n`O`lnQNag`OwmO>rsGOmcCKe]V]f]LF]UN`c]FP]N=Eg]`n]nPVn]IY]LVLtLJR[SRZxoOW^WEUNDUWop>DLD:=Dl=eljecscZcjkWSpg@Gg^GN^]NWqiHX]\ST\]TS|20. Amber Rapid|Anand, Viswanathan|2011.03.17|B90|1/2-1/2|W -FVnfEUm];L]VLVsm@Oxg?Ml\>@gVMVmg<`\UOUwnVOvx=Muc:=wu`NcZM[Zl[KtmDTf^U[m[T[^V[cl^OFjbHPn\N\^\=<\n@wpDLjb[RmeEUtm?>xgU]dnRmgmNxgCSvx:@me;Ejb[R\jIQdn?>nhMUk[RDtkE?wv?PqiBRjcvmvOUcULUr]=FvrGOr:@I:CM[CUE@wn?>k[RKvxBR[SEMme;EdZKBl\DLrsETSLCLtm=DZTBTutDBmXO`Xa>Nqi`fwvNPahfpe]pv|Vladimir Petrov Mem 2015|Schlosser, Philipp|2015.03.07|C88|1-0|W -EUxgDTph;Lm]T]g]@smIQXOFOm^OFue:;kc?>wuFbrsLT^mb[mg=Fsk;KgaKNapHXxwBRo_N^_XQXkoFNeg>FgWNWoW^VWVFVqaGOwo@HogV>h`HPuy[dgo]eaYPIogempfd]fl]VlfV]flOW`WX`gh>^yu]VhoV_uyIHjZHGWO^>|8th Tal Memorial|Nakamura, Hikaru|2013.06.15|D85b|1-0|B -FVl\@OmeEU\UOUxg;LjbIQn^UKtfng^VqaLTxq>=m=D=wt=DqxDKxwJRgnT\wvKTtdV^phcZdgZSvmGOgd^]mvSLkcLSdtHXaXQXtdX`ogOWg`W`dfTMfdMUdfSJvo]movmjc\J\n\U\f^\e^`jbvoRZ`@bc@:Zbogelg_c[_Wlc:bcbh`[s`Xb[XP[TPHsxWOTMOGxwG>wv>Gvw|67th ch-RUS 2014|Khismatullin, Denis|2014.11.28|B90e|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb?TnfTKsduvGWrt_imc>?wiaicT?GTN=ENXipywGHo_`gXgW^e^L^lpHpkVEFVOF>gVpqtdDLdf^Uwx>Nx@g^e^vo=;k[OWd^>^nd^NdULUphIYtl;AqaN^ogA@mv^NvoDLytMFov@;g_HP_g;KldFMgnN>ne>:dl:voEDdeDEov>vm>^bZK;TR;KmvEDRTDCTtCDtTK;TRDKRT;@TtPXaX@XtlKClqCDqlDEvoX@lT@;ovYaTlahvh;[lq[ZqIE>IDZ\D<>E@wnEU\U=Uvx?=meCKsmslIQru:=lsENphPXwpGOkrC:f^UDc[T[b[DS\fNGpwL]g]V]fWH?ut:CslCvtvSd[S=UwpUTpLGDrd]de]TLSLDLJj@HjBH@Bj@H]ULDjZ?TZLDGUMdlME|67th ch-RUS 2014|Lysyj, Igor|2014.12.02|A30s|0-1|W -@Om]HPld?HtX>@smEUnf;Exg?>wnFVvxDL]VEVucVgngIQXOHOjZBRwu=DphFewU]f^]elcPX^VOVaXVhvFDFcKhMwpFXm^X_og_qxo`g|vs World Rapid|Radjabov, Teimour|2009.05.09|D02|1-0|B -EUxgDTnf@Om];Lld<`qi`gugFNsm?F]T>@phLVgnO^wpGWmc=>vxIYia?Otm:Zc]FTkcZ>d\U\c\T]f]V\rtCSjZBJZSJSv[<=p^W^n^=Utr>PwvP^v^\M^VU][T]UTMUMVSMUS;@IrjUWjnHXaXWX;KYaKNON|68th ch-RUS 2015|Dubov, Daniil|2015.08.12|D43t|1/2-1/2|B -FVl\@OmeEU\UOUxg;LjbGOsd@R\@A\KBKrjKSdUF=vtCKqi<:k[T[UK=KfK[btdS[dcEZKTZcjcbjcj:jT?[cnujr|Ciudad Leon (simultanee)|Llamazares, Julio|2003.06.04|B90d|1-0|W -FVn^@Osd?Tw\EMxg>@meDLjbTK\j;EvxIQdnMU^ULUe]V^gV?>t_KDVEE>wOAHON>P]U|Eurasian Blitz Chess Cup|Onischuk,V|2016.06.18|C50|0-1|B -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeEU\c^ULUdS=Fl\BJSdU]dnIQwvKDnhCKcZ:;ZL><[SJRbZDMqiF=kbMDrj@IjnHXgVEVnVDVvV=Dun<@VNGNnN;?bFD_FM_mL^IAMVmvhw|5th Final Masters|Caruana, Fabiano|2012.09.25|C78k|0-1|W -EUm]DTld@OxgFNtXIQXO=Onf;Lsm?MwS>@vx?=wvOFjbZl:LunKDphCKneFWgvWMvpLCenQYngCJp_HQ_eYae[JSbZS>m^M^l^ahqhQ?[LBRk[>L^LDLgLR[d[?[h`|19. Amber Rapid|Ivanchuk, Vassily|2010.03.15|D11|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wnEMmeDLvx?>wvIQnwLTgm@weEM]LCLvxO`f_:;rs`VumVeme?>wv=a_fBRf]HQkcaY]fQ?su;:e\Nc\J\d^\U^MQ?vuU:og?Ql<;;M^Qfxqf_qx_fxqf_qx_f|SportAccord Blitz Men 2013|Leko, Peter|2013.12.15|C26|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMmeBJdZKBl\;EZdE?ktDLtfBfofCSe]?Pul<`ru=F]ULU\SFB^UBfxy>nuZueuOUveUfWf_fuv:=e_=]_n][p`[KypKOphHPn_OMhg@H_pMOghfnp_>f|2nd ACP World Rapid Cup|Grischuk,A|2008.01.07|C88|1-0|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBR[S;Evx?>dZKBl\DLrsMUulU^e^ETSKTZKBZTtf=Fgm:BmcOEwuB:cTETfTFTle:BbZ;eMTMuMI@\T;>n`N\ME\J`uB:uc>?suHXEF@HFV:>V>?>og>VutGW^WVWxoW_of_[tdHOfo|Piterenka Rapid 2012|Grischuk, Alexander|2012.12.29|C84|1-0|W -FVn^@OmeEU^UOUxg;Lwn?Fvx>@l\UKsd@]T=DjbBRtmDTmd@vx;Lsm=Dwv?=mwO^bkE@tkTcgmRZo_GOmcNcumCSnucNug:;moFTwt=Msr?@ulL]g]T]sm=Mmg]KtmOErt?=m[DT[dGOgmE?m\MF\fNGn`?NfUFMphNDUDKDwuMFqaCKlnBRaYIQdm=Mmf:=xpGN`NMNn`@Ak[R[b[NL[TKTt\DR\ZR[urLMZBMEBEFE`P=?rJECJNCENJECfQHQJO?OPOCHOWHXW?AI?GIApiXHG>AI>NHXNGXHGWIAia[dW@kcd\EV\U=Um\UNulV\n\NOwuLFln:=u=>=tu=unuFUqaOrbtHOxqUFgXCU\UrVo_VUunFWf^W]neUEphKSqpE@gV?>jb[JVg>vgv<`vgJTtkMDul`gpgDRsmRmlmTcm_crkr=Fr]:=]B=eBfeb_;F>;Cbfof>fxpfmpxmtxpt\Ck\Nk]HPqiOE]UNFUm@ImnEVnfFDgnDLpxLUxoVLngUjfnjBopL]noBEpqEMg^IHqpMVo_VR_oRdpq]SonSM^ed]qpQYiaMCn^]k^nkde\CT\UTeU^eV^UV`Ug`fpqdVnoGWgnV^qxHOng^]gnOVngW_h_]_okVNkKNFKCFOCKOHKkHIkCIQC^_^g^fW^WPWxoQPogPGgfGNf]NM|AZE vs World Rapid|Gashimov,V|2009.05.08|A70|1-0|W -EUxgDTph;LwpFVvx@Ome?Fsd>@n^U]dnCSld<`tm=Kul?@vx?=rtTKldE?nuRZd\Kfof?Eul@Ae]EK\dGOle=Ewv:uv<;eTLVf^U^m^W^T^O_tlGW^T_ZTZVEv>=>kc>vZkYakev>eoEOwe;vmvEFiXY_ewFOXIOHphahqh_NvmHImfIPc[POwpW_h_MWf^Wh^fhYf^N_pwYh^_hw_^wh^]hn]enteltj[SOV|UKR Ch sf Open|Eschenko, Vadim|2001|B01j|1-0|W -@OxgHPkc?Htk>@nfDTwn;LvxCKm]FN]TKTl\nwO^SdU]d^F^f]L]g]=]kd^Uuv]^v^>^dTUTtT^vc[vrogCJ[SJCjZrZw\BJTDZ\D\JS\TIYTSCLSTLExo@HohHOh_ENTLOH_VNWV_Wep`Y`g`ewiawpLKpUKMUc_XcjMEjcEDcNaYPY`YNUDBUNYQHIBrNUrZUNXONEZjENjpNUp`UN`xNUxXUNXpNUpoUNomN\mM\NM]Nc]`cN`xNUxHIQH`QI`aI@aqUNqp@IOFIQpxQYFOYaOVaYxw|World Rapid 2015|Kryvoruchko, Yuriy|2015.10.10|A17|1/2-1/2|W -FVl\@OnfEU\UOUsd;LjbUdkd?Mm]>@xg=FwnCKtkf^=EvmlcneEIrOIqmfZkOkqk^VPXg_X_|World Blitz Final|Svidler, Peter|2012.07.09|B46|1/2-1/2|W -DTn^;Lxg@OsdEU^UOUwSHPvx?HSLCLd^=Kme>@gmBRm\KBjZUK\KBKrsIP?Gl\EFqaUgkdgnPL>?L=LP@?dR|TCh-UKR|Kryvoruchko,Y|2008.05.24|A28|0-1|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;L_nCKt_OU_h?=ut<`n]LFqi`YwSBJSLFL]L=Ed\UFLFEFh_DTjZJRp`YPyuGOuMFCkc@GtkGFru:f]>?WO^f]de\ck\Gd[?>HhLOhfONfeNLkbG\e]\J]UJ\UV>E[T\Jb[LNVXELTK|Hotel Bali Stars|Vallejo Pons, Francisco|2003.11.28|C67s|1/2-1/2|W -@Om]EUldDTnfFNwe?Mo_>@xgCKunxqSLbgIAonLDph>F^XFnvnEOXND\h`<>`XO@_W>FkbFGnV\lqhUdN=GE=NEGWOHOVfdufnlPnmOXgnudnVAIhqPWVfdUfvU_N_W_qx_gvsIHbkgfxyfm]UH?|CHN-RUS Super Go 2015|Wei, Yi|2015.07.29|D30k|1-0|W -EUxgDTnf@OkcHPtb;Ebk?Hwn>@vx=Dm]T]f]?=sbBJutE;l\;LblOYph@]T=DjbBRtmDTmd<`qi`gng;LdOHOld?=bZCSZSTSrjFNsm:;gnSKuZKDnSLBSnBLnSLBSnBLnSLB|4. ACP World Rapid Cup|Jakovenko, Dmitry|2010.05.29|E05|1/2-1/2|B -FVn^?TxgEMsd@Own>@vxDLmeTKe]=FtX<`]VMVga`NaWNW^WIQXOFOn`OFd^;Eun:=ruEO`g=uwu?=u=F=ldO^g^@?phBRjb=Mk[?FxwR[b[MOnjOMwnM;[S;MSLCLj\MbogbknukS\LSL^LQYunYahaKxqixqneGOe\FM\Sqxd\xfaYfoL^of^UfoSJMDJSDMS[ofUNfm[SmfYQHQS[QY[dYadef_e^|TCh-FRA Top 16 Gp A|Belkhodja, Slim|2006.04.01|C55|1/2-1/2|B -FVl\@OsdEU\UOUxg;Lme?TucUKnf>@wnTMjbdS@AvxV^SMDMgmOPtkLVluVek]>p`KUscPwhWfmMYa_WPXWNahNFXFMP?on`opxypq|ECC|Kozul,Z|2002.09.27|B82|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LtmIQqiCKd\L]ld]Wp`@oT[Txy?>dZTF^VOEl\GOvaIQVOFOai>Frv:>elNVlWE?_VFVvV>VieOF\ULUe]CLWeJRZTVvjbvwewFvyxvtc[R[b[?PTet\]KL>eo\t[SP_ph_nxpndKN@?NM?@SKtsM;d^;>@I>G|37th Olympiad|Harikrishna,P|2006.05.28|A25|0-1|B -FVn^@Osd?[xgEMw\>@dUOU\UDLUc;Jld[Rvx<`qi`YwvJTclTNp`YPm]V]g]N]u]RK]m=axpMUvnU^mXaXtXGWXF?>`WPWFa>VahVFrv:>hMFEMh@GjZBRl^W^n^>^v^Emk[K=hVHP[R=R^aG@V]mna_CK]fLT_O@HOLnjfXjZX=Rd=KT\LDH@KfIYpgdOD<@G@wn?>k[RKmeDLvxIQwvEUtk;EnwBJumKBphCSwp@wnBJvxCStfEMjZS[dU:;UOHOrs=Do_?=xyOHneJRun@wnM_h_[c=[c=Dc[;<[cD;c[[SBJSTLT]TGOog>Dk[DSdk@tk=MkbMDbFDFum<`qi`WmRFNxqU\sm\cjc?=RBV^rRIYBf;SRSLSwtNMmwWNtTS[TSMufK=@rs?>k[ZcscLRcsDTtXIQXO=Ogm@IsKO=us:JKJCJskMDws=Mkt;s;M;lc;DcCDCUCEZCJRdJSZubZunrcnecTel|67. Blitz 2013|Korotylev, Alexey|2013.09.01|B09|1-0|W -HPm]?HxgEMld@OtX>@sm;En^FVweIQXaPXahOYvxY_e\=FwvEOjZ<`mw`N\NFNulOYwfNPfW?>]VHVgV>Vog:>d\CKvfBRhvX`vd`gdV_pxopfof>Vfg@?lmVW^WPWgnY_nuW^kc^ymvygulgelkeWvm_ekje[jkWVksV^sk^VksVOmnQYnpYap:?H:pH?p:?F:^FE^`E=`@=E@`EF`^OV^aF>ahVnhdnqstqndA>EAdGWtsW_\TKTdHEL|6. World Blitz|Mamedov, Rauf|2010.11.17|A07|1-0|B -@Ol\DTsd;Ln^FNxgEU^VO^qa?Fwe^dmdU\e\=uvuGMEGPaYPYEIYPIE=GutGVEMPWM]@cCL]f]=ao_?>CgE`ge>NphaY_W`nelNFwongtXGOXa:>lc@?rwFfclY`ds`]smgUmc]Klu>Vh`U\u]\w]KDKxwV^opfecm^]mc]ZwneiaoZjo]ic|Artek ol U16|Samakov, Nurdin|2000.09.15|B45|1-0|W -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vxBRsd?>dSFOulFqiFEtfK@gVEUk[RKm]U^tf;Ew\=FVErsOUscKDmn\nhnCSnhHPuvGWftBRtmRZcsUKldK\mtDhqh@GsrGNxwNUwn=Enu\KulU\tmKUvnIYryEFyvFNvy^fofUf|14th Ordix Open|Prill,G|2007.08.18|C81|1-0|W -EUxgDTnf@OkcHPtb=Rbk?Hl\U\c\>@wn;Lvx?=uckH>HZdR[m]FNqiIY]TEuru=unu[cjcNVgmWeugHNdZGWgU@GmgGOgvV^ve^exwW_wvBRvm_fofOViaNHZKVWK@wn?>k[RKvxIQmeDLdZKDl\EMZd;EwvE?qi?PnwMU\ULUdUOU^U=UtfFpLCLvtFNd\GWe]V]\]M]fN]utu=uxputNVtrVfLT[TKTfdHPia@GaYrjYPGPpgPXgfQYogT\g_X`f]jpbZpjd\`h]Vh`\@wu?>nfLRmkDTgm^pxp:=rsFNklCKbZR\m\N\u=>=su=uluHduE\^pxT\EBdHB;@I;K\dZR^\RJdlf^H]|4th FIDE GP|Bacrot, Etienne|2009.04.27|B90i|1-0|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBJvx;LdsLFl\FPsdDLrsIQbZJR[S?>tfKTqi@nfEMm]FV]VOEw\MVf^=Fun?>qaEK\SDLSe;EkbFOsmE?bk<`nfIYjZKEm\?NgVN_V`_pvmOk\kpf`fHkrskVf\V_mnETngTN\R:;e\_D\N>NR\;>svCSZSLS\fN^vu^_gpDKfU_ophoWUKBKue>^|Tal Memorial Blitz 2014|Kosteniuk, Alexandra|2014.11.14|A05|1-0|W -FVl\@OmeEU\UOUxg;Ljb@tfTKsd=FdZ?=ulL]g]K]rtDLZTN`f]=]wu:=k[`@vx:<]cTKjZETtXTclcKTugT]ru]dkdIQXO=OgUOdUCBRCUphHPef>=gO=?O]TW]dldfd?=dl=ews@HxpWgc[R[s[eb[kgOkjbclkcdZROJkSQYqaGWSCHOjkdLCKOVKLJLkjLJpgV]g_]d_XdcjrckrukduUd\UV\]o_JLV>LJXQJRQPRbPYbh>VhxVW]^W?xwYQ^U?OwxaYxpQI|World Rapid Final|Radjabov,T|2012.07.08|C54|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxEUdUOU^UV^gvDLUL;Lme=Otf^ve[Ue[Ud[UdUuUOLUc^\rj:@vxEMulKEbZ:cNFNmcE?tv<=e]V]c]NOd\@A]L=ElnW^n^>^\^AHqaEG^\?EL]ET]NTNvNOkxqGE\_k]|10th Petr Izmailov Mem|Kasimdzhanov,R|2006.07.15|B91|0-1|B -EUm]DTld@Oxg;Lnf=K]TKTk[TMsmFV[SLRuZCKd\GbZF[gv^mvl[RogFrRBJtr@O^TU[TJ[JRJ:JrJOEJBGOgmFMBJMFm^A?d\O`qaXaf`W`phMhohahLp`N\]?>mehepL>?]e|40th GM|Bartel,Mat|2012.07.14|A15|0-1|B -EUm]DTld@Oxg=K]TKTt_HPnf?Hsm>@wnFNvxTFul;Lf^IQwvNV^UOU_haWH?WfULogBRhoRZru>=jbQYfl=UlfU=xwGPflLUoKU\wo=;Kf;=fK=;Kf;=p`\cu=:=l[?[b[=uvucu`YPYd\S\[S\dkdZbSKbjKCjr2C;2rjohYP;>jG>GPGd\GP\TuZg_PWqaZ>_VOVfo>LovL>hg>YgfWNfeNUvoY`ed`Yd[YnohUN[RV^RKn`TL|Sportaccord WMG Rapid|Ivanchuk,V|2011.12.10|D11|0-1|B -EUxgDTnf;LwSFNvx@Fm]BJSnT]f]FWwv?Mne>@eWNWsd_fNGn_FM_e>^ld:>f_GYgqYn_MneM_eSkcJRjZSJvfIQrvHXf^W^aXQX_XOXmX@?q`EHX_HG`O?FO>G_h_F>ogJexoLFg^U^of>GfmFWvxeJxvJevxeJxvJ\|9th Masters Final 2016|So,W|2016.07.19|E46|1/2-1/2|B -@Om]HPxgCKph@sdEU\UOUnfUdkd;JtbJTun=DrtFV]cTcjc?=f^=Ed\:=tuBJuUGWwuDLbFEFU=@GuUW_=MLDngHQg`G>`aQ?h_KS_VIYaO|UKR Summer Youth Games|Kovtonjuk, Natalia|2002.05.14|A07|0-1|B -FVnfEUm];Lxg<`wSV^qi`ESLCLgV=Xph?MVE>El\IYtmYah`GWsdW`u`X`i`EN`XMF\ULUog^gvoF[og:?g`?omvop`gpXya@QdU[MU_M_a_QW]UNEvoAig^WM^]MW]TWf_GE@m]V]d]IQld=Ors<`Se:;qi`WtfLFd\DLwvCS\SLSsS;SeS?;SeWNgVFUfm;kV\km\mU_enNing_pgpOXv>@IusGWsCipCpXmpUmXxwXtwptXpwXt>vt_vN_twptXpwXtNvt_jZM[vf_XUVXP|SportAccord Blitz Men 2012|Giri, Anish|2012.12.16|C47|1-0|W -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[?FtkIY`XO^ia>@sm=Dm^P^wi:=vxGWgvHPogW_g^U^ul_fw?F?l^@Ivg?HrwCK[SLFTLFUiEU_^fDMd\_ekbMbLD|1st Asian Clubs|Mohammad,Sam|2008.12.25|D43|0-1|B -FVl\@Ome?[smEU\U=Ujb[mtmDTxg;Lph>@wpUMvxBRrt:;md?>gmCSmcS[dmOEmfL]cRVc]JC]gCgngVvmv|FIDE World Cup 2015|Svidler, Peter|2015.10.05|B51f|0-1|B -FVl\@Osd?[ph[dkd>@wp?>xgV^g]DT]lEU\U=Uvx;LlfUYogLVg^O`f`<`ul:=m]T]d]=]tk]Ew_IQldGOrv`Njb>=dtEmtD=ED;@IkVYV;BCSBfmj_gEmqimkf_N\_VOVpwkcgc\cnfcZvsjbwSZlsvl^xoHXSwIPvnQYnmPWwnX`i`Y`m=bj=?WNovjrvmrj|6. World Blitz|Radjabov, Teimour|2010.11.18|B31|1/2-1/2|W -EUxgDTnf@OkcHPtb;Ebk?Hwn>@vx=Dm]T]f]E;wv;LnS<`sm:@k[aYP?gVDV]VJRlnR[d[<;XOHOn`@AVO?PYPGPOG>Fe\U\vNFN`N|FIDE World Rapid 2014|Milov, Vadim|2014.06.16|E46|0-1|B -@OxgDTkc;LtkEUnfBJm]<`wnFNvx:@sbO^\UNUg^U^b\?>wvGW]ULVkVMVUM;ZR;=u]IYph_MvuE>UW^f\fMDc[=]u]LNfUDMxpA@Wg@I]aNQUfQOaYI@gU>GUG@G[SONYUM[pgNOgnOMSJCJUWGNo_MmngmeWVNGg`[vfWv[V^[TWaebagbRgXG?`YTFYPFX_XRSiaJRPI|74th Tata Steel GMA|Carlsen,M|2012.01.24|A15|0-1|B -FVl\@OmeEU\UOUxg;LjbGOn^UKtf@YQHPvxKZulCSwv?=ms:<^VOWlmT\e\S\nw]esdZTts<;mf;KphTcwpc]fm]gpgFTbZBJsrK[ZREFgpT]rj@Gpg[cxw=;gpPXpyGPo_X`mq]dkdcd|Human vs Computer|JUNIOR|2004.10.07|B90|1-0|W -@OxgDTph;Lm]T]g]IYqiFV]LELu=>=tX=Dsmd\DMkcMNlP>LPYFIY`NOXWOHaYIQWVQMVTMu`WutfmtyW^|UKR Team Ch|Eljanov, Pavel|2001|A16|0-1|B -EUxgDTph;Lm]@Owp<`l\U\uZ`gpgT]vx=Esb:=b\OU\RFVtmLRZRCKRJ?[m[U[J\[UnfUFf]V]ru>@wvFPgpEMumMOv^]eo_=Mpw?=^fIYfeMeme=eweYa\dONd]P?jbNvxp?N]oaipgvygfNTelytomtxfgxwg`TNl^HP_WPW^WwpmQpn`an\h`N?QX@AXOA@aY?NWNGN`X\UOFU^F=@G=DG>D;>E;BE]A>EA]E>]Vlp`a>EbZEFk[FEZRKR[REFRJpoaYFEJBo?VS|ECC|Hernando Rodrigo,Jo|2002.09.24|D91|0-1|B -@Om]HPld?HtXDTnfT]XOHOd]>@sdEUxgFNwn;Lvxo_RCrtCMneKSun<;dsBRkcRZcZSZsmOFtsGOVg>Ep`MG_WNW`WPXqaX`gvIYvpFMeS=>|Piterenka Blitz 2012|Jakovenko, Dmitry|2012.12.29|A11|1-0|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWul`gpg=Ek[BJtk?Fqa>vw>Vi`DLlcK:wp:DbZ;BtlVXpwMFc\OVTcB;yxF>wn>FnmVMcTMT[TDNxsNTZRFDsK;:\[DFl\XVmnFM[kVXk[XVnmMFmlFM[kVXK[MDkrTE[ZETZ[TE[ZETZ[|Supreme Masters 2013|Topalov, Veselin|2013.05.18|B96f|1/2-1/2|W -@OxgHPph?Hm]>@wpEMvx;E]UEKsdDLULCLg]LT]S@l\TMsd;L\UNUwn<`vx:DLJRLTRZ_WbeTV>EVRZbRBE>B:>E:BE>B:>E:B|MTO|Riazantsev, Alexander|2003.07.31|D27d|1/2-1/2|B -FVn^@Osd?[jb[RxnDLphEU^ULUk[RDm]V^wp;EvxIQog^gwg>@uw?>qi>Nn_NM_eO^dSMOSD=Dt_D\eo\lo^U^goldwuO_o_dhuwEOwoherv@sdEKjbKUdUOUxg<`w\DLmlTM\n=Ovx?>qi`YtmU_mdOPlP_nxyYPdm:=wvPeruMDm[eJp`CKu=>=[F=EFaLTypGOk[nd|World Blitz 2015|Socko, Bartosz|2015.10.14|C07|1-0|W -EUxgDTnf@Om];LldFNsm=DweCKvx?Ff^T]d]L[eS@rtD=XgEO^O=Ot\?@vx`YZlYPluKJkc?=dZTFtkO^rt:owjJwrJCTRC;k]>Miw=EmdGO]TPWd]MGRBDBTB;>BTGX]_>Vr:@IqaV_f_XgxogmwpW^piOW:BEBTBIPiw^lwJm^oglugpPYJeY`e^W^poHPBf`Wf]WNofNE]HQYH]EDfmuZmdDMdmMDmdDC]fCJf]JS]fZuf]SZ]fZbftbjtfu`fm`WmfjsfmW`mf`ifmiWmfU]f]st]KtuKTunTK^fKTngTKWtTKTZRAYvxS]wv>SRS]Sog`gpgYIvrS]gu=?_hNiu`i`V`IErbT\e\]gxpEm`ogXbfmj^VjJha?Wo`XN|TCh-RUS|Efimenko,Z|2008.04.02|B90|1-0|W -DTxg;LphEUwpFVme@OvxIQn^U]gaHPsb@vxBRtfRZum@vxMDsdEU\ULUe]V^gV;Lt_@wnEMk[RKvxBR[S;EmeRZrsETqiIQtfDLutMU^ULUe]V]g]?>wuVs[Kftf=Du]E>]\DFSKFM\DVFf_M_n_FDKD>L[]OE_U|World Blitz Final|Svidler,P|2012.07.10|C84|0-1|B -@OxgHPm]?Hnf>@wnEMvx;El\FVsd?>k[V^gmE?[SIYjZEunBRkcCK|4. Open|Milov, Vadim|2004.04.01|C11|1/2-1/2|W -FVl\@OmeEU\UOUxg;Lph<>|3rd ACP Blitz Octofinal|Petrosian,TL|2004.06.05|B78|1-0|W -FVl\@Ome?[tmDTsd;LphEU\UOUwpUdmd>@xgGOvx@wn?>k[RKmeDLvxIQdZKDl\EUul;E\ULUZdE?^UD;e]V]g]OUdU=Utk?N]WN_WF>Fl<@IngUXph_P@l\CK\UOUwnnw>VwpKSvuS[b[R[dU_?kc?@n^FVwn;LmeEMvxIQrsOItmIXutXgng@ImfGW^WPWgLCLo_VdPeZlel|KM FIDE GP 2015|Giri, Anish|2015.05.15|A05|1/2-1/2|B -FVn^@OxgO^me^OgV;LVLELwn\UYajZGWo_W^_XA?w?>?xyFVfxE`XPaiPHVHU^`uluHV^gipgp?AqiAipiV^|Aeroflot Open Rapid Final|Frolyanov, Dmitry|2013.02.16|C42|1-0|W -DTn^;LsdHPph?Hwp:;jZBJmeCSZSJSo_EMxg<`qi`gpgL]gp@Ovx>@dnOEh`=D_WT\n_EKxy?@smIQXa@jbBRsmIQm^MDgaGW^mHXagFPrs\U|Keres mem op|Tsiganova, Monika|1998.06.21|A65|1-0|B -FVldEUm]V^t_@Onf?Fd\>@sdDL\ULUxnvxGW_hEOtcCKjZBRdS>MrtO>cmMSnSF[ms>Msd:VdT[dl>=hVXPlnPNVhNOtlIQqi@IltOXu][TnmXOmdT]d]O]S]HP]L=@wn:;jZEMvxavR=ZRBJS]L]u]ETrbT^br^TrbTEbrE;]Z;LgnLFc[FWvo=F[SJSZS@S\=FmegmLR\N>NvxIQXfCKm\RLftMF\fFXfUXtrt:=d\GW^WNWuZ=MZLMLUF@IFW?WwvLMvfWGxwGEtdIPwnPOfgOFgfFOfgOFgfFOfgOFgfFOfgOFgfFOfg|TCh-RUS Men 2016|Grischuk, Alexander|2016.05.02|B44f|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBRtkEMme;EdZKBl\E?[S?NktDLtfBfofLS\S@sdEWdZ:kO>N\NEMOHAHN\;?ofSdjZJRfFMFvFHQFV?_VT_]xo]aTRaqRVqyZRyrRJduoguk\nrbg^QHVSbcSR|Supreme Masters 2013|Hammer, Jon Ludvig|2013.05.09|E15o|0-1|B -EUxgDTnf@Om]HPwS@ld=Dkc?=smEWtbO^rt;LbT^T]TFVc[BRjbU]d]V]f^W`[S]eSLDLqi`N^VLJwvenunJnvn=enf:=m^HQfe=ets@HTLCL^TebTNGNg]RZo_LT]NHGNTQ_swPXTZbZphZ^h_X_wrGPxo^VogPWrbIYia|78th Tata Steel GpA|So, Wesley|2016.01.18|E11i|1/2-1/2|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DTtbCKog@vxFOrv^LgVLpxp?=meOVvV;LV^GObt=>wv>^v^@Gqi:=h`=EjbHXtkL=d\=Nph|Alushta-100|Ovsejevitsch, Sergei|2002.04.19|C45m|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb@mcRZcTFTtTNcutK@weEMumO`]LCLf_:;qi`Vrs=RvxVelexoFNUO>FO`@]eBJSZCSZc=Rvx?=rt:UC?EBTXxwXYuE?TcG@IB:TtwntlEmlmnm|Keres mem op|Martonov, Anatoli|1998.06.17|B22|0-1|B -EUm]DTld;Lxg@OjbFNph?Mwp>@vx=K]TMTgv?=veTFtXNVsmV^e[BR[LCLk[RZd\IQXfU]f_@IU=PWh`ko>@IP=MWNMNGNL^PX@HX_HQ_VQXV]X=]f=RowiawO`XOkRvf]vx]dxTdmTomdok|Renova FIDE GP Zug|Kamsky, Gata|2013.04.29|D15g|0-1|W -FVl\@OmeEU\UOUxg;Ljb@tfTKsdN`dZ`gngK]rt=Mk[BJuc?=wuOEg`E?ZT:;[SJScSLBSZBUS;SsS>MSTM>aYbeNHP?H>F>TD?EYQe]`W>=DB|It (active)|Valmana Canto, Jaime|2005.11.17|B90k|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PldCKulVUVDVwJlj|Amber Rapid|Anand, Viswanathan|2008.03.21|C95|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBRtmDLvxKDwv?>qi;EnwIQdnMUnhE?l\U]gq:ZSLSY`RZrbN`u`E`i`HXph@H|8th World Teams|Leko, Peter|2011.07.18|C84f|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn<`tf`gng=Msd>pg>@rs@>srKCry>:yrC@agO^vxGWgv=aog^hnhMhtmHX\UNUcuEOulOYm[?>[mW_f^U^g^X`l\@H]U`ivga`pi`iULHQLD;<\U>@UM@P|FIDE World Cup 2013|Andreikin, Dmitry|2013.08.22|D03d|1-0|B -EUxgDTnf;LwS@Ol\HPvx?H\UOUm]T]g]=KuZ@SLCLtb?=Z\FVbTKR]cRS\a=>d\SZwtENTFNWFM:=MF=@sb@vx@bZBJtk=G[SGXqaXNph?OkbFbSLCLrbHXaXNXwsOQcCECsCU\m\XgxpQqpwW_f_:=\Vqywpyqpwqywpyq|63rd ch-RUS|Potkin, Vladimir|2010.12.11|C11k|1/2-1/2|W -FVm]V]u];L]ZEUld@Ot_?M_M=MZbMbsbng>NruA>xXM^e^N^u]DM_W^V]_>FWPVXPGFGaXGH_WMNg_YaWONF_`aiOQHGo_|8. Tal Mem Blitz|Nakamura, Hikaru|2013.06.12|B01|0-1|W -EUm]DTld@OxgT]d];Lsd@vx:dUEUNXOXn>|Moscow Aeroflot op-A|Atalik, Suat|2005.02.23|D13n|0-1|B -FVsd@OmeEUxg;LtX@n^DTm]=RweEU\UT]uZRZdZ;JtmCSeSO^SL:;m_J[_;[lvulr;h]TtvVev^e[>=\e^ae\ay[e=DeVE>VeyreVrRT]DM\c>SVGMDGVSwVLRbclDMLVbjVGMDlcjoGXoWX^wp^dDKclW_l^_a]Vpi^giEd^aigpiYV]EW^dYa]Va\VW\dWNdhpyhfNEKTypfhpyhHENHxygxwgpwopyonNEnvypvnpynVypVfpyfiypiIENIHpyHxygxwgpwopyonNET]UMFVEFnqMEqIFNIANFV^y^]^E=2A=F=|TCh-RUS Men 2016|Kramnik, Vladimir|2016.05.07|A05|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeBR[SEUvxU^e^;En\=FqiIQunETtf=vs=]l\:=rj]es[eb[ZbZjZT]phHPxp@HZB=EB:E=:B=EB:QYia]V:ETvwGW>FH?fUTeFCkowxokCKeV\TksxoVeofeTf]Tc]V^fVO?>KMsuUD>?Mu|World Blitz 2015|Dominguez Perez, Leinier|2015.10.14|C88|0-1|B -EUxg@rtCSZcEKmgK\g]=EkrDT]g:@gv=Dm^RZ^OFOtmLRm[?>vgRLgmDKm^L[\TKSb[OFnmNVwvWPqa:JrtZbkbJbt\PWmtbc^mWemce\cR\NtmF=vV=R[R>=o_Scxq]eVvNWTLCLRJcZvVZlmR=:VTlnTVnlVT:JR=@I=FJjTlelFTWeTdlt2dte^tfjpqiGWaYpkh`ksihsufTuehaW`a`eUT\^W`aUM\TMOT\IAahWIh`I@\T@N`hNUh`ON_WNOTFAI`_U\Ff\Jf>Je_hLT>fT\f]OWhaWX]fXUfmUVmdVfdRfgRdgwdVwtVUtuUVuya`ytV]tu`auv]TvwT]wga`gW`aWX]dI@d]@G]MG@M=@I=]XW]dW_ah_?ha?YX_fXUf_\d|18th Amber Blindfold|Ivanchuk,V|2009.03.26|A61|1-0|W -CKn^@ul=Ewu?=^UEUtXIQXFLFjZ:V]>=]\=:aipi_o:Z\eZbe]iho?bZ]eZbembjmdjbd\|FIDE World Blitz 2014|Wang, Hao|2014.06.20|A01|1/2-1/2|W -@Om]HPld?HtX>@smEUxg;Enf?>wnDLvxFV]VEVgV>VXOHOn`=K`<:uZ>^Zl@HwuBRgv<>veYaqiKDeT^\Tc\^cT^Fk[CKTeF^et^\tnR[s[\TjZTRlcRJn]OFclF[d[LT|World Blitz Final|Le, Quang Liem|2012.07.10|D02|1/2-1/2|B -EUxgDTnf@OkcHPtbCKwS@rtFVc[?>]VEV[T=Fd\U\m\V\t\KS\[:=ulBR[SFXphXUf^U^l^>^SK^nKLnjbt=:wujrLKH]KS:@vxDTld?>wv;LVLCLv>=>qiT\elO^smGWmgW_gVMV]V>Pt_@vx?>wv<`tX;Egm`NunIQXaHXah:=ru@Hn\EK\N>Nmg=uvuK\kc\fueflhVX`VOHOgmOFxoNVqi`ieiQYonVXnulbd\CSphBRutS\c\b\m\XTtkT\iYRZYVFMVWMNW_GOh`LTjbNF`XOX_`FN`X|6. World Blitz|Aronian, Levon|2010.11.17|C63|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQwvEUtkBRutO`duKDnw;EldCSufEKgmKZf`<`tlZklkDKmcR[b[:rvrU^e^=Fwn`NphHPcmGW^WPWklV^mw>?rJFCJbW_d\CGl^S\h_NUbh@A^VGOwfOV_V\dneUcxwdlelclwnlZ|NH Chess Tournament|Nikolic,Pr|2007.08.25|C92|1-0|W -EUm]DTld@Oxg;LnfT]f]=Dph<`wnFNt_DKuc:E_fLRqaIYne<:kcKSjZSZrZCSZjRLyr:jrjA;jJFMc[EDmcDCJr;:cTMTr:C:[T:CogCJh`HPfmJCefCDf_GO_fDEfeEFm_FG_MGHefHGf_G>_h>EM_NV]VOV_mENg_U]d]V]hgY`g`S[`gNWgnW^nu^U_WPWaYUNulNOlc]ec\W_m_OW_mW^YQLV\[VgQI|Internet Section 06A 8min +2s|Ferhat Tamur Ali|2004.03.06|D36e|0-1|B -FVn^@Osd?[jb[Rxg>@k[RKtk?>wnEMmeBJvx;EumE?du?PufDLl\MU^ULU\TKDe]V^gV=Fo_>=bZO>[SJSZS:rkrGOVPIPmjOucFGdvPX_XGYqaW_XO_fOH@HvdYaph;hcu=AjpNipn|World Blitz 2015|Kravtsiv, Martyn|2015.10.13|C88|1-0|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLg`JDvxBR[R:RbZ?TrsRBxyDN`N]NdnCKo_V_n_N]tk>@st=M_Y?=qiMPY_PXt\BEktXVtkIQ_YTMw_M;\LVXiaXFu`GW_W@AYHFHLP]WkHWHPQA@QPEGyx=eaYed`X;_PHGHX_dh_ohXog@IxoIQ^VX`VNQYph|Corus A|Topalov, Veselin|2006.01.24|B33r|0-1|W -FVn^@Osd?[xgEMw\DLvx>@wv;Ejb[dmdETgmCS\e=Kmw<`um`NwhOEewMUmnU^tfKDfTETh^TEbZBJZSJSnfGO^TNWd\S[Te:rvr?;kcV^eTDVrR;@I>^HP^FIQCMuwxqwvMGQYF[PX[TrtTWt_W_X_\Tvnl\noTL_gqh|FIDE Candidates 2014|Aronian, Levon|2014.03.21|C65j|0-1|W -FVl\@OsdEU\UOUxg;LnfU[wSBJSL[Lm]V]f]?Mvx>@]ULFtXGOXaCSucFWahWhqhOWg]=O]N?Gwv_aF^aI@?vw?FIHF=|MTO|Raetsky,A|2003.07.27|B45|1-0|W -FVn^@Osd?[xgEMw\DLvx>@me;EdnMU^ULU\c[MtXIQXaEKe]V^gV=DndMV]VDVaOVOdUOkUKBKuMkOru:JMOHOog^gwgKSuUJKUTOWgh@AcG?GTZKBKyv>FvyF>yv>FmdFavwaYtlW_cZYWk[_fofQq[SLFf^WidV=EVqiqe]FP^VP_n\qilm?TwuTFZcE=bZiWsjIY\eWEe^Ya]UFTUMDMVMaiZRKRmlCK^LEWlm_NMENXmUWOckXgkOHOUTKTLg;Djc=ESKD=KCEuC;2=Fgu|3rd ACP Blitz Prelim3|Paehtz,E|2004.06.02|B97|0-1|B -FVl\@OmeEU\UOUxg;Ljb<[SLFulIYe]?QmcCK]VX`g]OV]NENi`Y`ph<;wpA?l^NGrjF@jl@O^\GE\LQXLE=EvnEGcmUFtkO>m^>MnvM^p^XOyYFEpUGUdU]lvmlrmdBRtf:JyrJMd\CS\SMUS\UMh^ML^T?TfTQYe]Y`i`Aa]ULJogJ:\e:AbZA;k[R[ZR[cRJckrsaAe\DLULELT[;:sk:JkmLD\eDEefENfoA@tm?>wh:;utCSnuO`e]NEucT\clS[v>;>tw>;wuBRhwLFqi`OwfM_uvENfw_MwfNEvu;>usENxyDnyxnm]dmuofGN|8th ch-Euro|Orlov,And|2007.04.09|C42|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxEUtXU]dZKDutIQXm;Eld]dtdE?wt?PnuP_m_V_ZTBRqi=FulCKTcRZc]LTlsDM]LFD[SM?sj@V\MFvx@]T=DjbDTk[TDtkkVDFphZclcE?^pFEbZ?NpiHGuvDtkt@phEKbZGOvx:=kc?>tkYGrt@AgaNVapGNnYHPYnDGxyNin`i`f`KEogV]d]OW`oW_h`E?oe?NpvA@eVMV]VU]veNDwvDUv^UfunGce_>V^VLVtDcKDF]enmf\_U\mUKmg|10th World Teams 2015|Erdos, Viktor|2015.04.23|D15n|1-0|W -FVn^@Osd;LxgEU^UOUwSUdkd?Mvx>@m]V]d]IQld=Owv<`rs:=tfLFSnFUfmCKgV`WsSMV]VOPutDTd\UDScWengDNmf=EgUEU\Ue^og^UcbUgtkg^bB?=vwT\ko=?fKNXBb^eofewxwPswoX^ogGW|4. Zurich CC Blitz|Kramnik, Vladimir|2015.02.13|C47|1-0|W -EUm]DTld@OxgFNjb;Lk[CKtX=EXOHOsmgY>?YgE>vu>Gnp?>ulFDwrQ?yvM^pn?Qgp>@pg=FrsD@meDLvx<`qi`Y\cBRrsR[b[;J[SJTSLCLtfKRdZTcscIQunRDZdMUfT?>TbOIp`YPwsGObTPGcCI?T?@?gm:;C;D;du;DufDRfW=Dxp>;s;D;mw;[wh[mnmRmpg|WY ol|Zhao Jun|2002.08.25|C77|1/2-1/2|B -@Ol\FVnfEU\UOUsd;LulvnHPgVeSkSLSVPS[_W[cWO>@PF@?^VBRFP?G|Tashkent FIDE GP 2014|Giri, Anish|2014.10.28|B48c|1-0|W -EUxgDTnf@Okc@sm=DqiMVkVDVvx?>mgVMumIQaWNWwvU]f]T]nwOUph:<>rv>vgPQpwONgqN^mtdnwn^ntbnvxpv[bk>nqg[dksdlsyQHgXnopxlu|World Blitz 2015|Navara, David|2015.10.14|E12|1-0|B -FVmeEUxg;Ln^@Osm?Twn>@ldBRjZ?>vxIQqi=xpEOfuFEuk@HlnEMsr=ErsHIsrE=rsMEsrEDkeT?rsNTeT?TtXIHsuDAHGNHC>EC:NG:AE>AIGNIC>EC:NG:AE>AIGNo_V_h_>G_WPW^WNFIGFGpgGFQ_FEgnE<_h@wn?>k[RKmeDLvxIQtkEUwvBRnw<`qi`gugK]rsR[b[;Jdn]kskU]vsJDld]dndDNgf=Mfm>=kjN][SOESLCLj:=:duETm[:Z[kZRufRSkjHPsr@Hj:Tcf\MOruQY:>cRurR\r:HQe\Sk>AOA:AQHA:ksphsviav^:r^vrjV^xpHO\TvtjZtuw\]g\nuxpiOVng^giqxpqipoZBGW|NH Chess Tournament|Beliavsky,A|2007.09.01|C92|1-0|W -EUm]DTld@Oxg=K]TKTt_HPnf?Hsm>@wn;Lvx?>gVTKucOYnYPYmgGOVLCLclFV_h>FgaFGwutXWPgaK=Xh>N][=F[;G?aWNVWFVF;?@?hMP>Mb?GbT|38th Olympiad|Khenkin,I|2008.11.19|D11|0-1|B -FVl\@OmeEU\UOUxg;Ljb@tfTKsd=FdZ?=ZKDKuvO>gX>Do_GOXNDN_VLVruN]voFMf]M]o]=]xo:=ofKSutS[tD[bkb]ZwsCKsc@?cdIQqa=Mp`MEDEVEe]ZRbZ?FnuFMdBF|KO|Carlsen,M|2006.11.01|B90|0-1|B -EUxgDTph;Lm]@Owp=K]TKTvxFVjbV^gmIYmcT\tX<]dJLpiA@k[OWi`Y`d]CKsdVHC:nfU]u]=]H]><_V<=[SL<]Z=mrumudu@vxRLo_KSm\GW`hW^rsSJsrJSrsSJ|Dannemann Match|Kosteniuk, Alexandra|2003.02.02|B32q|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMm]V]g]O^dU;L]S^]eDLvf^fefLS\S:tm@IbZ>Nk]Nc]KcZmMZSKf|WCh 2016|Carlsen,M|2016.11.18|C88|1/2-1/2|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=MnfjZ<;vxO^ruMFnSGWwvBJSE=Ed\>=\UEUm\FNZRPF\KUMuM=Mk[T[g]NGlk[c]cFLvtW_c]_fofG>]LMLtuLMuM^Mk];D]HDLHdLSKU>^dm^VUdSLdnM\n]LUmo\f]cU\cm\SoaSRa=CK=eKSmcR[c][T]cT[c][T]c|Amber Blindfold|Topalov, Veselin|2008.03.23|B19|1/2-1/2|W -FVl\;LmeGWph@Owp?TsdEMnf>@xn=>vxW_h_>P_VMVnh<`og`WhWPWd^O^e^WGuUTFtm:=UG?GruFTmtGEuUCKwuEMjbBRxoLFUM=MuMTMtmHXpi@GiEIQk[R[b[DT[SF@EL@OqiGPopMDg_V_f_X_pgPXm_D_iaXag_QY^VO@VN@FLgF<_W2WMGFM>Y>|ACP Blitz preliminaire 3 (3eme)|Macieja, Bartlomiej|2004.06.02|B23e|0-1|B -FVl\@OmeEU\UOUxg;LjbGOn^UKwn|19. Amber Blindfold|Grischuk, Alexander|2010.03.21|B90|0-1|W -EUxgDTnfHPm]@Own?Hvx>@]T=DjbDTk[TDtk]SD;ruEV\cW_SM>?nm_gphVele;Me^MVwvVYiaY`c\F^v^`^\w?>md>Fue^vegvdgdBR[RKRdTO^TRFGRV^ownIYbZo`n`Y`VfPXaXGBfbBRxoHPofPXf]XW]\WN\[RBZRNMRJMD[TD;bZBHTU;BUVHGZ`BJ`_GHh`JKVOH@`X@?OV?>VW>?W`?@_]KL`W@?WNLT]u|19th Amber Blindfold|Ponomariov,R|2010.03.20|E06|0-1|B -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeEU\cBRrsR[b[;JvxJ[^ULUtX:Rwv<`qiK]XOHOi`]dvf[LgaL]aW=EW]d]fi?:umRrsr:rxqV^e^U^mQ]ophoxqp^fQI@?iYEmpgrwg^m[^ewu|MTO|Tkachiev,V|2003.07.28|C78|1-0|W -GWm]@OphHPwp?Hxg>@l\EMsd=>]U;JvxJTg]BRkcFVUNDLtbNulO`rt:>qi`VwuW_h_?_lmNWmMTNogH?d^?M^MW?M>?btl_?>MbTxyN_M^Tf^h_pypVg|Moscow Blitz Final 2014|Paravyan, David|2014.09.06|A03|1-0|W -FVl\@OmeEU\UOUxg;Lphp^UD]VMVRVOV^P>AZ^=Uo_`gagAQgVQPVPNWPFW^FUDUrZUOxo;Dof^lZ\lc\aDMf_MF_XcGa_OIXQI?_gLTqiT\h`Y`i`CS|38th Olympiad|Le, Quang Liem|2008.11.13|B78e|1/2-1/2|W -FVl\@OnfEU\UOUjb?Mw\UK\j>@xn=FsdtXON`nTFXF|EYCC B14|Predojevic, Borki|2001.09.08|B42|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwnwfPY_`Y`f`GW`fEVo_VgxogqfWq`og`q|XIII TCh-RUS|Erenburg, Sergey|2006.04.20|C42m|1/2-1/2|W -FVl\@OmeEU\UOUxg;LphxoBJT\=Uk[;Cg]>^nfHXogUV\dX`goVYop^>pxYVxo>EM_EN]MNFM]A=vm=UhfUW_hWRogOWd\RZfdKSdcBJc[Zb\SbdSJdlmfCJf_@ulTKtf?>wtN`smOEk[BJmcE?gv=En`E`vg?Nlk:=cTKT[T=ekCL]f]N_gv_nxwntog`EveE]rt]ewvefvu>=ul=mlsfe|World Blitz Final|Le Quang Liem|2012.07.09|B90|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvuIQuv;LqanSHXaXQX_n`fif@HSLCLru=;k[HPu]LT]\>Vjb;KnhKJogJbhWPWf^V^g^W_vobjph_`^V`i\TjlofX`TDihDGldf]dc]\cf\UfeU\ef\UfeU\ef|Aeroflot Open Rapid Final|Grischuk, Alexander|2013.02.17|C67|1/2-1/2|W -FVl\@OmeEU\UOUxg;LjbHPn^UFsm?Hk[IQtkPX[SL]g]V]wnFPvx>@n`<`u`P_`gGWbZW^m^CKgu=Ukt_Pul:@wnEMk[RKmeBJvx;LdZKBtfCSZdL]dUO`f]V]gm`Vo_VE_WDLU_EVuvBKvhGOnYJRmg=FbZR[ZSUCT?rB@wnT]f];LvxL]g]=]tf]angFVd^DN^MBRrtaFcKN]f]V]tDFOD<:]O>=U=nN=MN>M=>N=MNM|Corus A|Van Wely, Loek|2009.01.28|B90l|1/2-1/2|W -EUxgDTnf@OkcBJtk;Lm]T]g]FNph?[ld[MwpL]f]>@vxCSsmtlRZVeZcjcS[d\U\c\D=vrIQqaM?eV[clt?MtdM?ru=Rh`OIdhR=`XQXaXIX]UNUpU=FnYXNuvN_YW_U\UGOUMFMV`@G`Q|SportAccord Blitz Men 2013|Radjabov, Teimour|2013.12.16|E12|0-1|B -FVn^@OxgO^me^OgV;LVLELwnEFpLnoLO|Tal Memorial|Kramnik,V|2010.11.13|C42|1-0|W -FVl\;LmeGWph@Owp?TsdEMnf>@xn=>vxW_h_>P_VMVnhIYd^TF^OHOuYPYhY@Gtm?=pU@wn?>k[RKvxIQtkEMmeBJgm;LdUOU^ULFl\KBrtFWxyCSmcWFum:>m_A@_VNPVhPNhVNPtdB;dhDLhP;VPNVOyx@GNM>;kd;:[S:bdvG>SLO]xybJvRJRLD]OM=>GwtOdD<2F<=@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphBRwpDMldpLM^wv>N[\OFaYFTyxHPYPIPxyBRyQ^M\dM@gVEUVe[dmdU^e_=uvu;LuvIQqafT>MTMLMgfMUfgUMgf|40th GM|Naiditsch, Arkadij|2012.07.15|C67w|1/2-1/2|W -EUxgDTph;LwpFVme@Ovx?Fn^>@sdU]dnCSga?>jZSZo_O`aWVp^T\`n=>kc\cZJ>SJOHOtkSKxylfkV@m]V]g]IQ]cTKt_KDumCS\n=FjbBJru?=wv:BmfLTfh@AdUOU^UF?hdAIneGWcR?GewDK_mBFdhFvuvGPbZSZhPIPvr;ErZEOl\PGogHXZbW_bcKDwe=>xoOERLEVLV>VcbVFmdD=bc=DcbFfdmf>bcD=c;=Oe^OVqiQY^lX`i`Y`g`>AmdVdkdA@`X@>lZ>@XPGHZlHO;KOVKsPH>NHEoge\g_\dp`d]`XT\XP\d_W]UWOdlNvU\PHEHOHMUv>U]><\c<;cd;@sdIQn^@dU?>jb[TmeL]g]V]phOU\UEMqiFwx:>luGOo_WPpgPGxoDLuxHPxp>poFIm[ECjkCKov<:st:ZwpT[k[KRtsIDpo@?g^?FvmDBscZ[c[Rr[kBD^pDtm[rZ[mZrm[rZ[mtuml>EkjZljlurp^OW`WPW^gF=nf]fofrsf]s[]f[sf]S[gY[cl\sy\[yi[cihc;EtsIQfKBKcNFNn^L]dn]g^gGWnt=Ugn>=qiNOldQYtcOXogYaslUMnmXFmoFEoaHOaoMeowV^g^W^ue^elsOXwgDTg^EW^WPWjZ=@p`XavuW`i`@`ctT\kcaOc\`\teOdut\LsjdRjc@weIQXaBJvxCSrtQI|GRENKE Rapid WCh|Faqiry,R|2010.08.07|D10|0-1|B -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mnfog>V\cOW^W]\>G^UG>\cbZBR>Ec[tlUcltcZENZcNW[TWET]E>RZ>PZbts]fsrfmPWc\Wl\n|WICC qual Moscow f 25'+10|Novik, Maxim|2002.05.31|B19l|1-0|W -FVmeEUxg;LphGWwp?Msd@OtXV^XOHOgayxHXahU]d\;BxvFDf^MVmcOYnmY_vx_PctCSml=;srS\e\N\l\;[\lT\u]P_xuV]u]>=ld=]d][KjbDM]dKLqaGOrjMuaXQXdfBCfdCsj>GtnMen_edkdLM_UM=jk=AUfAqf`qi`figf\gokcGN\fonfUn^UDNMDJOWJ[W_[e_gclgo|World Blitz|Gashimov,V|2009.11.17|B01|1-0|W -FVnfEUm];LxgV^gmGWl\@Osd@utkKtTLFwn?;vxKkTtELnuLtmtksrs;sulsrtmrjwtFLp`HP`WPWxpW_piGNiaLFaXFUf_@H_WIQX`NGm_GY`hjb_fUfofbdhaYgtxHOlZOWZEWOxvdlvrOFEWldrBFMBJDLJBMUahdfh_fvBEU\EMgpML\ULQvw_X^fQNU]W`p^NJ^eJNwoqafn`nenaYopXa]UNfU]fFngFNp`ai`xYQgUNJ]VQIxyihyIJRIGRrGHhoHpofphfohirRieonednmdimnV]RZU\noidZr]^r:dgop\wpxwi:>^_>@i`@?`Wxpgcpockowkj?G_^wxW`Gojbxp`gphbdojguho^_ovugvmdTjZg^ZjTDjkDEmd_fk[^U[aEDd[U^[Sf]SKDCKJCsa`]UJR^e`[stRKtLKCUT[aLOaYeWYXOGCJTLJRLT|20. Amber Blindfold|Nakamura, Hikaru|2011.03.23|C11|1/2-1/2|W -FVn^@Osd?[xgEMw\DLme>@vx;Ejb[Rwv?>k[RKtfE?\cIQqi?PfKBKbZOIumIXgXQXogP_dnNe]N>]U=Dl\LTn_X_vs:Jxq>:mlDE[TKTsSCKrsJZSKE=lZ:ZK;=;s;@I;KZ\KM\]iaGOqi]mMLmlph_hihIPg_V_h_lo_foq^VqifniaVNPWLTWVNFaATDVMDBA>ng>FBRFVRBVWg^WV^gHPBJMFJBFMBJMFJBF>UMVNBHPXME>=g`NFHPFG`W=EP@EF@:G?:BFMBC?@WOX`Cs`hsuMTOVhputT[tx[dV^dm^g|World Blitz|Dominguez Perez, Leinier|2009.11.16|C65|1/2-1/2|B -EUm]@OxgDTld;LnfFNsm=Dwe?Fvx>@]TFTjb?=k[TFulNVf^HPwvU^m^<`^OFOgXLFqi`WeWFWX^OFtXFX^X:@XOFOuc@cC=>\T:;CD;kwSkSdSF=DM=Rvw>:_X:Crs?;XORDOFDMFMBJM;JS;hCJskS[knNWqiIYyqJbh_W@ywFV]ULRC[<;[TRcTBcrk[rctkV^elcmwu=aonESnmQYmtHQtsaoktSnuynele^eB]Qf]folsr?>fm>nmlnlyuldtkdluelpUMpoME;=kV@?VM|World Blitz|Grischuk,A|2009.11.17|D15|0-1|B -FVn^@OxgEU^UV^gV=Um]^eVe;LsdUWe_?[weWVunvw[dmdOUdmU_m_X_ogBJrvESv>Se>nenwn=>no>=on=>no>=on|Blindfold World Cup|Bu, Xiangzhi|2007.10.16|C43|1/2-1/2|W -EUxgDTnf;LwS=DvxBJSLDLm]<`l\U\]ULDf^FNqi`Yun?Fwv:=jZ@Osd>@UM=M^VMeVOYgOFgnF?2@?vnCKtfDLnlNVlnIQo_V_f_?@_feMf_Me_feMf_M]_fKSZSJSrvS[f]T]d^\dkd[d^dLdvuHPnmdfxy@H|6th Tal Memorial|Nepomniachtchi, Ian|2011.11.22|E36|1/2-1/2|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvuIQuv;LqajbU_t_FU_fUfifHXaXQXd\DL\T@Hk[HOrsIPfiOV[S=USLCLsCUTl\TRvm>=mtVNCDNMDC=ECEMEicEDtmRVmfV>c[BR[Z>Vf]GO\TVU]\PG\dUTd]TV]fDKZ^GU^VOVfeLTedV^nuKLdmLSmdSLdmLMmfMVulT\ls\dslULlcLEcuENulN`l^`W^LdlfmV_LUW^|SportAccord Blitz Men 2012|Aronian, Levon|2012.12.17|C67|1-0|W -EUm]DT]TFNxg?Tnf@Ojb>@l\U\w\=uvuTFun?=sm;EkcO>tk>MyuM\m\GO\METM<:U\dv\S>ELREDCK|4. Zurich CC Blitz|Aronian, Levon|2015.02.13|D27|1-0|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu?=uv;Lqa<`wnLFtmFWru`nvnO`yiHPuw=Mmt:>wvGOnw@GjbIQ_nPXaXQXnhWhih`QhiQWiIWHwn>FvyGNyQHWIFNFQIF=phMEIA=FbZFNkcWFtmFPAQEHmfCKZRPVQAVgA:DLRKBK:>HF>FNFfKOWKfFOd\OVc[W_h_X_fBg]nm]NmdNXB;VW[SLS\S^fofX^de_g;q^TemW^SKTCqxCMmv^Wl\MC\TCRvoW^xq^UqMU^TL|World Rapid 2015|Radjabov, Teimour|2015.10.11|C67|0-1|W -EUxgDTnf@OkcFNtk?Mm]CKwe>@vx;Ljbo_>Fh`FDldP?`XO>wgGWgiHPmgDHiQM;qa>MnqM^rt;MaY@wn?>k[RKvxBRtkEMmeDLds;EsmE?m\KD\RDR[R=Rqi?NwvNTnwTZktZdumIQvfLTmvdStmR=mt=RtmR=mt|20. TCh-2013|Kamsky, Gata|2013.04.11|C88|1/2-1/2|W -EUxgDTnf@OkcHPtbCKwS@m]=DsmEWvx?=rt;LuvFV]THQqiOEc[KT[TQ?mcBRnSRZcm?Tb[DKSLKLvn=>wv:<[TLTf^WN^UNUd\ULm^L^n^@H^lEKgm>=lkT]k]=]\T]mTKkC>Vf_VRCsxpskpxknRSnmSRmnRSnVSV_VxwVUwvUVvwV]wo]eoge]go]eoge]|5th FIDE GP|Eljanov, Pavel|2009.08.11|E15q|1/2-1/2|B -FVn^@Osd?Tw\>@xgEMmeDLjbBRqi;EvxIQwv?>tfTfvfCS\j=De]EKk[NfeK\utN>gaV]e]DBaWR[]e[deh\mWHO^|42nd Olympiad 2016|Navara,D|2016.09.09|C50|1-0|W -FVn^?TxgEMsd;LdZ@FZTMTme>@wnBRvxRZtfCKldGW^WFWgmPO>@f]V]dnDLwp=a^VMFut:=vxJDnhGWVO?OwvFMv^O_t\@A\]_^]^aOrwDSbZS][SLSZSCKws=?^fM_f^_hoh]S^CSdswO]xy?w|IV Open|Barrientos,S|2004.03.29|B33|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBR[SEUmeU^e^<`gmK]tk`nun;Eru=Fm\RZds]k\kETogIYn\YasdTNkeFburbMrZN]Z:>:g_]l_VMK\TKTeTO`VNGNTNDLSK:bdnlfwsbjn_`Vqi@Iscf\NTjRTCRJCTJKcK\KxoK\phHX_NIQN]ahohQPiaXaha\M]LVLa`M^T^|SportAccord Basque Men 2013|Ponomariov, Ruslan|2013.12.17|C88k|1/2-1/2|B -EUxgDTnf@OkcHPtbCKwS@sdEWdZ:@gV?>VeO^wn[?d^>^vxEUng^>e_DLm]?Mph;E_eEOt_FwvO^gp:>vfGOe_HX_e^ofFouF>@G>vudkdWevfeWrwWEpgCSgYGHwvH?vsBRYnEWswW^ngMNgp?HfnIYqiHPnoOWxqRZjbX`ia^ewuNfo_eluwfdwoS[on[b|WCC|Balogh, Csaba|2005.11.29|C67d|1-0|B -DTn^HPldEU^V;Lm]T]d]=KsdK]u]L]dU]lvulrUD>=D:@m]V]d]IQld=Owv<`rsLFSnCKgV`nvnOWsc?=V\FLulWYqi=>ckKS\MDMn>:>t_>NxqYUleNP_hBJjZLBZSJSksQYia@IogI@srBLr:@I:JGWJKLBefBW_;<_hqi|Qatar Masters Open 2015|Piorun, Kacper|2015.12.23|C47u|0-1|B -FVnfEUm];Etm@O]VEVmd?Msm>@xgVPphDTwpU]f]?>vwOUwx=DmwUdkdDRueT]d]=CL?Po_A@rs@?sC;MCBPFWFMFypFTBC?HpgHOCSTMSK=;KJIYLZOFJBFOBEMTZu;sgns[EDTMDLOFneYaha[_aY_OL@qi;EsmEK_qBRntO>wnFMqM>MtcGWcTW_f_?_ph_Omw=?yqK\kcCKc\KTwfT]u]U\ru@wn?>k[RKvxDLm]V]g]O^d^>^ldEMne^>t_=Oug;EghK=_MEVMVOVhV>VwvVvrv@?e^=OvuHPo_<`um:>^g`g]gOdmedkxoIQph?FeckOon>=gmO]mg]KgV=UcsQYVgK=gmFEm^=F^dUMd^MNneCKswGW^mFOm\N^wtYa\m^]efaitl]UmgBRlmEM[RKRbZUmfmMTmeT[gxLTxiT\el[ZioZ[ouO]qiRZ|World Blitz 2015|Nguyen, Ngoc Truong Son|2015.10.13|C89|1-0|W -FVnfEUm];Ewn@OxgV^gm?Ml\DLsd>@jZBRkc=FtkE;\ULUdSM[kbogGWxo@GluESZS>MunHXg^M^m^U^nuW_f_X_ph_gulGNl^Rc^Ic]qa[cofckh`NO`XOVIe]WfgWagfapfmp_es_NXPVOmdNDdkDS|World Blitz Final|Topalov, Veselin|2012.07.10|C05|1/2-1/2|W -@OxgDTl\;LsdHPm]T]g]?H]l>@n^BJrs:;wnCS\SJSk[EMvx@n^U^e^W_m\<`\M=MuMDMld:>gmHXkc?GwvGEpw@HjZMUog`N^UNUc[IQrb>=wnUGmcLFcTEDnwFPd\CKTeD\tk\lkrG\[Slme_P_w\_ixyioyxoixyioyxoi|8th World Teams|Ivanchuk, Vassily|2011.07.23|B09i|1/2-1/2|W -FVl\@Osd;LnfEU\UOUul@dl=Ert:=meBJxgNWgmWeweEele=evn?=m^OFp`GOtl@GyteEqa=^hED[TDTlm<=hW=mnmV^W]N]k]TWmnWYx`OW`x|SportAccord Blitz Men 2013|Wang, Yue|2013.12.14|B49|0-1|W -EUm]@OxgDTld;LjbT]d]@vxLRt@dUOU\U;Eld[RmeRKvxDLUcETcl<`qi`YjZTNlcN_t_V_e]@Awv=O^VMVvVYPclKDVn?>lPOPZR>NnNPNul:>gXNPlPGPxwIQXgBJk[A@rv>?vF?GF>G?>?@?wn?FneFNe^PXgmDMmcMFcTFT[TQYd\NO]UHPph_hoh|World Cup|Matsuura,E|2007.11.25|C65|0-1|B -DTl\HPph?Hwp;LsdBJnfCSdSJS\S:;SL@Oxn>@vxELm]lmIQnv]fef>fvfgWmM;<[TWUMUTU|CCM4 Ordix Open|Ehlvest,J|2004.08.07|A36|0-1|B -FVl\@OmeEU\UOUxg;Ljb@vx?=mcRZcTFTtTEMutKETdE?gmNGn`?NaYN]YQHPwv]SfTSdTMdjts=Mm\M=\fL]fU=U^UGUo_DLsu|It|Bologan,V|2003.12.20|B90|0-1|B -DTxg;Ln^@OsdHPm]T]g]?H]c>@wnBJvxCStfEMjZS[dU@ldCKvxg`>G_WMhqhIYWNY`NGFGvrOWrRGDxpHO]UKMnmOVm]PXRZDC]mCDmnVOZRW_nNMNUN_gpwDIwvIyvmywRVwomvOV|8. Tal Mem Blitz|Kramnik, Vladimir|2013.06.12|D02|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUul;EtmE?ZT?PphCKTc=l[RZng=utuGW^vV^gYBR[eP?e_Z[vfRZh`NcusW`Y`<>`u>;ul?El^[TfhTX^LET_n;=hXQXndZbLSbjstTetre[dj[jrscGSwjdstdUtTU_TX=uXWGN|10th World Teams 2015|Sethuraman, S. P.|2015.04.25|C97j|1-0|W -FVl\@OmeEU\UOUxg;Ljb@sdEOdUOUng=Fun?=wu:<]SBJSdUdkdIQu=<=ruCgng=uguFDueKSqiGOjZDLZSJSxw@GdmOWmdTFdkFOkOGOo_OFwoLTonTLnoHXp`LyeSyqovqiSTFG|41st Olympiad Open 2014|Fressinet, Laurent|2014.08.14|D30r|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb`W>SlkBJkpx]pPOG_g]dPMd[MU[Re]FDW`Ddg_RD_XGF`YSLUWdhXahH^VDRWwRmwumXa`Xf`afoaiHI]UIYipLSpoYVuvFMvVMV|10th Petr Izmailov Memorial|Ponomariov, Ruslan|2006.07.13|B90u|1/2-1/2|W -@Ol\DTsdEU\UOUxg;LnfBJwnHPucU[d^?HjbLRcZCSZu[ene=e^TeUm]>@vx?=tmR\md<`qi`gugUgpgFV]VHVdV\Vg_VeTe=ewu:=ue=ertemtLJRkcmeLJecJR@HbZSZRZcSxpIQiaQYZBHOBJOHphSTf^TdogdTJMTDMUGO_WPWUWHPWUDLh_LJU]JK_fKJg_Jr]MPGMEGP_WPQEMQHf]rZ]UZRULRZLUZRU]RZ]fZrMEHQEmQHf]rZ]UZRUMRVm]HG]\G?\Z?GZ[G?[\?GMEVFEM|4th Open|Illescas Cordoba, Miguel|2004.03.30|A33e|1/2-1/2|B -@OxgDTl\;LsdHPm]EUnfT]g]?H\UOU]LCLdU=UuULUwe>@rsFVkcPKJf_JSP>S\_fNWXPW`f_`W_fW`f_`W_W^fPHfn>S\SH@2nv2@USZU^vt]UZSUMtQWVQAVUA:U]:^]^SL^VLEVUE=UL=@l\DLsd;J]UFVtXLTn^IQXO=O^WPWgaJDo_V^unwsEH;:OF:;FD;s]Oappw]kwn>DbsD>nmkOsdOdmdBRlf>DiwRZcZEZqiD>wn>OiaO>dk>DkbZEnuD>uZEZbZ>OZSPGfuO`SZ^fudGFZc`oclFOdnOFndFEdnEDndD@xnEK\cIQvx?>n_[MueDLtm=Dph<`wv:=v>=>rtDEmf`WemO^d^W^muM_f_KU_mEWun>Ntv^gnwNvwvUOm_HX_VO`VM`OMVOUc\g^\n^gnwGOVM@GvmWsmeg^ecGPog^lc\skwele\ePGeIGNMTktxotm|FIDE World Blitz 2014|Fedoseev, Vl3|2014.06.19|C09|1-0|W -EUxgDTnf@OkcHPtb=Rbk?Hl\U\c\>@wn;Lvx?=ucZTV^g]L]k]EDTcH]f]CK\TWNTKBKmeNcjc^ene=]e\DEu]E]wn>M\e]UtLKSp`Y`i`@?o_?F`XFELtMWeWUWnfGOXO|21st TCh-RUS 2014|Smirnov, Pavel|2014.04.13|E15j|1/2-1/2|B -FVl\@OsdEU\UOUn^U[me;Ljb[JwnJTk[TNxgHPvx?H[SL]g]N]n`<`u`>@rs=MbZBJtfJSdS]SsS:ZSCMeCDZ^`EeEDE^\ws\@phEU\U=Uwp;Lme?=smm\YAwtHkrkAklk>M\MFMog`gpgBRqaKSxo@HofHOtwOFf_GOh`=A_h@meCKsm@ulVFngFDd\U\l\O`\`Hkru:=jZLE`\kVphEWg^WN\lVOm\@Hu=?=wuBJu=D=\mKSZSJS^e=Km^OF^dT\c\S\e^KRxpFOdn\dqaR[n_Ncls[Z^edlstZj_nOktmjsm[cNndsr[]GOelkd]Kr:px:U\pL`ivd\wdOwpLEiq>FqyFMpgMVgpV_p:_h:C|4. ACP World Rapid Cup|Grischuk, Alexander|2010.05.28|E15|1/2-1/2|B -@Om]HPtX?Hsm>@ldIQXaEMn^=>weFV]VMVxn;Ek[OYogGWvxW_aoPXd\YOnd@A\T>Pm\X`xy`hoxhqxqOYdUYhyxhwewDLUFP>FWBRjbEOWHAH\R>FR\?=ulOYru=ulu@aYPXgmX`phOXdU@HnNtlqiW_NPlPYPHPh_S[_WPH>VHIVUIHUVHIVNIHNPH?PQ?@QP@?PM?HMT[bi`bjTbG?bZ?GZjG?`X?GWOH@XP@APG|UKR Ch U20|Yarmysty, Mikhail|2002.03|B23a|0-1|B -EUm]DT]T@OxgFNnf?Tjb>@l\TKk[BR[SNV\U;EtkV^gmETwn=UvxUXxy@wnDTdSMFvx;Lt_BJVLCLSd?>wvT]u]^_m=FneF[ld^v|Corus A|Smeets, Jan|2010.01.22|C42|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=EcC:;CJV^e^W^gmLVqi`YJB;=BCENw\?FsdDLCJ>@vxVgmgYgdU=U\UNUpg^gJZIYxqFMZ_?>wx@IbZHX_MUMqy>^xX^aXhMuyqun|KO|Radjabov, Teimour|2006.11.02|B97|1-0|B -FVl\HPm]V]u]@OtX?H]f>?sdIQXaEMxgtLX`LMFMj:>F:^F?ga?@^>M?>SHOf^?MSTM=^VOaha=aqx`hWiAQTUQNwGDLUca]xw]rwnrVngVng_nV_gVng_nV_g|Eesti EST, Men Ch 2003|Paernits, Rauno|2003.05.17|B20|1/2-1/2|B -EUxgDTnf@OkcBJtk;Lm]<`wn=RkdRK]TKTjb:=c[TKsmFNvxKDqi`gmg?Fus>@sk=f^U^e^=utuFOdO>O^eLFkVFUVDfUtugoS\MTuUT\UWkKWo\doWd]ZRKP>GPJia]^WS^]aY]^GF^]SW]^WS^]FE]\SW\[EF[\FG\]WOJRGPRrPQrxOW]^WR^_QIxsYQsCIPCKPYKCRXCsX`_WQI|Sberbank GM Rapid|Korobov, Anton|2013.06.05|E12|0-1|B -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=EsdUKgXIQcNENXN>EN?A?qi`Yp`W`wn:>n`Y`i`>Fd^KU`XQX^XUOtmF>vn?ArxEFk[BJbZCSyA>AxtFEZSJStTAqTSqpX^O^e^pxmdxsdVL[VHDLSCEGk[A=ucG?aWT[WFDFb[FGcs?@[SJSr:=:sSKMh>=KCE>cNH?hM|Eurasian Blitz Chess Cup|Svidler,P|2016.06.19|B41|0-1|W -FVl\@OmeEU\UOUxg;Ljb@m]V]d]IQld=Owv<`rs:=SnCKgm`WsSBJSkKSmcLFngDTkmT]c]WPphMTtkF<]c=mumOgcT@IE?I@?E@IE?I@|67th ch-RUS 2014|Morozevich, Alexander|2014.12.07|C47u|1/2-1/2|B -FVn^@Osd?[xg>@gV?>VeO^wn[?d^>^vxEUng^>wvDLv>=>e_NrvNWguIQog^Op`WExp:>qa>vuvQY`XEWvnOE_hGOXOHOe_@GneWe_e?Qh_Q?_h?QjZGNpoNWonE?h;?N;BN_e_Q_no_tkctkd\WNonkdBTNE\ULUc[ED[SCKneKTedT\ZRDCd[CBg_OW[ZBCZ[CB[Z|Aeroflot Open Rapid Final|Frolyanov, Dmitry|2013.02.16|C67|1/2-1/2|B -DTl\@OsdEU\UOUxg;LnfHPucUOm]FNwnT]f]?Hvx>@wuCKtXIQX_rtH?bZBJqi:@l\BJSLDLZLCLkcJRtkRZwt?;xw@?wn:JkdMbtlbMltMbtlbM|66. ch-2013|Vitiugov, Nikita|2013.10.09|E34|1/2-1/2|B -CKm]@Ol\FNsd?[xg[dkd@phCo^EWnYWPY`PW`YHPYuIO|4. Zurich CC Blitz|Nakamura, Hikaru|2015.02.13|A06|1-0|B -FVnfEUm];EsdDLf^U^]V=Ft_EVu]VP_h@QvtQW]^F^d^?Fxg>@w\Whqh<`\c`gpg:=g_=uyu?=u=F=^M@?tuCSMG=Kun?FGXIQX^P?_W?Eo_ET^mQYmgT^gV^hnghWVLFMLVBRldKTclWFleS[V\MD\R[dkdFUd\UdRcTFc]dj]NDENHYag`j[e^[JHWFOWaJT^UTeagEF`WOkU^eTgVkt^UtmVgmtgVtmVPFMWOTe_WmdOGekP_MV_ndRGPR=nhV]hn]Tn_=a_NTMWOkeOGaFPHMVG?2F?H?ek?Fk\U\V^FM^fMVfmV]mlNTlk\ckb]\bk\[ks[dsrTNrsN]sr]lrsc\st\jtul]ut]ntudeuvefvujcuvn_vwclwv_pvwfgwxghxwlewxp_xyenyx_i|Piterenka Blitz 2012|Grischuk, Alexander|2012.12.29|C03|0-1|W -FVl\@OmeEU\UOUxg;Ltm?Tsd>@phUdmdL]wp<`d]V]vxDLrtTKgV`NV\?>umNUpU=UwvKDjZ>Nn^]fvf:=fNUNtvNmf>FfF<=F=D=\MCKMpg>Eg^EMh`HPUfKSZSJSo_=OkcO]fl]dqaIY`YGW^gPYlfMNfldOghNUhiOkihkt|2. Governor's Cup|Kupreichik, Viktor D|2001.11.17|B57|1/2-1/2|W -EUxgDTnf;LwS=Dm]T]u]@O]_DKsdGpoXYopGNwuYXpoQYuwX`wy`^on^`neYakc\@wvNUeWDTtXIQXa;Lsm=Dl\]dkd:=ulLVahVgmgUgpgOYWN@AlPY_h_?OPYM_v^=?ruDKN`HPYiQYxpAHuE?GEGOG`NGONUOWUcKMia_XahX_haHQaFMeqa_mg_edc@dA@NWOFMm[MVA?NUOWVNW_^_?_U^_`N`Y`^CQYCUYaUGaXpw[dwndVnf`hohVhf^hDG>DK>GXOG\PX\nONn`NM`nKRnSRmSnML^emve^LK^UvonwKRU\RZ\dZbw\X`dl`h\Uo]leBRemT\mlb[Up[TlmTMmlMVlmV_pU]OmnOaUL_VnfaXfgX_LZVWZS\dSeWVelV]lP_MPWMVWP]\gn\[|Rapid Match|Short, Nigel D|2008.06.06|C32|1-0|B -EUxgDTnf;LwSGOl\U]k[FVvxV^gvOWf]T]me@O\TBRsm?FucR[vl=Utk@lfUYm\:;\KF=[Z=DphO`f`N`ZL?GKU`iUd;=L^G_^ni`og_]g`YTnfDKxyT\rvIYfN\NvNKRdn]`n_YaypahqhRDpi`XN^D_^_XRjZ=e_`ebw_RYipbj_ojbokYRk[RJ[;@I`aIP;[PGpiG@[;@G;CG@a`JQipbjpgjb|FIDE Candidates 2014|Mamedyarov, Shakriyar|2014.03.27|E20|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb@smRZk[ZcmcN`tkFMwu=FbZ?>qi`YutOEtvYgngETe]TclcV]^VM[vn:=gLCLceLTZRFNRJT\eg\dJBdknk[dB:2dk:ZkrZr]eruemg`N`i`>V|14th Ordix Open|Scholz,C|2007.08.18|B90|1-0|W -FVn^@Osd?Tw\DLxgEMme;EjbTK\jE?dn?Pnh>@vx?>wvIQqiMUldKDul:rb[bvr`OmtOErb:;hWETwnCS\jS[bB[cjsDKBb@?WMKDM\TNbB?>nw>=gmP_mgGOgxQYxn_nwnYangHXg`=FtbFEbt;A\KEF`iFGogGPK\OW^WPWBCA:Cc:rtmNTckr:slTNluNTun:rklryipyrpqrJnwX`g`W`\kV^qx^elTJjk\aiTLiqxyjrLD|SportAccord Blitz Men 2012|Bologan, Viktor|2012.12.17|C54|0-1|B -FVnfEUm];LwSV^l\BJSLCLxn=Xvx?MsmXYn_Yuwu@O_n<`uvJRnd`EkcIYtkYaqiHXog^gmgX`i`O`\U>]WCKWM>EbTKJM\`OtvP`TFO^FMESMqip\f`alp^Xf`XgxogvovSE`OaqpqYqOEqjUMJCEVGOV`CL`OLMO^MV^TV]TN]dNTjrvnd[TN[cnm|Moscow Blitz Final 2014|Savchenko, Boris|2014.09.06|C18|1-0|W -FVnfEUm];LwSV^l\BJSLCLuZEvu=Oul`QrwNiyiONwyA@phahihQWhiNOmvWao_^gvh:@e]T]g]L]f]=DbSD;unBJSdJRnf:J\T?>ruRZpwJRd^NV]dRTuE=e[ES[lSco_FMvuV_h_@G^UcUuUGNlf=<_WNFUSMbkb|FIDE World Cup 2015|Svidler, Peter|2015.10.05|A30c|0-1|W -FVn^@Osd?[jb[Rxg>@wnEMmeDLvx?>wv;EnwE?qi?Pk[RDdnMUnhCKl\U]tmBRulIQvs;rs;CsCEGag:=d^KUwn?HrtA>gmLFnYIPYPGPvnFWqi>NmgPGt\G@ytCK\LNLtLWFL\DT|Baku FIDE Grand Prix 2014|Gelfand, Boris|2014.10.08|B90e|1/2-1/2|W -FVl\@Osd?[nf[dkdEMxn=FogOYphGWwp>@vxDTme;Lrspw>Mw\M\uUFGUG?GkjGFvuHPiaBJ_WPWhWFDjoLVo_:>xpVP_`P?aYDEuw>VXPIPYP?NWQ@HQWH@WQ@HQWH@|18. Amber Blindfold|Carlsen, Magnus|2009.03.24|B30|1/2-1/2|W -FVl\@OnfEU\UOUjb?Mxg>@f^<`qi`gugU_ph_Nw\;LmeL]guDLtfMDvxNXsmXixpi_h_V_f]=XpiXQi`QP`aPp]Opqa`qp`apqa`qp`a|6th Tal Memorial|Svidler, Peter|2011.11.20|B42h|1/2-1/2|W -FVn^@Osd?[xgEMw\[dmd;Evx>@tXIQXaETwvNEQiCpihp^_g|World Blitz Final|Carlsen, Magnus|2012.07.10|C65|1-0|B -EUm]DTld@Oxg;LjbBRnfHP]T?Hd\U\u=L=tmO^sd^dmdHdkdEvtENw\NOu]p_Ya[\LJnfahqhOW_p=MrvJRk[R[\[]fvf>?p_?AfNME_PAQN>;BPaEe[_euxpQK_WKs|WYB12|Wu Li|2001.10.24|B79|1-0|W -EUxgDTnf@OwS;EkcBJSE=EvxFNjZCKm]@gVO^Ve^Mu`NVruC<`nDLetM^T^U^nm<`og^gpg`iwoFatn?FsbEKrtBJnfKZkcZdtlNWlmA=o_V^blWEl]HPwvdSpwS]m]ESvuSwxwFN]Z=Mum@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvBRnwDMldCKphnonM;ZROWp_H]xp;_N=eWOegOPmu2NH>=|31st ECC Open 2015|Inarkiev, Ernesto|2015.10.23|C95j|1-0|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=MnfjZJNtkPXd\U\m\O^g^W^u=>=og=eclNOkjeb\b^lbl|WY ol|Wong Zi Chuang|2002.08.27|B19|1-0|W -EUxgDTnf;LwSGOvxBJSLCLga@Qo_FNme?Fl\>@sdHX_XOXagQGqiNVf^U]dnX`i`<`uv=MvhMPtm@AwoPYrw:>hqYqgq`NnhGMo?>?w?F?qgMGhWIYWhN`gq`uxoAIqgIPhWPOmRGQR=ONWhQ`ov`fhYulvmls=Xfpjb?MYHNEmnJRnoseope^HY^PYhV^gm^fm^Mh^hPepge\g^ENX=\c=Rcl^gNUgnT\hYLTYOULO`LSR=lP`f]f=OPY|Vugar Gashimov Mem 2014|Carlsen, Magnus|2014.04.22|E27|1/2-1/2|W -EUxgDTph;Lm]T]g]FV]LCLwp?Tl\@Fvx>@sm<`qi`Nul:c[TKgXFPuMNEwuFM=@XOFOe^U^nf;Esm?>qiBRjZHPulETmc=UcTUTruDL]cTVcmCSwn:;iaVFphSZurFCrjZbkcOFvx=slEelZedmgdtxptsjn=;g];kZLbjnkskL>|Rapid Match|Short,N|2008.05.04|B05|1-0|W -EUm]DTld@Oxg;LjbBRnf<`bZFNsb?Fwn>@vx=KbSLBSB:Bgm`nunB:]TFTkc?=tk:V]fp_g>=]V=>VMpfgoxpow2|CHN-RUS Super Go Pt2 2015|Wang, Yue|2015.12.16|D15n|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUgmU\e\CKtk;EulE?ru=F\T?NmgKSZdN]le]nen=gaHPag=uvu:=nf@Hu=F=dnR[b[=uxqN\nhOEktQYgaE?hWPWfQH@aW|Tal Memorial Blitz|Mamedyarov, Shakhriyar|2008.08.29|C96|0-1|W -FVphEUwp;LmeGWxg@Ovx?Msb>@l\U]tXMTblIQXO=OjbBRkcOMnfmgGYum>fc[R[b[:rwrL[lf]fmnMene[exwYGrZetwvGYvufnumToZ:@ImtYg:>g^|25th ECC|Chatalbashev,B|2009.10.04|B09|1-0|W -FVl\@OsdEU\UOUn^U[meDTwn;Ljb[JtfJDn`?F`<=@vx?=ul@wn?>k[RKvxBR[SEMme;EdZKBl\DLrsETZdIQtfO`fmGWskRZusTcmvW^e^;uM;>wv^fof>fxwjlMLlWngWegneWngWegne]phf>vu]kLgO^ge@AuvkVefVWwx^OfoW^qi^VxpA@ogVkge@ApxkVxpVNegOIg`Nf`_fd_odmpwmdwpIOvudlngl\um\SmkSRolRDl\DMkl>VljV>jl>@qi;ExnEKntun>PV_NUmgPNgV?;p`;?xqSZ_hU^`W^Wn\N\V\W^w_?_h_:?\RHXrx?WR\WSiaIQaXQX_MFM\MSkqi^pi`pUf^Ucxrkjrsjp`WX`W_pld\ld]ULU\UZbMSdg_`bjsrgeUM@GrteutDGP|2nd FIDE GP|Cheparinov,I|2008.08.12|B12|1-0|W -FVmeEUxg;LphGWwp?Mvx@Ol\U\sm\ene>@wvIQk[L[gVMVvV[eVnetrt?>n>O>uc@Im\>M\M=MtvvsBRpgMTqa>NC:N>:CRZsuESCU>VU:ZbaYV>:UTUuU>vxqDLUTvrgLSLTLrjqpjkLJbjpgI@gf@GogGFf_kq_VqY|8th Tal Memorial|Mamedyarov, Shakriyar|2013.06.17|B09i|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphBRl\U]\T<`qi`Nia=Em\N\e\ENrsP?kt?EtmR[b[:bscbjus>:seD=wp=FvsFT[TETenTcscCSpwjZm[S\n\N\w\LTgVZ[\G@?cg[sxp:rgW]eGYsxpqxyqprxpgemgfmu2YuxuVg?FWTutTStdf_ywSCF?CkOY_`YO`_d\gV\^_Wwvk;O>VP?@o_^NPVNOW`O?;C>O`WOE|2. Norway Blitz 2014|Giri, Anish|2014.06.02|C95|1-0|B -EUxgDTnf@Ol\;L\UOUwS@tk:kd?OgaONmgF=c[MFp`_hohT[b[FagaNMrs=Xxp>?slMOaWHPdmYgpgXYgpPW^WOWmfWglLYGtlgfvfGwpq?olowoqyowyqwoqyowyqwo|Sportaccord WMG Blindfold|Le, Quang Liem|2011.12.14|A32|1/2-1/2|B -FVn^@Osd?[jb[Rk[RKdZ>@meEU^UOUtkDTl\U_ph_Pqa;LaYPFYQHPZK=K[SL]k]V]wpBJSJ:JxgFWgmogQWpiWfiE=E^OENO>N>sc>Nh`NEvsENsvN>vs>N_^NOg_Oa^VH@V>@H>VHQVXaX_XQXcKJbKSbeSTX`TDGW\TedTL]exoW_DEdloxemLDmu2|World Blitz|Mamedyarov,S|2009.11.17|C70|1-0|W -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbDTk[TDtkmcT?wuUWrt<;dRCKn\DTuUENUWN\Rd;CqaHPWX\NdO=UXUNUp`BRtuCLctKSjbU\`XS[b[R[xp?Mo_^gpg\UgoIY|Supreme Masters 2013|Wang, Hao|2013.05.10|B65g|1-0|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mul@vxNVldV_t_;_w_=Kxy:>umLVrwVeme>fem?>c]f^_^U^mX@A]WKDqaO@Wf@OfWO@wvDVv^|SportAccord Blitz Men 2012|Ding, Liren|2012.12.17|D20|0-1|B -@Om]HPtX?HldDTnfT]XOHOd]>@sdEUxg;LwnFNvx@rs;ExgFVvxV^g]DT]c?>me^eneHduldHtf:;cTETlTCKTb@smCKtk@gVEUk[RKm]U^tf;EwnDLvxKDo_EKumKUdUOUl\UfmfGOV`BRruR[b[:jumjmfmOW`VDV_VW_]U_gpg@wnEMvx;EsdFV]VMVf^DLjZ=DtfO`fm?=gX`On\=?utBRqiETmfDFkcCKwvOYXg@AtbY_f_V_^VGOVNOWdnHrbrFHn]T^]LHrvr?>NFF]NDCN_YX_PFfg_XYPVCFSL@QLgfgVgF^gm^fMKfbK[QG[SGMSUbZwnZb\TMSUWYPWXPGmgSdnedUe]|4. Zurich CC Rapid|Aronian, Levon|2015.02.19|A07|0-1|W -FVl\@OmeEU\UOUxg;Ljb<[SLFulIYe]NWf^WI]VX`i`Y`yIAI^UIyg]EUtkOV]cUSvtSKkVFLlW<;tl?bm\L[ld[jdlj[ld[jdl|FIDE GP Beijing|Grischuk, Alexander|2013.07.07|B80m|1/2-1/2|W -EUxgDTnf;LwS@Ol\HP\UOUgV=MVLCLSn@p`W@xnDTnh=FwnGWvx;EjZEOtb@iaIYwi:J`XFMts?>iWE?e]V]g]L]f]?N]dCS\MDMle=;yv@IWNGNo_>?vw;@smIQX_FM_hMhqh=MwnT]d]BR[SLFvxneQYrsFWtlDlelMDluWMbZHPVeM\m\D\eV\dkdPgm^Mmcd\cm\dmcPlcmluvu@GrtdeunebtLGFLDF=DL=FLDF>DL>ELKbjnvjrvnrjnvjrvnrZmcZjnvRZcTEFKJjrvmrjmvMSJZjZTZNV]VOVZTSMvnFOogOW|Aeroflot Open|Aronian, Levon|2004.02.20|D15i|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKvxBR[S;En\ETmetf@ArsOYph>PgaPGxqIQapTEfKEKdnGPpaPXutAItXQXap?Gpf:?qpY_n_V_f`IPl\KEwuNVskETkmTcmkc]uv?Ah_X_og]NvyAaSKDLkmLTmkG?yqPGkS?:qyGFysFESkEL`oN?ou?Nud:AsyNXkSaiyiAidUihpohgongiSR_gnoiqohqphagoUfpxR:Xg|SportAccord Blitz Men 2012|Leko, Peter|2012.12.16|C84|1-0|W -FVn^@Osd?[jb[Rxg>@wnEMmeDLvx?>k[RDe];E]UBRtXIQXaHXahE?gm?PULCL[SVZk:JkeJKeVMVmcKMunRZcTCLTCLCsC;Dvu=@me@wn=F\UNUvx?=g]@vxOEk[ZcmcHdrsEVg]V\uld]c]\btb:bwu=RltbdtkRT]cT[uUdckc[cscaY>Ep`=LxpEDph;:gUFNUp:jScjlo_lTYQCSp^LRc[R\ho\M^eDKonTt[ktyngyQgpQaenGW`XIQphQX_XaZhgM\klKTf^ZbgoW^n`NV`NT]NGbg|8. Tal Mem Blitz|Gelfand, Boris|2013.06.12|D15|1-0|B -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mnf@tXIQXOHOn^EMsmFV]VMVm\;Ewn=Fvx?=utQYwu=>\fEKjZBRk[DLtkFD[R:Rk[RBZRKEf\OF[kFTgvEOveO^ng^M\VBRkmRrurTKrv@wn?>k[RKmeDLvxIQdZKDl\EUul;E\ULUwuCKZd@Bf=DkcU]feLTn^]ftfV^elEWsd;=ru=ed^O^ueFMeU|Ch Ukraine team|Sinzhuk, Pavel|2000|D85l|0-1|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg];EtkHPvt?HuvEOogDT]c>@g^?>meOUnmUKqaKZe]Zktk>=w\BRmXFXaXT]c]H]d]=]kd]Mya@wn?>k[RKvxBR[SEMme;EdZKBl\DLrsETZdIQqiMU\ULU^UntvnvwvWev>@I>=DLR:esxqUFmXsW=AIPiaLN:ZFUZuUOogWVqiOYueGWAYPYe\YPX_Vv\Tvy_qysbZPIq_sy_qysq_sy_q|75th Tata Steel GpA|Aronian, Levon|2013.01.19|C88k|1/2-1/2|W -EUm]DTld;LxgFNnf@Osm?M]TMTk[TMtkNV[SLRd\V^g]>@\U?>ph<`uZOErtETtTMTwp:^p^=F]l`i^eTKZ_<=vn=UyuU=l]HX]WX_WF@?kb?>h_iNF@GW@O>GOINjIXG>qaR\btjcuyBRSJCJaY>FYQJRQI=AogRZno|Blindfold World Cup|Carlsen,M|2007.10.18|D47|0-1|B -DTn^;Lxg@OsdHPm]T]g]?H]c>@wnBJvxCStf:;ogEMdUOU^ULVf]l\[dkdFNUNCgpgGNc]=E]S;=rjOYu]NV_VMVvVE]d]>V]V=UjlY_lDHQqaUVSMVfM^fgDIQI^XIQXg_UgVUKVLPXaXQXLRKZ|2nd FIDE GP|Navara, David|2008.08.02|A29|1/2-1/2|B -FVnfEUm];L]VLVsm@OxgVgmg?Ml\@wnU\n\N`vxO^gm`Wm^W^ln:=ogFVph^U\UVUf^UctfGWruW^g^MVw?=?nece|TCh-FRA Top 16 Gp A|Pelletier, Yannick|2006.03.31|C10|1/2-1/2|W -FVn^@Osd?TxgEMwn>@vx?>meBRqiDLgqRZjb?hoTowoQYe]V]u]O]n]YarvIPyxMUomLT]SU]^V:JSMJKM\KJ\MJKM\KL\MLK|FIDE WCh KO|Kobalia, Mikhail|2004.06.19|C55|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb?TnfTKk[<`wn=OulV^tk^eneONe\>^>f\oh=>h`\kdUkeywGO[SLVgV>VUKBKbZVX`geVg^XYZRKRrRV\R:NW>?\aBraic[Ve[RiqRKqlrue_|Amber Rapid|Ivanchuk, Vassily|2008.03.18|B87|1-0|B -FVl\@Ome;LxgEU\UOUjb?Fn^UKwn>@vxwu=utuGO\TLRgm>LogCKutKSldLJg_S[b[Jn[R:=mw=etvedvnN\nmdc_VOVTL@GfBZbkbcsmoGNph\eogsuRJeJxpJegoe^piFbwfut|Corus A|Ivanchuk, Vassily|2009.01.25|B92n|1-0|B -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[?Ftk>@smO^wp^mgmPejbCSpwewywV^o_^gmgFXue?>ktXOrjBRjpU]d]O]pn]Oe=>=[R:RvoS[b[L[opRT|ETCC|Miton, Kamil|2007.11.05|D43n|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQwvEUtk;EnwBJphKBwpCSbZU]dnNvtDEmv:vd]\dv\t|30th ECC Open 2014|Svidler, Peter|2014.09.17|C92p|1/2-1/2|W -EUm]DTld@Oxg;LjbT\smueEMeM=MyxMmxpmpwp>npxnkrwIYiWPWwWO`WGkqX^qkGIBJbZCSZSJSIYS[d[k[^o[sxpskYAFstTKk[F=]N=@wnBJvxCStf:;ogEMdUOU^ULVf]l\[dkdDKd\K[c]@f]V]dn=a^VMFwpDLvxJDrtDN_WN_wvBRnhR[b[F[v^aQtsLTug_pxp:jsw[m^`CSgUT\e\S[WOHPVNGNUN@ANF?:`]Q?]E?@h^mQ^M:?MG?GFG@GEGA@GCQ?wujJOG@Hu=JO=EOWEUWOU=[cCcHG=<|Dortmund (groupe B departage)|Leko, Peter|2004.07.27|B33y|0-1|W -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBJvx;LdZKBtfBfofCSZdueIQgmLFbZ:;ZSJSwsFP]UDLULELrR=Kxy>=dUOU^ULEl\S\m\ES\KSene;K[SPFf^=;st@?tDGWRBW^e\FBD;:qa^fGH>?\n:ryqrtDG?>nY|SportAccord Rapid Men 2013|Dominguez Perez, Leinier|2013.12.12|C84|0-1|B -FVl\@OmeEU\UOUxg;LphpgDLgf;D_V>VvtDMk[BRjbR[b[VSd\EF\]MDtTDKTSKSfmCKmdFBdcBF]=OW^WFfcdfh=ALT[TKTAYh`YX`aXHa_HGSLWOLUG?UN?:NO:?OV?_V_d\_f\Tfe|FIDE GP|Carlsen, Magnus|2008.04.30|B78e|1/2-1/2|W -FVl\@Ome?[smEUxg;Ljb[mgm>@nf<`ulU]f^BRqi`YphOEwpETmcTNvxRZcm=Mk[ZcmcHXbZL[lmDTZRCKRK:rcr?:tkMKws[LrlKcsr:rlrcumuYupwIYxpL[ktGOogYah`@GpoGFwnuZov[jtmjdmtFMnwMLvmdsmvLKwnsdnwKRtbdsbkR[vnsdnvduktN_wnuftm[bmf_pvmpfmtbj|FIDE GP|Topalov, Veselin|2002.04.03|B51h|1-0|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vx?>tf=v^=UsvXFguLTo_HPh`NHugFNxoCKRKNKcmKN^nJjm^jnvnU=^O@?OI?FnkT\kC=EIOECgCF?C;?F;DF?D=H>O>|UKR Ch U12|Kononenko, Dmitry|2000|B92j|0-1|B -FVn^@Osd?[xgEMw\DLvx>@meIQdnMU\c[Me]O^gV;EVeEKldK\nh=ac\U\eVMV]V?=un^hqha`n`<`og`Nh`=ewv:=tfCKxo=Uf_BRvnHX_qKSqxS[rtemtv[cjbmlowLTxfUVwoGWnlclvtW_fmQYphVUtlY`g`N`mv_gow`Wlq@HvmW`mfUuwousfTskoxksxoHPofsvfovtT]PWoftvfmvrmfrvfmvNbZWPqoPWoqN>mtWPqo>vtmvrmlPWom`Ylkrv]ovVo]VN]oW`kbNn|FIDE Candidates 2016|Anand, Viswanathan|2016.03.24|C65j|1-0|B -EUm]DTld@OxgFNjb;Lk[T\smBJbZ?Mn^U^gX^fofOUm\MFXG>GweHPvxGHtmf\Xm\mA^OAQ`gFWOE|Aerosvit|Eljanov,P|2007.06.19|D15|0-1|B -EUxgDTnf@OkcHPtbCKwS@ul:=jb?>wuVN\ULUqiUgmgO^c[=<[TNuwRTZRKSRJO]g]NKwrS[bc^mckm\kc\bxwblrZl]f]T\wn\]nf]\ckKNfg\dg_[cogdlklclZ\Nnp`HO\LOF_XFELdEMXQMUQIU]dD]eIHno|2nd Norway Chess 2014|Aronian, Levon|2014.06.04|E15o|1-0|B -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeBRrsEU\cR[b[;JvxJ[tXKD^U[UdULUXOHOga@Aug:Rsre\V^gW?GCG>G\T]eW^em^lGUluAHTLULum|Corus A|Anand, Viswanathan|2010.01.16|C78j|1/2-1/2|W -FVl\@OnfEU\UOUsd;Lul@dl=MxnBR[SL]f]V]me?>rtNUqa>FlTMNk]CKTdUp]OpwvwNnwpHOyinVdL:>ifVWfgWNLNGNgO>=td=]phFHhg]aONHGgha_dD_ghpgopxoONOGOxpIQe]@?ph?>DI>=h`OM`WM]WV]eIQ=DQID@]TMTsm=Fkc?=\UNUtkU]SL]fkOHOofCLulrtF^loJnOLvu>=XU=U\U]UrtPeweUeunei|TCh-RUS|Riazantsev, Alexander|2008.04.06|D43n|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvBRnwDMld=DrtR[b[CSul@d]D_f^_XiaX=TLCG^_GN]oPX_^NUol|Supreme Masters 2013|Carlsen, Magnus|2013.05.13|C95j|0-1|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLvxJDg`BR[R:RbZ?TrsCKxyDN`N]Ndn>@o_V_t_N_w_TM_gMDucKSZSRScl=M|NH Chess Tournament|Khalifman, Alexander|2007.08.30|B33r|1/2-1/2|W -@Om]DTldFNxg;LnfCKsm?]ga_OE?HuM_^v^C^MJS[EV[dkd^gpg@]T;Jk[O^g]FV]ckr>Nm\U\uZWewpV^rkQHkbNKvuIY[SJTbT@vx=DgXNES\IQXg:;jZBJtfCSZSJS\c?=gmE>ulM?cULFd\FU\U;:qiS[wt>Slc:rtrDCm\=:rsGOo_V_f_@Ixq:JclC:skJr_D|CHN-RUS Super Go 2015|Ding, Liren|2015.07.30|A33a|0-1|B -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[`gpgL]g_?Mtf>@f]V]dn=a^VMFwpDLvxJDrtDN_WN_wvFXtT_nun:>ngX_qiCKTL>VvV_Vg^a^p^?=bZVML\@?xpMVZR?Fpg=E\@wn?>k[RKvxDLmeIQwvEUtk;EnwBJqiU]dsOIsmIXphE?xqXgmgHXgm=OwpAY`AiqiP_h_O_ip=AwyN`ktAyuy`gpwgyt_V_cT_gTCypwxKDCTD_TJHP^VX`JTPYrvYav^_XVNGNTNXfbZ|17th TCh-RUS Premier|Motylev,A|2010.04.01|C92|0-1|B -FVl\@OmeEU\UOUxg;LjbHPn^UKwn?Hk[>@smnuKEtbEKbkKErtEKcj=EtrKEnmJRonRZcZCByoA@txWfnfBZxsZbscbcjcM[mn@poipnfnGOioENo`[MnfDLqiMD|NH Hotels|Jussupow,Ar|2006.08.28|C18|1-0|W -FVl\@OnfEU\UOUsd;Lul?Fjb>@k[UdmdGWtkFOw\@AxnW_vxOaxy_gnh<`\egpyp`gpxahoh=XrvX`f^?Ovf:?engnwO?Oln`nfnOMxoA@nlBJon@GktGNtfMEltLFtu|Aeroflot Open|Goloshchapov, Alexander|2002.02.08|B47u|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb@ulTKtf=FwtN`sm?=k[:<[S`gmgL]g]K]f]=]lTFTtTOETdDTSL@xnEU^ULUm]V^tXIQXa;LvxHXahOYZc@wn?>k[RKmeDLvxIQtkEUwv;EnwBRqiKD^ULUdSD;l\U]gm:Jo_OImgJO_VEVS]IXxyVvV;V]LELkVOWVhXiu`=O`iLEiWEWrvR[b[Odyqd[e][m]UQYvVWPwnYahaGOVF@?FCmnC;?G|Corus A|Bacrot,E|2006.01.19|C92|1-0|W -FVn^@Osd?[xgEU^UV^gV>@jb[dmdOUw\DLvx?>o_GOV`<`u`=Kxy;J`n@A\JCJd\UDkcLT_WJRtfKLbZDJw_>VrwJ[_aLEp`A@npIQfQHQaQVF`XFIXO@AQPEGwx:=PHIHOHA@piGHxH@Hi`|AZE vs World Rapid|Guseinov,G|2009.05.09|C65|0-1|B -EUm]DTld@OxgFNtXIQXaHXahO^nf;Esm^hqh?Hh`>@we?>vxNV]VEVgV>Vug@k[RKmeBR[SL]dZ]gngKBvxEMrs@k[RKw\DLmeBRtkEMvx<`qi`Yp`YPdn;J[SJTSLCLrsKDnhMU^ULU\jV^ga^eaPGPkO?OsSDhST@ATU=Kuehoxy:?USoTwOKOSsOoj\oasw?=egRZ\SaFSZTbZLbMg^Fa^gaXL^=>gpXV^eMDe^VM^e>fenPXwgf>gwHPwgAHgw>fwgf>gwHQwg>^poMVnw^vopvugoutoGtuiaDMl\MDaXQX\TVTpgTVGIutgeDKIEKfypVkpitdeUXQwekoU^deEeowihwohiowihwohiow|5th FIDE GP|Inarkiev, Ernesto|2009.08.18|C78j|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@w\DLk[RKmeBRtXIQXO=OdZKD[SO=usEUSKU\KD=DZK:JK\?>vx;EbZEK\fFDUFEfVOVoTEMuvYavwKLTRa\UFMmwv\a|Aerosvit|Shirov,A|2007.06.22|C78|1-0|W -FVmeEUxg;LphGWwp@Ovx?Msd>@n^W^e^U]dUO^g]L]p^?k[OIXTIXTX=Xd^X`^MDM\U?Ftk;SK<=eS=EKCpCVNGNSVxym[y^V^C^wm^Lvn>GnfNVm^E]^h]_hwPXwmX`[dGNd[NW[TWNT[LS[dNWdk_ZogSLg`Z`mwLSwm`pktpxtkxvfgV^ghvf|42nd Olympiad 2016|Atabayev,M|2016.09.03|C18|1-0|W -FVn^@Osd?[jb[Rxg>@w\DLk[RKmeBRrsR[b[EMvx<`qi`Yp`YPtXIQXa?>um;E`XQXaXE?gaK]dn]KndK]dn]Knd|World Cup|Alekseev, Evgeny|2007.12.08|C78|1/2-1/2|B -FVl\@OmeEU\U=UxgV^sd?[uZ;LZ[L[dUOUe^[lvmlr^UV_CKphHEeJE]_X][RK[KJ\K[\N[sXO|Karjakin-Nakamura m|Nakamura, Hikaru|2005.04.29|B53i|0-1|B -FVn^@Osd?[xgEMw\[dmd>@\e;EtXETgmIQXaHXah@HunTNvtOEqaN_ngEOaXQXux?Ah_<`gfV_fvAyxy=Fog`EvxF>ph_hm\>Fxh:@hXH?XaEN^VMV\VOUaQ?>e^FXQX@XVeCKd\UO^L>FkcFML^O^g^X`yvDTtm`hvfhpmdpqjbBRe_qa_UMLdeaAfhRZedAahfLCcZCJdcJRUdaifiNi^ViEdSEWSMWPMCRJC=PY=LYgLFg^FUJRcd^PUFP^F<^PdcPWVNGNON>=NMl^kZ=FmtMDu]A=]^F?gX@k[KEmc]Krt?>n`EO`nOEn`EO`nOE|65. Ch|Jakovenko, Dmitry|2012.08.09|B92|1/2-1/2|B -FVl\@Ome?[tm[mum>@sdCKxg?>phDLwpEU\ULUe]V^gV;EVE=Evx@_ULUkc\cuc=Ewn;LZR?@xgVPwn?>dO=OldDTvxCKuZ>FwvBJnwZ`IQphKSwpJR`YS[utPVgVMVmc[dkdVdvuT\cTCLYaHXa`d[TJ[bts\d`nLZuUdlswlt2wtbtJTZLUuLpxpOL|World Blitz|Gelfand,B|2009.11.18|C10|1-0|W -FVl\@OmeEU\UOUxg;Ljb@ulTKtf:=_VctstCKVOHOZR=FRKDKxoA@gVEUVe[dmdU^e_=uvu;L_nIQqiLVkcCKtmd\DThWVLmdL]WfOEtkEVru=MumHPwnGWyu>=nw@GuvGOkt=EjbPXc[QYvuONuvYatkCJ[SJCktBJbZJRmuNOumONmuE=umMEmuEMumNOtk]NmM=MogN]g^C^fu^CuoX`i`W`ktOWou`hdmMPufWNweVeleNGvyPQmvaiywG@pihpfpCpwopitkiWop@GphQq|Aeroflot Open|Kobalia,M|2004.02.23|C67|1-0|W -EUxgDTnfHPwS;El\BJSE=E\U@Okc?Htk>@kOFOsdOWvxCSrtRW>fg_LTWOMUOWULp`fe`XeuXPuw_VwxWOLSV^BR^U]ebZS[O_[cUTem_gclgoxP|VI World Blitz|Gelfand,B|2010.11.18|B90|1-0|W -FVn^@Osd?[jb[Rxg>@w\RdmdEMgm;EvxETwvCK\e<[SKRgmL]k]V]f^U^e^F^un^ln`GW`uA>wn]eulelvxRmnglt2rtmtwt=ebZeb|ClubCh-EST|Rauk,T|2002.03.10|B89|1-0|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLg`JDdnIY`iBR[RDStm:Rn]S]mR=RvwCSbZS[rsHPph?Qwp>@yw?:pyRZuvLTo_ZlvoV_ol]lh_:bwol]iwbd_WQfopPXsvf_wnYan`[c^Vdtvt_tVNGNWNck|6th EICC|Radjabov,T|2005.06.22|B33|1-0|W -FVn^@Osd?[xg>@gV?>VeO^wn[?d^>^vxEUng^>wv=>evDLm]?Mph;JldJDvp>Et_M_p_DN_NENunNngn:>nw@?ogHXxoIQrv>vov?FvmFMmfBRjbGOwn|WCh 2016|Carlsen,M|2016.11.28|C67|1/2-1/2|B -EUm]DTld@Oxg;Lnf<`qi`gug=K]TKTsmFNph?Fwp>@vx?=gnLVwuTLmcL\c]:DGYGHG>VGOVRjt]\tnRJOH\[n_[T_ic[X`Jbi_[S_NTMN=SKIYME=CEDCTDLTNbeYaKC|14th Ordix Open|Sargissian,G|2007.08.19|D43|0-1|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn>@vx?>tfFObZBRsdL]f]V]dSDLSbvmflml`gpgL]ls]ceW<;rjcmsrmcrscmsrmcrs|19. Amber Blindfold|Gashimov, Vugar|2010.03.24|B87|1/2-1/2|W -EUm]DTld@Oxg;Lnf<`qi`gugFNsm?M]TMTph>@wp=Dgn?>vx:=kcBJtkNVruV^c[TBd\U][S]envL[ut[lvulfofBfxqf]k]=]w_>Vmg^g_]Vn]enpqyIYugpjSJD@mcO^ue?=ws:sk^TcTFT]T:kSTSeSESsS:bSUbrxqHPUSrjSCjlqxltxqtlqxltxq|9th Masters Final 2016|Nakamura,Hi|2016.07.22|D37|1/2-1/2|B -FVl\@OnfEU\UOUxg;LsdU[meEdn=@n]N]tf@Ih`W`Y`EDqiR:wx:@xh]W`WIWug@hgWAiWihiypiafTKTsvaZvVZ]VT]epw|4th FIDE GP|Ivanchuk, Vassily|2009.04.26|B33r|1/2-1/2|W -EUm]DTld;LxgFNnf@Osm=DweHXqiIQjbT\el@vxO^e^U^rt?=wu=emv:=tsD\ut=McRZlR\ls\MVMtsCKbZGWxweUd\UeZRKRvRebsSbrwnrtSWt\RmMDWO@HOJDKmR\lnvKTp`ltvntlnvltvmtwmnwtRDtlnwltwptlJLHGDM|World Blitz|Mamedyarov,S|2009.11.16|D45|0-1|B -FVl\@OnfEU\UOUsd;LulSZ>Gm]N\[SLRrsFU]VUKn]KZlZGPskOVgVPpZRpyvm?TV\T]f]=]mdytd]A=|2nd Sanjin Hotel Cup|Zhang Pengxiang|2005.07.14|B48|1-0|W -FVn^@Osd?[jb[Rxg>@wnEMmeDLvx;Ewv?>nwIQk[RDtkMUdsBRsmDMld=DulCKphfofMhmghagaO^[RKRd\U\l\DK\SKOSCOawpEOtwa`xy`nkt=>bZ^oyxoeCgetwtngpg>fgLfetTe]TRHXR:@HZR]mRJmjLSOUSLU_:BX`L>_ixwiX>LQYLUjZwnYanfHOB:OVJBZbfnV_nmGWmlXglkbRULg]L>]S>SRSkdSCdmCF|SportAccord Basque Men 2013|Ponomariov, Ruslan|2013.12.17|C92o|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUgm;E^ULUZdU]d^BRrsR[b[OI^hHPmgQYqaCKgXEOng:Bh^O^g^IO^L:st@HtL:j_Xjrur]rLtrOXhE]tu][ue[syqOrhosyqhrVg_V^o]^]e]ys]MschoH?MEKSECS[phcsog[cgpGWpqskqx?>xw>=wv=@]UNUumSL^V|World Blitz 2015|Lagno, Kateryna|2015.10.13|A31|0-1|B -FVn^@Osd?[o_;L_VLVxgVgug=Fwn[dkdO^vx>@gf?>nY^OfF>FYgEMmeIQd\:;jZBRtmCKrsOEwvFvsv@?e]v>?>g^EO^W>Fp`HPW_FNqaMU_gQY`YOY\TNEgfELTKDKfeKSmRSZR[Y_edLS[M_pMFpfFXfu|TCh-RUS|Zvjaginsev,V|2008.04.10|C63|1-0|W -FVl\;Lme@OjbEU\UOUxg?Fn^UKwn@vx=EsmBRulRZrt?=wuFOqiKKfcZgmGOm\brxpM?CDZunw=w\|Open|Herndlbauer,M|2003.08.16|B92|0-1|B -EUxgDTnf@OkcHPtbCKwS=vm=DmlA=qa=Md\IQyuMunuQYbkDMunVklkMVkdGOdmL>md>GdmG>mdPXph>PdmXahaOWo_^gngW_guP>ug>GmnBRneG>em>PguPGug|67th ch-RUS 2014|Grachev, Boris|2014.12.05|E15r|1/2-1/2|B -FVnfEUm];LxgV^gmGWl\@OsdGtk:wtIYdnOUkdUdtdYaog^gpgDTSL;rjHPqiMFxoFXg_XFofGN^VNE|FIDE World Cup 2011|So, Wesley|2011.08.31|C11k|1/2-1/2|W -FVnfEUm];LwSV^l\BJSLCLxn=Xvx?MsdXanh@OulEo_A@dcGO[SFNioe\ck@Hv[:@SLEFo^Ni_oif^XQ`[Cft|5th Final Masters|Vallejo Pons, Francisco|2012.10.12|C18p|1-0|W -EUm]DTld;LxgT]d]GwSBJSnGHucX`gxPaphW^yqagng`gcuLVT@l]W^wi?>vxF?]WJTgX^WiWHPWiDLul=Fwv?HipBRXgT^nfRZgmZbm^O^p^F^l^>^vubktk^ZjbIYqiCSxpH?u]ZBrt?T]_GWh`TM_gBG`YPYtr@IpwIPwnMVrxPOia:AxXONXPGOPHAQHBO?bZS[ne?;BJNMgWQPo_VOWYPpYQ;?krMDQO?Od[ONrVDC[SpqV]qaJBC;SKayZRyueluyRJLTBC;:]TNLCDLDKDyA_WA@]T=DjbDTk[TDtkVeTDbZO^ZRK\m^U^e[@?un?FxwGWqa\MjbM\n\D\wnHOphOVnm\@vxIQmeDLdZKDl\;Ewv?>nwE?qi?PphMUulCKwpU]tmVu]aW]=AHTeVRygRb\TbjovWagCjqeoOY=]aW]`HOTLOFLDWM`]|It (active)|Korneev, Oleg|2005.11.20|C84|1-0|B -@Om]HPld?HtXEMsm;En^IQXaDTxgPXahOYweT]d]CSvx:;mc>@jZSZrZ=KcRYhqh@ph=Mo_GO`i?=uYRBYuNDip]N_WN]h`KS`XS[djD>XP=;PI@Apg[cjd]lgYT]Y>]d>YdmumBZYGl]qaZjmfMFG\F>wx>YxpYayxjpxp;:|Keres mem op|Shevtshenko, Robert|1998.06.20|B33|1-0|W -FVmeEUxg;Ln^@Osm?Twn>@vxBRjbRZqiIQwv?>^UOUm^T?l\U_nw_NtfN]^d]gugL]f]=]v^]KrsDLe]>=\TKD]V@meIQdnMU\c?>e]O^gV;EVe[?ldEOclFwv:>vF>F_MPMrvFvmv@?vfGOe_?GfeE?elHPlZBJZcCSclQYlmGHmfMEk[HG_eEWon?NfQN?nm?NmfNHQ_W_h_HNfoYaphahohGFh`NH`hHN_WPWeTNT]TFGh_GPjbPH_WHGg_GFWPFNPHNWHGW_GN_^NMOWMLW_LK_gTLgoLDow2D<2wOKR^e@ndDLsmBJjZLTZRT]f]F[uZ[dkd?>wnU\Z\CS\c<\VPVMVOIg`<\V]GO`a\lahIXqaXN|World Blitz|Karpov, Anatoly|2009.11.16|B12|1/2-1/2|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mnfk[T\ruMJg]PFlkHXjZFPmcPVcTJMZR<;RJCJurEFJTVene\eTeBJ]W@rj?OxyOPjmEim=F=woiaBZ@?Zuaou=?G=DGOD=OG=D|It|Korneev, Oleg|2005.04.07|B97v|1/2-1/2|B -FVnfEUm];LxgV^gmGWl\@OsdEqaCKphBRctKSbZA;ZS;SrjRZnuDT]TMVulSTls:;tnZbytTSmdUdndSksrks||Kiriakov, Petr|2004.05.09|C11|1-0|W -@OxgDTkcHPtk?HnfEUwn;Lvx=Dl\U]f]T]g]DV]SVksd<`WBJ|8th ch-Euro|Bindrich,F|2007.04.13|E17|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphCKwpU]rtO>tr>Dk]DN]fMeqaWPxqP^rweUp^U^wuGWuE@IEG^UGBN]f]U]qx]uxpuUpxUuxp|FIDE GP|Kamsky, Gata|2008.05.05|C95l|1/2-1/2|W -EUxgDTnf@Om];LldFNsm?M]TMTk[TMtkNV[SLRd\V^g]U\m\R\w\>@\n=FucO`qi`VruFOkb?=vxOPxyPQyx@]V?ogF[rtOEVE>EvuE>xo[dtdGfB<\t\G\jb@GBKGNKBNGBKGNKBNG|30th ECC Open 2014|Roiz, Michael|2014.09.16|E34|1/2-1/2|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;L_nIQqiiaOUaYGWyaLVtmDTkcJRruUFnwRZwSNESnENnSNESnENnS|2. Sanjin Hotel Cup|Motylev, Alexander|2005.07.10|C67|1/2-1/2|B -FVn^@OxgO^me^OgV;LVLELwn@l\NVk[TMtk<`wnV^g]`n]n;E\UEVkVMVrjBRjmR[b[=MucCSn]OU]SM[c[U[vnGWo_^gpg?>no:RSdRTdnVOg_Oaog[lnh>fgof^yt^_ox_\hWaXtwlfWM\`xyfwmjIY|Open|Loeffler, Stefan|2003.08.24|D27|1-0|B -FVn^@Osd?[xg>@gV?>VeO^wn[?d^>^vxEUevU]n\^>me;Lt_?M_M=MvgLRwv:>umR\e\DTrvGOv>E>kcHXgv>PveCKjZ@GZRMNxwIYRKBKmnNLogYawoPWphL:ovaivoWPovPYvoYPovPYvoYP|8th Tal Memorial|Carlsen, Magnus|2013.06.14|C67d|1/2-1/2|W -FVn^@Osd?[ph>@wpDLjb[TmeEUunU^d^O^e^CKxg@vtOYuxYHts?>mt@IsrEWxw=FxyF>yqWEqy>FyqI@qy;:yq@IqyHNnxNHxnEWnxWExnEWnxWE|Vugar Gashimov Mem 2016|Radjabov, Teimour|2016.06.02|C18b|1/2-1/2|W -FVl\@OmeEU\UOUxg;Lnf@gVEUVe[dmdU^e_=uvu;LuvIQqa?=wn<`tf=Eru:=uE=EaY`nvnLFf]OU_UFUphCKjZDT]fGWZR@Gd\UOldECRKBKk[CByuBjnwjluMldMKT[K[OYf]dl\TYO[CGPwpl\]OPOCD\lpxHPTLOXD@gVEUVe[dmdU^e_=uvuIQuv;LqanSHXaXQX_n`fif@HSLCLru=uvu>An]WPp`LT]LHOfhBJLROVR\V_\fAyumDLfp_VpfGOd\PGjbGNkc|FIDE Candidates 2014|Anand, Viswanathan|2014.03.19|C67w|1/2-1/2|B -EUm]DTld@Oxg;Lnf<`qi`gugFNsm?M]TMTph>@wp:\U=UmcT?tm?[wuUVjb[mumLRc]R\ml\MrtHPl<>DdH@piBJk[GWiw@GbZGOZRIQdTPXaXQXTKW_K=OPxq_hohVO=O>OqxOU[SJS]SMSwSUfxofWSL^fovW]LCPWRJ]SvnW`nf`hfeh_e\SDJBX`\T`hTK|18th Amber Blindfold|Leko,P|2009.03.25|D43|0-1|B -FVl\@Ome?[tm[mumDTsd;LxgEU\UOUnf>@wnFo_X_f_V^ph@nmgmlm>ETfNJmeJjqaGWf_ENe]jZ]fNOfgOP_MZ]MD]\DMPGMVGNV;\[;D[CDRCcg_cSRDSTD;T<;B<\_g\tB;twgfNOfnws;_scnoONopIYpoNU_DU^opckpi^gDMksiqg`MVsvVDvnqx`g|Hotel Bali Stars|Radjabov, Teimour|2003.11.28|D45n|1-0|B -EUxgDTnf@Okc;LwSFNvx?Mm]>@tkT]f]BJSeCSjb=KunS[nuJRb[L[en@ul=Mqi`Em\MNe]V]f]FOwu?>neHP\fNMf\MFtQENe^F=\VLFQXDLlmOHVeGOeTN=vmq`ml`Qdv<`nm=ExiQWudAQrs`iyiP`c[FavaWaiqaWjZWFskYaqiGOlsHX_XOXmoQAowA?wv?Oiy`Yyw;?wO?O[SJSZSLSdSFLSdYGvnOwduwxsjGWudxtduWNnmt\js\ZudZ:muNWuv:?sjLFvnWNjs?:nYNJY`E=dSJrsl:jkjrjltj\tm\emvefvwfe`nenwn=EnoFWSdDLdnENoxWhntNWxq^f|WY ol|Sengupta,D|2002.08.25|C18|1-0|W -FVl\@Ome?[tmDTphEU\UOUwp;Lxg>@vxGOsd@vxGWsm@Ak[BJm\FPtfW^e^@mel\OYphYOfB:BgmB:unCKxy>Pmg?GgaPQnfHXagGHyp:?qiQYgxX`iaHGfXYXaXO>ogGHg_V_h_NVxnV_n_HXZd?GdUEV_NXYUF@AwGVGrwYVwGVNG?AH?>HG>AGFAIF=phNOh`Ooe]om]Um]\TKT`W=@meDLe];EtXIQXa?>]VMVn\=FqiF[un[kdZk[ZKEK\eOYjb[TnmGOm[T[b[=wsBJxw=]wn:=hq@GmcNcscY_q_V_iaKEaXOXrR=>csEVogQYnmGOmd>=enYasy]ERrEIyiIDrRDEiyEmyvONRrm]vy]MrRMERr=AyiLT[SJSnSE]rBA;iy][SnVLBrL]neNVrRCSRJ[ZJPS[dm[cPXVOXUckysZrld]cmuT\el;@UWOF|18. Amber Blindfold|Radjabov, Teimour|2009.03.17|C55|1-0|B -FVn^@OxgO^me^OgV;LVLELsdqiOUf]GOyvUF]TFPgYWNogNGYPIPv>=>uvRdmdCKTo>vdvEN|2. FIDE GP|Ivanchuk, Vassily|2008.08.03|C42|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@gVEUk[RKm]U^tf;EV\DLwnKD]UEKUMD;\KBKf_ph:=UGFG\G@Gh_GOvfOWog^gfgHPghIQhi=miQ>fQIfbIGWNGCbjCKNGKCG@wtmp|NH Chess Tournament|Jussupow, Artur|2007.08.23|C83|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeBRrsEU\cR[b[;JvxJ[tXKDXOHOgaOWaW@dZTMkc=En^Ni^UipxpLU\U:@we;LWMDMd\LVvxCKtb?>ZdNqiO>MhS[b[R[dZ>Om]EU^VOEo_NJZk=K_WJr]mrukuETho[cWOHXiackukTcmuK]ke]rurcraXQXfh@IeT<@VNIPNFPOo]OF]rGWrVW_V_FO_fOWf]X`hf@;fVWPxo;[TNPGN_[cVfcsohsu]VumVdmuh`U]f^\N^N]dNL|Sberbank GM Rapid|Zhigalko, Sergei|2013.06.07|C58|0-1|B -FVnfEUm];LxgV^gmGWl\@Own@bFLFsdDT]TU]f]=]dS]Tc[TVutFLtdVdSdL[rs[lvul]sC?=yv:@dSD;phUF@?FLktLVt?Eejqa`HP`g??^oFOh`WXfiXH|Premier|Barsov, Alexei|2003.01.05|C18|1/2-1/2|W -EUm]DTld@OxgFNjbCKtX;Enf?Msm>@d\IQXa@gVEUVe[dmdU^e_=uvu;L_nIQnhLVqiCKtm@wnEMk[RKmeBRtmDLvx?>dZKDl\;EZdE?wvIQqi?PrtDKdZKDul?vfiXtdMU\U@AePLUdqp;CpoCKn^LTg_V_h_P`aXKSogBRtyS[yY`xXO[cYTRZTDZbDCclCBlcBCclCBlcBC|8. Tal Mem Blitz|Morozevich, Alexander|2013.06.12|B72|1/2-1/2|W -EUxgDTnf;LwS=Dm]T]u]FNl\@smELrt:Vg>LgVL>Vg|68. ch-RUS 2015|Lysyj, Igor|2015.08.10|E34|1/2-1/2|B -DTn^;LsdHPph?HwpFNme@Fo_EMxg:;jZBJvxCSZSJSdnS[ld[dkd>@tfGWgm@Aul2AIfoRjsu|FIDE GP IQT Final|Zeliakov,Nugzar|2002.04.02|A25|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUul;E\ULUZdEKbZ@sdUFtmIQrtBRjb@IdZGWk[R[b[V^gvL]Zd@xgT]XOHOd]EUsd;LwnFNvxumIYjbYatlF=wtLFcTCKTeFWevWMnJ<;JwKSveM\mvBReTOFdsNVkcV]f]\MsdMWdnS[bZFOtu:Bvm;E_UFWo_XaloPXhaXaUFWFvF@?FfQHTXH]fvEYPIPgu>Num?Aqp=?mROWRVNE`WPW^W?>VTHY\VEIogX`V`YO`oO`ia`fpx>@wtIYTD;:D_BJtDfU_^UDxpD>^]>H]OY>o^HYOM>Sk[@=MTSZTd=<^TZLd]YOTNOYh`A@`XLlgoluNT<>TN>ow>npxumwoYhWOmvxphWonvh|Hotel Bali Stars|Polgar, Judit|2003.11.29|B92g|1-0|B -EUxg@gaO^d^P^ph?>ngV]f]=OtkIQwv^gugOgagMDxwEKrt:=gaGOaW@GWfQYtsKG>md>GsvUEvfHXqiOWh`Y`i`W`wpD_fvEFvuFn]Unld[LUuU`hTLlopioqi`ql`glLUSLN[TNVSCGNT]VvC[_M[Zvwgpw_pi_aipNUZRU]|World Blitz 2015|Grischuk, Alexander|2015.10.14|D02|1-0|B -FVl\@OmeEU\UOUxg;Ljb?Fn^UKwn@vx=MsmL]f]V]wvBRrtRZnwDTphKE^VMJm^CSgXNWo_:@wnGWulBRkcFOtkV^gm^eneOklkUfof=ekdeUvx@tm?>ZRH?gVFNvt?MVEA`WNWxpYayxA@RbBRmvE>cmGNmg@AbZ>GkcAQtuG>un>GnwG>pnQAxp:Jwx>GxyG>px>GnpAQZbK=gXFX_XQAbT=FT]A=]fLTpm=]voG>fv]_yq>Lof_gmoghxhahqhJ:ia:=omFIvuL:e]T]m]IC]MNFuUCU\U=MfT:UVMFNh_ULjZL>_f>Lf_L>_g>EghELh_|FIDE World Cup 2015|Eljanov, Pavel|2015.09.29|A40w|1/2-1/2|W -FVmeEUxg;LphGWwp@Ol\U\uZ?MZ\=FtX@vxLFrtDLgm@AZl?=m\MDtu:ruELUf=Xf`XmumQIygLZmnahohZE`f>?fW@Ank?OgpPXqaX`koEW^WIHog`hgYA@xq@?p^|UKR Summer Youth Games|Maletskij, Igor|2002.05.21|B09p|1-0|W -EUm]DT]TFVl\U]xg;Lk[V^[S^gSLCLng?Twe=FunFnvn@Fsmg_PFvVHPrv=EcTED_WGOVN<=|WY ol|Nasri,A|2002.08.22|D20|0-1|B -FVn^@Osd?[jb[Rxg;LwnRdmdO^gVLVuU>@U^?>vxEU^]=>u]CS]BWlBE>NEmletvPXvfNfmfXfofe^xo@IhMI@Mh@IhMI@|SportAccord Blitz Men 2013|Dominguez Perez, Leinier|2013.12.14|C77|1/2-1/2|B -FVl\@OsdEU\UOUnf;LxgU[wSBJSL[Lm]?Mvx>@]ULFf^FPqiIQjbGWk[Patfagug=axqW_fTHXp`QY`YX`wx`h|Superstars Hotel Bali|Amura,C|2002.11.30|B45|1-0|W -EUxgDTnf@OkcHPtbCKwSc[T\[SPXkbF^vxX`ga^VphVdrjDVbkdcuc\ckV>VjkENwt<;kcU]ce=Exw]fefVfofEDtuOUapUdu=D<=]dnwn@vx:;ogEMdUOEldFNU[L[d[EKumKZc]@wnEMl\FVsd=FvxV^gmDT]UIYxylm]fwfOPut`QmoPYdOWEOX@PonYnvnQ`f`E`nfGOXaCKxoPQtv`Wfb>FofIPvsW`_W`WswFGw_W<_^QAfo@wnGWme=>vx>PdUNUk[BJtk:>e]V^n\PN\UNUgVLV]VDLog^gwgHPruUNf^W^l^?g^g>=uv=mkdm=dk=mkdmUdkNWgnWNngUm|World Teams 2013|Korobov, Anton|2013.12.04|B85|1/2-1/2|W -DTn^;Lxg@OsdFNwS=DSLDLunBJm]EU^UOUdULUl\UYtfT]g]Yn]n?[fm[FogNVvoGrt<:ndFbtsb[dS:joxjnfoA:srnmut:rtrNcqiGPrtmeov[FtdedSdPWd^clvmWNxwNU^olZo^ZSwvU\^hSEh^\emROW^oelRmESmRFToyHPyoIYoySeyhTFhyFTyhV^g^W^hn^fphe\n_TM_nleiae^n_^gRdfn|Corus A|Ivanchuk, Vassily|2006.01.29|A28|1-0|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LnfFVtbCKwS@SMhYNQYhZatfaqxoQP|It|Radjabov, Teimour|2005.04.05|C45k|1-0|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBRtmDLvx?>dZKDl\;EwvE?ZdIQ[S?PrsMUulNPWNVWiUCsCXamdV>iW|SportAccord Blindfold Men 2012|Grischuk, Alexander|2012.12.19|C84|0-1|B -EUxgDTnf;LwSFNvx?Ml\@Om]>@]TMTsmBJ\UJSULCLulTFlL:;Ll?NV[mvmCc\cUFyraiph=EcNECNWAQW^CkmdkorBF@VWQOB:?G^UGPWoOo:@PY@AY`UN`gAigfiY||Kiriakov, Petr|2004.05.09|C11|0-1|W -FVn^@Osd?Tw\CS\SDLSnEUdZTF^U=UmeUpngpPunPWtm>@vt_PGPhPoidU>nPhioUO@?OY:=Z_?>YH>E_]EFHWFO]=nvtmvumnu=hgouWf|6th EICC|Beliavsky, Alexander G.|2005.06.30|C51|0-1|W -EUxgDTnf@Om];Lwn@tk?=utDFtdF?wtO^dvIQ\m^mgmNVngGOgLCLm\RZ\R=ec[TKtLKR[RecLK?Tf^|18. Amber Blindfold|Kramnik, Vladimir|2009.03.16|D37|1/2-1/2|W -EUm]DTld@OxgFNjb@wvRZ\UNUmw?>tXIQXaE`rtDKes:=ue`gegL]geHPwf]ctuU]f\KJ\VOUeJCJah=vuvMhqhTlJSlmv>@H>@wn?=sdDR]gOYvxY_m];LdU_U\URUn\URutL]g]H]k]=]tfFVwv@wn?>k[RKmeDLvxIQdsEUsm;EtkKDwvE?nw?PphCKwpU]unLTl\BJ[SOYnuY_h_P_mwJS\S=EbZ_pxpEipy<`wmGWvxW^xhiYm^>?uc@Agm?_rx:>ZRKRSKD;og`NcS_axpNipoYGkb>@bTG_SR_fRbiWm\f_yxWNTM|ETCC|Roiz, Michael|2007.10.30|C95l|0-1|W -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=Mnf@me?=jbHVqiMOsm:;ulVDm^Oang;SwuUOtm@wnEMk[RKmeBRtmDLvxKDwv?>rsIQnwR[b[<`qi`Yph;EwpE?sr=Er:>:[SLTh`YPusDRskRdmd?NdmOIgaQY|World Cup|Timofeev, Artyom|2009.11.25|C84f|1/2-1/2|B -FVl\@Fxg;LmeEU\UFUjbIQnfHXe]V]g]FDFDLF^LD|2. Governor's Cup|Kupreichik, Viktor D|2001.11.21|B90|1/2-1/2|B -FVl\@OmeEU\UOUnf;LxgHXjbX`gmIYk[BJmcYatkAQun`hog=Xf^U_kt@ru<`wn`nmn=Ovx[dkdOduU:=U=?=wtd[qiIQt\[SnlSUc]L]\]UR]ZRKjbBRZ\KM\]MFbZ=]f]FNld|8th ch-Euro|Zhigalko, Sergei|2007.04.06|B22u|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBRtkEMme;EwvDLnwKBumE?ph?PwpIYvnYamX<`duahqhP?uf?NXa`YnvHPgXBfofNXaX@He]O`X=>=piGOi`Y`xp=Al\AYvx:ApoRZ\TMU]VOV^UYWovAq|FIDE World Cup 2011|Kaabi,M|2011.08.29|C88|1-0|W -FVn^@Osd?[xgEMw\DLvx>@meIQdnMU\c?>e]O^gV;EVEfnh=awv:>vf>fhwfNclHPk[QYleCKjZLT[TKTeSEIQLtewtwowyqr]>?QY|Supreme Masters 2013|Svidler, Peter|2013.05.17|C65j|1-0|B -EUphDTwp;LmeFVn^U]o_V_h_=avwGWxgaF^V@tXEUnf;Esm?>wnFVvxV^gvDLd\U\m\EKrtKUvl;R:;:K:Ya:KaiKULUbZX=n`WM`i=RsjM\i`H?`n\bjcRvnSbscUsmS\m\U\?[\lGWxp@HqaHGljGHjNvnaYnYN\Ygpx[v\lHQwqgYxpv[lj[RjURvUjvRjlYXlTX=]URKTLKDqwQHwmPXm\W_UM_gpx=OLD|VI World Blitz|Radjabov,T|2010.11.16|A07|0-1|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBJvxKBds;Esm?>l\E?qiOYgVYhVghwmw?NwhN]tk]gng=Xe]^wf;_uv=>dmIQtr_fof^NrsPXseNPenXWngWlmt>^gnlcnuc\un\cnucsum^NmnPhyqNPvxs^tmhXmvPNvo^]f]NnohQYbZnkhMYaMFXPFak[aoCKxtPLtrKT]TU]ov[\rsLTZR]eqhTVhg\lvhVns;@I;=np=epmeclkcdmUdbUSbrScg`kp`_ph_^cbrsbR^]RZ]UhXUMXSstZaMLaQLDJRtuRZurSRrbRBD;QJiaIPaYPYbiY`ibJRbrGWrx`gxwgnwrBGrjnejbe\brRVrt\ct@wn?>k[RKmeDLvxIQtkEUwv;EnwBRdZKD[SLSZdEK^U;>L[U^uwDM[j^ljd>:sklekj:jdjemjdM[|Corus A|Adams,Mi|2009.01.31|C92|1-0|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;L_nIQnhLVqi?>d\@ItfHXwnVPyvPanwIPut^weLU\U<>ogaWe^>^g^W]kd]Sd\SM\]POl\EVrtQYjZM\t\V\]\OV\eBJ|Tal Memorial Blitz|Leko, Peter|2008.08.30|C67|1-0|B -EUm]DTld@Oxg;Lnf<`qi`Y]TFVp`YPk[O^iaIY`X?Ftk>@sm=Dm^P^wpCKTKBKvx^Pd\V^g]L[\U[ersDE]LFMjZ:Jk]MDsc?>ZREMo_^gwgeT]TKTunMUnJUcf^cuJwuZ^VDVLV>VRJVNwoZJoTJZToN^giZuxq^n|2nd FIDE GP|Grischuk, Alexander|2008.07.31|D43l|1-0|B -FVld@Om];LxgV^gVEUVLCLnf?Md\>@sdBR\TMFtmO`wn`QuZ=EvtENqiQWn`NPuxIY`nWaZuPOuwHPo_^gpgaWwoRZjb@gvT\ve\ek[=EwvGWZSV^SZFOtkEGZuLVvwNcuvVgpg^gxy:>wxGYducuvuOkrs?OqaY`xpgpyp`usuOL|?|Seidov, Zakir|2004.03.06|B38|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLm]V]g]O^d^>^ldEMne^>t_=OuYHPYQK]d]O]ru]HQH@H_MFxo:>vF?FuvF=v>=>p`>FofFNqaEVenV\n\U\bZIY`YPYZRCKRKBKd]|1st Asian Clubs|Kobalia, Mikhail|2008.12.30|C89i|1/2-1/2|W -FVm]V]u];L]ZEUxg@Old?TtXIQXad\U]f^KDtsD_meFVnwZEiE=EwiEFeuOW^WVMWOFViaVWyv>=ueCKcmMOaOWOmwQYwh_Dv^=A^F;slNvxXvwdUwolcDhcbW_ec>fX@=E@HENUf_fHBfncKhMBJogbZnv2KMNFMKF?J:?HK;g?|GMB|Rogers,I|2003.01.21|B01|1-0|W -FVl\@OnfEU\UOUjb?Mw\UK\n>@meDTxg;LsdGWkc@ul=Fk[TKtf?=wtN`sm`gmgO>[SL]g]K]f]=]lcCKqiHPt\FMrtBR\]M]t\]Mcd:=\LMFnu=ML\MEbZ>M\LM^e^EuxquEphIYia@HqpGOd\FG\dGFd\FG\dGF|FIDE World Blitz 2014|Andriasian, Zaven|2014.06.19|B90|1/2-1/2|B -FVl\@OsdEU\UOUucUKxg?Mme>@phDTwp;LtXMFXF=Fcb=Ntnxwnhwv^yvmyUN]h^|Young Stars of the World|Andreikin,D|2005.05.24|B32|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwBJqiU]dsOIsm=OutE?ld]dtdIXvn?Pe]V]g]P_nfOPxyED=A=;cNWxglnvwnjgVEDogIYVG=;c;D;GVBRyxRZudjbdsbjsdemdu;DwnZbf^W<[SL]l]V]nf]VqiIYul?[lcVTdnWNcZN\jb\nvnT\nuOUpwUduv\wywdZb[ZKtkGOrB<;BjK\k]CKog^gwg\MvnMS]r;Cjl=Ug_A:rd:=dkUXh`=Al\SM\]CLkdAI_wY`]`XYwgLUmeUNf^MGghYXdmX`h`HX`hIamdGMdmDT[TKThgT\^V\eneOVmXV^efaYgONViaMWfnWaXaYaOJ|vs World Rapid|Guseinov, Gadir|2009.05.07|B27|1/2-1/2|W -FVnfEUm];L]VLVsm@OxgVgmg?Ml\@weU\e\N\l\O^md^dkd?>vxF^\^>^wt^Zxw:>tlGWph@GrsCKsuGOqaHPu]ZJwnIQ]UONUuJRg]NO]cRVd\PXaXQXuyW_h_X_yi_fifVfofM_ld_VdlV_|NH Hotels|Andersson, Ulf|2006.08.19|C10o|1/2-1/2|W -EUm]DTld;Lxg@Onf<`qi`gugFNsm?M]TMTph>@wpNVvx?>f^U]wu:=mvKBrtBKtrKBrtBKtr|68. ch-RUS 2015|Motylev, Alexander|2015.08.13|D43|1/2-1/2|W -@Ol\FVme?[sm>@jb[MxgDLk[MDtk?>rtBRn^R[b[EUwnU]tr:rur;JkbOYph<[CN>CD<:BCETCL>LDLTEqiHPm\:>LDPXDB>Nh`@?BRNLgVEVRVL]Ujn^]>?UM?>CF>?]UnmULmlLEljF>?HEF|2. Norway Blitz 2014|Grischuk, Alexander|2014.06.02|B51|0-1|W -EUxgDTnf@OkcHPtbCKwS@wv:;l\U\c\O^bkEWnw;Cwe^MsbWeueMWe^CDruLR\T=Ep`WQqiGW`WEWTKBKxpW^v^QW^nWMgX?WXNDE]UHQkVR\b\M\o_PX_XQXNXWXVh@Gn^\M^_G>iaX@jZED|FIDE Candidates 2016|Topalov, Veselin|2016.03.16|E15o|1/2-1/2|B -FVn^@Osd?Tw\>@xgEMvxDLm]V]g]BRjbRZk[Zc]cTKtX=FxyNE>?Veow^vwpvfSW_gphgohpfvWgvxpqxuqpEFgGFNGoeopouUofUW?WNWf]WN]^MU^]NM]eMTedU]deTUemU^mn]enm^]mu]fuvemvufe|9th Masters Final 2016|Giri,A|2016.07.14|C50|1/2-1/2|W -EUxgDTnf;LwSFNvx?Mm]@Ol\>@sdBJSLCLul@wnEMvx]A?FA]F?]A?FA]F?|FIDE Candidates 2014|Topalov, Veselin|2014.03.17|A29|1/2-1/2|W -EUm]@Old@gVLRngRCV`OEf^U^m^W^g^GW^CZ\t\U\aYLFgV\UVEUG>G@GogBRxTHXYPFPE?P?ph?NTM_hMhN]ypGNhvRZphZb|41. Olympiad Open 2014|Nezad, Husein Aziz|2014.08.03|D02|1-0|W -@OxgHPl\DTm]T]g]?Hsd;Lph>@wpL]u]EMvxOH[CH?C;FN>S?H;:U]oglcZRcU:BNVRJrRSeHOBDONh`GW`WPWJBV^g^W^e\U\D\RB\]NV]=V_po^fopBHpwH`=?_h|Tal Memorial Blitz 2014|Leko, Peter|2014.11.13|A30|1/2-1/2|W -FVnfEUm];Lxg<`wSV^qi`ESLCLgV=Xph?MVE>El\@Otm:;\TMhyxhovoXaop;kuwA;wWE=xuaQWoQXohXhphOYhoGWsdHXdnW_mdklutltrt_gnhYHty|GMB|Stellwagen, Daniel|2003.01.25|C12|1/2-1/2|W -FVl\@OnfEU\UOUsd;Lul@wePVgVMVvxO^ruENo_VWd\?>m^U^enWPxy:=bZPh_WN=u`=mwxhMxumucuMu`u@m^U^sm?>]THrurEiwu=Xnw:=m\KTbk=uru>=uliWldGO\mLVdR=mkVmuVhW`RJXUqiUexqew|5th Final Masters|Aronian, Levon|2012.09.24|E15o|1-0|B -@Om]EUxgF]T=RsdO^g]^dum;@wn?>ulFVkdRJmeV^e^O^dH@HvxJRwtEOZd^dldRdtdFxw:=wvO^ru=unuWNun^McbCKgmPXbdGWo_HOvoX`qiIYdtNGi`Y`tyOHphFEytM>ov>OtdE=db=E|Tashkent FIDE GP 2014|Gelfand, Boris|2014.10.22|E15d|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb@sd?>k[T?rsN`gX`N_WN^e^hiyx]ewo?Tt_en|Aerosvit|Van Wely,L|2007.06.25|B90|1-0|W -FVn^@Osd?[o_;L_VLVm]O^]V^du`=FxgGW`WEUWed^ld[TtfDLfTFTe]TKweKkvxkd]d^dgXd^e^U^VNIQX^=TC=Ew_\j_oj\omEDvFDKmk\SCMBRMSLSFNKDkSRZSTDENV:JVUENUVNOVWOPWoA;ojZbTl;cqiPWlnQYjlJRxqHXljYajlceltRJtwWPwsJLsSeuScurnoLtcKPYp`ahqhtdhpruK;ue;AYPA@PQoOQI@?emOomo?odDiaDB|5th Kings Tournament|Nisipeanu,LD|2011.06.17|C63|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwBRqiKD^ULUdSD;l\U]gmE?o_V_v>=>k]:J[R?I]KJKRK>fxy_gmgOYp`YhypQYumfKrv@In^HPph|Premier|Kosteniuk,A|2003.01.01|C92|0-1|B -EUxgDTnf@OkcHPtbCKwS@rtFVd\V]f]H]mg]H\ULCc[:@g]T^tm=EmvGWp`W`u`FTru:>va@AxyKSwx?G`Y>?l^U^_WCU]NTfN?G?VNELNF?@uULU|World Blitz 2015|Agdestein, Simen|2015.10.13|D45|1-0|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBRtmDLvx;Eqi?>wvOY[SYhSLCLdZKBgq=aqgaOl\MUulOPnuU^e^hY\TY_m_V_ld?vu@AZKBKTKGWgY:;uMJ@wnL]g]H]vxDL_mBRnuCSdn]He]=Krt?=mdck>;U\OL\eLMenMmnmh`mtphl\o_\d|Norway Supreme Masters Blitz 2013|Radjabov, Teimour|2013.05.07|B30|1-0|W -FVn^@OxgO^me^OgV;LVgEUwn?Mvx>@wvLFsmFPmwDTe]T\tXIQXO=OwfldCSgmO=jbPFn`@A`NGNo_F@uY@OYi>Ff`=>mgO`i`HXgVMV_V>PvwFG`nAHwG?GxpX`bZSZrZQYZrPene\erwGWwrHPrBWgBrgfrufn|75th Tata Steel GpA|Wang, Hao|2013.01.14|C42m|1-0|W -FVn^@Osd?[xgEMw\DLvx>@me;EdnMU^ULU\c?>tXIQXaBJjb[?wvV^g]ETcjHXah<`e^U^qi`Yk[TZut:=TLYPldOFLD=@nhU]ds[msmLTwn;LvxHPqigqGOum>Mo_V_m_@Aq`N`n`=FhnIY`gLV_hFIn_:>rvIQguQXhoYald]dkdVLoaAHaoT\iaXQoTMGaYGVe]Ve_e\eTSemvn>FSeQYnoYao_aX_`XQ`h?>hiQXihXQhiQXihXQhiQXih|Moscow Blitz Final 2014|Dvalishvili, Pavel S|2014.09.06|C60|1/2-1/2|W -EUxgDTnf;LwS=DvxBJSLDLm]@O]TLTkc<`tbTRqi`Yl\U\c\:Fo_VEm^|FIDE World Cup 2011|So, Wesley|2011.09.01|E36|1/2-1/2|B -FVn^@Osd?[xg>@gV?>VeO^wn[?d^>^vxEUng^FkcF>wv=>un;Ltk>ngnBRjbHPp`Wene?HkH@Ho_L]xo]NogNTew:>ruGW`WPWc[R[b[TNldHOur>@rBCKd\@xgoxH\UN_UMDMB:_U[SH`:;`_ov_[;?OV?>V_>=[^vo^]=M]movm]MQ]^vo^FwpUdQa_Xa\duohufqaXO\LOVpgFNaYIQL@meIQjb[dkdMU\c?>qi=Dwv;E^ULUd\U]ld]dulCKldfvfDLfhGOxqLM\TKTw\CU\UMUiaXah`UMl\_No_MU\dN]di=;k]T]iaUMaQ;CQPCF`a]ePI@GIYGNaiM_qy_wyqw_qy_tyqtDqyFEifNMfeMFefDVfVOV|Aeroflot Open Rapid Final|Grischuk, Alexander|2013.02.17|C65|1-0|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLvxJDrsIYgnDNtf=Oum:=nu?MdnMDf]N]n]=][SOMSLCLscDKbZHPml>@un?>cd>NxyNOph][d\[\e\M]le]TogOMelYaypahqh@HltM=g_T]_V]^ng^VwvVTtkH@vy=]kn@?nf]\fQ?FyvFEvuEDuw\ZQHZjpyTWh`W_gpjowoKoHd_QpiQfdfofypDMpgfXg^MT^eBRelRZldXOdlT[`XOXiELTE>XO>GPXGNZblsT\sj\djsX`|6th EICC|Moiseenko,A|2005.06.28|B33|1-0|W -EUxgDTnf@Om];LldFNsm=Dwe?Mvx>@]TMTk[TFtk?=ul@wn?=cTFTtTGOvxRZutK?vntbucbFNWHPW_?HqaA?mwFM_tM[tuIYwq[bp`bknwY`q`OW`VW^e^:>VekrurdrgV?Ao_rdwodmogmfV`DLSLCLeVA?`f>VfW?W|WY ol|Nguyen Huynh Minh Huy|2002.08.26|B90|1-0|W -FVl\@OnfEU\UOUjb?Mph>@wpUKmeDTxg;LsdMFulleFa|World Cup|Bacrot,E|2007.12.02|B42|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBR[SEMmeRZtf;EqiETrsDLSLCLut:uvNVvnGWtv:>bZW^l\V]vt>:nm]VmUVNt_:JZRIQ_mNOmvO_Uu^fof_\usMUsC\^CKJKRKU]xo^lvn]foflcf^cK^UK[nN@INW|14. Ordix Open|Sebag, Marie|2007.08.18|C88|1/2-1/2|B -EUxg<`m]FNl\`gpgU\sd?[nfDT]T;Ew\@Ovx>@dZ:<\n=Dtm[mumDLm]ETZTLT]Twn>MnuGWiaBRm]M\kc\bgnbsjZsduvd^n\TLvnLM]MFMog^dnedUe]U[]d[UdeU[em[Ume|WCh 2016|Carlsen,M|2016.11.11|A45|1/2-1/2|B -FVnfEUm];LwSV^l\BJSLCLxn=Xvx?Mo_^gwg<`f^XY^V`gpgMFuZYPxy:=sdPeZL>?t_HX_hIYrwe\L\U\]UFTd^TfUMDM^M@FhvfTM^Tf^MfTM^=Ug_Tfv[JR[bX_^O?HOUFUypHPwuU[b[R[pgPWuUA@wnDTdSMFvx;Lt_BJVLCLSd?>wvT]u];>dnLTnhWPgnOUn\U_hn_n\nMNneNjePGPkcjktu@HphJRuv>vmvklvF|19. Amber Rapid|Gelfand, Boris|2010.03.23|C42|1/2-1/2|W -FVl\@OnfEU\UOUsd;Lme@jbIQd\TMqiLVgVMV\UNUmgO^ulDlelVOg]tX;CXWL[WV|World Team Ch|Erenburg, Sergey|2005.11.09|B90u|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUulU]tmCKZk;EkuE?gvHXph?PvpOIogGW^W?rs@Hmt=Fsc?;tbF=ws;cscO^g^Wilu=EcCE@tsnw@IwnFMnwUFldFUdlUFld<:wu:JucFUdl>:kdI@dm@GmvJKvm:>mvGPvm>EmdKJdkDEd]T]rj]VsmA@sd=KuZKJZl<`gV`Nn^;Eo_:=VgCSwvEKgVS[dnJ@wnEMvx;El\FVsd?>k[V^gmE?tkIYul;uZ;KRcDFcm:;ZlPXdVKsts;slsN?Vd|KM FIDE GP 2015|Dominguez Perez, Leinier|2015.05.16|A08|1/2-1/2|W -FVl\@OmeEU\UOUxg;Lph^UhpUT>@k[RKtkDLgVEUdZKD^UOUl\U_m];Eph_PwnEV]V=FvxDVulFOkVPVldngIYZT>fu=@I=efFxoCKTcO`g`i`c]FEofEFfmLT[TKT]cFnmd`WemnfdkWecTe\m]\w]EfnkdnqEGqiT^wp^XIPXiPGioGNd]NW]fHX|GMB|Hector, Jonny|2003.01.24|C78s|1/2-1/2|W -FVl\@OnfEU\UOUsd;LjbUdkd=Mm]MPxg?F]UV^gmLVuZDLULVLZ^@k[RKw\DLmeBRrsEU\cRZcjIQvxwvE?^ULUvV?PVn=Euw>@nJkKJZENw\LFvxU\t\FU\TKkmtkCZ\?=tmIQqi@Im[=ETLNG[RW_f_G_\lCSwvEFRm_WogUOm[F>LDWPg^O^DLPWLTST]TWUvuULuMLDM]DL]MLDleIAMED_eg_XEBXUBGU]xqA@TL^OGC>@gVEUk[RKm]U^tf;EwnDLvxKDo_EKumKUdUOUl\UfmfGOV`BRruR[b[<`n`OW`n@Afc=M\TMQphHX]UX_cdQHdHAHUMD=w_=X_w:ZqaX=[SZbSLCLxqbjwojlu]lTnwTt]\tuwiuMoWMmqy?WiW^fW`fn`nmn\L=OLtHPtxPYxpnvyqY`pjO]qpvfpq]VjZ`g|Vugar Gashimov Mem 2016|Hou, Yifan|2016.05.30|C83|1-0|W -@OxgHPm]?Hld>@tXIQXaDTnf=Kut;LwnEUvx@n^DTo_;L^VOEmg:@wn?>k[RKmeDLvxEUtXU]dZKDutIQXm;Eld]dtdE?wt?NZTN_m_V_qiBRnuCKTcR[b[:rtrF^V?HO_D;BrLT[TKTrs;=c\Cg_gHVph=MxpMOg`@I\UF>sC>FCFOF`WIHUGFOWOHOG\V]o_]dpgdvh`vag^ah\cha^UaocuofU^fo^goaucavc\va\UavULvag^ahLEha^UaoiaoaUTah_WhoTUofE>foe]oxU\OF>LFMLgxfgpfX]UXOpgO=\S=XSKXOKCOXC@gVOVphCKruumHXlWOHagIQWlHOgvCJveD;lZJ\wuONet;VkcKSZRNOc\VdRSdmumU\m=>=S\OrpwrbteBReV=?\U@HVE?>w\>FxpbdETdVf^VU^UHOUMFB\SB:MEOFTCGWE=2:=C=F=SeW_h_X_pgRZg_=Fe\FO\w|Hotel Bali Stars|Azmaiparashvili,Z|2003.11.28|D11|0-1|B -FVn^@Osd?[xgEMw\[dmd;EvxETgm>@wv@AjZBRkcHPmwT^ogMU\e^dumU]vVOEVvETtbCKbTKTwhdUh^GWl\U[^o=Mewv>E>xo>GskA@qaLVQmVewe;>mRM_kn>fRm_aoxW_ZRaOnvOJvrG>e^>Gmk]ekdemdmfcm_J\ru\N_DNORJOJ^UGUuUcgUEJwxqgGEGwGDTG_qy_wyqw_qyIYTBYaBF_wyqw_qy|Renova FIDE GP Zug|Caruana, Fabiano|2013.04.24|C65j|1/2-1/2|B -@OxgDTkcEUnfHPtbCKwS@m]=Dsm?=vxBRqi;Jd\DCbkKS]TJT\SESrtTeneSewvRZkVZctDC[uc[cjcFNvtO>VH>DtD@HgVenc[=?mc:LVeP[S><]L@HVPIPLVho>?oh?>ho|76th Tata Steel Masters|So, Wesley|2014.01.19|E15q|1/2-1/2|B -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLvxJDrsIYgnDNtf=Oum:=nu?FdnYaqi>@mt]nunN_tlFMn`MD[S_ewue_SLCLfB=usu?:Bf:=u=D=bZOMld_N`NMNdTNETBEuxqGWB;@I;VW^V^I@^>@I>^IA^L=OL>AI>^IAZRur^>AI>YI@Y>@I>^IAfKrjo_jcKocj^>AI>YI@Y>@I>YI@oaOaY>@I>YI@YajRaXRmiamfXWfvWXvfaY@IXWI@YQHQWP@APQA@QX@GXUG?UVfoqiowV^wyi`yQ^W|TCh-RUS|Yakovich, Yuri|2007.05.05|B33o|0-1|W -FVl\@OmeEU\UOUxg;Ljb@Xg?>sdFOvxIQaYPIwvOdkd=Ors:;g]L]d]CKZB>lD?DG?GB;|Wch U10|Berczes, David|2000.10.22|B90j|0-1|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMmeBJum;ErvJRdZKB[SE?nu?PxyDLSLCLl\<`kd==u=D=\ZbZdZGOyp@GpgGNgnOWneFLogL[e\X`g`W^Zd[lrklf\Sf`d^`qTLqgS\RZkb=Db?HP?QZb^dNMQ?ML?bgXbtXNd^N]tf]WfTDMh`MT|6. EICC playoff|Aronian, Levon|2005.07.02|C88|1/2-1/2|W -FVl\@OmeEU\UOUxg;Lsd?TucUKnf@jbBRkcGWqaIQwn=Ors:>aYOFgaFXp`V^e]TMtkW`d^XYvmNU^MDMyqU^neMUsxHXe^>^|Artek ol U16|Primbetov, Kazbek|2000.09.19|B57k|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMwv;LqiBJn\L]dUOU\UDLUj]gugVfVMVvVPemf|TCh-RUS|Harikrishna, Pendyala|2007.05.04|C88h|1/2-1/2|W -FVn^@OxgO^me^OgV;LVLELwn@tXE`qi`NsdU]XOHOdUNUpU=UBF@HkcU^wv?@og:g^U^wWIQXaK\n\<\]U^fahFMugO`dnMhqh`VgfV`fg>fgwfhWY`f|20th TCh-RUS 2013|Jobava, Baadur|2013.04.08|C54k|1-0|B -FVl\@Ome;LjbEU\UOUxgHPn^UFwn?Hvx>@k[IQ[SL]g]V]smBJSJ:Jo_GW^V=O?@qa`ipi@_h;ExiDTwn=KrsKLvxT\og^gngCSioEKf^^VOEoiE?i_NWst?NmwFX_NGNwfWeqaXQtrKZum>?kcZKmkBRf`Q_h_?_km:?`O?OVO_Oc\S\vfLMrvKEmkIQkSE?Sk?Pkoe^aYPFf^U^v^FUovRZ^VU_v^_U^lZbgUNUlnO?n`?;xq;?qi?O`h@IhfMEiqEGfiO_ihGOVU_aqxa_UV_wxqwrh`OL`WIAW?AIV>LDphrjqiDEh`E>?>jk>^IA^:|Tal Memorial Blitz|Carlsen, Magnus|2008.08.30|B12|0-1|W -FVl\@OnfEU\UOUsd;LulSnOW^hV^gXLVvxN\n\V\og>PXi?Mg^MhqhW^bZ\Vi_Phl^K\rjA?me<;jn?O_YOwxwhqp`qi^pipnp=epl\ftfef`XfgwngGldCKdfGWYHWXHNXYfdDLdhVPnm;GIUOIA>FXIqickOEIXiqkcEOXIOUA:qickU[:BFMBH[ekleVIOiaHBa_O>MTZR_olcKRBRT]RZ]UZRUN>HNGRBGPHNQYBZPQcdoONTOMT^MedlQPZReURZVgZ\gV\ZU=^oPWoiVPZ\=M\ZMUZ\LTldUVdeWN\tVUefNMtrUVfeMUrxT\emPaxwU]w_V^_?\dmuap?=]\=<\c<;^[;|TCh-ESP Final|Movsesian,S|2006.11.03|B48|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxBR[SEUmeIQ^UOUdZKBl\UKZdFfUOU\UV]j\]KufMV\cV]U\@HclFV\nVTljTdjU]OU^Kfofdc^]O]f]cd]UHOSK|SportAccord Blitz Men 2013|Vachier-Lagrave, Maxime|2013.12.14|C88|0-1|B -DTl\@Osd;Ln^HPph?HwpBJxn>@vxCSm]T]n]L]u]:;\SJS^VO>]B=DBD>Dt_DNdU?>wvN_U_ueCKecFN[eH?n^EUVM?Mjb>F^]K;qiIY]^@dZTFxgEMvx=>Zd>YdUF=rt@Ak[OU\UL;t\;EulEK\D=DlDYPwtW_DF<`FC:;CBKUBRUFtDPOh_FP_VPVgVMVog;:DB:@tkT]f]BJSeCSjb=Kun:BsmBFrsNV]V?>nfKfofLVgVMVk]VM]OHOwOMbc[FfmgfNO_:gXNFXI@HIOELOYH?YhJRhWFD_a?@scbtenGOciDB[RLEaA@GiIGNn`ELA:BIW]NM:J|World Rapid 2015|Korobov, Anton|2015.10.10|E52|0-1|B -@OxgHPl\?Hsd>@n^FVwn;LmeEMvxBRdSOEqiETtX=EXmL=wv=NnwDLSdGW^WPWmfEGfTNTe]V]g]KR>Yue;:R[LT[bMUeUOLgVLZbZ:ZVE?=weYGe^W^ETGUTZULZT^fvf=uxqH]|FIDE World Cup 2015|Eljanov, Pavel|2015.09.29|A05|1-0|B -FVldEUm]V^t_@Onf?Fxn>@qi;EsmEK_hBRn_RZrtDTwnT]d]FMvxHX_YOYhM=MnY@vxTKmeIQtm?>rtGWdUNUn^W^e^UGmd=Oxy:=gaONkcL]tv>?aWG>Z\>S\N]NdVSwpwKovt@Iw\N]VH?WH]W?]V=m\NDLNWI@WN@INW|Sportaccord WMG Rapid|Vachier-Lagrave, Maxime|2011.12.10|B35|1/2-1/2|W -FVn^@Osd?[jb[dmd>@tXIQqaEMug;Exn?>nhMUhWQXaXHPXO=OWfU^g^EKphATLAqohqy|4th ACP World Rapid Cup|Shirov,A|2010.05.28|C69|1-0|W -FVn^@Osd;Lxg?[dUOU^UL]g]V]wn>@vxDLme?>ng[MphLTg^CKu`NipUpxp@GpgBJvr:>jZNnruPXqiIYh`Y`i`W`g`M_m_X_utnmwymoyIGOIQOFQK>@`W_gtvonvw@?W`np`i?A|SportAccord Blitz Men 2013|Ivanchuk, Vassily|2013.12.14|C48|1-0|B -FVl\@OmeEU\UOUxg;LjbIQn^UKtfFld[evn:gm=Dkc>:msDMsd:RwnMVogQYdsV]ce]VecV]ce]Vec|Vugar Gashimov Mem 2016|Mamedov, Rauf|2016.06.01|B90e|1/2-1/2|B -@Om]HPld?HtXDTnfT]f]>@xgEMsm;Lw\IQXOHOvx=D]UL;un;Em^OHwvCS\SEKSL@vxGW^WAIi`HO>YOQYGIAG>AI>FIPFNPHNVHGVXQJXWGF`XJnWOF>O_npXO>E_WED^VpkOGkcVNcfNFfcGHchWPhVH?VTPhDEheEL?GToG>oOeJ|WYB12|Susilodinata,Andrean|2001.11.02|B92|0-1|B -EUxgDTnfHPm]@OwS@ld=Dsm?=kcCKtbBRutRZ]TKTd\EW\UOUbkHktk;LcZUKktL[ZR:RmcRjrj[jtTDTcTjdnJW@vx=Dd\FV]TETc[LZuvTNbkU]f]V]nuZLul?>vs:=wvN_v>=>leOYew_nwn>nphDEsw]ekHYHrvEFvnenwsHWgvW][SL:seFVogVTxpPXmc]cjcTFpoIQenFTnfT@xggmcNm\N\e\>FtlO^ru@Ang^dSdV^gnLV\TVgngMqxqFaqx^gu]W_l^gp^p:JdnHXwuaY]=JO=?O?ndYau]DLdZaYZd_fofYG]uGFphFTuw?>wgX`goTfhf>fonfndnAHxpHOphOWn]WV]cIYcRCKRLVUL[U\[j\cjdckdZkb|FIDE World Blitz 2014|Maletin, Pavel|2014.06.20|B85|1/2-1/2|W -EUxgDTnfHPm]@Own?Hvx>@]T=DjbBRtmDTmd<`d]TMl\;L]d?=uZO^dH@H\UMUwuUTZ^=unu`W^ZTtZcGOp`RZsdtrcCW`xp:=CL=udurug]FV]N`NLNPXNFHPF>PH>FHPF>|40th GM|Leko, Peter|2012.07.19|E05n|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwBJqiKDdsCKsm@gVEUVe[dmdU^e_=uvu;LuvIQqatuQYihHPunEFmf>L|11th Karpov|Jakovenko, Dmitry|2010.06.09|C67w|1/2-1/2|W -EUxgDTnf;LwS@Ol\HP\UOUgV=MVLCLSn?HsdU[vx@meqikbuebT|20. Amber Blindfold|Anand, Viswanathan|2011.03.17|E20|1/2-1/2|B -EUxgDTnfHPm]?Hwn@Ovx=Dl\>@\UOUf^U_]U_nun<`qi`gng;EsdT\gnEVt_DT_VHVxyCSo_V]ru:;nm]dkdS[d[;[wg?;m]T]u]\d][;[gd[^db^_bB@?B:?HUMFMjZHOZR_ZRJIYJBOFyxZjxwMUwvU]vw]ewvYavuFOuvOFvuFOuvjnvwnF:=FB=eBjeUjlURPXRSOPSRlmRSGWSKPGKJm]wo]_of_^fo^NJBGOB:OV:bNMbfVOfbMmogm]goOVbf]^fb^\oxV^xq\]b:^f:bf_b:_f:bf^b:^_:BX`i`W`phahqp]mpxhpBbmnbZ_gZbnfbfgf|29th ECC Open 2013|Wojtaszek, Radoslaw|2013.10.23|E06|1/2-1/2|B -FVl\@OnfEU\UOUsd;LxgU[wSBJSL[Lm]V]g]@tf?>o_M?xyL]f]ELue=aru:=elIQ]V=uwuaFdULU^UGOVdFnln>nuvnlph@GjZCSZSJSv^?Td[OW|Moscow Blitz Final 2014|Popov, Ivan RUS|2014.09.06|B45|1-0|W -@OxgHPm]?Hnf>@wnEMvx;El\FVsd?>k[V^gmE?[SIYjZ?IwvYaqiIXnw;cjWNkrDLvuOEdUNU\ULDrH@HbJ:JjJEVJb;KbZGWurD;Z]K[]dHOrJ[sJr;kdkskrJksJMOGphV\MEG>ECsCw\ahoh>FUMFMiaMT\NCKNGKOG@T[xo[donOK@IKknwdeIPefPWko|FIDE World Cup 2015|Svidler, Peter|2015.10.05|A08|1-0|B -FVn^@OxgO^me^OgVEUe]?Msd>@wnDTdSMFvx;Lt_BJVLCLSd?>wvvuvO`_hWele=Xqi`OvVXPVDOYhV:>e]T?DCJRruIQCJ>NJePXegYOdnOEVhXFndEKkcKn_PIutGOtLWFVMFLgU@AUL>=M?=?aYIswp?=_N=@N_@;LD;>DGs^pxAI_P^:]U:=jbTD>vDGW^GPI@P^v^qp@Gpg^VgpG>pg>EgpEMpgVvg`vV`gOWgpV^og^ZpoMVofZbfnV]_N]UNHUVh`W`g`V_HWbJ|16th Ciudad|Topalov,V|2003.06.06|C42|1-0|W -FVnfEUm];LxgV^gmGWl\@Osd@k[BJucL=bZDLZR=GdZ:=tkFMZTEFTNFN[SW_kb_gpgNig_U\c\JS\c@AogHXbMGM_X?@g_IQwoQX_WOUWOifcfUfrbfWm^M^oW@?bf=]ne^OWX]afFaZFfZrxprjpxjrxprj|World Cup|Rodriguez Vila, Andres|2009.11.22|C11i|1/2-1/2|W -EUxg@OphDLwpIQvx@sdBRjZ;JmcTBwuJTcTBTe]TF^VOEtf=;rtEKkcFbts?@wp=aqiDTf]V]dUM_u`a`i`_Mo_T[^VMTp^IQvn[byq?=UO@?OI?F_WJDWOHOVOFMqQDN^W=@WN:>no>N`XNVogCSg_MNrtS[XPVW_^@PQPGPI?T?|Canarias en Red prel 3rd|Milanovic, Danilo|2004.05.05|B33w|1-0|W -FVn^@Osd?[xgEMw\DLvx>@me;Ejb[dkdMU^ULU\c=Dwv?>d\V^g]ETqi@wn?>k[RKvxIQtkEMmeBJwv;LdUOU^UL]g]V]ng>vuvv>E>xwGOe]XWp`Wswn>Snm@?guS\ulsjbZKBmtCSZRB;`X\UXQHQdij\iQ?FQfFGkdDTfiT[iEG?dm?@mQ|XII It I|Campora, Daniel H.|2003.03.28|C88i|0-1|W -FVnfEUm];LwSV^l\BJSLCLuZ@XOFORYDTd^T]vxEL^O=On_HPY`?>wv:=aY]eYPGPv>=>ruL^`aPXa`>?`NON_N?WN]WT]cTDog^guegneUn\UX@Gxp\cjcDCXWGPWgJRgdC[dLPHLdRZcZ[Z|23rd ECC Men|Zhang, Pengxiang|2007.10.09|C18b|1/2-1/2|W -FVn^@OsdDLm]=RogEMtf;Eum?Fxn>@nh?>weMUhWF?vxV]f]EVmX=`^=U^VUVgW@HogVfg`YhWTh^TL^o`_oeleHPLJfeJRei_`]eRSemSUibUmbcm]cs`_sy_`OW`hPO[Sys]Us[aYOXhgXYUWYPWTPOgfONfeNM|Piterenka Rapid 2012|Nepomniachtchi, Ian|2012.12.29|C44|1/2-1/2|B -FVl\@OmeEU\UOUxg;LjbIQsdHXucUKnf@mcKEwn=>ph>GcmBR[SLFvxQYbZDTSLFLrtEKlsL[kbGFm\K\e\W_dUNU\U_fofV^t\:>b[R[\[?wnwFT[^>?w\@AsSTbUMbtxptlpxlo|4. Zurich CC Rapid|Caruana, Fabiano|2015.02.19|B90|1-0|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LtbCKvt@gVEUVe[dmdU^e_=uvu;LtmIQkcBRjZHX_nO`mvGWqi`OphCKut@]T=DjbDTk[TDtk@vxLVbZ:;ZSJSulOUphU[lsDTo_VLkcMFmg[UtmFOslOrwrUOlT=UTUNUrtHPc[O^mv?@wpUKxn;Lsd<`qi`YmeBRkcGWh`YP`WPWnhWNia=Od^OGrsMFulIQvw:=wx=Eyq?=pwG?srKUtkUO^O?OktOGrsEUh^US^mSTlkTUm^GPqpPGpqF?tmUSc[R[b[?[klSKwn=:qp:jlu[msKDK^mGFm^Fan`NUpqa=^djbdU=U`Wb:qp@AuYLFW^UNYgNOgi:?iEF<^C@vxDTulOW^WNW_h:@tmJRwtWV>EV^Jravks^VsvwovyVYrsYIENIYscopyvYVNOpgc;iavyaY;@]Uyig^@AVNOG^]AYf^ia]fay_WYQNVyrf]rZ]TQaUMa^ME^V|Pedro Zabala (6eme memorial)|Moskalenko, Viktor|2004.10.12|C18e|1-0|W -FVl\@Ome?[smEUxg;Ljb[mgm>@nf<`ulU]f^BRkcOEqi`NwnGW^WNWm^W^e^ETne=avx?Ors:?ogahxyOgpg?glphipigiypiec[R[b[T^[SLRsrCKwW^MWVM\Vvect_cS_D]ev>@G>=empoSkogklDKltrRmu2=utuRBGPKTuEBZ\Vg^V`T]PYZrHX^WE]ry`qyq]aqoayW^Ya^gai|Aeroflot Open|Vescovi, Giovanni|2002.02.07|B51h|1-0|B -@OxgHPm]?Hnf>@wnEMl\;EsdFVvx?>jZBRkcV^gmE;og^gng;Lm^O^d^L[^dDLdj[Jxy=mfCKdUNU\U:[kMJd[>=kj;:tr:;ru=M[M|FIDE World Cup 2013|Sasikiran, Krishnan|2013.08.14|A08|1/2-1/2|B -FVnfEUm];LwSV^xnBJSLCLl\=Xvx?Mo_^gwg<`goXapha=uZ`Esm@O\TMFndO`onGWmg>@tmJRrwFOdu=mdJSZSLSgVOV]VDLd]ENxwIQwn@IqaQYo_IPvxPIxvIPvx|5th Final Masters|Carlsen, Magnus|2012.10.11|C18o|1/2-1/2|W -FVl\@OmeEU\UOUxg;Lnf?Fjb>@wnBRsdvw>NTlNPngPLSTLTlT]ebZeMTSK@n^DTm]T]g];LtfEMwnOEvxETum@meCKxn@gVEUVe[dmdU^e_=uvu;LtmIQqiCKd\@sdFNvx;LwvU]dZOUtmNVldMF=F[UF=|Eu Rapid Ch|Ruck,R|2002.09.30|D76|0-1|B -EUxgDTnf;LwSFNvx@Fm]BJSnT]f]FWld?Msb>@bld\>Ytk=EgmYnun?>mgEGneGPru:=jbM;lfU\c\W]g]L]k]PeueNVvu=]e]V]u];B]EBfofIQ|42nd Olympiad 2016|Nisipeanu, Liviu-Dieter|2016.09.08|E46|1/2-1/2|B -FVldEUm];L]VLVt_VP_hIYqi@OsmYahq?MqM=MnfnvGWvn>AphahxhP>hXAiXHD=HBW_kc_fnfiq]nVfmf>EBR=d^>L^OLCOECgETJB[SgYTNY>ST>GN=G>T[B;RJ;B[R>E\TE<=LB:L]@qiBRxnRZjbDLp`O>d\FMulGW`XU\m\MFiaDXPIQrtFMVG=O\UDU_ULUaY?GPGOGlnGEyx@IxP:?vmMFmlW_ls_fof?gnqESsrgGqVFXPHGHVWIAt@rtBRph=EaYKrsdcstcdtsUcQH>VWOVWqoWovodLohLOst@HtTIQTSONhoHPS[NM[;QYngX`g^PXohYahoMOonai;AX_nocuAaOKaAKkovugA?_f^g`g?>fe>?iq?ge\giqy2iyksvmsymlyilmibmnbcnmZbmnbj|Karjakin-Nakamura m|Nakamura, Hikaru|2005.04.29|B90n|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUgm;E^ULUwvU]ng:;rjCKqiE?m^NuYWP^PaPY`;?lnOFo_GW`gPagCV^e^?;CU;=^W=UnNFEN>@IWOD=\U=OkeEU>nUceVaWnkcdVgWavwagpgdbxp]ekmb[meBRphRZwuKStbOah`QY`W[\bMS[e]\lWN[cMVckuxks2xHIQ]MlTH@TMNMsKMEKC|Corus A|Short,N|2010.01.24|C96|1-0|W -@OxgDTkc;LtkEUnfBJm]T]g]FNphIYwpYasm?M]LCLf^NVun>@vx?>wvJRjbMTldaipg=rsT]dvLTnl;:xwKCbZ=MwxMKljO>\UCBgn>OU\O^n`^X\UT\xw\do_KOvoXN_V:=U\]V`i=mjmdm\<@I|66th ch-RUS 2013|Andreikin, Dmitry|2013.10.05|E12s|1-0|B -EUxgDTnfHPm]@Own?Hvx>@]T=RjbRTk[TDtkcREK]VHVrV:BRLDLf^>O^UOUjrBDg]LOVOUOwv?=]cKZphFNxp=MrtDdts@?qaIQpgOEgpEKvf?HpwGWfvHOvudDumNVwvV^enMmvmDEmvZdsrKZo_PXaXQX_XOXvoEInwW_c]_g]g^gogIGgfGFf]FE]VZkVNEmrvmlwik\vwlnNEnfw?djiNfbEFbh?WXQWOhPOoj[NGPKoW[LF?K;G>;>|76th Tata Steel Masters|Caruana, Fabiano|2014.01.13|E05s|1-0|B -FVl\@OnfEU\UOUjb?Mw\UK\j>@sd=Fme|65th ch-RUS|Vitiugov, Nikita|2012.08.07|B42g|1/2-1/2|W -DTl\@OsdEU\UOUxg;LnfHPucU[d^@^d:;CJKSe]S[d^FVgVEWVL=Dng;KJ\DL^TW`un`gpg[cjbrltm?>mdKSytHQbZlf\SfWnwLSZSQt|Hotel Bali Stars|Romero Holmes, Alfonso|2003.11.27|A33o|1-0|B -FVsdEUn^@O^UOUuY;LwS?Fxg>@SLU_YVFMVXGOXRCLvx_pxp@ld]KuYGW^mYgTFf]L]d]DL]U:=UL>LgnLpxpW_h_X_py=UogFTruUX\mXHm^ONn\N\c\TfuM?<\TfTMQTfwuHDyp@HQY@vxEMl\;L]ULRsmDTrs:;kcCSulS\c\;sls=Ksl@tfKC\UNUSe?>rtFMnkE`gmLFcTC;qi`WenP_ngFPf_P_mc;=wv=XxwWeTe_ev>:>klXtltetctMFte>:gU:=Uc=]wnHPph@Hnf]=iaFMfn=>ngGWgpHOpg>^c@IQ@cPXaXQXgp^]cl]\lc\devX`pwOVwndDvlMTlvV]nmDIcN[cvecjNjTMjN]^mnIqNgq`OqgX`ga>@rsDEnu=@]T=RjbRTk[TDtk@tfT]f]GWvxW_SLCLogFPumkc>FwoXantT\owPVmoaYoBHXtnX`g`V`BxFGdm`qxqYnm_n`phIYrvMUc\U^woYavfN\qpGIpq`u|Corus B|Kosteniuk,A|2005.01.28|C28|1-0|W -EUxgDTnf@Om];LldFNsm=Dwe?M]TMTvx>@jbBJd\U\e\CS\nneUNoh>Oh_W`i`OET]PX_hNUeWE?WXPL=_V=LVO|NH Hotels|Jussupow,Ar|2006.08.22|D46|0-1|B -FVn^@OxgO^me^OgV;LVLELwn@gV?>VeO^wn[Md^>^vx;LldCKev=Om]umF^kc>NwvJCnw^ao_NQqiQPeoLFd\Cg\TWU_WFWTMWMoeM^mlUWlDIQD=@I=aPhxqHXfXhXa_|2nd Sanjin Hotel Cup|Ni Hua|2005.07.12|C67|0-1|B -EUxgGnw?P[SP_fV:?kt_PVOHOZRPFRJLSwSFWJCW]rB?;SZA@xw|FIDE World Cup 2015|Andreikin, Dmitry|2015.09.22|A45g|1/2-1/2|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DTtbCKvtHPp`]U>^v^GOBL=?geDCd\OXbk?okVY_econVMn^LRCBMTEDRLBCjZ_NLRCBRLBCLR|11th Karpov|Rublevsky, Sergei|2010.06.12|C45m|1/2-1/2|B -EUm]@OxgDT]TFNnf?Tjb>@l\;L\UNUwn=Fvx?=k[TK[SLRtk<`smO^m^U^g]K]k]`nunRc]HcrHr=Mwt:=r]FXtdCKphXWqa=@k[T\elGWjZKDZRIQgqNVo_V^h`LFphPXxyQY`YX`yp@Gwy?AqwAQsr@vxU\e\NVulV]g]EK\nKUdUOUwu=Fph?=]W@mfL[jb[edU=UndUN]UNPog^gwgFagi?>um>fifaoxyofmfekfnkerueTUMPNnSCKqiIQbZ:=SLNcLgTZdZcZgUZEuv@IUeGWvuBReURZU]KS][EL[bLEb[=:ue:<[myx>YumY>xo>EmnCKnmck|Rapid Match|Short,N|2008.05.05|B12|1-0|W -@OxgDTl\;LsdHPm]T]g]?H]lBJphIYqiEMwp>@tmR\>N\mNUDtUSmgxpgvpytlSnl^ogvgwp^snw|2nd Norway Chess 2014|Caruana, Fabiano|2014.06.13|A35l|0-1|B -FVn^@OsdEU^UOUw\Udug=Emd;LghE`h`<`tf?Mog`EvtGWxn>fxHXnhIY\e>?k[BR[SL=d\Yahn=NndCKdUN_ew_UuUENUu@nfCKwn@rt=@vxTKm]V]g]IQjZBRdUOU^U?>rb=a]S;JbhVe]@I_OV>aXUNXQNOwO>@OGIQh@:@SDJ[GOQXOM[eDNXWNT|World Cup|Gelfand, Boris|2009.12.06|C55i|0-1|W -FVnfEUm];El\V]f]@Oxg?[tm[msm>@wnU\m\OUphEKvx<`\V`YgaYnun=OngOgagGOVeK\rt\Mwv?>v>:>jZDLZRUFe[>trMSrZEDZ\SM\tDCtlMWltHPtr>=rZWMZr=>rZMSZ\CD\ZDEZ\SM\ZENZrNWrt>rt>Nt\PXaXOXRKBK\tN^tLS]c]^]ev]mvlWVk[UFLdFWlfX`gpV]dbWfbfKSpwmkfFk[FI[\IYS[og[cYS]dg`ckSkdkwn\`ng`@h`kdg_d]_W]U`X@?WPUNPI?:XPNOPHOG|26th European Club Cup|Vallejo Pons,F|2010.10.19|C08|1-0|W -FVn^@Osd?[xgEMw\DLvx>@me;Ejb[R\jIQdn?>nhE?ld?Pe]V]g]MU^UOUwv>vuvRDtm]W>vsv?Tv^TV^VDVjs@?WfVDxwPVhn_nwn?FqiENo_V\f\N\noDKmfKfofFMphGOf]\NiaNGslGN|4. ACP World Rapid Cup|Jakovenko, Dmitry|2010.05.29|C65|1/2-1/2|W -EUxgDTnf@OkcBJtk;Lm]<`wn=RkdRK]TKTvx`gngFVc[TMsmMNjb:=us?Mf^U]dk>@gnCSl\]dkdM;bZL]d]V]ne=@xgV^e^O^mt=Onf;LwnEMvxtdPXg_XFwgL;ghGWnYHPYgDLd];EsuBJxo?OqaONuyEOaYN^]m^\YPIQhiO^g^F^yt\tmtMUiQ@HQIHPIE>FEMFNtTNMTMPGMEGOECU]CcLTcKOGKBG>B;>Ef]T];V^loh]eVWEDWVDEV]E<]^lu^L<=LM=>MN|Corus B|Smeets, Jan|2005.01.23|B52n|1/2-1/2|B -EUm]DT]TFVxgV^g]?T]cTMsd@vx?>qi`EmoBRtfL[]gRZc]Zbkc=FgV;V_VFVf_VY_M[L]LELoWYWwWO^M[HPWwGWru@Hl\U\e\IYwvYa\eHQe^>^v^L^xoPXuMQYMm^s[FCSF[s^of:JfoX`i`W`mn`hox^snVYPVvsjvrjc|Blindfold World Cup|Bu, Xiangzhi|2007.10.16|D20|1-0|B -FVnfEUm];LwSV^l\BJSLCLxn=Xvw<`XQArtjZ>EcbMNdsNMsmMLmcE>cTLKTN>EZRKLNTE@vx<`ld=OSnIQqi`Wne:=rsCKsSLFeWFWulWFwv?>SsDTtbT]bMOMd]FPlZ>vsvMEZcP_|It|Slovineanu, Viacheslav|2001.08.08|C47|1/2-1/2|B -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmDTmd<`d]TMl\;L]d?=\UOUdH`gng@HsdUdkdMTucLVcC:;C^;cbZcdgn=mnSdlqiTMrtljtul?[sm>GfT[TlTG?TdBRmcNcdc?[cl<;wt=EnwA=ldEMgmM]mc[dkd]ZcTZrtrK@m]T]f]O^smGWl\tfX`g`OEw?>?VLCLry?O`XO?yQNVQLV]f_HGLDGWTLETnVW^V^U^_M]eMTemDE|66th ch-RUS 2013|Shomoev, Anton|2013.10.11|E52|0-1|B -@OxgDTnf;Lm]EUld<`qi`gugFNsm?M]TMTph>@wpCSvx:@l\U\w\;LvxNVu=?=k[TMtk<`smIQrtBJ\c`Wm\WN\M=McNMNwu:>xw>FwnOEgmEKm^KZkrGOp`FDqa@?^hNFhWFEo_V_f_EutuZK`XQXaXOX_XHPWfDFrOFIfpIEuwK\p_Emng?GwymjyIG>ICjbgobjov\VvuVg_NgVNTVgT^>?OH?>^M|Ukrainian Games|Kalinin, Oleg|2003|D27l|0-1|B -EUxgDTnf;LwSGOm]BJSeFV]VOVf^U]vx@OtXIQXa?Me\HXahMDwv<`qi`YldCS\n>@jZO^ZS^hohV^gmYnunDhSLhvnv^fmg=Md]T]sb:>bl]elfMTxoTVru?gpgVqowqywoyqow>?fWqiwoiqowqiwoiWvfWOf^Ok|Tashkent FIDE GP 2014|Mamedyarov, Shakriyar|2014.10.29|E20|1/2-1/2|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;L_n@]T=DjbBRtmDTmdPH>FHPF>PH|12th Karpov Int|Caruana, Fabiano|2011.10.07|E05m|1/2-1/2|B -@OxgDTl\;LsdEU\UOUnfHPucU[d^=X^[lvulrGU=D^TFVTNDKUEBJEDKBDRLRN?A?k[Rcjcrctk?okd:=wnoOulcmyuOL|4th Zurich CC Classical|Nakamura, Hikaru|2015.02.16|A33o|1-0|B -FVl\@OmeEU\UOUxg;Ljb@tfTKsdN`gm`nunL]nu=Fm\:=xyIQ\KBKo_V_f_=E_hFNhaO`dU`VahKShoDLo]LUucVL]T?>cSU^e^N^ruEuwu^lux>nk[LVSCVeC<@I@tbCKng@vxGOVOD_OH?Gwv@smV^l\MVus^e\UOUseVkpU@Aru=OxgLFUjW_vx@|VI World Blitz|Mamedyarov,S|2010.11.18|D11|0-1|B -FVl\@OmeEU\UOUxg;LjbIQnfHXk[?Htk>@[SL]f]V]wnUduldnvnX`gm?>nw=FlufktfNuc:>tm]erjWT|Amber Rapid|Van Wely,L|2008.03.20|B90|1-0|W -FVn^@Osd?[jb[Rxg=Fk[RKwnDLm]EMvx>@tk?>wv;EnwBJumKBruE?qi?P]U>=ULCLdZ@vxOUm\M_\VLFn\vtGH\l>NiaIYlmEFxwRZmlKSleDLwxU_|67. Blitz 2013|Demidov, Mikhail|2013.09.01|C10|1-0|W -EUxgDTnf@OkcHPtbCKwS?f]V^gV?Hum=DVEDEsdIYrt:>duO`ufGWl\U\t\EMn`Y`fWPWmXHGXWGHWXHGXWGHWXHG|74th Tata Steel GMA|Gashimov, Vugar|2012.01.28|E15o|1/2-1/2|W -FVnfEUm];LwSV^xnBJSLCLl\=XulXpyxpq\U@FULGWtmqMn_MLsd:;rtaXOX_t@PjZPYZRKoxp\V|75. Tata Steel GpA|Van Wely, Loek|2013.01.27|B76|1-0|W -FVl\@OmeEU\UOUxg;Ljb?Fnf>@wnGWvxV^e^W^n\^g\U@AUg@wn?>k[RKvxBR[SEUmeU^e^;En\RZqiIQue=FtfETenDLSLCLgaHXaW;f]DVZdV]u]FVnfET\wVW]\TN\L;kL\kld^l\^OWOw\N_xqOL\w_NphQYwpL\p^YahaXaqp@H^WN_pg_PWe\Ue^U\g`\Z`YZRY`RZfdHQ`gZugpP_pq_PdOuZ^UZbUGbeOP|TCh-RUS Men 2016|Svidler, Peter|2016.05.06|C88k|0-1|W -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;Lqi?=uvIQjb@mXV^Xf:;f]?=umO>kc;MdZ@m]^eweUftfWesmL]rt]WmwHPtdewu=:=ywWfdf=Eog?=fnEevoecwtDLtlIYnF=UFn@HovHOvoUVnmOFm]VU]^FM^nBRn>celnem>=MD=>mn>nDMnlRZofCSf^LTloU]^fMUolT\lt]efnU]tyecyu]Tum\dkdcdmjT\nm\cjrdlmelprspke]|It (active)|Contreras, Henry|2005.11.17|B40n|1-0|W -FVl\@OmeEU\UOUxg;Ljb?TnfTKk[<`wn=Oul>ZRK\uZ\fof?TxoL[e]V]f]T]g]=]Z>A>sdBJng]m|Canarias en Red prel 3rd|Morkore, Thomas|2004.05.05|B90q|1-0|W -EUm]@OxgDTldFNjb?MtX;Enf>@sm=DwnCKd\@smCSld=Kc[BRjbRZph:ktQtaAHAvtAH`X>Dty;KgfDJfmJ;ya;EaiK;iy;KyaK;ay;K|FIDE GP Beijing|Ivanchuk, Vassily|2013.07.16|D58m|1/2-1/2|B -DTn^;LxgHPm]T]g]?H]c@Osd>@wnBJvxCStfEMog@jb?>qiE?\j?PtfKfvfMUe]O^d^U^gVPV]V:>rj>vxqBJl\vnqhHPhgnl[SLS\SJSjBlkBC@Hp`kcgpYa`XH?pxS[xpcspg[cg`?>`acko_>=C;=F;CFMCKMUKSU]SC]fCcf_cksk|Vugar Gashimov Mem 2014|Radjabov, Teimour|2014.04.26|C54d|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb<`nfGWuc=EcC:;CJV^qi`Ye^W^g]L]f]^ftf;kweUfof?FvxEUwokoxo>@oxUXJNYGN^GP^NPGN^GU^I@GIWXWeWFXsdXfxyf]ruUpyp]duEGOEDdVD@ulTKtf=Fsd?=rtN`dZ:tTGOTUL;SdDLUE;E[SLSdS@GneGNfmE;g_HP_VOVp`IY`XNEe\ENqa;EmRCKR[E;bZ;L[vL;vo;Eof>MSMNM\SMDfmE;mf;EfoDCovCDvdDMdmMDm[E;[?;E?FE;F?;E?FE;F[;L[dLBS\DMdrMNrkNMkdBLdvLBvhBLhoMD\UL[UN[eofDLNO|19th TCh-RUS 2012|Frolyanov,D|2012.04.09|B90|0-1|B -FVn^@Osd?[xg>@gVEUVe[dmdU^e_=uvu;LuvIQqaLFkc?=tbFU_UOUd\U_bF=EFT_NTfN]rtCKld]NtuEuvu@wnEMk[RKvxBR[S;En\IQmeDLrs?>wvRZ\jE?dn?PnhMUqiKDl\U^e^DMtfMb\T:RulLSjG@Glj=MKVrEVhWbjogQYTLV\LD|74th Tata Steel GMA|Aronian, Levon|2012.01.14|C84f|0-1|W -EUm]DTld@Oxg;LjbBRnf<`smRZqi`gmgFNwe?Fd\T]f]>@vxU\e\OUueFOwu=KrsLR\jKJe^R\gVCSue?=kcZcjc:EvxAt_BJrtIQqaFTnfT?jbW`og`YdZOE_D?TZTEtDEDutDKxoJRpwGOweNVeWY>t<:Yg_Yn_VOV@sdEWdZ:ng;Frv@f^EMtXRDunIQXa<`wsPXah;ESEDEqi`gng?@tfFTfTET_fTZkcKfofZTwtCKc[Tetde[jbIQg]?:qaJZrs[jdDZ\]L:baYbfsKfVD<@ILV\p`I@GVjdxod^of^XKC>:CF:?VP?=P_=:_N:bf_bg_VXNFN@GNMgfVWfgWVgfVW|38th Olympiad|Bu, Xiangzhi|2008.11.20|D38f|1/2-1/2|W -EUm]DTld;LxgFNnf@Osm?M]TMTk[TMwe>@vxLVgVMVtkCKjbWX>?vsCLsK:NF?FogAYvmFTweEVyvVemeYVfmCUjZBJmfHXfoUGvf:ha:jmvS[aX[d|Human vs Computer|FRITZ|2004.10.06|C45|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLmeIQtkEUwvO`vw`Owv;EnwBRqiKD^ULUdSD;l\U]gm:J\TR[b[OUrJCJSM;MTMU[uZ[UZLU_m\GOk]V]v>=>\K>vL<@IKE_nxqvwE?IA?PAIP?IA|2nd Grand Slam Masters|Shirov, Alexei|2009.09.10|C92u|1/2-1/2|B -FVl\@OphEUwpU]me?Fxg;Lvx>@sb^M=Ml[L=SUMFo_GO_VOV\TDLUM=G[UFXkKBbKD>?UF@AF@\UOUf^U_]U_nunCStf;EwtDMsdS[dZ@wp=a_WDT[TMTvx:@gVEUVe[dmdU^e_=uvu;LuvIQqa<`tf?=wnCKaY=MruMunu:=un`WyxO`ftLVxyDTkc`Oya@?nuO`un`OnuO`un=Md\`OtkVLkOMO_UOMUfWIjbGWld?GfUGNaiLFihFU\UNOd\HXYPIPo_^ghgKSgiOXifXOphPGvmMJ\SJMngGUfeONgUMUeUNUmeUMbZBJSJMLe\QYJBLC\TW_h_Ya_WaiWOiqOGqy2B:2|74th Tata Steel GMA|Navara,D|2012.01.17|C67|0-1|B -FVn^@Osd?[jb[Rxg>@wnEMk[RKmeBJtfKfof;EvxDLum?>duMUuoU^e^=Fl\LTwuCKmMFne:xn>MutT[b[EOnhHP\TKT[TMShnOEeSJSsSCJSRNLwvIYvmGOqa?GtrJ\rZETRBGNZ\TcmdL\dc\lBJNGJBGNBJNFJBF=BGlnGO=FOg@um?;duJRbkRZ\SLScZ:ZndZ:pwS[dSMUjb:RSDH?b[RZudF[dZ[ZDJ;:JTZLwnEKvwO>wp>MtrK\ml:;ysGWkt;slsLsj>LtbLSJB\Kb[S\jlMSBr?Mlu@Gn\K\TJM[J[SdrBGP[UdUunUdBD@SLCLp`WPqaIYyxT\e\F[\TKDunPlvwU]f][mnmDVmlVq`YOYl^=Urvqixpicktc\wx\]tX]^v^?;Xf;sxqUupXYO^]OU]usuX`GW`\NVfX@G\lusqps[ZRBJogW_poGNX=Uflm[kmkfuonukaYk\no\f=XNWXFfUF?WOopUfpif\i`\R?MRC|World Rapid Final|Mamedyarov, Shakhriyar|2012.07.07|E12|1-0|B -FVl\@OmeEU\UOUxg;LjbBRsd?Fn^UKwn<`vx>@tf`gngL]rtDLg`RZds:RsmRStsFTk[Zcmc]cscTfofKZcSZdurdSbZSBrV=eVTB<^VCKTLefxyfewuePL\@wn?>V\DLUL;LvxL]\fCKog[Td^O^g^>^ld]nunTfmfFwvA=_XCSZlIQXOHOV`@ruLRcZ^mgmR\m\U\u=?=ZBPlBC=uvnD=C:umnvmuvnumnvmuvn|2nd Sanjin Hotel Cup|Zhang, Zhong|2005.07.18|D43n|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;EnwBRqiKD^ULUdSD;l\U]gm:J\TR[b[OUrJCJSM;MTMFJrFDruOWn^gX^nXiuwiXo_V_w_W_n>@Ih_XNp^HP_WPW^WIHWNGN>NKUNMU[M][e]eHPkdPWypD\dvW^ei\Lia^evhLNh_e^_t^UpgQYt_NK_fKSaYULYALUA=UVf]VW=?WNg^NF?AFE]VS[^W[KAIELIyLTytTUtuULVMKSWNSCutLKNUKStdSKdu`QO^pIY`nX`xwOPw?>?f^apypYa^VMF]Uaipx`hUMDMn\BJtfMV\D;:D<|Tal Memorial Blitz|Ivanchuk, Vassily|2008.08.29|B66|0-1|W -@Ol\DTsd;Ln^HPph?Hwp>@meBJxn:;jZO>tfL]rsEMvx<`og`Ek[]ndnT[s[CS\SJSZS;S[SESuc=En]SZcj>DwtDJpiJ[iE[jtDZEDEj[]nHOe]?XmFNofNU^U=CfeCTe\>EmfTZ\cZTfTMTc\EMh`HVg_Vknhkth^MF_WPW`WtfUMFE\UT\^OE=U\f_\U_qOIq_IO_XO`X_`VGOVe|SportAccord Basque Men 2013|Leko, Peter|2013.12.17|A37u|0-1|B -FVn^@Osd?Tw\DLxgEU^U>@UMCS\nS[dZTMme;EvxEKld[dZdIQd^MDulwvU_nwE`gm>Nph_ixpNPog`WpyKUm\=FkbFalpa=pmU_bk=Uru:>mfU=e]_UfmV]k]PN]BiX^XQXvN>NBo=FuvX`vNFNg`W^wp^pypN`\f`^px^smusjfULUuUjrxprkU:@I:^HP^fDVfeIHe\Vdpgkmgpmk\UdOh`H@U\Odpgkmohmugpumhomkpgkmqimugpum\TmkT<@H<\H@phkmiadVhgVdgpmkaY@HpgkmYQH@gpdOc[mQ[SOVSKQqpwqywnyCofCpfoVh\ThoTop`ne`[o][cem@I]TcgTDgomdovd\vN\SNUDTUETLEeSTedTMdhMEhiEFifFGf_GF_fF=fX=]Z>?Z_?@QYF=_\@H\dHIdl=;PXIAldA@d\@?\w?Hwr|FIDE GP|Smirin, Ilia|2002.06.01|C54j|0-1|W -FVnfEUm];LxgV^gmGWl\@Osd@vx=G\ULUdZEMo_HXZdGAdnAPph@AtTX_f_?@m\M=\f@HxyFMwtPF[SJRbZIYtw=@TlYakb:=bM=McdahnhCKhYHPdDNElp@=mg=Diy?=wuHPgaPYaWFW`WU^yY^eueMele=AcGK]kcDMYyMFGP]kyskbsyBRngb[gnCSPY[TYPT]PYFM|UKR Ch U20|Zubov, Oleksander|2002.03|C57d|1-0|W -FVnfEUm];Ewn@OxgV^gm?Ml\DLsd>@p`U\m\M[\m?>ulEKqi=Fjb[dkdLTbZT]d]BRtbF=bTIQrsKUm\>N\VCKTb@rsBRwv=O^VOPxyPep^e\st\Nm_:=vfHPfeLT^C=ECpGOVONO_hOWd^EFef?>^MFfof|73rd ch-UKR|Kuzubov, Yuriy|2004.08.25|B33x|0-1|W -FVn^@Osd?[o_;L_VLVm]O^]V^du`=FxgGW`WEUWed^ld[TtfDLwn<`vx>@rv:>fTFTe]?_]T^Tg]_wnwHPd\TN\UN]v^]gpg`g^[gU[CUjCBjUwp>VpUVUk[U]|8th World Teams|Radjabov, Teimour|2011.07.20|C63u|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@k[RKwn?>meDLvxIQqiEUwv;EnwE?tk?PdZKDZTCKTc?kb[brbGW^W?WYnNPm^@wnCKl\_VIQqaQYtLH@LD>FDF=F]UOEVDNUgUFvxqEVqhvnUgVgpgnkDBkVhpVOB:@I:^OMbZMT^_IH_^HO^_ON_^NE^CTDCUEFU^F?^UDBU=?H=]HI]OBDg_DEogEmpimEihENONGNhoIHofH?f]?>]\>E\SEDS\DL\]LM]^MT^VT[VN[ZNOKSOPS[_W[cWOckOGks2PHskH@kp@IpgIHg`HI`^IH^VH@VN@ANOA@OP@APOA@OaG?2a`@I`^IQYaQXai?A^pX_po_`iqA:Zc`iox:;c\;qxqiq|SportAccord Blitz Men 2013|Le, Quang Liem|2013.12.16|A07|1/2-1/2|B -@Om]HPld?Hxg>@tXEMsm;En^IQXa=>weFVvxOYwvBRjZY_eS@I]VMVm\>NSE@wuHOng@wpUKxnDTsd;LvxMFul@wv=O^VOPxyPep^eim_]W_m:=rt=]ulHPvx?=mX[FX_]\ogF[lcCSVNGN_VW]cs]g^PgVPWV`W`if`N@AN\[dxhfotdS\dgo]sl|It|McShane, Luke J.|2003.12.22|B33x|0-1|W -@OxgDTphCSwp@m^O^X^;Ltf=KldGW^TFTe]L]pCKCf]:=unT]nNCGNG@Gd]=]wu?=u]=]rt]mtDGODB|ECC|Novkovic, Milan|2002.09.25|A15|1/2-1/2|B -@OxgDTkcHPl\?Htk>@nfCKwn@vxCKl\V\OUrt>NM=:=\KBKd\NM\UMUxwHOwvOVn\Uutu=uvuGOulCLldVMc[KS\@IQ@GPXGPMUjbUMPGLEGPELPGLEGPEL|Vugar Gashimov Mem 2014|Carlsen, Magnus|2014.04.28|E15f|1/2-1/2|B -FVn^@Osd?Tw\EMxgBRjbDLvxCS\j<`qi`Yme;Eun>@tf?>fTETnfS[dn=KnhYPgaMU^ULUwvU]fm[cjcTclcKcaPIPrtRZtTOUh^U_vu:;ph_UTlUO^OHOut@Hia>FmuFCaYcUYP;AogHPunCclTUNh`PHtlAQn^c;TLNj^n;Anpjc`XQypyAyxyOXlmcULlUgyxX`mnGOlmHPnoghxw|Eurasian Blitz Chess Cup|Ponomariov,R|2016.06.18|C50|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQdZKDl\EUulU]tm;E\TE?ZkOIbZGWk\HX^W;s;:;RJ;:lZPFg^N@wn?>k[RKvxIQtkEMmeBJdZKBl\;EZdE?ktDLtfBfofCSe]?P]VPVgV>Vu]=FruO>]KFBKB:Bu]@?ds?Fsm>OwuaXQXetc[tnJRn]>EmqRZqIF=IA=DA:DC:R[k]WkK|5th FIDE GP|Bacrot,E|2009.08.13|C88|1-0|W -EUxgDTnf;LwS=DvxFVm]V^gV?Ml\@O\UOUsm@\MDMkcT]u]?=V\MP]VU[tb[eVhPNbM=Eru:=MD=@tl?>leYqnd>=ef=>fe>=ef=>|KM FIDE GP 2015|Jobava, Baadur|2015.05.21|C10c|1/2-1/2|W -FVl\@OmeEU\UOUxg;LnfS[>F[ZFECSEBZ[BFlTFvTdvF[\FG\eGPemYQckQIdtxpks2PstsIA2s^px^]AQmlQIlkIakdaQdkQa]dxpS[a^[ch`kt^_tu_ZdeZrulrOckOLlmLQmuQyul|Corus A|Movsesian,S|2009.01.27|B80|1-0|W -FVl\DLxgV^g]@OmeEU\U?T]cTKsd^eue>@tf;JUL=FfKJ[esBKn^[UogCLvoUdkdFVseEogIYxpomELpoLSvx>F`XPWiaOXxXHPXxS\_;FGof\cxtKL;VJRtxRZxtCStxL\|Tal Memorial Blitz|Movsesian, Sergei|2008.08.29|D38|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQwvEUtkO`vw`Owv;EnwU]dsE?smOIm\KDldCS\m]dkd<`ul`gmgIXgXQXwn=On`DK|25. ECC|Fedorchuk, Sergey A|2009.10.10|C92|1/2-1/2|B -EUxgDTph;Lm]T]g]FV]LCLwp@Ol\:;vx?F\ULUuZ@tXENsdU]d^;kjZknZR?>RJO^XF>FBF=FJBNUB:2U:r:F?:?@?pg^dgndnxpndwtHXqiIYpwYahaXatr?Hr:GO:=d^o_^T=MT^M=^hwohY_VOV=>HO>AOXA@XW@AY_AaV^aA^fogfnA?WPgoPX?_X_on_hnehie]|Vugar Gashimov Mem 2014|Caruana, Fabiano|2014.04.27|D85s|1/2-1/2|W -FVn^@OxgO^me^OgVEUe]?Msd>@wn;Lt_?>VLCL_M=Mvx>FjbrvLT]TMTneFvwv>vmvWeleU]dnTln]lk]LkbvsHPqiBRs;@H;DbtxqRZDCtde]dcCBZbLVbjp`O^qp^M]UcUVgM\|CHN-RUS Super Go 2015|Ni, Hua|2015.07.31|C42s|1-0|W -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LnfFVwSGNFGFTKFGKBtfldrwGNwsdbs;NE;CELC;LE;CELC;LE|Renova FIDE GP Zug|Kasimdzhanov, Rustam|2013.04.25|C45k|1/2-1/2|W -FVl\@OsdEU\UOUxg;Ln^U[me<`jb[Jk[L]wn`gngDLg`JDrsBR[RDSdS]Stm?buZ=esceM`nS]cC>@Z\:=RJLTmXb[C[T[X=?=vx[cneIYqi]gpgMe\e=eJBe=ws=:sc:BcSGOST@GxpGPTSBbSCbdCBdeBCedCBdeBC|FIDE GP|Radjabov, Teimour|2008.05.03|B33p|1/2-1/2|W -@OphEUo_DTxg;LwpHPvx?Hme>@ldCKjZ]N=Mp^MNWNU^eE>NrutfUf\fOkrsk]l\]KRZE]vtGWZl]TbZHXlkBRtuW_e]=]u]T]k]K]gL_fL>foxyNW|ch-FRA Top 16 GpA|Milliet,S|2005.02.05|C42|1-0|W -@OxgHPl\?Hsd>@n^FVwn;LmeEMvxIQtmOEdUBRUdETdSGW^WruLTkcHdedCKjbGPv>?>uv>vdv@Gc[R[b[PO[TKTv^OP^sWFs;POxqQYiaXa;DG>D;>G;CGPqiOWiqWOqi|4th Zurich CC Classical|Kramnik, Vladimir|2015.02.17|A05|1/2-1/2|B -EUxgDTnfHPm]?Hwn@Ovx>@]T=DjbBRtmDTmd<\TMPuZFVk[<;]V`gpgLVtkV\m\U\rt?FZlPQwpFOkO@OnfA>vx=Ul\UXwuQi\wigxygWu]O`]_WNtuXYyxYXqaXVwSDLpLNLSLCL_`HPxp;DuMGW`]>FpgBRjbFGg_V^]^W^_hRZM]GFh_FG_hGF]MFVMOVUOGD;GIUeIHebHP;C[SLSPKCBKSBJS[JR[\bcTLc;LD;tl;CphIY\wYam\ahohHPiaGNlq>A\VEHw\A>\UNUvtOV]VUcqkcZksHEtLEesr>@bMDMrZMVZ\@HLNeU\LUSNPHPLPRZxpCJP@JR|It|Nakamura, Hikaru|2003.12.23|B97i|1-0|B -EUxgDTl\U]nf;Lf]T]weFVvxGWgVLVwv=FewHXme@QtXFXvV?FsmQGmgXOVn>@g]]gOKclELrvFOn>?>v>L>e]O]g]K]lW>EWe]eweGVe^EL^W@HkcIYogHOWlYaxoaipiVglugXu`X^ofOVia^O`gLgfgCKqiBRgfOYfeY_ed_iaYiXYQVMd]XIjbIOc[R[b[OI]^MN^_NO_^ON^_|Sportaccord WMG Rapid|Nielsen, Peter Heine|2011.12.11|A60|1/2-1/2|B -FVn^EU^U@OsdOUxgUdkdV^un=Fg]DT]c;LnfFVtbCKwS=tbTXb?A?g_XUvtSEyv?>tk=Dd\UTkcTYqiYTvf>F]nENu]GWjZFEfdTRc[HP]ENEdbRTn]DM]SESZSTDbrIQiaMN[dNOphPXaXQXryOPd]DF]fFDf]X_h_DIyrPO\TIE]\KT\T^frvEFT]F^]e^_vf_[l\[ce]cf]fOV\TVUSKBKTKW_f_UL|6. World Blitz|Carlsen, Magnus|2010.11.17|C45|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeBRtkEU\c<`qi`gugU]dZKBgW;Eo_HPWXCSZTET[TOEX=:=_VEVbZBTktT[vn@Ht_=>p`GW`WPW_V>VyxHQxw?>w_W^_aQXa`XOrwVWe^Wwnw>VwnVT`hOVh`Td`a]enuemZSLSaYV^YIdhld^fulRZ|3rd UKR Games Men|Fedorchuk,S|2007.05.25|C78|1-0|W -EUxgDTnf@Om];LldFNsmCKwe@t_=FwvL[^CFC_MOFMFCFjb[Urt:W_fFG?FN]r|4. ACP World Rapid Cup|Drozdovskij, Yuri|2010.05.27|D45|1-0|B -FVnfEUm];El\V]u]@O\U?T]e>@xgEKsdKUdUOUjb?>el=Fw\DLk[TKvx<`tk`gpgFa\ULUlW>NkVHPW_a_V_PX_hGWg_X`xp:=qi`ipi@GipU]f]=]rvNvwvKDvyGPyv]EvNPGNQGHQNHGNQG>haD_QN>?[S_MNO?HOWMbo_EGWXH?XYbFaoFM_WBRSJCJYQGEov?>pg>=g^EF^UM_vR=E|Vugar Gashimov Mem 2014|Radjabov, Teimour|2014.04.20|C07t|1/2-1/2|W -DTn^;LsdHPph?HwpFNme@Fo_>@xgEMvx:;jZBJqiCSZSJSh`GWwvS[dnNV^WPW`W@vx=RSEOEtmGOjb[dmdRDV`EK`fgh<\_YWPY_PW_YWPY_|World Blitz|Tkachiev, Vladislav|2009.11.16|C64|1/2-1/2|W -FVn^@Osd;LxgBJm]V]g]?[]LCLweEU^U=FunFnvnLUjb[dkdDTyvEtfELogA;vs;srsOEf_EKp`IYqiY`g`KZ_mGW`XT\en:AwpW_syNWiaWlaYU]ngLTd]T]m_\dyvZT_V]\VHA@YQlIgYTeYG\SvsSLG@dlsrI@XPe_po_Prt@cQI|Moscow Blitz Final 2014|Motylev, Alexander|2014.09.06|C47|0-1|B -FVl\@OmeEU\UOUxg;Ljb@smN`qi`Yp`YPm\OEtf?>rtFTlc=O\mOMcSTfofEKm\K\t\:J\lGOSUPGUMDMe]J:]ULFlD@?gmCKwt>D<:EMCRZUMEJ;>=MES[b[BSonSMne=D[SMC;JDEe\CM\[HXJTED[R|TCh-FRA Top 16 Gp A|Guidarelli,L|2006.04.02|B90|0-1|B -FVl\@OnfEU\UOUsd;Lulrs>PgaPGSLN\m]CLtkGYaWYPWhOW^m\SlWPWhWSeWhesmsKZkrV]r]LT[TZTvnTN]d=Uh^?FsmA=m\HPytNT^TFTbZ=>og>Nf^TFdvUYqiNJtrYSneFOrjSsvm@m]^ene<`umVYe]TKsd;EmXIQXY`YtfO`f_HX_M?>qi`O]ULUl[>Nh`NM`YU]dSMNruOYS]K]u]EV[U:cTMLTNLKNH>GHWG\WfKJ[T|ClubCh-EST|Danilov, Nikolai|2002.03.09|B19|1/2-1/2|W -@Ol\FVme?[tm[mum>@xg=Fsd?=rtDLnfEU\UOUwnUOmlLTjbCKgVFVng;LgL:;Lg@H>VH@fdu=o_KS_WS[dDPKDF@?FBGOVh=MhMKMBCM]CI]^IC?>CK>Fp`FEKOEDOGDLG?LD?GDLG?LD?:[c:rckrs^[qhDMhgMVgf[cfmV_WOciOGiAskA?me_`ko`Xe^XP^V?GoGPG|76th Tata Steel Masters|Dominguez Perez, Leinier|2014.01.26|B52n|1/2-1/2|W -FVm]V]xgEUtXGOX_?[smDTnf]f_fU]f_@_M:>JS@AldBJSJ>:J\?>d]T]tsEWogFP\S>NWHPWl>FvxGOSebdrtd]g]:foBJXY>Fh`FGYaGHof|UKR Ch|Troshchenko, Vladimir|2000|B22k|0-1|B -@Om]EUxgDT]TFNnf?Tjb>@l\TKk[BR[S;EtkNVwnV^gm?>vxEV\UKDsd=MphM>e^|Superstars Hotel Bali|Vera,R|2002.11.30|D27|0-1|B -EUm]DT]TFVxgV^g]?T]cTMsd@FtXGOXf;LfTMTcT=KTc@um?=dSFWld:VhaWh_BJc]W]S]PYrb>?_WYabcGPWNPGNV<>Vhahoh>Fxw?ypEGZR>LrwGwpwIYwn\T]LTLKLCLd\|TCh-RUS|Onischuk,Al|2007.05.07|D20|0-1|B -EUm]DTld;Lxg@OnfFNsm?M]TMTk[TMtk>@jbNVd\U]ul]fofMD\T=FweOUm\GWf^U[b[L[lc[eceW^e^?_^nFT\mytELfo`ZV_IQqaLSgVHXaXQXtTX_TSZjVg_hoh>Fm\FHh_jZgVHD_WZ\|Aerosvit|Onischuk, Alexander|2008.06.10|D48g|1/2-1/2|B -FVn^@Osd?[xg>@gV?>VeO^wn[?d^>^vx;LevL]ne^>ld]NenDTvlEUmeHPng?Hph=Me]T]d]CKtf?dnCJpi=MwvJnmnN_f_G_nFMOFOHOvn@HiNO]tl?=l<=@l\^e\ULVnfBR[S=>rsV`kO?Om\W_ue_fof:>vmdsysOQi_Qqmeqjsc>@[S?>_VEV]VOEe]D;SLCLrs;[;E;Zk@?yx?FxwGOkeOVgVDVeVFOo_OWwnW^Vg^Wp`WOgVHPiaOH`XQYneHIe]IHjbHIVe;Ee[E;]VBR[eIHVN;JNMJ;MD|Ch Ukraine (juniors) (under 12)|Tishin, Dmitry|2000|D02o|0-1|B -EUm]DT]TFVxgV^g]?T]cTMsd@vt?>weBRldRZ]LCLcTZbkcE`uvQWqiWfi`f`eI@?v>=>IW`QTE?@EOHOyQU]mo||Dreev, Aleksey|2004.05.09|D20|0-1|B -FVl\;Lme@FxgEMsdHPph?Hwp>@rsBJvxe]V]^VOHiw]eVNEC[b>DJMDSMECENEFLbFS]xp]gpgLVgpVEwe@GFbEVenHObkVLngL[ktO]tm[egneTh`GO`WPWmRTNn\OV\NVNpgNV|Rapid Match|Short, Nigel D|2008.05.05|B23|1/2-1/2|B -FVl\@OmeEU\UOUxg;LjbngX`g`cUmR>@`gUgpgGEwsELs[=EWOIY[ZLJRJCJxwEUZJUTJN@?hV;IYiy^_yx_g>GYXxvg_vwogwyX`yi`HG>HE>E_XiyXPyxPGxyaYyYGP|36th Olympiad|Quezada,Y|2004.10.26|B90|0-1|B -FVn^@OsdEU^UOUxgUdkdV^un=Fg]DT]c;LtbCKvtHPog^fnfFfmf?QwSjZPWcm\memHdmMLCMECLEMLCME|ch-RSCU Rapid|Nepomniachtchi, Ian|2011.01.09|C45|1/2-1/2|B -FVn^@Osd?[xg>@gV?>VeO^wn[?e_^OvxEUm]DLne?Mwv>vuv;EtmE?kc=Dph<`vw`grvIQeW?I_eIXeVgYqaXgVgYgweg`xp`WeWM[ds[m|FIDE World Cup 2015|Andreikin, Dmitry|2015.09.21|C67d|1/2-1/2|W -@Ol\DTsdFNxg;Ln^EU^VO`\UNUwSU]SLCLdZ?Fvx>@qi`QmeQWkcbTFTZTGOVO=OT^OPumIQm_>?_`PGgVGDVP?GP_:?_ULU^mDRmgGOvnRKrvOP`YKJn>PO>?O?g]Je]N?ON_edY>@I_UdLUOLO>^QYp`|Eurasian Blitz Chess Cup|Arutinian,D|2016.06.18|A04|0-1|B -FVn^@Osd?[jb[Rxg>@k[RKw\DLmeBRrsEU\c;JvxR[b[J[tXKD^U[UdULUXOHOga:RugV^e^U^g^OW^\CS\dS[dLDqxq=aqxRJLDJQDhahohQPxq?=w_@gV?>VeO^wn[?d^>^vx;LevL]ne^>ld]NenDTvlEUmeHPng?Hph=Me]T]d]CKtfBRgn@^VO`SLCLwvGOVNEMm]=RqiT]g]`Vo_V\_W@wpEU\U=UmeCKsm@vx?>bkFVgVEV]V>Vd\VFngFEut=D\ULUwu:=tlUgmgO^kHEuru=ulu@HxwDMuM^MgmGWjZHOwnONneBJm\KSZSJS\MNMqiMUogIYiaUVedVOdeONedNMdeMVedVNdeNVedVUdeT\c\S\edUTf^W^g^TS^VSTVNTMd\MN\]NW]UW`UV`aV_PX_gX`g_`h_W|31st ECC Open 2015|Brunello, Sabino|2015.10.20|E15r|1/2-1/2|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeDLvxIQtkEUwv;E^ULUgmE?dZKDng:;l\U]ZTCKT^OI^h?PktIXgL>?mgPFtXQXgXGOuYOXL^?_YX=?rj@phDLjb[RwpEU^ULUk[RKvx;LdZKDmeIQl\U\e\=uwuSM>vuvCKMC@HC=:=kZ=M[S`NdVMmZKmlKUNU\UlnVOHOvsn>SK>;xwOVsSV]wv]\Ss\UvmULmf;KsKLKfgGWh`W_g^KT^WT]WP_gPQ]eQXenqanoaYohYQgoQIow2IA2w_|19. Amber Blindfold|Smeets, Jan|2010.03.14|C60|1/2-1/2|B -DTl\@OsdEU\UOUxg;LnfBJwnHPm]?HvxT]f]>@wvIQdZCKtf@wn?>k[RKvxDLm]V]g]O^d^>^ldEMne^>t_=OuYHPYQK]d]O]ru]HQH@H_MvsvEKMT:=ewcNxoKZTfBJvtGOtl=ultZktlkeweueftHGonecnmPXldcsphsrmfNUqaIYfnrjtmGPdfPWnvXahaW_fe_hmdOWdVhae]ai]_UNVOihOVhp_apgVMjrvmrjmdjbd]braYru]Vg`YIN\IH`gMTuUVOJRHCRZCB\SBFW_FvUT[TgpvV_gVXpw|World Cup|Shirov, Alexei|2007.12.11|C89i|1-0|B -FVn^?TxgEMld@Om]TKwS@og^Txy;L]LELg_T^tfLQyxHX_XQXfKBKsb:>bl>VlvXmnm^mwom^onV>ve^MnoDLrw>fe[?>ph@H[lfnl]nowo>vxpHP]gvsgVPHpiKSiasvVevNe_N^jbIQqiMGh`W`_YH?i`^vYhvNhW?@W]Nv]W@Iahv^oqIPWaPXagXOg]^fh_fe]WGVWfefqQOHQNf^_WV\|40th Olympiad Open|Fridman,D|2012.09.09|C24|1-0|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxIQtkEMm]V]g];EogBJxyKB]WEVWhfeW=FkOF^WY^PYAP@Aa|World Blitz Final|Topalov,V|2012.07.09|C88|0-1|B -EUxgDTph;LwpFVme@OvxIQn^U]jZ<`sbOEuv?FgmBJog`YmcCKpiGOiNYGNG>Gg_:;vuQYcmYamgahqhFMld=>d]L]g]T]b\MDu`G@xpET_VDVrb>N`NTNk[VDbj@G[S;:wWJSWS:JtmA:ZRKRmRGPjbDRSRJRbR|Vugar Gashimov Mem 2014|Nakamura, Hikaru|2014.04.29|E90q|1/2-1/2|W -FVn^@Osd?[xg>@w\DLvxEU\c<`qi`Yme=Mun;Eds[RsmRDwvETldTcjcBRmwOEwhYPtfGW^WPWc[WP[R:RrRDRvrR=rBM;BZ;Mga=aZaEOaZIQnm?>xyMEZaEFmuLTe]V]d]T\a_CShWFNugPW_WN^WOHOgO^NO_S[_D[cyq>FD;F>;D>?fm?GD;G?;D?GD;G?;D|Amber Blindfold|Aronian, Levon|2008.03.16|C65|1/2-1/2|W -FVl\@OmeEU\UOUxg;Ljb@dZK=kcV^tb?>rt>NwvIYvnYanlpwJwxw=OuYW_h_X_wn>@vx=FogHPYQEN\n^gngN\wv\egL:;Lg?>jZMTZRFMrZGWZa>FaZ;sZje\jl\cd\clgUFNQaDLUNMNa=@H=DHQm]stD_PX|UKR Team Ch|Kulikovsky, A|2000|B45|1-0|W -FVl\@OnfEU\UOUsd;LjbUdkd?Mm]>@xg=FwnCKvx=>?>WNHd_WdmWOm[OG>=NO|37th Olympiad|Filippov,An UZB|2006.05.24|B46|0-1|B -FVl\DTsd;LphHPwp@Fnf?Hxn>@vxEMkc:;tkBJdUFU\ULFo_GWmeCKumxy@AnxF@xgEDjbC<^W?V\M=kHAHe]KS\fT]m]=OfWPW]m?=m[OM[]MO]_=Eqi@FvNOG_VH@UM|UKR Ch U14|Savchenko, Yuri|2001|A36|0-1|B -FVl\@OsdEU\UOUn^U[me;Ljb[Jk[L]dnDTn]V][TJTwn@]cEN\lNcscRZcsZblj?=ph=]scGW^W:?gp?Wo_WGngGBpi@?i`BRgL?FL^IQqaFM^PKS`YS[PGMFG\FOcsTMY`HXaXQX`gX_h`RVjqVfgoMT`XOXsy]\qYXOe\fVogVY|4th YM|Kosteniuk,A|2003.09.21|B32|1-0|W -EUxgDTph;Lm]@OwpIYld<`gVFNV`Y`nfNV]VLVuZ=EZE>EsmT\qaCSvx?TwuENf^Ve^UNWmwToxq:>jZOIZSHXue\erZ>nUMXahaIOtXOYZ`GOpgOX`XW_XY_g|SportAccord Rapid Men 2013|Mamedyarov, Shakhriyar|2013.12.13|D90|1-0|B -FVldEUm]V^t_@Onf?Fd\@cCL[\T[lvmlr_D=>wSNExnESdSO`yr`ondoeDhBJdUFTSd:BCcTFjb>Lrs?=cKLKUKGWk[FXmnIYqaXQKZBGZTGOT^W^d^OPne=>hVPpbZpj^djb[SJSZSQfSK><]UfKsK@jb[dmdV^gV?>V\OUwn;L\fU_u=>=nw@vxwhM?gXU[kdJRd]CU]TEusHPh^?HqiGW^m[jnJjdswIQm\@I\RUuphEUxpT\wuduR\UeJMufofenpxngZRNVMmghmphvpwvdwuW_RJ_fxpfnundc\McZn\ZbM^bfiaQYJB|WCh 2016|Carlsen,M|2016.11.21|D05|0-1|B -FVl\@OnfEU\UOUsd;Lul@wnGWmeBRvx@AdU=UtmV^gvFOmdUcdO?OrtRZldLRog^evecdtdN\wv:=eV\nvnDLf^A@^WOWphWOg_OMV\R\d\M]\]=]xo]eop@GpiGOiaeca`HPnlIQlmLTmMOGMmGNmnNOnlCK`aOWloWOh`KS`XQX_XOVa`S[b[T[qaZbonVMnmMTmlcdkd[cltcktsT\aYbjskjr2kqrx`iPYqpxyihYahoaip`\eXPyqogqng_n`_`iq|FIDE GP Tashkent|Morozevich, Alexander|2012.11.29|B85|1-0|W -FVnfEUm];LsdV^og?[tm@Oun>@no?>vtBRxnCSdS:;ndLFohFyvf\e\FvmvU\DSRZjb@?vm=USdU]mf]aqi?FdZFMkc\clcaQZkQPk\MTfgT]bZPOg`]d\VdcZRc[VEOP`g[Rp`RS|64th ch-RUS|Timofeev,Arty|2011.08.14|C10|1-0|W -EUxgDTnf@OkcHPtb=Dbk?Hl\U]f]T]g]>@wn?=sdBJ]llcMT]TW`umU_\NGNcN_NkO=mtm>?OaPXahIYmn?Wqi`iyiX`iyWUTLCLyt;Ct\NXh_Xg|3rd ACP Blitz Prelim3|Kiriakov,P|2004.06.02|C11|1-0|W -FVn^@Osd?[phDLjb[RmeEUtm>@wp?>xn^fK@IusHXqpIPscWapq^nKTnlcKGOKSldSRQYTMagqpgvpwvgRJgmwpm^MVdlV]X`i`Y`JR`h]fhoRrlnpgnv|World Blitz Final|Andreikin,D|2012.07.10|C76|1-0|W -FVl\@OmeEU\UOUxg;LjbfUEWsuL]d]T]u]Wlohlkyukb]ebTecCKur<;U[T\[L;=BLF?[Kdvhivwgp=e|EST Ch sf|Saraikin, Sergei|1999.03.07|C11u|1-0|W -FVldEUm]V^t_@Onf?Fsm>@qi;ExnEK_qBRulRZjbu]>MtuELslGWogMGlmVF][K\m]CSg^W^q`GMn\M\wq@wn?>k[RKvxDLm]V]g]O^d^>^ldEUne^>uYHPYQ>Vp`=?Q?@?t_;EruV>uvEO`X@wnEMmeDLvx?>k[RDe];E]VMVtfIQn\BR\jE?qi?Nue=FjNNumN>fn>;mkLTd\SL[dL^k;D;n^O^dV;VgV^MVeM\eT|6th Tal Memorial|Aronian, Levon|2011.11.23|C84e|1/2-1/2|W -FVl\@Osd;LphEU\UOUwpvn<;rvIQXNGNh`KSZ^P^n^NVahUO^nO`pLCLjZSZn^`O^[;<[ZV^Z\^v^A;^`HXqaXa`a;kaQLThVkno_T\xwn^QiELwoLSiIDLIYS[YQLTQN\d_WdlVk^_ov[ckt_W|Qatar Masters Open 2015|Dubov, Daniil|2015.12.24|B35i|1-0|W -EUxgDTnf@Om]FNjbCKl\@vx;EsdO^tmEO]TKTulBRwu=Kd^O^md?=gmGWm^W^umMFluRZrtU]f]FX]UXmum=Umn:>tvUWn\CU\ZKLZLULpiWGk[Ggdmgb[T>:mf@Giwbrw\GFvr:rxprZ\cZbc@IQh`HX@IbrqiruphFOIWQYiaY`W@vxFNd\U\m\O^\K:;ulGWjb=FKZQYNL_gpgYaqiW_LNT]N^]f^ZfTZBHOBGOVGIV]Ia]faYfgYIghIG_gGWgoWGhij\ipGHpgHG|RUS-UKR Blitz g/3|Shipov,S|2003.12.14|E07|0-1|B -FVmeEUxg;Ln^U^e^=uvu?Tuv@Owe<`sm>tk<;rsIQphTKkrOEh`YPc[R[b[E?eSGOl\K]g]V]og?Nvo>FohP>iaQY`Y>Y\TY>g_]eaYN]r]L]S>F>_W]nhgn]g`CKyi]L`_LVYQHQiQ>?TKDKsuVL[SL]uy;DQI=EIEDEm\]S\KELKULT_femfmT]yaSMmnMW^W|2nd Sanjin Hotel Cup|McShane, Luke J.|2005.07.16|B07m|1/2-1/2|W -FVn^@OxgO^me^OgVEUe]?Msd>@wnDTdSMFvx;Lt_BJVLCLSd?>wvT]u]@vxDLld;Et_OY_f=DsmGWfX?>nfFVgVEV]VDVpgYOXOVOuZFTeIYqaXaZaOaha@IxpHOwyBRpwRZjbIQe_:=umCSwpLT_UFEyuOapwaXwvYaU_Emum=mvmX_f_aimvG\gyQY|Baku FIDE Grand Prix 2014|Dominguez Perez, Leinier|2014.10.04|D02u|1-0|W -EUm]DTld;LxgFNnf@Osm=DweHXeSEOG\dGFEF@HFMHhMEmcBRqadlctLdhoNVaYU]f]V]YQ]eoWELW^LD^_DL_gLDtedegelt2xotQe\DKjZQOohOV\_VHhgHrp`rwg^w\^W\GWXGHXYHA_QAQYQ|RUS-UKR Blitz g/3|Dobrov,V|2003.12.14|D45|0-1|B -EUph@Owp@g]WPk[T^d^P^p^O^ul^Ovu=WF>Fxp@rtFVd\V]f]U\]T\cmc?>TK=Kwv:=nwE?ul>vtv?NbkHklkK[vtLUtuUcu=N=jc=CkVCRV>@H>VH@V>@H>VH@|5. FIDE GP|Cheparinov, Ivan|2009.08.22|E15|1/2-1/2|B -FVl\@OmeEU\UOUxg;Lsd?TucUdkd>@ph=>gXLRcUTKtb>=U=?=wpndW_]U_fof=Gd^GV\dCU^MEM[MQMf^VgdgMLgdLdkdUjxX>^XHjNHI^\tk\LIaLKkt@tfRZsm=MqiOErt?@uc?=rt:VeDM]f>H\TKTeTHWfdW]d\M_xw_mp`muwpugpx]nxwn_wv_pvmgomdp_d[_i[SiXTEXNSJN?ET?NTEN?ETIY`YPYjZYa\`?PTE@H`[of[kHQEOQXOIXQIOQXOIX`kp`_ZRaipX_gXWgpIXiqWUphX^ha^mPVUpfeJBeEB:E<:B@vx<\UNUue<;sdHXeWAQruX`gn`iWi?MngLFutD;DWfDEgLCL>:Oo:BE=BJsmJLmcLdokf\ksyq=FdfFOfest\fcR]URCe]tvf\vr\mCTm^T^]^ru^auUaiURibOWqhW^brRXhiXRi`GOphRX`aXRrw^Vw_R:a`:@`g@;_^VWZR;:^Z:JZbWVh`VNg^NM^WMFWPF?br?FPHF>rv>EHG|Vladimir Petrov Mem 2015|Lysyj, Igor|2015.03.08|E12n|0-1|B -FVl\@OnfEU\UOUsd;Lul?Fjb>@xgmd>PnwUOgmPQm\@\e\O^tu?OSMDMog^dkdV^g_HXlo:@usX_f_L=sK=NKMN_o]_ixyioyxo`qiQ_i`_M`WM]d]OWv^Wg\Tgbw\@=]UbdTLCLULZbxq=<^`IY`a@ul?>wnMDkcEMtkBJjZJRqi;JvtJ[ls;mcVene^elmP^yqFVo_VFc]DKjrK]r][cmd;[trF>qk[ZrZ>Z]^Zr^eRZemZbdcbkmkrwk]wi_WQY`YiW]_WscZsK_]KJZ[JC[RCDRJ@I]_HPYPIP_]GWJSPX]KDES[X`\TMTKT`gUMgnTS|It|Varavin,V|2002.08.04|B50|0-1|B -FVl\@OmeEU\UOUxg;Ljb=ZRNDLC:RB>VC^CK^[KL[\LE\ZEF|Tal Memorial|Grischuk, Alexander|2010.11.11|B90i|1/2-1/2|W -@Ol\HPsd?Hph>@wpFVxg=Fm]EMvxV^gvIQvlDL]U;EULCLl]sSNESTDMTUMN^gELUTLgng>=jZH]TU=U\U|2. Norway Blitz 2014|Caruana, Fabiano|2014.06.02|A04|0-1|B -EUxgDTnf@Om]<`smFNqi`Ywn;El\?Fvx>@kcT]g]YPtkETmgU\n\OErtNV]nV^gVEVkVTe\e^en_=RV]emt\CS_PIP\lF[u`?>wu>Nia:>aYN^`gRJ]rJNYPNPjb^fofPluwlcb[cfgofoxo>^wu^[umBRrd[_of_Zm=|Vugar Gashimov Mem 2016|Eljanov, Pavel|2016.05.29|D30v|1/2-1/2|B -EUxgDTnf;LwSFNvx?Ml\@Om]>@]TMTsm=FkcU\SL\dLSdmum?=mlBJSn@meDTkc;LtkCKphulU[b[L[ls[ef^evsvKSrt;DvfDRkdRdfd==dR=eiweMRbF=tTDTbT=KTdMLdeKDefLdfnDMnvMTxq@?wp?FaYdlvnTdnuCLuvJRvuRZcZSZmsdkgmZbu`bj`HFMHOMDOGDKGIjr2IQk]QXlmsmrtmgtXgX]oYQoOQIOQqxL>pi>PiWP>xpKTXgTMh`QHphMF`X>Eh`HIgVEW^WIqVPFGP_qx`axya`yu`hGFWOFG_iGPh_ue_`eW`hPYhpYa|Superstars Hotel Bali|Paunovic,D|2002.11.30|B42|1-0|W -FVn^@OxgO^me^OgVEUe]?Msd>@wnDTdSMFvx;Lt_BJVLCLSd?>]TFTneO`um:BdZTMrvBFvF=FkcLTZd@p^EMZ[:aYNG^g?Axy|5th Kings Tournament|Nakamura, Hikaru|2011.06.13|B90i|1/2-1/2|W -DTxg;Ln^@OsdHPm]T]g]?H]c>@wnEMvxBJtf[J\dmn;BkdL]xL:rs\Zs;:L;=HO=MOFMuGWxTFG^WPWyxVEToGNqaW_utEVo]Z\tuVE]o\ZutEVo]V\tvNMvuLUuvMEvrZr]rENxqNWqi\fiqfwqxwhxoWNrdUCdmNVmdVUdmhYmRYHRDHND;ULoxNDxqDUqiC@wnEMl\;EsdFVvx?>k[V^gvEK[S@w\DLvxEU\jU^gV=]V\RDdn]=m]^eue=ele?=t_;JwuOU_DJD\fUFj\=Mnddf>;fcMNcfNMfcEDwn;=cdDCkc=EnfIYqiHXphOWfgM]\LX`gp]udtutLtEetsKSZSCKsvecvNKSNVSKVWRZWYZbYAKBAIcCIYCKYIBJIAJRA:KJ:>bj>vR[vr`ipi[di`dkrvjr2vrJr`WrRWORJOWkdh`d]`XJRWO]^XPRJOX^g|11th Karpov|Onischuk, Alexander|2010.06.11|C78d|1/2-1/2|W -FVn^@Osd?[jb[Rxg>@wn?>k[RKmeBR[SDLvxRZrsKTe]V]g]O^d^>^tkEUng^>l\T?\ULUwv>vuv;EgUETU\=XvdT^dg^M\e@wn?>k[RKmeDLvxIQtkEUwv;EnwU]dsE?smOIm\KDldCS\m]dkd<`ul`gmgIXgXQXwn?Nn`DKbZN]lkSZrZ=Ovw:=dm]NZbN_kl=Mph_NxpN]lt]SbcO=mXGOXfHPqa@HaYMece=efQH@YPe^`g^Pt\PG\`|4th ACP World Rapid Cup|Shirov,A|2010.05.28|C92|0-1|B -FVn^@Osd?[xgEMme>@wnDLjb[Rvx;EgmRDmcMU^UOUdULUo_DKxyV^_W^eue?>WOEOtX>NnY=MXONOwOHOrveWMFvnU]n^DVN\FD\e>FypFH^aVhaIHIWOA@eI@IOWIHqhDLpwLKk[KJWeJMegMDg`HI`^I@^`@I`^I@h`DhbZhb^U@?Ucbtwn?FcetrZRCKeIFMIB]enmelBKMVKfVOf_ON_\NVmlrZlkZE\TV_TW|19. Amber Blindfold|Carlsen, Magnus|2010.03.18|C65|0-1|W -FVn^@Osd;Lxg?FwSL]SZDLmeBRZcEMqi>@vxOEtfFOjb]clcETuldnLT[TMTgmc]f]T]o_=K_V>@tXDTnfEMsmT]f]=Dwn;LXOHO]ULVvxVgmgjm@IutHQfQIQia>;trQHrbCKRK;KngDTmeH?pwJR]LEWefFNLRO]fnWec[engnK[RcNVcT[swp]TbjGWnesvjkvren?Hk;V^;>HG>;rvnwvtwntr;CGOC;T];>OG>=rvnw]T=;PXaXYa;AahohvfpiT]AIGPIQPXQMW_MNfhiq]xqyXWNL_gUMWN\Txfyqf_LDhHqiHDMD_Di`NUwJUTJCT]`WgoCJ^fW`]d`gdmgpfn|75th Tata Steel GpA|Carlsen, Magnus|2013.01.20|A11|1-0|B -FVn^@Osd?[jb[Rxg>@wn?>k[RKvxDLm]V]g]O^d^>^ldEMne^>t_=Owv>vuv;Ev>E?_hKD[SLTSKD=]S^EL^\LS\S=KSc:>e\KRru>=cCRdha=;C;Oa\G@G;c?NcdN]deHPqiaFusGHxyIYeJHQJ<]W@o_NU^UL[ug[lrtlfwv=Ecm<=m^fUh`UfpiEU`XOF_WFMxyM;vn@AtxT\e\f\kc\Vgp]enmU]xu]f^o=]i`V`o`fXqiXW`o?=uxHPo`W^|ACP Blitz Prelim1|Dimitrijevic,A|2004.04.12|B04|1-0|W -FVn^@Osd?[jb[Rxg>@gVEUk[RKm]U^tf;EV\DLwnKD]UEKUMK\MD=uru\fofGmcEMcTGOtmL=TEONETNGm[MOTEONEVG@[F?F\UNOvmW_`XOMf_Aamf@In`:;rs;[ZE[cf^=CVLME`ECM^VFXE`XOVNI@NE@GEDMSDEPXyvaA`NGP_WPQNGS]v>cCEM]WMTA>G>CST\WM\eSUelM>L[URsv>MvNRTlcMSNJS]cjTS[e]gJZgVevVLveLVevQYvlVLkcSUlfUmjsmof`okstkpZ:L[tuO]:AYPA=pxun]O=;[U;SU_nmxhSKPWKCOdmld]c[W^CF^UFEU\ED\[DC[\|Europe Blitz Ch|Volkov, S.|2002.10.02|C12|0-1|W -EUxgDTnf@OkcHPtbCKwS@rtFVc[?>]VEV[T=FtsV\utKTng\Vgn:VvVkVqiIYBEVvpw@HEev^ef^_wnHQnwGWwnQHfc_acfHOfcaXxwXawpa]cbOXbJXQngQHJL]_LJ_XpqXaqpa]JLYaLNPXNfX`i`W`g`]`pqHOfi`_qp_^pq^VqpVUpqOXifX`fiUTqpTBifB:pq`_fi:BqpBCpqCLif_`fiLTqpTopo`i|Corus A|Radjabov, Teimour|2007.01.14|E15s|1/2-1/2|B -FVl\@OmeEU\UOUxg;Ljb?TnfTKk[<`wn=Ouc>@tm:>gVEV]VOEo_F=p`W^d^U^ruE;md=Dum>=m=?=|It|Alexikov, Alexander|2001.08.13|D02|1/2-1/2|B -FVn^?TxgEMsd;LdZ@Fld>@wnBRm]TBtfMUgVLV]VBfofU^u=?=ZTFPvoCKT^HP>MVeofeTM\TZfmX`\RZdR\aipi`i\VPYVgY`mf`h|CCM4 Ordix Open|Bologan,V|2004.08.07|C28|1-0|W -FVnfEUm];L]VLVsm@OxgVgmg@ruRKqaBRaYIQyaS[n`[clsE`a`\dkd<\f^RZse?<]nM>`_KT_WTbWGbMeM>MGBM^uE\DED@l\EMnfFVme;EwnDLsm=Ful?=vxMU\ULUrtO>jb>Mc[GObZBJlcFGtDM>DdE?wtMcTNuc>G[SJSZS?NTZNHkbHWbT@ZRLRgVU[rRKRpC:;CpGOuZRKVL[LZL=>L^>EdU;=U_NG^lEFn^FTlsDLk[TSsr=]me][tb[Zrt?=^VSVpLZRL^VDtDKDb[RjwtDK[THXTKBK_pOW^W=:pfjrtr:rxpKSe]S[flrZWEZB|ETCC|Jones,G|2007.11.06|B35|1-0|W -FVl\@OjbDLnfEUm]V]f]@t_M_n_N`og=Mum?>voLTsd;LdSM;yv`Ev>E>rvLRv>O>_U;=e^:;m_RL]TKTbZL]S]T]k[;<_W=aon<=UF@?FL]e^e>MWT=>nmaqmd>vZR?@RJM@vxV]SLCLg]=MulLT]WPN>?NP?>PN>?|Aerosvit GM|Mamedyarov, Shakriyar|2006.06.24|B90e|1/2-1/2|B -EUm]DTld;Lxg@Onf<`qi`Y]TFVp`YPk[?FtkIY`XO^ia>@sm=Dm^P^wp:=vxGOgq^pxpHPul@Io_OX_XCKw?F?TKBKjbV^d\U\qwLVl^V`k]?HrtH]f]=?px?w|KO|Zhao, Xue|2006.10.30|D43|1-0|B -EUm]DT]T@OxgFNnf?Tjb>@l\U\w\=uvuO^unTFsm^M\e;Em\ET\MTeMeVOV_V>Fk[GOngOVg^RJPQ[\HX\LQHaX|Open|Miniboeck,G|2003.08.19|D27|0-1|B -FVl\@OmeEU\UOUxg;Ljb@ulEGcTbTlT?:ws:jnwG?TtX`fT?GgmIYTfGFo_NGmcKE_VOVcmEKmcKZcTZTfTFOsCL]T]V]CDOoxyofDljltl@HphHOypfgpxgfloOVxpGPo?VN?_NFqi`ipifxiaPGaXxq_DF?XOqoD_oj_M?@wij:MF:jF=|2nd Sanjin Hotel Cup|Bu, Xiangzhi|2005.07.11|B90p|0-1|W -EUxgDTn^U^gX@Ow\FNsd?Fvx>@wv;LX^O^d^CKjZLV\w@vx@AsdGWo_=F_VLVn_Ya?Of^:=_UKUdUO?tXVPaY=<^WEWrv>EYuPVe]VL]TMTxyWNk[TMvNENU_Nj|Canarias en Red prel 3rd|Theoneandonly|2004.05.05|B42g|1-0|W -FVn^?TxgEMld@Om]TKjZ;LwSBJSLCLZRKBue>@vx<`smOYm\GW\VMVgV@Ae\LTogT]VL]eLBemBLmt2rt=Xg`XfxyYhqhfQyxQfxyfQ|20. Amber Rapid|Gashimov, Vugar|2011.03.19|C24|1/2-1/2|W -FVnfEUm];LwSV^l\BJSLCLul=Xog@O\TIYsdXPg^O^xg=vxGOf^l^t_:Bwo?FgmA>rvOWmgFOgVOV_VYaqi=ER[JR[kRZjbPXkjBCV_XPjnCcvt>;nJckJR;CokCkRDE>D<>G|76th Tata Steel Masters|Rapport, Richard|2014.01.15|C18d|1-0|W diff --git a/GenIconos/Formatos.tema b/GenIconos/Formatos.tema index af81b40..ce74fa1 100644 --- a/GenIconos/Formatos.tema +++ b/GenIconos/Formatos.tema @@ -558,3 +558,5 @@ Blancas8 windows8 Knight_32px_1.png Negras8 windows8 Knight_32px.png Book windows8 Book_32px.png + +Write windows8 Create_32px.png diff --git a/GenIconos/gnome/64px-Gnome-weather-clear.png b/GenIconos/gnome/64px-Gnome-weather-clear.png deleted file mode 100644 index 8a444ca..0000000 Binary files a/GenIconos/gnome/64px-Gnome-weather-clear.png and /dev/null differ diff --git a/GenIconos/gnome/64px-Gnome-weather-few-clouds.png b/GenIconos/gnome/64px-Gnome-weather-few-clouds.png deleted file mode 100644 index 25f996e..0000000 Binary files a/GenIconos/gnome/64px-Gnome-weather-few-clouds.png and /dev/null differ diff --git a/GenIconos/gnome/64px-Gnome-weather-overcast.png b/GenIconos/gnome/64px-Gnome-weather-overcast.png deleted file mode 100644 index 2f05ebb..0000000 Binary files a/GenIconos/gnome/64px-Gnome-weather-overcast.png and /dev/null differ diff --git a/GenIconos/gnome/64px-Gnome-weather-storm.png b/GenIconos/gnome/64px-Gnome-weather-storm.png deleted file mode 100644 index 3f9d0ed..0000000 Binary files a/GenIconos/gnome/64px-Gnome-weather-storm.png and /dev/null differ diff --git a/GenIconos/nuvola/view_tree.png b/GenIconos/nuvola/view_tree.png deleted file mode 100644 index cc880d0..0000000 Binary files a/GenIconos/nuvola/view_tree.png and /dev/null differ diff --git a/GenIconos/otros/led_circle_orange.png b/GenIconos/otros/led_circle_orange.png deleted file mode 100644 index cd2354d..0000000 Binary files a/GenIconos/otros/led_circle_orange.png and /dev/null differ diff --git a/GenIconos/silk/arrow_joinR.png b/GenIconos/silk/arrow_joinR.png deleted file mode 100644 index c0259c8..0000000 Binary files a/GenIconos/silk/arrow_joinR.png and /dev/null differ diff --git a/GenIconos/vehicles/Train.png b/GenIconos/vehicles/Train.png deleted file mode 100644 index 3939228..0000000 Binary files a/GenIconos/vehicles/Train.png and /dev/null differ diff --git a/GenIconos/vehicles/Train1.png b/GenIconos/vehicles/Train1.png deleted file mode 100644 index 26ca80e..0000000 Binary files a/GenIconos/vehicles/Train1.png and /dev/null differ diff --git a/GenIconos/visualpharm/delete_shield-26.png b/GenIconos/visualpharm/delete_shield-26.png deleted file mode 100644 index 2b66398..0000000 Binary files a/GenIconos/visualpharm/delete_shield-26.png and /dev/null differ diff --git a/GenIconos/visualpharm/glasses-32.png b/GenIconos/visualpharm/glasses-32.png deleted file mode 100644 index 82c9784..0000000 Binary files a/GenIconos/visualpharm/glasses-32.png and /dev/null differ diff --git a/GenIconos/visualpharm/outline_star-26.png b/GenIconos/visualpharm/outline_star-26.png deleted file mode 100644 index 8af3b38..0000000 Binary files a/GenIconos/visualpharm/outline_star-26.png and /dev/null differ diff --git a/GenIconos/visualpharm/rectangle-26.png b/GenIconos/visualpharm/rectangle-26.png deleted file mode 100644 index 63fe694..0000000 Binary files a/GenIconos/visualpharm/rectangle-26.png and /dev/null differ diff --git a/GenIconos/visualpharm/rectangle_stroked-26.png b/GenIconos/visualpharm/rectangle_stroked-26.png deleted file mode 100644 index e21f301..0000000 Binary files a/GenIconos/visualpharm/rectangle_stroked-26.png and /dev/null differ diff --git a/GenIconos/visualpharm/right-26.png b/GenIconos/visualpharm/right-26.png deleted file mode 100644 index 82d22e4..0000000 Binary files a/GenIconos/visualpharm/right-26.png and /dev/null differ diff --git a/GenIconos/windows8/Active_Directory_32px.png b/GenIconos/windows8/Active_Directory_32px.png deleted file mode 100644 index 63191ef..0000000 Binary files a/GenIconos/windows8/Active_Directory_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Ascending_Sorting_32px.png b/GenIconos/windows8/Ascending_Sorting_32px.png deleted file mode 100644 index 63dc1a4..0000000 Binary files a/GenIconos/windows8/Ascending_Sorting_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Books_32px.png b/GenIconos/windows8/Books_32px.png deleted file mode 100644 index 2504675..0000000 Binary files a/GenIconos/windows8/Books_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Code_Fork_32px.png b/GenIconos/windows8/Code_Fork_32px.png deleted file mode 100644 index c2e925b..0000000 Binary files a/GenIconos/windows8/Code_Fork_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Coral_32px.png b/GenIconos/windows8/Coral_32px.png deleted file mode 100644 index c0e138f..0000000 Binary files a/GenIconos/windows8/Coral_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Create_32px.png b/GenIconos/windows8/Create_32px.png new file mode 100644 index 0000000..f44f49f Binary files /dev/null and b/GenIconos/windows8/Create_32px.png differ diff --git a/GenIconos/windows8/Factory_32px.png b/GenIconos/windows8/Factory_32px.png deleted file mode 100644 index a590aa9..0000000 Binary files a/GenIconos/windows8/Factory_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Google_Sketchup_32px.png b/GenIconos/windows8/Google_Sketchup_32px.png deleted file mode 100644 index bafdf98..0000000 Binary files a/GenIconos/windows8/Google_Sketchup_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Originals/Download_32px.png b/GenIconos/windows8/Originals/Download_32px.png deleted file mode 100644 index 3628fa1..0000000 Binary files a/GenIconos/windows8/Originals/Download_32px.png and /dev/null differ diff --git a/GenIconos/windows8/Share_18px.png b/GenIconos/windows8/Share_18px.png deleted file mode 100644 index ca7633d..0000000 Binary files a/GenIconos/windows8/Share_18px.png and /dev/null differ diff --git a/GenIconos/windows8/Under_Computer_32px.png b/GenIconos/windows8/Under_Computer_32px.png deleted file mode 100644 index 8e54cda..0000000 Binary files a/GenIconos/windows8/Under_Computer_32px.png and /dev/null differ diff --git a/GenIconos/windows8/University_32px.png b/GenIconos/windows8/University_32px.png deleted file mode 100644 index 4628af8..0000000 Binary files a/GenIconos/windows8/University_32px.png and /dev/null differ diff --git a/GenIconos/windows8/dashboard-32.png b/GenIconos/windows8/dashboard-32.png deleted file mode 100644 index c47aac6..0000000 Binary files a/GenIconos/windows8/dashboard-32.png and /dev/null differ diff --git a/GenIconos/windows8/define_location-26.png b/GenIconos/windows8/define_location-26.png deleted file mode 100644 index 711ee66..0000000 Binary files a/GenIconos/windows8/define_location-26.png and /dev/null differ diff --git a/GenIconos/windows8/documents-32.png b/GenIconos/windows8/documents-32.png deleted file mode 100644 index 730cfb5..0000000 Binary files a/GenIconos/windows8/documents-32.png and /dev/null differ diff --git a/GenIconos/windows8/engine-26.png b/GenIconos/windows8/engine-26.png deleted file mode 100644 index 396a3e4..0000000 Binary files a/GenIconos/windows8/engine-26.png and /dev/null differ diff --git a/GenIconos/windows8/factory-32.png b/GenIconos/windows8/factory-32.png deleted file mode 100644 index 8199f2e..0000000 Binary files a/GenIconos/windows8/factory-32.png and /dev/null differ diff --git a/GenIconos/windows8/folder-32.png b/GenIconos/windows8/folder-32.png deleted file mode 100644 index 8ed4cca..0000000 Binary files a/GenIconos/windows8/folder-32.png and /dev/null differ diff --git a/GenIconos/windows8/greentech-32.png b/GenIconos/windows8/greentech-32.png deleted file mode 100644 index 60e3951..0000000 Binary files a/GenIconos/windows8/greentech-32.png and /dev/null differ diff --git a/GenIconos/windows8/online-26.png b/GenIconos/windows8/online-26.png deleted file mode 100644 index 98b5f6b..0000000 Binary files a/GenIconos/windows8/online-26.png and /dev/null differ diff --git a/GenIconos/windows8/research-26.png b/GenIconos/windows8/research-26.png deleted file mode 100644 index cd13392..0000000 Binary files a/GenIconos/windows8/research-26.png and /dev/null differ diff --git a/GenIconos/windows8/research-32.png b/GenIconos/windows8/research-32.png deleted file mode 100644 index 4ef164b..0000000 Binary files a/GenIconos/windows8/research-32.png and /dev/null differ diff --git a/GenIconos/windows8/settings-26.png b/GenIconos/windows8/settings-26.png deleted file mode 100644 index 5f086a3..0000000 Binary files a/GenIconos/windows8/settings-26.png and /dev/null differ diff --git a/GenIconos/windows8/speedometer-26.png b/GenIconos/windows8/speedometer-26.png deleted file mode 100644 index c865254..0000000 Binary files a/GenIconos/windows8/speedometer-26.png and /dev/null differ diff --git a/IntFiles/Iconos.bin b/IntFiles/Iconos.bin index 713d82c..4799c6a 100644 Binary files a/IntFiles/Iconos.bin and b/IntFiles/Iconos.bin differ diff --git a/LCEngine/LCEngine.pyd b/LCEngine/LCEngine.pyd deleted file mode 100644 index 07b9d4e..0000000 Binary files a/LCEngine/LCEngine.pyd and /dev/null differ diff --git a/LCEngine/LCEngine.so b/LCEngine/LCEngine.so deleted file mode 100644 index c3bc5cf..0000000 Binary files a/LCEngine/LCEngine.so and /dev/null differ diff --git a/LCEngine/LCEngine.c b/LCEngine/LCEngine2.c similarity index 62% rename from LCEngine/LCEngine.c rename to LCEngine/LCEngine2.c index a8abf9c..997b1d6 100644 --- a/LCEngine/LCEngine.c +++ b/LCEngine/LCEngine2.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.25.2 */ +/* Generated by Cython 0.28.5 */ /* BEGIN: Cython Metadata { @@ -8,9 +8,13 @@ ], "libraries": [ "irina" + ], + "name": "LCEngine2", + "sources": [ + "LCEngine2.pyx" ] }, - "module_name": "LCEngine" + "module_name": "LCEngine2" } END: Cython Metadata */ @@ -18,10 +22,11 @@ END: Cython Metadata */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) + #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_25_2" +#define CYTHON_ABI "0_28_5" +#define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -43,8 +48,9 @@ END: Cython Metadata */ #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif +#define __PYX_COMMA , #ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) + #if PY_VERSION_HEX >= 0x02070000 #define HAVE_LONG_LONG #endif #endif @@ -60,8 +66,14 @@ END: Cython Metadata */ #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #if PY_VERSION_HEX < 0x03050000 + #undef CYTHON_USE_ASYNC_SLOTS + #define CYTHON_USE_ASYNC_SLOTS 0 + #elif !defined(CYTHON_USE_ASYNC_SLOTS) + #define CYTHON_USE_ASYNC_SLOTS 1 + #endif #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS @@ -80,6 +92,10 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 @@ -87,6 +103,8 @@ END: Cython Metadata */ #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS @@ -111,6 +129,10 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 + #undef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT 0 + #undef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 @@ -118,6 +140,12 @@ END: Cython Metadata */ #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif + #if PY_VERSION_HEX < 0x02070000 + #undef CYTHON_USE_PYTYPE_LOOKUP + #define CYTHON_USE_PYTYPE_LOOKUP 0 + #elif !defined(CYTHON_USE_PYTYPE_LOOKUP) + #define CYTHON_USE_PYTYPE_LOOKUP 1 + #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 @@ -157,6 +185,12 @@ END: Cython Metadata */ #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif + #ifndef CYTHON_PEP489_MULTI_PHASE_INIT + #define CYTHON_PEP489_MULTI_PHASE_INIT (0 && PY_VERSION_HEX >= 0x03050000) + #endif + #ifndef CYTHON_USE_TP_FINALIZE + #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1) + #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) @@ -167,6 +201,103 @@ END: Cython Metadata */ #undef BASE #undef MASK #endif +#ifndef __has_attribute + #define __has_attribute(x) 0 +#endif +#ifndef __has_cpp_attribute + #define __has_cpp_attribute(x) 0 +#endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) && _MSC_VER >= 1400 + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +#ifndef CYTHON_MAYBE_UNUSED_VAR +# if defined(__cplusplus) + template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } +# else +# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) +# endif +#endif +#ifndef CYTHON_NCP_UNUSED +# if CYTHON_COMPILING_IN_CPYTHON +# define CYTHON_NCP_UNUSED +# else +# define CYTHON_NCP_UNUSED CYTHON_UNUSED +# endif +#endif +#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) +#ifdef _MSC_VER + #ifndef _MSC_STDINT_H_ + #if _MSC_VER < 1300 + typedef unsigned char uint8_t; + typedef unsigned int uint32_t; + #else + typedef unsigned __int8 uint8_t; + typedef unsigned __int32 uint32_t; + #endif + #endif +#else + #include +#endif +#ifndef CYTHON_FALLTHROUGH + #if defined(__cplusplus) && __cplusplus >= 201103L + #if __has_cpp_attribute(fallthrough) + #define CYTHON_FALLTHROUGH [[fallthrough]] + #elif __has_cpp_attribute(clang::fallthrough) + #define CYTHON_FALLTHROUGH [[clang::fallthrough]] + #elif __has_cpp_attribute(gnu::fallthrough) + #define CYTHON_FALLTHROUGH [[gnu::fallthrough]] + #endif + #endif + #ifndef CYTHON_FALLTHROUGH + #if __has_attribute(fallthrough) + #define CYTHON_FALLTHROUGH __attribute__((fallthrough)) + #else + #define CYTHON_FALLTHROUGH + #endif + #endif + #if defined(__clang__ ) && defined(__apple_build_version__) + #if __apple_build_version__ < 7000000 + #undef CYTHON_FALLTHROUGH + #define CYTHON_FALLTHROUGH + #endif + #endif +#endif + +#ifndef CYTHON_INLINE + #if defined(__clang__) + #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif @@ -195,19 +326,91 @@ END: Cython Metadata */ #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); +#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL) + #ifndef METH_FASTCALL + #define METH_FASTCALL 0x80 + #endif + typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs); + typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args, + Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast + #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) + ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif +#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) + #define PyObject_Malloc(s) PyMem_Malloc(s) + #define PyObject_Free(p) PyMem_Free(p) + #define PyObject_Realloc(p) PyMem_Realloc(p) +#endif +#if CYTHON_COMPILING_IN_PYSTON + #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) +#else + #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) + #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) +#endif +#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#elif PY_VERSION_HEX >= 0x03060000 + #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet() +#elif PY_VERSION_HEX >= 0x03000000 + #define __Pyx_PyThreadState_Current PyThreadState_GET() +#else + #define __Pyx_PyThreadState_Current _PyThreadState_Current +#endif +#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT) +#include "pythread.h" +#define Py_tss_NEEDS_INIT 0 +typedef int Py_tss_t; +static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) { + *key = PyThread_create_key(); + return 0; // PyThread_create_key reports success always +} +static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) { + Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t)); + *key = Py_tss_NEEDS_INIT; + return key; +} +static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) { + PyObject_Free(key); +} +static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) { + return *key != Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) { + PyThread_delete_key(*key); + *key = Py_tss_NEEDS_INIT; +} +static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) { + return PyThread_set_key_value(*key, value); +} +static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { + return PyThread_get_key_value(*key); +} +#endif // TSS (Thread Specific Storage) API +#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized) +#define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n)) +#else +#define __Pyx_PyDict_NewPresized(n) PyDict_New() +#endif +#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS +#define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash) +#else +#define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name) +#endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ @@ -252,18 +455,6 @@ END: Cython Metadata */ #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 @@ -280,6 +471,7 @@ END: Cython Metadata */ #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact + #define PyObject_Unicode PyObject_Str #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) @@ -291,8 +483,11 @@ END: Cython Metadata */ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) +#if CYTHON_ASSUME_SAFE_MACROS + #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) +#else + #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq) +#endif #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -327,7 +522,7 @@ END: Cython Metadata */ #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif @@ -336,68 +531,17 @@ END: Cython Metadata */ #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif +#ifndef __Pyx_PyAsyncMethodsStruct + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + } __Pyx_PyAsyncMethodsStruct; #endif #if defined(WIN32) || defined(MS_WINDOWS) @@ -425,14 +569,6 @@ static CYTHON_INLINE float __PYX_NAN() { __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -441,14 +577,15 @@ static CYTHON_INLINE float __PYX_NAN() { #endif #endif -#define __PYX_HAVE__LCEngine -#define __PYX_HAVE_API__LCEngine +#define __PYX_HAVE__LCEngine2 +#define __PYX_HAVE_API__LCEngine2 +/* Early includes */ #include "irina.h" #ifdef _OPENMP #include #endif /* _OPENMP */ -#ifdef PYREX_WITHOUT_ASSERTIONS +#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS) #define CYTHON_WITHOUT_ASSERTIONS #endif @@ -479,8 +616,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) +#elif defined (_MSC_VER) + #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value)) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) @@ -488,8 +625,8 @@ typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* enc #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString @@ -502,31 +639,37 @@ static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s)) +#define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b); static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); +#define __Pyx_PySequence_Tuple(obj)\ + (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS @@ -625,10 +768,12 @@ static int __Pyx_init_sys_getdefaultencoding_params(void) { #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ +static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; } -static PyObject *__pyx_m; +static PyObject *__pyx_m = NULL; static PyObject *__pyx_d; static PyObject *__pyx_b; +static PyObject *__pyx_cython_runtime = NULL; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; @@ -639,7 +784,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "LCEngine.pyx", + "LCEngine2.pyx", }; /*--- Type declarations ---*/ @@ -710,16 +855,7 @@ static const char *__pyx_f[] = { /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name); #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif @@ -741,17 +877,8 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value); #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) @@ -817,23 +944,35 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif #else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif @@ -857,6 +996,18 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif +/* UnicodeAsUCS4.proto */ +static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); + +/* object_ord.proto */ +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyObject_Ord(c)\ + (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c)) +#else +#define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c) +#endif +static long __Pyx__PyObject_Ord(PyObject* c); + /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -875,22 +1026,10 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -/* UnicodeAsUCS4.proto */ -static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); - -/* object_ord.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyObject_Ord(c)\ - (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c)) -#else -#define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c) -#endif -static long __Pyx__PyObject_Ord(PyObject* c); - /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); @@ -903,11 +1042,36 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( /* dict_getitem_default.proto */ static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +/* UnpackUnboundCMethod.proto */ +typedef struct { + PyObject *type; + PyObject **method_name; + PyCFunction func; + PyObject *method; + int flag; +} __Pyx_CachedCFunction; + +/* CallUnboundCMethod1.proto */ +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg); +#else +#define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg) +#endif + +/* CallUnboundCMethod2.proto */ +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2); +#else +#define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2) +#endif + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); @@ -943,6 +1107,7 @@ static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* s /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg); /* append.proto */ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); @@ -977,7 +1142,7 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck); @@ -1028,7 +1193,6 @@ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* CythonFunction.proto */ #define __Pyx_CyFunction_USED 1 -#include #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 @@ -1080,6 +1244,17 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); +/* SetNameInClass.proto */ +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value)) +#elif CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_SetNameInClass(ns, name, value)\ + (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value)) +#else +#define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) +#endif + /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); @@ -1089,6 +1264,13 @@ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); +/* CLineInTraceback.proto */ +#ifdef CYTHON_CLINE_IN_TRACEBACK +#define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) +#else +static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line); +#endif + /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; @@ -1123,6 +1305,19 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* FastTypeChecks.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type) +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type); +static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2); +#else +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type) +#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2)) +#endif +#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -1132,13 +1327,14 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cython' */ -/* Module declarations from 'LCEngine' */ -#define __Pyx_MODULE_NAME "LCEngine" -int __pyx_module_is_main_LCEngine = 0; +/* Module declarations from 'LCEngine2' */ +#define __Pyx_MODULE_NAME "LCEngine2" +extern int __pyx_module_is_main_LCEngine2; +int __pyx_module_is_main_LCEngine2 = 0; -/* Implementation of 'LCEngine' */ -static PyObject *__pyx_builtin_range; +/* Implementation of 'LCEngine2' */ static PyObject *__pyx_builtin_object; +static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_StopIteration; static PyObject *__pyx_builtin_chr; static const char __pyx_k_[] = ""; @@ -1148,7 +1344,6 @@ static const char __pyx_k_c[] = "c"; static const char __pyx_k_d[] = "d"; static const char __pyx_k_f[] = "f"; static const char __pyx_k_h[] = "h"; -static const char __pyx_k_i[] = "i"; static const char __pyx_k_n[] = "n"; static const char __pyx_k_q[] = "q"; static const char __pyx_k_r[] = "r"; @@ -1173,46 +1368,33 @@ static const char __pyx_k_nx[] = "nx"; static const char __pyx_k_ot[] = "ot"; static const char __pyx_k_pv[] = "_pv"; static const char __pyx_k_to[] = "_to"; -static const char __pyx_k__25[] = " "; -static const char __pyx_k__34[] = "."; -static const char __pyx_k__38[] = "\n"; -static const char __pyx_k__39[] = "+"; -static const char __pyx_k__40[] = "#"; -static const char __pyx_k__47[] = "-"; -static const char __pyx_k_c_i[] = "c_i"; +static const char __pyx_k__15[] = " "; +static const char __pyx_k__24[] = "."; +static const char __pyx_k__28[] = "\n"; +static const char __pyx_k__29[] = "+"; +static const char __pyx_k__30[] = "#"; +static const char __pyx_k__37[] = "-"; static const char __pyx_k_chr[] = "chr"; static const char __pyx_k_col[] = "col"; static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_f_i[] = "f_i"; static const char __pyx_k_fen[] = "fen"; static const char __pyx_k_fil[] = "fil"; static const char __pyx_k_get[] = "get"; -static const char __pyx_k_inc[] = "inc"; -static const char __pyx_k_liK[] = "liK"; static const char __pyx_k_liM[] = "liM"; static const char __pyx_k_liN[] = "liN"; -static const char __pyx_k_liP[] = "liP"; -static const char __pyx_k_liX[] = "liX"; static const char __pyx_k_lia[] = "lia"; static const char __pyx_k_lib[] = "lib"; -static const char __pyx_k_lin[] = "lin"; static const char __pyx_k_lix[] = "lix"; static const char __pyx_k_num[] = "num"; static const char __pyx_k_pgn[] = "pgn"; static const char __pyx_k_pos[] = "pos"; static const char __pyx_k_san[] = "_san"; static const char __pyx_k_siW[] = "siW"; -static const char __pyx_k_sig[] = "sig"; static const char __pyx_k_sp1[] = "sp1"; static const char __pyx_k_sp2[] = "sp2"; static const char __pyx_k_tam[] = "tam"; static const char __pyx_k_xpv[] = "xpv"; static const char __pyx_k_base[] = "base"; -static const char __pyx_k_dicB[] = "dicB"; -static const char __pyx_k_dicK[] = "dicK"; -static const char __pyx_k_dicN[] = "dicN"; -static const char __pyx_k_dicQ[] = "dicQ"; -static const char __pyx_k_dicR[] = "dicR"; static const char __pyx_k_exit[] = "__exit__"; static const char __pyx_k_fens[] = "fens"; static const char __pyx_k_fich[] = "fich"; @@ -1221,7 +1403,6 @@ static const char __pyx_k_info[] = "info"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_iter[] = "__iter__"; static const char __pyx_k_join[] = "join"; -static const char __pyx_k_liBR[] = "liBR"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_mate[] = "_mate"; static const char __pyx_k_move[] = "move"; @@ -1232,7 +1413,6 @@ static const char __pyx_k_pv_2[] = "pv"; static const char __pyx_k_resp[] = "resp"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_siMB[] = "siMB"; -static const char __pyx_k_sig2[] = "sig2"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_type[] = "type"; static const char __pyx_k_xmin[] = "xmin"; @@ -1242,8 +1422,6 @@ static const char __pyx_k_a1h8q[] = "a1h8q"; static const char __pyx_k_check[] = "_check"; static const char __pyx_k_depth[] = "depth"; static const char __pyx_k_desde[] = "desde"; -static const char __pyx_k_dicPB[] = "dicPB"; -static const char __pyx_k_dicPW[] = "dicPW"; static const char __pyx_k_enter[] = "__enter__"; static const char __pyx_k_fenOB[] = "fenOB"; static const char __pyx_k_hasta[] = "hasta"; @@ -1258,7 +1436,6 @@ static const char __pyx_k_posA1[] = "posA1"; static const char __pyx_k_posFC[] = "posFC"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_rfind[] = "rfind"; -static const char __pyx_k_salto[] = "salto"; static const char __pyx_k_san_2[] = "san"; static const char __pyx_k_split[] = "split"; static const char __pyx_k_strip[] = "strip"; @@ -1282,13 +1459,11 @@ static const char __pyx_k_setFen[] = "setFen"; static const char __pyx_k_xpv2pv[] = "xpv2pv"; static const char __pyx_k_captura[] = "captura"; static const char __pyx_k_capture[] = "_capture"; -static const char __pyx_k_filaIni[] = "filaIni"; static const char __pyx_k_isCheck[] = "isCheck"; static const char __pyx_k_numMove[] = "numMove"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_xpv2pgn[] = "xpv2pgn"; static const char __pyx_k_InfoMove[] = "InfoMove"; -static const char __pyx_k_LCEngine[] = "LCEngine"; static const char __pyx_k_castle_K[] = "_castle_K"; static const char __pyx_k_castle_Q[] = "_castle_Q"; static const char __pyx_k_getMoves[] = "getMoves"; @@ -1299,6 +1474,7 @@ static const char __pyx_k_moveExPV[] = "moveExPV"; static const char __pyx_k_num2move[] = "num2move"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_xpv2lipv[] = "xpv2lipv"; +static const char __pyx_k_LCEngine2[] = "LCEngine2"; static const char __pyx_k_PGNreader[] = "PGNreader"; static const char __pyx_k_desdeA1H8[] = "desdeA1H8"; static const char __pyx_k_fen2fenM2[] = "fen2fenM2"; @@ -1319,6 +1495,7 @@ static const char __pyx_k_isEnPassant[] = "isEnPassant"; static const char __pyx_k_knightmoves[] = "knightmoves"; static const char __pyx_k_fenTerminado[] = "fenTerminado"; static const char __pyx_k_InfoMove_mate[] = "InfoMove.mate"; +static const char __pyx_k_LCEngine2_pyx[] = "LCEngine2.pyx"; static const char __pyx_k_StopIteration[] = "StopIteration"; static const char __pyx_k_setFenInicial[] = "setFenInicial"; static const char __pyx_k_InfoMove_desde[] = "InfoMove.desde"; @@ -1336,10 +1513,10 @@ static const char __pyx_k_PGNreader___iter[] = "PGNreader.__iter__"; static const char __pyx_k_PGNreader___enter[] = "PGNreader.__enter__"; static const char __pyx_k_InfoMove_isCastleK[] = "InfoMove.isCastleK"; static const char __pyx_k_InfoMove_isCastleQ[] = "InfoMove.isCastleQ"; +static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_InfoMove_coronacion[] = "InfoMove.coronacion"; static const char __pyx_k_InfoMove_movimiento[] = "InfoMove.movimiento"; static const char __pyx_k_InfoMove_isEnPassant[] = "InfoMove.isEnPassant"; -static const char __pyx_k_c_correr_lucaschess_pyLC12_LCEng[] = "c:\\correr\\lucaschess\\pyLC12\\LCEngine\\LCEngine.pyx"; static const char __pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP[] = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; static PyObject *__pyx_kp_s_; static PyObject *__pyx_n_s_FCpos; @@ -1356,7 +1533,8 @@ static PyObject *__pyx_n_s_InfoMove_jaque; static PyObject *__pyx_n_s_InfoMove_mate; static PyObject *__pyx_n_s_InfoMove_movimiento; static PyObject *__pyx_n_s_InfoMove_pieza; -static PyObject *__pyx_n_s_LCEngine; +static PyObject *__pyx_n_s_LCEngine2; +static PyObject *__pyx_kp_s_LCEngine2_pyx; static PyObject *__pyx_n_s_PGNreader; static PyObject *__pyx_n_s_PGNreader___enter; static PyObject *__pyx_n_s_PGNreader___exit; @@ -1364,12 +1542,12 @@ static PyObject *__pyx_n_s_PGNreader___init; static PyObject *__pyx_n_s_PGNreader___iter; static PyObject *__pyx_n_s_PGNreader_next; static PyObject *__pyx_n_s_StopIteration; -static PyObject *__pyx_kp_s__25; -static PyObject *__pyx_kp_s__34; -static PyObject *__pyx_kp_s__38; -static PyObject *__pyx_kp_s__39; -static PyObject *__pyx_kp_s__40; -static PyObject *__pyx_kp_s__47; +static PyObject *__pyx_kp_s__15; +static PyObject *__pyx_kp_s__24; +static PyObject *__pyx_kp_s__28; +static PyObject *__pyx_kp_s__29; +static PyObject *__pyx_kp_s__30; +static PyObject *__pyx_kp_s__37; static PyObject *__pyx_n_s_a; static PyObject *__pyx_n_s_a1; static PyObject *__pyx_n_s_a1Pos; @@ -1378,8 +1556,6 @@ static PyObject *__pyx_n_s_append; static PyObject *__pyx_n_s_b; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_c; -static PyObject *__pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng; -static PyObject *__pyx_n_s_c_i; static PyObject *__pyx_n_s_captura; static PyObject *__pyx_n_s_capture; static PyObject *__pyx_n_s_castle_K; @@ -1388,6 +1564,7 @@ static PyObject *__pyx_n_s_celdas_ocupadas; static PyObject *__pyx_n_s_check; static PyObject *__pyx_n_s_chr; static PyObject *__pyx_n_s_ci; +static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_col; static PyObject *__pyx_n_s_coronacion; static PyObject *__pyx_n_s_ct; @@ -1395,20 +1572,12 @@ static PyObject *__pyx_n_s_d; static PyObject *__pyx_n_s_depth; static PyObject *__pyx_n_s_desde; static PyObject *__pyx_n_s_desdeA1H8; -static PyObject *__pyx_n_s_dicB; -static PyObject *__pyx_n_s_dicK; -static PyObject *__pyx_n_s_dicN; -static PyObject *__pyx_n_s_dicPB; -static PyObject *__pyx_n_s_dicPW; -static PyObject *__pyx_n_s_dicQ; -static PyObject *__pyx_n_s_dicR; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_enter; static PyObject *__pyx_n_s_ep; static PyObject *__pyx_n_s_exit; static PyObject *__pyx_n_s_extend; static PyObject *__pyx_n_s_f; -static PyObject *__pyx_n_s_f_i; static PyObject *__pyx_n_s_fen; static PyObject *__pyx_n_s_fen2fenM2; static PyObject *__pyx_n_s_fenOB; @@ -1417,7 +1586,6 @@ static PyObject *__pyx_n_s_fens; static PyObject *__pyx_n_s_fi; static PyObject *__pyx_n_s_fich; static PyObject *__pyx_n_s_fil; -static PyObject *__pyx_n_s_filaIni; static PyObject *__pyx_n_s_from; static PyObject *__pyx_n_s_ft; static PyObject *__pyx_n_s_get; @@ -1431,8 +1599,6 @@ static PyObject *__pyx_n_s_h; static PyObject *__pyx_n_s_h8; static PyObject *__pyx_n_s_hasta; static PyObject *__pyx_n_s_hastaA1H8; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_inc; static PyObject *__pyx_n_s_info; static PyObject *__pyx_n_s_infoMove; static PyObject *__pyx_n_s_inifen; @@ -1449,17 +1615,12 @@ static PyObject *__pyx_n_s_knightmoves; static PyObject *__pyx_n_s_lc_pgn2pv; static PyObject *__pyx_n_s_level; static PyObject *__pyx_n_s_li; -static PyObject *__pyx_n_s_liBR; -static PyObject *__pyx_n_s_liK; static PyObject *__pyx_n_s_liM; static PyObject *__pyx_n_s_liN; static PyObject *__pyx_n_s_liNMinimo; -static PyObject *__pyx_n_s_liP; -static PyObject *__pyx_n_s_liX; static PyObject *__pyx_n_s_lia; static PyObject *__pyx_n_s_lib; static PyObject *__pyx_n_s_lidef; -static PyObject *__pyx_n_s_lin; static PyObject *__pyx_n_s_lix; static PyObject *__pyx_n_s_lower; static PyObject *__pyx_n_s_main; @@ -1510,7 +1671,6 @@ static PyObject *__pyx_n_s_resp; static PyObject *__pyx_n_s_rfind; static PyObject *__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP; static PyObject *__pyx_n_s_runFen; -static PyObject *__pyx_n_s_salto; static PyObject *__pyx_n_s_san; static PyObject *__pyx_n_s_san_2; static PyObject *__pyx_n_s_self; @@ -1519,8 +1679,6 @@ static PyObject *__pyx_n_s_setFenInicial; static PyObject *__pyx_n_s_siBlancas; static PyObject *__pyx_n_s_siMB; static PyObject *__pyx_n_s_siW; -static PyObject *__pyx_n_s_sig; -static PyObject *__pyx_n_s_sig2; static PyObject *__pyx_n_s_sp1; static PyObject *__pyx_n_s_sp2; static PyObject *__pyx_n_s_split; @@ -1541,57 +1699,55 @@ static PyObject *__pyx_n_s_xpv2lipv; static PyObject *__pyx_n_s_xpv2pgn; static PyObject *__pyx_n_s_xpv2pv; static PyObject *__pyx_n_s_y; -static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fich, PyObject *__pyx_v_depth); /* proto */ -static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_9PGNreader_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */ -static PyObject *__pyx_pf_8LCEngine_9PGNreader_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pgn1); /* proto */ -static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos); /* proto */ -static PyObject *__pyx_pf_8LCEngine_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_c); /* proto */ -static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1); /* proto */ -static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1h8q); /* proto */ -static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num); /* proto */ -static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos); /* proto */ -static PyObject *__pyx_pf_8LCEngine_16liBR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_fi, PyObject *__pyx_v_ci); /* proto */ -static PyObject *__pyx_pf_8LCEngine_18liN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos); /* proto */ -static PyObject *__pyx_pf_8LCEngine_20liP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_siW); /* proto */ -static PyObject *__pyx_pf_8LCEngine_22knightmoves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_no, PyObject *__pyx_v_nv, PyObject *__pyx_v_mx); /* proto */ -static PyObject *__pyx_pf_8LCEngine_24liNMinimo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_celdas_ocupadas); /* proto */ -static PyObject *__pyx_pf_8LCEngine_26xpv2lipv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ -static PyObject *__pyx_pf_8LCEngine_28xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ -static PyObject *__pyx_pf_8LCEngine_30pv2xpv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv); /* proto */ -static PyObject *__pyx_pf_8LCEngine_32runFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_depth, PyObject *__pyx_v_ms, PyObject *__pyx_v_level); /* proto */ -static PyObject *__pyx_pf_8LCEngine_34setFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_8LCEngine_36getFen(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_38getMoves(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_40getPGN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desdeA1H8, PyObject *__pyx_v_hastaA1H8, PyObject *__pyx_v_coronacion); /* proto */ -static PyObject *__pyx_pf_8LCEngine_42xpv2pgn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ -static PyObject *__pyx_pf_8LCEngine_44isCheck(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_num); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_2desde(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_4hasta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_6coronacion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_12mate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_14captura(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion); /* proto */ -static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion); /* proto */ -static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_move); /* proto */ -static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_8LCEngine_56setFenInicial(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_8LCEngine_58makePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv); /* proto */ -static PyObject *__pyx_pf_8LCEngine_60getCapturesFEN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_8LCEngine_62getCaptures(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_siMB); /* proto */ -static PyObject *__pyx_pf_8LCEngine_64fenOB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_8LCEngine_66fenTerminado(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_9PGNreader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fich, PyObject *__pyx_v_depth); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_8next(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pgn1); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_2posFC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_c); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_6posA1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_10move2num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1h8q); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_12num2move(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_14liN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_16knightmoves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_no, PyObject *__pyx_v_nv, PyObject *__pyx_v_mx); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_18liNMinimo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_celdas_ocupadas); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_20xpv2lipv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_22xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_24pv2xpv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_26runFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_depth, PyObject *__pyx_v_ms, PyObject *__pyx_v_level); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_28setFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_30getFen(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_32getMoves(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_34getPGN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desdeA1H8, PyObject *__pyx_v_hastaA1H8, PyObject *__pyx_v_coronacion); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_36xpv2pgn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_38isCheck(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_num); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_2desde(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_4hasta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_6coronacion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_8movimiento(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_12mate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_14captura(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_40getExMoves(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_42moveExPV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_44movePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_46makeMove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_move); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_48fen2fenM2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_50setFenInicial(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_52makePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_54getCapturesFEN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_56getCaptures(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_siMB); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_58fenOB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ +static PyObject *__pyx_pf_9LCEngine2_60fenTerminado(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ +static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0}; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; @@ -1603,7 +1759,6 @@ static PyObject *__pyx_int_50; static PyObject *__pyx_int_51; static PyObject *__pyx_int_52; static PyObject *__pyx_int_53; -static PyObject *__pyx_int_56; static PyObject *__pyx_int_58; static PyObject *__pyx_int_64; static PyObject *__pyx_int_80; @@ -1618,37 +1773,32 @@ static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__23; -static PyObject *__pyx_slice__24; +static PyObject *__pyx_slice__13; +static PyObject *__pyx_slice__14; +static PyObject *__pyx_slice__17; +static PyObject *__pyx_slice__18; +static PyObject *__pyx_slice__19; +static PyObject *__pyx_slice__25; +static PyObject *__pyx_slice__26; static PyObject *__pyx_slice__27; -static PyObject *__pyx_slice__28; -static PyObject *__pyx_slice__29; -static PyObject *__pyx_slice__35; -static PyObject *__pyx_slice__36; -static PyObject *__pyx_slice__37; -static PyObject *__pyx_slice__41; -static PyObject *__pyx_slice__42; -static PyObject *__pyx_slice__43; +static PyObject *__pyx_slice__31; +static PyObject *__pyx_slice__32; +static PyObject *__pyx_slice__33; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__23; +static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__35; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__42; static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; static PyObject *__pyx_tuple__46; static PyObject *__pyx_tuple__48; static PyObject *__pyx_tuple__50; @@ -1667,31 +1817,18 @@ static PyObject *__pyx_tuple__74; static PyObject *__pyx_tuple__76; static PyObject *__pyx_tuple__78; static PyObject *__pyx_tuple__80; -static PyObject *__pyx_tuple__81; static PyObject *__pyx_tuple__82; -static PyObject *__pyx_tuple__83; static PyObject *__pyx_tuple__84; -static PyObject *__pyx_tuple__85; -static PyObject *__pyx_tuple__86; static PyObject *__pyx_tuple__87; static PyObject *__pyx_tuple__88; -static PyObject *__pyx_tuple__89; static PyObject *__pyx_tuple__90; -static PyObject *__pyx_tuple__91; static PyObject *__pyx_tuple__92; -static PyObject *__pyx_tuple__93; static PyObject *__pyx_tuple__94; -static PyObject *__pyx_tuple__95; static PyObject *__pyx_tuple__96; -static PyObject *__pyx_tuple__97; static PyObject *__pyx_tuple__98; -static PyObject *__pyx_tuple__99; static PyObject *__pyx_tuple__100; -static PyObject *__pyx_tuple__101; static PyObject *__pyx_tuple__102; -static PyObject *__pyx_tuple__103; static PyObject *__pyx_tuple__104; -static PyObject *__pyx_tuple__105; static PyObject *__pyx_tuple__106; static PyObject *__pyx_tuple__108; static PyObject *__pyx_tuple__110; @@ -1703,29 +1840,14 @@ static PyObject *__pyx_tuple__120; static PyObject *__pyx_tuple__122; static PyObject *__pyx_tuple__124; static PyObject *__pyx_tuple__126; -static PyObject *__pyx_tuple__129; -static PyObject *__pyx_tuple__131; -static PyObject *__pyx_tuple__133; -static PyObject *__pyx_tuple__135; -static PyObject *__pyx_tuple__137; -static PyObject *__pyx_tuple__139; -static PyObject *__pyx_tuple__141; -static PyObject *__pyx_tuple__143; -static PyObject *__pyx_tuple__145; -static PyObject *__pyx_tuple__147; -static PyObject *__pyx_tuple__149; -static PyObject *__pyx_tuple__151; -static PyObject *__pyx_tuple__153; -static PyObject *__pyx_tuple__155; -static PyObject *__pyx_tuple__157; -static PyObject *__pyx_tuple__159; -static PyObject *__pyx_tuple__161; -static PyObject *__pyx_tuple__163; -static PyObject *__pyx_tuple__165; -static PyObject *__pyx_tuple__167; -static PyObject *__pyx_tuple__169; -static PyObject *__pyx_tuple__171; -static PyObject *__pyx_tuple__173; +static PyObject *__pyx_tuple__128; +static PyObject *__pyx_tuple__130; +static PyObject *__pyx_tuple__132; +static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +static PyObject *__pyx_codeobj__45; +static PyObject *__pyx_codeobj__47; static PyObject *__pyx_codeobj__49; static PyObject *__pyx_codeobj__51; static PyObject *__pyx_codeobj__53; @@ -1742,6 +1864,19 @@ static PyObject *__pyx_codeobj__73; static PyObject *__pyx_codeobj__75; static PyObject *__pyx_codeobj__77; static PyObject *__pyx_codeobj__79; +static PyObject *__pyx_codeobj__81; +static PyObject *__pyx_codeobj__83; +static PyObject *__pyx_codeobj__85; +static PyObject *__pyx_codeobj__86; +static PyObject *__pyx_codeobj__89; +static PyObject *__pyx_codeobj__91; +static PyObject *__pyx_codeobj__93; +static PyObject *__pyx_codeobj__95; +static PyObject *__pyx_codeobj__97; +static PyObject *__pyx_codeobj__99; +static PyObject *__pyx_codeobj__101; +static PyObject *__pyx_codeobj__103; +static PyObject *__pyx_codeobj__105; static PyObject *__pyx_codeobj__107; static PyObject *__pyx_codeobj__109; static PyObject *__pyx_codeobj__111; @@ -1753,32 +1888,12 @@ static PyObject *__pyx_codeobj__121; static PyObject *__pyx_codeobj__123; static PyObject *__pyx_codeobj__125; static PyObject *__pyx_codeobj__127; -static PyObject *__pyx_codeobj__128; -static PyObject *__pyx_codeobj__130; -static PyObject *__pyx_codeobj__132; -static PyObject *__pyx_codeobj__134; -static PyObject *__pyx_codeobj__136; -static PyObject *__pyx_codeobj__138; -static PyObject *__pyx_codeobj__140; -static PyObject *__pyx_codeobj__142; -static PyObject *__pyx_codeobj__144; -static PyObject *__pyx_codeobj__146; -static PyObject *__pyx_codeobj__148; -static PyObject *__pyx_codeobj__150; -static PyObject *__pyx_codeobj__152; -static PyObject *__pyx_codeobj__154; -static PyObject *__pyx_codeobj__156; -static PyObject *__pyx_codeobj__158; -static PyObject *__pyx_codeobj__160; -static PyObject *__pyx_codeobj__162; -static PyObject *__pyx_codeobj__164; -static PyObject *__pyx_codeobj__166; -static PyObject *__pyx_codeobj__168; -static PyObject *__pyx_codeobj__170; -static PyObject *__pyx_codeobj__172; -static PyObject *__pyx_codeobj__174; - -/* "LCEngine.pyx":42 +static PyObject *__pyx_codeobj__129; +static PyObject *__pyx_codeobj__131; +static PyObject *__pyx_codeobj__133; +/* Late includes */ + +/* "LCEngine2.pyx":42 * * class PGNreader: * def __init__(self, fich, depth): # <<<<<<<<<<<<<< @@ -1787,9 +1902,9 @@ static PyObject *__pyx_codeobj__174; */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_9PGNreader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_9PGNreader_1__init__ = {"__init__", (PyCFunction)__pyx_pw_8LCEngine_9PGNreader_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_9PGNreader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_9PGNreader_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9LCEngine2_9PGNreader_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_fich = 0; PyObject *__pyx_v_depth = 0; @@ -1804,23 +1919,28 @@ static PyObject *__pyx_pw_8LCEngine_9PGNreader_1__init__(PyObject *__pyx_self, P const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fich)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fich)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 42, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 42, __pyx_L3_error) } @@ -1843,23 +1963,23 @@ static PyObject *__pyx_pw_8LCEngine_9PGNreader_1__init__(PyObject *__pyx_self, P __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 42, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.PGNreader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.PGNreader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_9PGNreader___init__(__pyx_self, __pyx_v_self, __pyx_v_fich, __pyx_v_depth); + __pyx_r = __pyx_pf_9LCEngine2_9PGNreader___init__(__pyx_self, __pyx_v_self, __pyx_v_fich, __pyx_v_depth); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fich, PyObject *__pyx_v_depth) { +static PyObject *__pyx_pf_9LCEngine2_9PGNreader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fich, PyObject *__pyx_v_depth) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "LCEngine.pyx":43 + /* "LCEngine2.pyx":43 * class PGNreader: * def __init__(self, fich, depth): * self.fich = fich # <<<<<<<<<<<<<< @@ -1868,7 +1988,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject * */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fich, __pyx_v_fich) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - /* "LCEngine.pyx":44 + /* "LCEngine2.pyx":44 * def __init__(self, fich, depth): * self.fich = fich * self.depth = depth # <<<<<<<<<<<<<< @@ -1877,7 +1997,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject * */ if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_depth, __pyx_v_depth) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - /* "LCEngine.pyx":42 + /* "LCEngine2.pyx":42 * * class PGNreader: * def __init__(self, fich, depth): # <<<<<<<<<<<<<< @@ -1889,7 +2009,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject * __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("LCEngine.PGNreader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.PGNreader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1897,7 +2017,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject * return __pyx_r; } -/* "LCEngine.pyx":46 +/* "LCEngine2.pyx":46 * self.depth = depth * * def __enter__(self): # <<<<<<<<<<<<<< @@ -1906,20 +2026,20 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader___init__(CYTHON_UNUSED PyObject * */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_9PGNreader_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_9PGNreader_3__enter__ = {"__enter__", (PyCFunction)__pyx_pw_8LCEngine_9PGNreader_3__enter__, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_9PGNreader_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_9PGNreader_3__enter__ = {"__enter__", (PyCFunction)__pyx_pw_9LCEngine2_9PGNreader_3__enter__, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_9PGNreader_2__enter__(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_9PGNreader_2__enter__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1928,7 +2048,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject int __pyx_t_4; __Pyx_RefNannySetupContext("__enter__", 0); - /* "LCEngine.pyx":47 + /* "LCEngine2.pyx":47 * * def __enter__(self): * pgn_start(self.fich, self.depth) # <<<<<<<<<<<<<< @@ -1937,7 +2057,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fich); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_depth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) @@ -1945,7 +2065,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject pgn_start(__pyx_t_2, __pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":48 + /* "LCEngine2.pyx":48 * def __enter__(self): * pgn_start(self.fich, self.depth) * return self # <<<<<<<<<<<<<< @@ -1957,7 +2077,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject __pyx_r = __pyx_v_self; goto __pyx_L0; - /* "LCEngine.pyx":46 + /* "LCEngine2.pyx":46 * self.depth = depth * * def __enter__(self): # <<<<<<<<<<<<<< @@ -1969,7 +2089,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngine.PGNreader.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.PGNreader.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1977,7 +2097,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":50 +/* "LCEngine2.pyx":50 * return self * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -1986,9 +2106,9 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_2__enter__(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_9PGNreader_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_9PGNreader_5__exit__ = {"__exit__", (PyCFunction)__pyx_pw_8LCEngine_9PGNreader_5__exit__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_9PGNreader_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_9PGNreader_5__exit__ = {"__exit__", (PyCFunction)__pyx_pw_9LCEngine2_9PGNreader_5__exit__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_self = 0; CYTHON_UNUSED PyObject *__pyx_v_type = 0; CYTHON_UNUSED PyObject *__pyx_v_value = 0; @@ -2004,29 +2124,36 @@ static PyObject *__pyx_pw_8LCEngine_9PGNreader_5__exit__(PyObject *__pyx_self, P const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 1); __PYX_ERR(0, 50, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 2); __PYX_ERR(0, 50, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 3); __PYX_ERR(0, 50, __pyx_L3_error) } @@ -2051,23 +2178,23 @@ static PyObject *__pyx_pw_8LCEngine_9PGNreader_5__exit__(PyObject *__pyx_self, P __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 50, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.PGNreader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.PGNreader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_9PGNreader_4__exit__(__pyx_self, __pyx_v_self, __pyx_v_type, __pyx_v_value, __pyx_v_traceback); + __pyx_r = __pyx_pf_9LCEngine2_9PGNreader_4__exit__(__pyx_self, __pyx_v_self, __pyx_v_type, __pyx_v_value, __pyx_v_traceback); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_9PGNreader_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__exit__", 0); - /* "LCEngine.pyx":51 + /* "LCEngine2.pyx":51 * * def __exit__(self, type, value, traceback): * pgn_stop() # <<<<<<<<<<<<<< @@ -2076,7 +2203,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_4__exit__(CYTHON_UNUSED PyObject */ pgn_stop(); - /* "LCEngine.pyx":50 + /* "LCEngine2.pyx":50 * return self * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< @@ -2091,7 +2218,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_4__exit__(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":53 +/* "LCEngine2.pyx":53 * pgn_stop() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -2100,25 +2227,25 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_4__exit__(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_9PGNreader_7__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_9PGNreader_7__iter__ = {"__iter__", (PyCFunction)__pyx_pw_8LCEngine_9PGNreader_7__iter__, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_9PGNreader_7__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_7__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_9PGNreader_7__iter__ = {"__iter__", (PyCFunction)__pyx_pw_9LCEngine2_9PGNreader_7__iter__, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_7__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_9PGNreader_6__iter__(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_9PGNreader_6__iter__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_9PGNreader_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); - /* "LCEngine.pyx":54 + /* "LCEngine2.pyx":54 * * def __iter__(self): * return self # <<<<<<<<<<<<<< @@ -2130,7 +2257,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_6__iter__(CYTHON_UNUSED PyObject __pyx_r = __pyx_v_self; goto __pyx_L0; - /* "LCEngine.pyx":53 + /* "LCEngine2.pyx":53 * pgn_stop() * * def __iter__(self): # <<<<<<<<<<<<<< @@ -2145,7 +2272,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_6__iter__(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":56 +/* "LCEngine2.pyx":56 * return self * * def next(self): # <<<<<<<<<<<<<< @@ -2154,20 +2281,20 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_6__iter__(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_9PGNreader_9next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_9PGNreader_9next = {"next", (PyCFunction)__pyx_pw_8LCEngine_9PGNreader_9next, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_9PGNreader_9next(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_9next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_9PGNreader_9next = {"next", (PyCFunction)__pyx_pw_9LCEngine2_9PGNreader_9next, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_9PGNreader_9next(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("next (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_9PGNreader_8next(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_9PGNreader_8next(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_9PGNreader_8next(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { int __pyx_v_n; char *__pyx_v_pgn; char *__pyx_v_pv; @@ -2182,12 +2309,13 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("next", 0); - /* "LCEngine.pyx":57 + /* "LCEngine2.pyx":57 * * def next(self): * n = pgn_read() # <<<<<<<<<<<<<< @@ -2196,7 +2324,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ __pyx_v_n = pgn_read(); - /* "LCEngine.pyx":58 + /* "LCEngine2.pyx":58 * def next(self): * n = pgn_read() * if n: # <<<<<<<<<<<<<< @@ -2204,9 +2332,9 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p * pv = pgn_pv() */ __pyx_t_1 = (__pyx_v_n != 0); - if (__pyx_t_1) { + if (likely(__pyx_t_1)) { - /* "LCEngine.pyx":59 + /* "LCEngine2.pyx":59 * n = pgn_read() * if n: * pgn = pgn_game() # <<<<<<<<<<<<<< @@ -2215,7 +2343,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ __pyx_v_pgn = pgn_game(); - /* "LCEngine.pyx":60 + /* "LCEngine2.pyx":60 * if n: * pgn = pgn_game() * pv = pgn_pv() # <<<<<<<<<<<<<< @@ -2224,19 +2352,19 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ __pyx_v_pv = pgn_pv(); - /* "LCEngine.pyx":61 + /* "LCEngine2.pyx":61 * pgn = pgn_game() * pv = pgn_pv() * d = {} # <<<<<<<<<<<<<< * n = pgn_numlabels() * r = pgn_raw() */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_d = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":62 + /* "LCEngine2.pyx":62 * pv = pgn_pv() * d = {} * n = pgn_numlabels() # <<<<<<<<<<<<<< @@ -2245,7 +2373,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ __pyx_v_n = pgn_numlabels(); - /* "LCEngine.pyx":63 + /* "LCEngine2.pyx":63 * d = {} * n = pgn_numlabels() * r = pgn_raw() # <<<<<<<<<<<<<< @@ -2254,7 +2382,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ __pyx_v_r = pgn_raw(); - /* "LCEngine.pyx":64 + /* "LCEngine2.pyx":64 * n = pgn_numlabels() * r = pgn_raw() * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] # <<<<<<<<<<<<<< @@ -2264,17 +2392,18 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = pgn_numfens(); - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_num = __pyx_t_4; - __pyx_t_5 = __Pyx_PyBytes_FromString(pgn_fen(__pyx_v_num)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_num = __pyx_t_5; + __pyx_t_6 = __Pyx_PyBytes_FromString(pgn_fen(__pyx_v_num)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __pyx_v_fens = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":65 + /* "LCEngine2.pyx":65 * r = pgn_raw() * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] * if n: # <<<<<<<<<<<<<< @@ -2284,7 +2413,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p __pyx_t_1 = (__pyx_v_n != 0); if (__pyx_t_1) { - /* "LCEngine.pyx":66 + /* "LCEngine2.pyx":66 * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] * if n: * for x in range(n): # <<<<<<<<<<<<<< @@ -2292,10 +2421,11 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p * return pgn, pv, d, r, fens */ __pyx_t_3 = __pyx_v_n; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_x = __pyx_t_4; + __pyx_t_4 = __pyx_t_3; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_x = __pyx_t_5; - /* "LCEngine.pyx":67 + /* "LCEngine2.pyx":67 * if n: * for x in range(n): * d[pgn_label(x).upper()] = pgn_value(x) # <<<<<<<<<<<<<< @@ -2304,35 +2434,35 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ __pyx_t_2 = __Pyx_PyBytes_FromString(pgn_value(__pyx_v_x)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyBytes_FromString(pgn_label(__pyx_v_x)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_upper); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyBytes_FromString(pgn_label(__pyx_v_x)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_upper); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); + __Pyx_DECREF_SET(__pyx_t_8, function); } } - if (__pyx_t_6) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_7) { + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error) } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_t_5, __pyx_t_2) < 0)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_t_6, __pyx_t_2) < 0)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "LCEngine.pyx":65 + /* "LCEngine2.pyx":65 * r = pgn_raw() * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] * if n: # <<<<<<<<<<<<<< @@ -2341,7 +2471,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ } - /* "LCEngine.pyx":68 + /* "LCEngine2.pyx":68 * for x in range(n): * d[pgn_label(x).upper()] = pgn_value(x) * return pgn, pv, d, r, fens # <<<<<<<<<<<<<< @@ -2351,32 +2481,32 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_pgn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_r); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_r); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_6); __Pyx_INCREF(__pyx_v_d); __Pyx_GIVEREF(__pyx_v_d); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_d); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_d); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_8); __Pyx_INCREF(__pyx_v_fens); __Pyx_GIVEREF(__pyx_v_fens); - PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_fens); + PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_fens); __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_r = __pyx_t_6; __pyx_t_6 = 0; + __pyx_t_8 = 0; + __pyx_r = __pyx_t_7; + __pyx_t_7 = 0; goto __pyx_L0; - /* "LCEngine.pyx":58 + /* "LCEngine2.pyx":58 * def next(self): * n = pgn_read() * if n: # <<<<<<<<<<<<<< @@ -2385,7 +2515,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ } - /* "LCEngine.pyx":70 + /* "LCEngine2.pyx":70 * return pgn, pv, d, r, fens * else: * raise StopIteration # <<<<<<<<<<<<<< @@ -2397,7 +2527,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p __PYX_ERR(0, 70, __pyx_L1_error) } - /* "LCEngine.pyx":56 + /* "LCEngine2.pyx":56 * return self * * def next(self): # <<<<<<<<<<<<<< @@ -2408,10 +2538,10 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("LCEngine.PGNreader.next", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("LCEngine2.PGNreader.next", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_d); @@ -2421,7 +2551,7 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "LCEngine.pyx":73 +/* "LCEngine2.pyx":73 * * * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< @@ -2430,20 +2560,20 @@ static PyObject *__pyx_pf_8LCEngine_9PGNreader_8next(CYTHON_UNUSED PyObject *__p */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_1lc_pgn2pv(PyObject *__pyx_self, PyObject *__pyx_v_pgn1); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_1lc_pgn2pv = {"lc_pgn2pv", (PyCFunction)__pyx_pw_8LCEngine_1lc_pgn2pv, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_1lc_pgn2pv(PyObject *__pyx_self, PyObject *__pyx_v_pgn1) { +static PyObject *__pyx_pw_9LCEngine2_1lc_pgn2pv(PyObject *__pyx_self, PyObject *__pyx_v_pgn1); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_1lc_pgn2pv = {"lc_pgn2pv", (PyCFunction)__pyx_pw_9LCEngine2_1lc_pgn2pv, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_1lc_pgn2pv(PyObject *__pyx_self, PyObject *__pyx_v_pgn1) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("lc_pgn2pv (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_lc_pgn2pv(__pyx_self, ((PyObject *)__pyx_v_pgn1)); + __pyx_r = __pyx_pf_9LCEngine2_lc_pgn2pv(__pyx_self, ((PyObject *)__pyx_v_pgn1)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pgn1) { +static PyObject *__pyx_pf_9LCEngine2_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pgn1) { char __pyx_v_pv[10]; int __pyx_v_resp; PyObject *__pyx_r = NULL; @@ -2453,17 +2583,17 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("lc_pgn2pv", 0); - /* "LCEngine.pyx":75 + /* "LCEngine2.pyx":75 * def lc_pgn2pv(pgn1): * cdef char pv[10]; * resp = pgn2pv(pgn1, pv) # <<<<<<<<<<<<<< * if resp == 9999: * return "" */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_pgn1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_pgn1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error) __pyx_v_resp = pgn2pv(__pyx_t_1, __pyx_v_pv); - /* "LCEngine.pyx":76 + /* "LCEngine2.pyx":76 * cdef char pv[10]; * resp = pgn2pv(pgn1, pv) * if resp == 9999: # <<<<<<<<<<<<<< @@ -2473,7 +2603,7 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self __pyx_t_2 = ((__pyx_v_resp == 0x270F) != 0); if (__pyx_t_2) { - /* "LCEngine.pyx":77 + /* "LCEngine2.pyx":77 * resp = pgn2pv(pgn1, pv) * if resp == 9999: * return "" # <<<<<<<<<<<<<< @@ -2485,7 +2615,7 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self __pyx_r = __pyx_kp_s_; goto __pyx_L0; - /* "LCEngine.pyx":76 + /* "LCEngine2.pyx":76 * cdef char pv[10]; * resp = pgn2pv(pgn1, pv) * if resp == 9999: # <<<<<<<<<<<<<< @@ -2494,7 +2624,7 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self */ } - /* "LCEngine.pyx":79 + /* "LCEngine2.pyx":79 * return "" * else: * return pv # <<<<<<<<<<<<<< @@ -2510,7 +2640,7 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self goto __pyx_L0; } - /* "LCEngine.pyx":73 + /* "LCEngine2.pyx":73 * * * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< @@ -2521,7 +2651,7 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngine.lc_pgn2pv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.lc_pgn2pv", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2529,7 +2659,7 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self return __pyx_r; } -/* "LCEngine.pyx":82 +/* "LCEngine2.pyx":82 * * * def posFC(pos): # <<<<<<<<<<<<<< @@ -2538,20 +2668,20 @@ static PyObject *__pyx_pf_8LCEngine_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_3posFC(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_3posFC = {"posFC", (PyCFunction)__pyx_pw_8LCEngine_3posFC, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_3posFC(PyObject *__pyx_self, PyObject *__pyx_v_pos) { +static PyObject *__pyx_pw_9LCEngine2_3posFC(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_3posFC = {"posFC", (PyCFunction)__pyx_pw_9LCEngine2_3posFC, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_3posFC(PyObject *__pyx_self, PyObject *__pyx_v_pos) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("posFC (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_2posFC(__pyx_self, ((PyObject *)__pyx_v_pos)); + __pyx_r = __pyx_pf_9LCEngine2_2posFC(__pyx_self, ((PyObject *)__pyx_v_pos)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos) { +static PyObject *__pyx_pf_9LCEngine2_2posFC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2559,7 +2689,7 @@ static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, P PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("posFC", 0); - /* "LCEngine.pyx":83 + /* "LCEngine2.pyx":83 * * def posFC(pos): * return pos / 8, pos % 8 # <<<<<<<<<<<<<< @@ -2583,7 +2713,7 @@ static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, P __pyx_t_3 = 0; goto __pyx_L0; - /* "LCEngine.pyx":82 + /* "LCEngine2.pyx":82 * * * def posFC(pos): # <<<<<<<<<<<<<< @@ -2596,7 +2726,7 @@ static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, P __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngine.posFC", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.posFC", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2604,7 +2734,7 @@ static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, P return __pyx_r; } -/* "LCEngine.pyx":85 +/* "LCEngine2.pyx":85 * return pos / 8, pos % 8 * * def FCpos(f, c): # <<<<<<<<<<<<<< @@ -2613,9 +2743,9 @@ static PyObject *__pyx_pf_8LCEngine_2posFC(CYTHON_UNUSED PyObject *__pyx_self, P */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_5FCpos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_5FCpos = {"FCpos", (PyCFunction)__pyx_pw_8LCEngine_5FCpos, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_5FCpos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_9LCEngine2_5FCpos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_5FCpos = {"FCpos", (PyCFunction)__pyx_pw_9LCEngine2_5FCpos, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_5FCpos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_f = 0; PyObject *__pyx_v_c = 0; PyObject *__pyx_r = 0; @@ -2629,17 +2759,20 @@ static PyObject *__pyx_pw_8LCEngine_5FCpos(PyObject *__pyx_self, PyObject *__pyx const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("FCpos", 1, 2, 2, 1); __PYX_ERR(0, 85, __pyx_L3_error) } @@ -2660,25 +2793,25 @@ static PyObject *__pyx_pw_8LCEngine_5FCpos(PyObject *__pyx_self, PyObject *__pyx __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("FCpos", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 85, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.FCpos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.FCpos", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_4FCpos(__pyx_self, __pyx_v_f, __pyx_v_c); + __pyx_r = __pyx_pf_9LCEngine2_4FCpos(__pyx_self, __pyx_v_f, __pyx_v_c); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_c) { +static PyObject *__pyx_pf_9LCEngine2_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("FCpos", 0); - /* "LCEngine.pyx":86 + /* "LCEngine2.pyx":86 * * def FCpos(f, c): * return f * 8 + c # <<<<<<<<<<<<<< @@ -2695,7 +2828,7 @@ static PyObject *__pyx_pf_8LCEngine_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, P __pyx_t_2 = 0; goto __pyx_L0; - /* "LCEngine.pyx":85 + /* "LCEngine2.pyx":85 * return pos / 8, pos % 8 * * def FCpos(f, c): # <<<<<<<<<<<<<< @@ -2707,7 +2840,7 @@ static PyObject *__pyx_pf_8LCEngine_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, P __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("LCEngine.FCpos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.FCpos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2715,7 +2848,7 @@ static PyObject *__pyx_pf_8LCEngine_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, P return __pyx_r; } -/* "LCEngine.pyx":88 +/* "LCEngine2.pyx":88 * return f * 8 + c * * def posA1(pos): # <<<<<<<<<<<<<< @@ -2724,20 +2857,20 @@ static PyObject *__pyx_pf_8LCEngine_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, P */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_7posA1(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_7posA1 = {"posA1", (PyCFunction)__pyx_pw_8LCEngine_7posA1, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_7posA1(PyObject *__pyx_self, PyObject *__pyx_v_pos) { +static PyObject *__pyx_pw_9LCEngine2_7posA1(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_7posA1 = {"posA1", (PyCFunction)__pyx_pw_9LCEngine2_7posA1, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_7posA1(PyObject *__pyx_self, PyObject *__pyx_v_pos) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("posA1 (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_6posA1(__pyx_self, ((PyObject *)__pyx_v_pos)); + __pyx_r = __pyx_pf_9LCEngine2_6posA1(__pyx_self, ((PyObject *)__pyx_v_pos)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos) { +static PyObject *__pyx_pf_9LCEngine2_6posA1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2745,7 +2878,7 @@ static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, P PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("posA1", 0); - /* "LCEngine.pyx":89 + /* "LCEngine2.pyx":89 * * def posA1(pos): * return chr(pos % 8 + 97) + chr(pos / 8 + 49) # <<<<<<<<<<<<<< @@ -2758,36 +2891,26 @@ static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, P __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_97, 97, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_pos, __pyx_int_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_pos, __pyx_int_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_49, 49, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_49, 49, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; - /* "LCEngine.pyx":88 + /* "LCEngine2.pyx":88 * return f * 8 + c * * def posA1(pos): # <<<<<<<<<<<<<< @@ -2800,7 +2923,7 @@ static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, P __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngine.posA1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.posA1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2808,7 +2931,7 @@ static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, P return __pyx_r; } -/* "LCEngine.pyx":91 +/* "LCEngine2.pyx":91 * return chr(pos % 8 + 97) + chr(pos / 8 + 49) * * def a1Pos(a1): # <<<<<<<<<<<<<< @@ -2817,20 +2940,20 @@ static PyObject *__pyx_pf_8LCEngine_6posA1(CYTHON_UNUSED PyObject *__pyx_self, P */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_9a1Pos(PyObject *__pyx_self, PyObject *__pyx_v_a1); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_9a1Pos = {"a1Pos", (PyCFunction)__pyx_pw_8LCEngine_9a1Pos, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_9a1Pos(PyObject *__pyx_self, PyObject *__pyx_v_a1) { +static PyObject *__pyx_pw_9LCEngine2_9a1Pos(PyObject *__pyx_self, PyObject *__pyx_v_a1); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_9a1Pos = {"a1Pos", (PyCFunction)__pyx_pw_9LCEngine2_9a1Pos, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_9a1Pos(PyObject *__pyx_self, PyObject *__pyx_v_a1) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("a1Pos (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8a1Pos(__pyx_self, ((PyObject *)__pyx_v_a1)); + __pyx_r = __pyx_pf_9LCEngine2_8a1Pos(__pyx_self, ((PyObject *)__pyx_v_a1)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1) { +static PyObject *__pyx_pf_9LCEngine2_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1) { int __pyx_v_f; int __pyx_v_c; PyObject *__pyx_r = NULL; @@ -2839,7 +2962,7 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P long __pyx_t_2; __Pyx_RefNannySetupContext("a1Pos", 0); - /* "LCEngine.pyx":93 + /* "LCEngine2.pyx":93 * def a1Pos(a1): * cdef int f, c * f = ord(a1[1]) - 49 # <<<<<<<<<<<<<< @@ -2848,11 +2971,11 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_2 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 93, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_2 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_f = (__pyx_t_2 - 49); - /* "LCEngine.pyx":94 + /* "LCEngine2.pyx":94 * cdef int f, c * f = ord(a1[1]) - 49 * c = ord(a1[0]) - 97 # <<<<<<<<<<<<<< @@ -2861,11 +2984,11 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_2 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_2 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_c = (__pyx_t_2 - 97); - /* "LCEngine.pyx":95 + /* "LCEngine2.pyx":95 * f = ord(a1[1]) - 49 * c = ord(a1[0]) - 97 * return f * 8 + c # <<<<<<<<<<<<<< @@ -2879,7 +3002,7 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":91 + /* "LCEngine2.pyx":91 * return chr(pos % 8 + 97) + chr(pos / 8 + 49) * * def a1Pos(a1): # <<<<<<<<<<<<<< @@ -2890,7 +3013,7 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.a1Pos", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.a1Pos", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2898,7 +3021,7 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P return __pyx_r; } -/* "LCEngine.pyx":97 +/* "LCEngine2.pyx":97 * return f * 8 + c * * def move2num(a1h8q): # <<<<<<<<<<<<<< @@ -2907,20 +3030,20 @@ static PyObject *__pyx_pf_8LCEngine_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, P */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_11move2num(PyObject *__pyx_self, PyObject *__pyx_v_a1h8q); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_11move2num = {"move2num", (PyCFunction)__pyx_pw_8LCEngine_11move2num, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_11move2num(PyObject *__pyx_self, PyObject *__pyx_v_a1h8q) { +static PyObject *__pyx_pw_9LCEngine2_11move2num(PyObject *__pyx_self, PyObject *__pyx_v_a1h8q); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_11move2num = {"move2num", (PyCFunction)__pyx_pw_9LCEngine2_11move2num, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_11move2num(PyObject *__pyx_self, PyObject *__pyx_v_a1h8q) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("move2num (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_10move2num(__pyx_self, ((PyObject *)__pyx_v_a1h8q)); + __pyx_r = __pyx_pf_9LCEngine2_10move2num(__pyx_self, ((PyObject *)__pyx_v_a1h8q)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1h8q) { +static PyObject *__pyx_pf_9LCEngine2_10move2num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1h8q) { PyObject *__pyx_v_num = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2934,7 +3057,7 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel int __pyx_t_8; __Pyx_RefNannySetupContext("move2num", 0); - /* "LCEngine.pyx":98 + /* "LCEngine2.pyx":98 * * def move2num(a1h8q): * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 # <<<<<<<<<<<<<< @@ -3051,25 +3174,25 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel __pyx_v_num = __pyx_t_2; __pyx_t_2 = 0; - /* "LCEngine.pyx":99 + /* "LCEngine2.pyx":99 * def move2num(a1h8q): * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 * if len(a1h8q)>4: # <<<<<<<<<<<<<< * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 * return num */ - __pyx_t_7 = PyObject_Length(__pyx_v_a1h8q); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_t_7 = PyObject_Length(__pyx_v_a1h8q); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 99, __pyx_L1_error) __pyx_t_8 = ((__pyx_t_7 > 4) != 0); if (__pyx_t_8) { - /* "LCEngine.pyx":100 + /* "LCEngine2.pyx":100 * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 * if len(a1h8q)>4: * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 # <<<<<<<<<<<<<< * return num * */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_q, __pyx_int_1) < 0) __PYX_ERR(0, 100, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_r, __pyx_int_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) @@ -3093,7 +3216,7 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_5); __pyx_t_5 = 0; - /* "LCEngine.pyx":99 + /* "LCEngine2.pyx":99 * def move2num(a1h8q): * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 * if len(a1h8q)>4: # <<<<<<<<<<<<<< @@ -3102,7 +3225,7 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel */ } - /* "LCEngine.pyx":101 + /* "LCEngine2.pyx":101 * if len(a1h8q)>4: * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 * return num # <<<<<<<<<<<<<< @@ -3114,7 +3237,7 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel __pyx_r = __pyx_v_num; goto __pyx_L0; - /* "LCEngine.pyx":97 + /* "LCEngine2.pyx":97 * return f * 8 + c * * def move2num(a1h8q): # <<<<<<<<<<<<<< @@ -3130,7 +3253,7 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("LCEngine.move2num", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.move2num", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_num); @@ -3139,7 +3262,7 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "LCEngine.pyx":103 +/* "LCEngine2.pyx":103 * return num * * def num2move(num): # <<<<<<<<<<<<<< @@ -3148,20 +3271,20 @@ static PyObject *__pyx_pf_8LCEngine_10move2num(CYTHON_UNUSED PyObject *__pyx_sel */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_13num2move(PyObject *__pyx_self, PyObject *__pyx_v_num); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_13num2move = {"num2move", (PyCFunction)__pyx_pw_8LCEngine_13num2move, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_13num2move(PyObject *__pyx_self, PyObject *__pyx_v_num) { +static PyObject *__pyx_pw_9LCEngine2_13num2move(PyObject *__pyx_self, PyObject *__pyx_v_num); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_13num2move = {"num2move", (PyCFunction)__pyx_pw_9LCEngine2_13num2move, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_13num2move(PyObject *__pyx_self, PyObject *__pyx_v_num) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num2move (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_12num2move(__pyx_self, ((PyObject *)__pyx_v_num)); + __pyx_r = __pyx_pf_9LCEngine2_12num2move(__pyx_self, ((PyObject *)__pyx_v_num)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num) { +static PyObject *__pyx_pf_9LCEngine2_12num2move(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num) { PyObject *__pyx_v_a1 = NULL; PyObject *__pyx_v_h8 = NULL; PyObject *__pyx_v_q = NULL; @@ -3176,7 +3299,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_RefNannySetupContext("num2move", 0); __Pyx_INCREF(__pyx_v_num); - /* "LCEngine.pyx":104 + /* "LCEngine2.pyx":104 * * def num2move(num): * a1 = posA1(num%64) # <<<<<<<<<<<<<< @@ -3236,7 +3359,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __pyx_v_a1 = __pyx_t_1; __pyx_t_1 = 0; - /* "LCEngine.pyx":105 + /* "LCEngine2.pyx":105 * def num2move(num): * a1 = posA1(num%64) * num /= 64 # <<<<<<<<<<<<<< @@ -3248,7 +3371,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":106 + /* "LCEngine2.pyx":106 * a1 = posA1(num%64) * num /= 64 * h8 = posA1(num%64) # <<<<<<<<<<<<<< @@ -3308,7 +3431,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __pyx_v_h8 = __pyx_t_1; __pyx_t_1 = 0; - /* "LCEngine.pyx":107 + /* "LCEngine2.pyx":107 * num /= 64 * h8 = posA1(num%64) * num /= 64 # <<<<<<<<<<<<<< @@ -3320,7 +3443,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":108 + /* "LCEngine2.pyx":108 * h8 = posA1(num%64) * num /= 64 * if num: # <<<<<<<<<<<<<< @@ -3330,14 +3453,14 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_num); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) if (__pyx_t_6) { - /* "LCEngine.pyx":109 + /* "LCEngine2.pyx":109 * num /= 64 * if num: * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) # <<<<<<<<<<<<<< * else: * q = "" */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, __pyx_n_s_q) < 0) __PYX_ERR(0, 109, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, __pyx_n_s_r) < 0) __PYX_ERR(0, 109, __pyx_L1_error) @@ -3349,7 +3472,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __pyx_v_q = __pyx_t_2; __pyx_t_2 = 0; - /* "LCEngine.pyx":108 + /* "LCEngine2.pyx":108 * h8 = posA1(num%64) * num /= 64 * if num: # <<<<<<<<<<<<<< @@ -3359,7 +3482,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel goto __pyx_L3; } - /* "LCEngine.pyx":111 + /* "LCEngine2.pyx":111 * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) * else: * q = "" # <<<<<<<<<<<<<< @@ -3372,12 +3495,12 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel } __pyx_L3:; - /* "LCEngine.pyx":112 + /* "LCEngine2.pyx":112 * else: * q = "" * return a1 + h8 + q # <<<<<<<<<<<<<< * - * def liK(npos): + * def liN(npos): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyNumber_Add(__pyx_v_a1, __pyx_v_h8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) @@ -3389,7 +3512,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":103 + /* "LCEngine2.pyx":103 * return num * * def num2move(num): # <<<<<<<<<<<<<< @@ -3404,7 +3527,7 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("LCEngine.num2move", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.num2move", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_a1); @@ -3416,29 +3539,29 @@ static PyObject *__pyx_pf_8LCEngine_12num2move(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "LCEngine.pyx":114 +/* "LCEngine2.pyx":114 * return a1 + h8 + q * - * def liK(npos): # <<<<<<<<<<<<<< + * def liN(npos): # <<<<<<<<<<<<<< * cdef int fil, col, ft, ct - * liM = [] + * */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_15liK(PyObject *__pyx_self, PyObject *__pyx_v_npos); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_15liK = {"liK", (PyCFunction)__pyx_pw_8LCEngine_15liK, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_15liK(PyObject *__pyx_self, PyObject *__pyx_v_npos) { +static PyObject *__pyx_pw_9LCEngine2_15liN(PyObject *__pyx_self, PyObject *__pyx_v_npos); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_15liN = {"liN", (PyCFunction)__pyx_pw_9LCEngine2_15liN, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_15liN(PyObject *__pyx_self, PyObject *__pyx_v_npos) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liK (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_14liK(__pyx_self, ((PyObject *)__pyx_v_npos)); + __Pyx_RefNannySetupContext("liN (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_14liN(__pyx_self, ((PyObject *)__pyx_v_npos)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos) { +static PyObject *__pyx_pf_9LCEngine2_14liN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos) { int __pyx_v_fil; int __pyx_v_col; int __pyx_v_ft; @@ -3446,6 +3569,7 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py PyObject *__pyx_v_liM = NULL; PyObject *__pyx_v_fi = NULL; PyObject *__pyx_v_ci = NULL; + PyObject *__pyx_v_t = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3462,26 +3586,14 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; int __pyx_t_14; - __Pyx_RefNannySetupContext("liK", 0); - - /* "LCEngine.pyx":116 - * def liK(npos): - * cdef int fil, col, ft, ct - * liM = [] # <<<<<<<<<<<<<< - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("liN", 0); - /* "LCEngine.pyx":117 + /* "LCEngine2.pyx":117 * cdef int fil, col, ft, ct - * liM = [] + * * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - * ft = fil + fi + * liM = [] + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -3530,11 +3642,7 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); @@ -3585,10 +3693,22 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py __pyx_v_fil = __pyx_t_6; __pyx_v_col = __pyx_t_7; - /* "LCEngine.pyx":118 - * liM = [] + /* "LCEngine2.pyx":118 + * + * fil, col = posFC(npos) + * liM = [] # <<<<<<<<<<<<<< + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): + * ft = fil + fi + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_liM = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "LCEngine2.pyx":119 * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): # <<<<<<<<<<<<<< + * liM = [] + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< * ft = fil + fi * ct = col + ci */ @@ -3596,22 +3716,18 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py for (;;) { if (__pyx_t_8 >= 8) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif if (likely(__pyx_t_4 != Py_None)) { PyObject* sequence = __pyx_t_4; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif + Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 118, __pyx_L1_error) + __PYX_ERR(0, 119, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); @@ -3619,58 +3735,58 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 119, __pyx_L1_error) } __Pyx_XDECREF_SET(__pyx_v_fi, __pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_ci, __pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":119 - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): + /* "LCEngine2.pyx":120 + * liM = [] + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): * ft = fil + fi # <<<<<<<<<<<<<< * ct = col + ci * if ft < 0 or ft > 7 or ct < 0 or ct > 7: */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_fi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_fi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_ft = __pyx_t_7; - /* "LCEngine.pyx":120 - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): + /* "LCEngine2.pyx":121 + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): * ft = fil + fi * ct = col + ci # <<<<<<<<<<<<<< * if ft < 0 or ft > 7 or ct < 0 or ct > 7: * continue */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_ci); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_ci); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_ct = __pyx_t_7; - /* "LCEngine.pyx":121 + /* "LCEngine2.pyx":122 * ft = fil + fi * ct = col + ci * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< * continue - * liM.append(FCpos(ft, ct)) + * */ __pyx_t_10 = ((__pyx_v_ft < 0) != 0); if (!__pyx_t_10) { @@ -3695,36 +3811,36 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py __pyx_L8_bool_binop_done:; if (__pyx_t_9) { - /* "LCEngine.pyx":122 + /* "LCEngine2.pyx":123 * ct = col + ci * if ft < 0 or ft > 7 or ct < 0 or ct > 7: * continue # <<<<<<<<<<<<<< - * liM.append(FCpos(ft, ct)) - * return tuple(liM) + * + * t = FCpos(ft, ct) */ goto __pyx_L5_continue; - /* "LCEngine.pyx":121 + /* "LCEngine2.pyx":122 * ft = fil + fi * ct = col + ci * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< * continue - * liM.append(FCpos(ft, ct)) + * */ } - /* "LCEngine.pyx":123 - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: + /* "LCEngine2.pyx":125 * continue - * liM.append(FCpos(ft, ct)) # <<<<<<<<<<<<<< - * return tuple(liM) * + * t = FCpos(ft, ct) # <<<<<<<<<<<<<< + * liM.append(t) + * return tuple(liM) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = NULL; __pyx_t_7 = 0; @@ -3741,7 +3857,7 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3751,7 +3867,7 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3759,7 +3875,7 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py } else #endif { - __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (__pyx_t_12) { __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; @@ -3770,18 +3886,27 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_11); __pyx_t_2 = 0; __pyx_t_11 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_t_4); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":118 - * liM = [] + /* "LCEngine2.pyx":126 + * + * t = FCpos(ft, ct) + * liM.append(t) # <<<<<<<<<<<<<< + * return tuple(liM) + * + */ + __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_t); if (unlikely(__pyx_t_14 == ((int)-1))) __PYX_ERR(0, 126, __pyx_L1_error) + + /* "LCEngine2.pyx":119 * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): # <<<<<<<<<<<<<< + * liM = [] + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< * ft = fil + fi * ct = col + ci */ @@ -3789,26 +3914,26 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":124 - * continue - * liM.append(FCpos(ft, ct)) + /* "LCEngine2.pyx":127 + * t = FCpos(ft, ct) + * liM.append(t) * return tuple(liM) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":114 + /* "LCEngine2.pyx":114 * return a1 + h8 + q * - * def liK(npos): # <<<<<<<<<<<<<< + * def liN(npos): # <<<<<<<<<<<<<< * cdef int fil, col, ft, ct - * liM = [] + * */ /* function exit code */ @@ -3820,3479 +3945,2521 @@ static PyObject *__pyx_pf_8LCEngine_14liK(CYTHON_UNUSED PyObject *__pyx_self, Py __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("LCEngine.liK", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.liN", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_liM); __Pyx_XDECREF(__pyx_v_fi); __Pyx_XDECREF(__pyx_v_ci); + __Pyx_XDECREF(__pyx_v_t); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":127 - * +/* "LCEngine2.pyx":130 * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct * + * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< + * if nv > mx: + * return [] */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_17liBR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_17liBR = {"liBR", (PyCFunction)__pyx_pw_8LCEngine_17liBR, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_17liBR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_npos = 0; - PyObject *__pyx_v_fi = 0; - PyObject *__pyx_v_ci = 0; +static PyObject *__pyx_pw_9LCEngine2_17knightmoves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_17knightmoves = {"knightmoves", (PyCFunction)__pyx_pw_9LCEngine2_17knightmoves, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_17knightmoves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_a = 0; + PyObject *__pyx_v_b = 0; + PyObject *__pyx_v_no = 0; + PyObject *__pyx_v_nv = 0; + PyObject *__pyx_v_mx = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liBR (wrapper)", 0); + __Pyx_RefNannySetupContext("knightmoves (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npos,&__pyx_n_s_fi,&__pyx_n_s_ci,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_no,&__pyx_n_s_nv,&__pyx_n_s_mx,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npos)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("liBR", 1, 3, 3, 1); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 1); __PYX_ERR(0, 130, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ci)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 2); __PYX_ERR(0, 130, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_nv)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("liBR", 1, 3, 3, 2); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 3); __PYX_ERR(0, 130, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 4); __PYX_ERR(0, 130, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liBR") < 0)) __PYX_ERR(0, 127, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "knightmoves") < 0)) __PYX_ERR(0, 130, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_npos = values[0]; - __pyx_v_fi = values[1]; - __pyx_v_ci = values[2]; + __pyx_v_a = values[0]; + __pyx_v_b = values[1]; + __pyx_v_no = values[2]; + __pyx_v_nv = values[3]; + __pyx_v_mx = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("liBR", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 130, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.liBR", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.knightmoves", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_16liBR(__pyx_self, __pyx_v_npos, __pyx_v_fi, __pyx_v_ci); + __pyx_r = __pyx_pf_9LCEngine2_16knightmoves(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_no, __pyx_v_nv, __pyx_v_mx); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_16liBR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_fi, PyObject *__pyx_v_ci) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_t = NULL; +static PyObject *__pyx_pf_9LCEngine2_16knightmoves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_no, PyObject *__pyx_v_nv, PyObject *__pyx_v_mx) { + PyObject *__pyx_v_lia = NULL; + PyObject *__pyx_v_lib = NULL; + PyObject *__pyx_v_li = NULL; + PyObject *__pyx_v_x = NULL; + PyObject *__pyx_v_y = NULL; + PyObject *__pyx_v_nx = NULL; + PyObject *__pyx_v_f = NULL; + Py_ssize_t __pyx_v_xmin; + PyObject *__pyx_v_lidef = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; + Py_ssize_t __pyx_t_7; + PyObject *(*__pyx_t_8)(PyObject *); int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - __Pyx_RefNannySetupContext("liBR", 0); + int __pyx_t_10; + Py_ssize_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + int __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + __Pyx_RefNannySetupContext("knightmoves", 0); - /* "LCEngine.pyx":130 - * cdef int fil, col, ft, ct + /* "LCEngine2.pyx":131 * - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * liM = [] - * ft = fil + fi + * def knightmoves(a, b, no, nv, mx): + * if nv > mx: # <<<<<<<<<<<<<< + * return [] + * lia = liN(a) */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_1 = PyObject_RichCompare(__pyx_v_nv, __pyx_v_mx, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "LCEngine2.pyx":132 + * def knightmoves(a, b, no, nv, mx): + * if nv > mx: + * return [] # <<<<<<<<<<<<<< + * lia = liN(a) + * if b in lia: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 130, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 130, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 130, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; - - /* "LCEngine.pyx":131 - * - * fil, col = posFC(npos) - * liM = [] # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":132 - * fil, col = posFC(npos) - * liM = [] - * ft = fil + fi # <<<<<<<<<<<<<< - * ct = col + ci - * while True: - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_fi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngine.pyx":133 - * liM = [] - * ft = fil + fi - * ct = col + ci # <<<<<<<<<<<<<< - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_ci); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_ct = __pyx_t_7; - - /* "LCEngine.pyx":134 - * ft = fil + fi - * ct = col + ci - * while True: # <<<<<<<<<<<<<< - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * break - */ - while (1) { - - /* "LCEngine.pyx":135 - * ct = col + ci - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_9 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = ((__pyx_v_ct > 7) != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L8_bool_binop_done:; - if (__pyx_t_8) { - - /* "LCEngine.pyx":136 - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * break # <<<<<<<<<<<<<< - * - * t = FCpos(ft, ct) - */ - goto __pyx_L6_break; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":135 - * ct = col + ci - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * break + /* "LCEngine2.pyx":131 * + * def knightmoves(a, b, no, nv, mx): + * if nv > mx: # <<<<<<<<<<<<<< + * return [] + * lia = liN(a) */ - } + } - /* "LCEngine.pyx":138 - * break - * - * t = FCpos(ft, ct) # <<<<<<<<<<<<<< - * liM.append(t) - * ft += fi + /* "LCEngine2.pyx":133 + * if nv > mx: + * return [] + * lia = liN(a) # <<<<<<<<<<<<<< + * if b in lia: + * return [[a, b]] */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); } + } + if (!__pyx_t_4) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_a}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_a}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_11 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_7, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_a); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_1); - __pyx_t_1 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_lia = __pyx_t_1; + __pyx_t_1 = 0; - /* "LCEngine.pyx":139 - * - * t = FCpos(ft, ct) - * liM.append(t) # <<<<<<<<<<<<<< - * ft += fi - * ct += ci + /* "LCEngine2.pyx":134 + * return [] + * lia = liN(a) + * if b in lia: # <<<<<<<<<<<<<< + * return [[a, b]] + * lib = liN(b) */ - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_t); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_b, __pyx_v_lia, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_6 = (__pyx_t_2 != 0); + if (__pyx_t_6) { - /* "LCEngine.pyx":140 - * t = FCpos(ft, ct) - * liM.append(t) - * ft += fi # <<<<<<<<<<<<<< - * ct += ci - * return tuple(liM) + /* "LCEngine2.pyx":135 + * lia = liN(a) + * if b in lia: + * return [[a, b]] # <<<<<<<<<<<<<< + * lib = liN(b) + * li = [] */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_v_fi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ft = __pyx_t_7; + __Pyx_INCREF(__pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); + __Pyx_INCREF(__pyx_v_b); + __Pyx_GIVEREF(__pyx_v_b); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_b); + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":141 - * liM.append(t) - * ft += fi - * ct += ci # <<<<<<<<<<<<<< - * return tuple(liM) - * + /* "LCEngine2.pyx":134 + * return [] + * lia = liN(a) + * if b in lia: # <<<<<<<<<<<<<< + * return [[a, b]] + * lib = liN(b) */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_ci); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_ct = __pyx_t_7; } - __pyx_L6_break:; - /* "LCEngine.pyx":142 - * ft += fi - * ct += ci - * return tuple(liM) # <<<<<<<<<<<<<< - * - * + /* "LCEngine2.pyx":136 + * if b in lia: + * return [[a, b]] + * lib = liN(b) # <<<<<<<<<<<<<< + * li = [] + * for x in lia: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":127 - * - * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("LCEngine.liBR", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_19liN(PyObject *__pyx_self, PyObject *__pyx_v_npos); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_19liN = {"liN", (PyCFunction)__pyx_pw_8LCEngine_19liN, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_19liN(PyObject *__pyx_self, PyObject *__pyx_v_npos) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liN (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_18liN(__pyx_self, ((PyObject *)__pyx_v_npos)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_18liN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_fi = NULL; - PyObject *__pyx_v_ci = NULL; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - __Pyx_RefNannySetupContext("liN", 0); - - /* "LCEngine.pyx":148 - * cdef int fil, col, ft, ct - * - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_1, function); } } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); } else { #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_b}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_b}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); } else #endif { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(__pyx_v_b); + __Pyx_GIVEREF(__pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_b); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 148, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 148, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 148, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_lib = __pyx_t_3; + __pyx_t_3 = 0; - /* "LCEngine.pyx":149 - * - * fil, col = posFC(npos) - * liM = [] # <<<<<<<<<<<<<< - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - * ft = fil + fi + /* "LCEngine2.pyx":137 + * return [[a, b]] + * lib = liN(b) + * li = [] # <<<<<<<<<<<<<< + * for x in lia: + * if x not in no and x in lib: */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_li = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "LCEngine.pyx":150 - * fil, col = posFC(npos) - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci + /* "LCEngine2.pyx":138 + * lib = liN(b) + * li = [] + * for x in lia: # <<<<<<<<<<<<<< + * if x not in no and x in lib: + * li.append([a, x, b]) */ - __pyx_t_1 = __pyx_tuple__21; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; + if (likely(PyList_CheckExact(__pyx_v_lia)) || PyTuple_CheckExact(__pyx_v_lia)) { + __pyx_t_3 = __pyx_v_lia; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lia); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 138, __pyx_L1_error) + } for (;;) { - if (__pyx_t_8 >= 8) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - if (likely(__pyx_t_4 != Py_None)) { - PyObject* sequence = __pyx_t_4; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 150, __pyx_L1_error) + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 138, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 138, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_1 = __pyx_t_8(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 138, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF_SET(__pyx_v_fi, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_ci, __pyx_t_3); - __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":151 - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - * ft = fil + fi # <<<<<<<<<<<<<< - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: + /* "LCEngine2.pyx":139 + * li = [] + * for x in lia: + * if x not in no and x in lib: # <<<<<<<<<<<<<< + * li.append([a, x, b]) + * if li: */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_fi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngine.pyx":152 - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - * ft = fil + fi - * ct = col + ci # <<<<<<<<<<<<<< - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_ci); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ct = __pyx_t_7; - - /* "LCEngine.pyx":153 - * ft = fil + fi - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_10 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_10) { + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_2 != 0); + if (__pyx_t_9) { } else { - __pyx_t_9 = __pyx_t_10; + __pyx_t_6 = __pyx_t_9; goto __pyx_L8_bool_binop_done; } - __pyx_t_10 = ((__pyx_v_ct > 7) != 0); - __pyx_t_9 = __pyx_t_10; + __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_lib, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_9 != 0); + __pyx_t_6 = __pyx_t_2; __pyx_L8_bool_binop_done:; - if (__pyx_t_9) { + if (__pyx_t_6) { - /* "LCEngine.pyx":154 - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue # <<<<<<<<<<<<<< - * - * t = FCpos(ft, ct) + /* "LCEngine2.pyx":140 + * for x in lia: + * if x not in no and x in lib: + * li.append([a, x, b]) # <<<<<<<<<<<<<< + * if li: + * return li */ - goto __pyx_L5_continue; + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); + __Pyx_INCREF(__pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_x); + __Pyx_INCREF(__pyx_v_b); + __Pyx_GIVEREF(__pyx_v_b); + PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_b); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_1); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":153 - * ft = fil + fi - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * continue - * + /* "LCEngine2.pyx":139 + * li = [] + * for x in lia: + * if x not in no and x in lib: # <<<<<<<<<<<<<< + * li.append([a, x, b]) + * if li: */ } - /* "LCEngine.pyx":156 - * continue - * - * t = FCpos(ft, ct) # <<<<<<<<<<<<<< - * liM.append(t) - * return tuple(liM) + /* "LCEngine2.pyx":138 + * lib = liN(b) + * li = [] + * for x in lia: # <<<<<<<<<<<<<< + * if x not in no and x in lib: + * li.append([a, x, b]) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_11); - __pyx_t_2 = 0; - __pyx_t_11 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":157 - * - * t = FCpos(ft, ct) - * liM.append(t) # <<<<<<<<<<<<<< - * return tuple(liM) + /* "LCEngine2.pyx":141 + * if x not in no and x in lib: + * li.append([a, x, b]) + * if li: # <<<<<<<<<<<<<< + * return li * */ - __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_t); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 157, __pyx_L1_error) + __pyx_t_6 = (PyList_GET_SIZE(__pyx_v_li) != 0); + if (__pyx_t_6) { - /* "LCEngine.pyx":150 - * fil, col = posFC(npos) - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci + /* "LCEngine2.pyx":142 + * li.append([a, x, b]) + * if li: + * return li # <<<<<<<<<<<<<< + * + * li = [] */ - __pyx_L5_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_li); + __pyx_r = __pyx_v_li; + goto __pyx_L0; - /* "LCEngine.pyx":158 - * t = FCpos(ft, ct) - * liM.append(t) - * return tuple(liM) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":141 + * if x not in no and x in lib: + * li.append([a, x, b]) + * if li: # <<<<<<<<<<<<<< + * return li * - * def liP(npos, siW): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + } - /* "LCEngine.pyx":145 - * + /* "LCEngine2.pyx":144 + * return li * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct + * li = [] # <<<<<<<<<<<<<< * + * for x in lia: */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_li, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("LCEngine.liN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_fi); - __Pyx_XDECREF(__pyx_v_ci); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc + /* "LCEngine2.pyx":146 + * li = [] * + * for x in lia: # <<<<<<<<<<<<<< + * for y in lib: + * if x not in no and y not in no: */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_21liP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_21liP = {"liP", (PyCFunction)__pyx_pw_8LCEngine_21liP, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_21liP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_npos = 0; - PyObject *__pyx_v_siW = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liP (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npos,&__pyx_n_s_siW,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; + if (likely(PyList_CheckExact(__pyx_v_lia)) || PyTuple_CheckExact(__pyx_v_lia)) { + __pyx_t_3 = __pyx_v_lia; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lia); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_8)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 146, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npos)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_siW)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liP", 1, 2, 2, 1); __PYX_ERR(0, 160, __pyx_L3_error) + } else { + __pyx_t_1 = __pyx_t_8(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 146, __pyx_L1_error) } + break; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liP") < 0)) __PYX_ERR(0, 160, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + __Pyx_GOTREF(__pyx_t_1); } - __pyx_v_npos = values[0]; - __pyx_v_siW = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("liP", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 160, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.liP", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_20liP(__pyx_self, __pyx_v_npos, __pyx_v_siW); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_20liP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_siW) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - int __pyx_v_inc; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_liX = NULL; - long __pyx_v_filaIni; - PyObject *__pyx_v_salto = NULL; - PyObject *__pyx_v_sig = NULL; - PyObject *__pyx_v_sig2 = NULL; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_t_13; - PyObject *__pyx_t_14 = NULL; - __Pyx_RefNannySetupContext("liP", 0); + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":163 - * cdef int fil, col, ft, ct, inc + /* "LCEngine2.pyx":147 * - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * liM = [] - * liX = [] + * for x in lia: + * for y in lib: # <<<<<<<<<<<<<< + * if x not in no and y not in no: + * nx = no[:] */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 163, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + if (likely(PyList_CheckExact(__pyx_v_lib)) || PyTuple_CheckExact(__pyx_v_lib)) { + __pyx_t_1 = __pyx_v_lib; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; + __pyx_t_12 = NULL; } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); + __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_lib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 147, __pyx_L1_error) } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; - - /* "LCEngine.pyx":164 - * - * fil, col = posFC(npos) - * liM = [] # <<<<<<<<<<<<<< - * liX = [] - * if siW: - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":165 - * fil, col = posFC(npos) - * liM = [] - * liX = [] # <<<<<<<<<<<<<< - * if siW: - * filaIni = 1 - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liX = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":166 - * liM = [] - * liX = [] - * if siW: # <<<<<<<<<<<<<< - * filaIni = 1 - * salto = +1 - */ - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_siW); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) - if (__pyx_t_8) { - - /* "LCEngine.pyx":167 - * liX = [] - * if siW: - * filaIni = 1 # <<<<<<<<<<<<<< - * salto = +1 - * else: - */ - __pyx_v_filaIni = 1; + for (;;) { + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 147, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 147, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_12(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 147, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":168 - * if siW: - * filaIni = 1 - * salto = +1 # <<<<<<<<<<<<<< - * else: - * filaIni = 6 + /* "LCEngine2.pyx":148 + * for x in lia: + * for y in lib: + * if x not in no and y not in no: # <<<<<<<<<<<<<< + * nx = no[:] + * nx.append(x) */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_salto = __pyx_int_1; + __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_9 = (__pyx_t_2 != 0); + if (__pyx_t_9) { + } else { + __pyx_t_6 = __pyx_t_9; + goto __pyx_L16_bool_binop_done; + } + __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_y, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_2 = (__pyx_t_9 != 0); + __pyx_t_6 = __pyx_t_2; + __pyx_L16_bool_binop_done:; + if (__pyx_t_6) { - /* "LCEngine.pyx":166 - * liM = [] - * liX = [] - * if siW: # <<<<<<<<<<<<<< - * filaIni = 1 - * salto = +1 + /* "LCEngine2.pyx":149 + * for y in lib: + * if x not in no and y not in no: + * nx = no[:] # <<<<<<<<<<<<<< + * nx.append(x) + * nx.append(y) */ - goto __pyx_L5; - } + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_no, 0, 0, NULL, NULL, &__pyx_slice__13, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":170 - * salto = +1 - * else: - * filaIni = 6 # <<<<<<<<<<<<<< - * salto = -1 - * sig = FCpos(fil + salto, col) + /* "LCEngine2.pyx":150 + * if x not in no and y not in no: + * nx = no[:] + * nx.append(x) # <<<<<<<<<<<<<< + * nx.append(y) + * f = knightmoves(x, y, nx, nv + 1, mx) */ - /*else*/ { - __pyx_v_filaIni = 6; + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_nx, __pyx_v_x); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 150, __pyx_L1_error) - /* "LCEngine.pyx":171 - * else: - * filaIni = 6 - * salto = -1 # <<<<<<<<<<<<<< - * sig = FCpos(fil + salto, col) - * liM.append(sig) + /* "LCEngine2.pyx":151 + * nx = no[:] + * nx.append(x) + * nx.append(y) # <<<<<<<<<<<<<< + * f = knightmoves(x, y, nx, nv + 1, mx) + * if f: */ - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_v_salto = __pyx_int_neg_1; - } - __pyx_L5:; + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_nx, __pyx_v_y); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 151, __pyx_L1_error) - /* "LCEngine.pyx":172 - * filaIni = 6 - * salto = -1 - * sig = FCpos(fil + salto, col) # <<<<<<<<<<<<<< - * liM.append(sig) - * + /* "LCEngine2.pyx":152 + * nx.append(x) + * nx.append(y) + * f = knightmoves(x, y, nx, nv + 1, mx) # <<<<<<<<<<<<<< + * if f: + * li.extend(f) */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_salto); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_2); - __pyx_t_3 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_sig = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_v_nv, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = NULL; + __pyx_t_15 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_14)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_14); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_15 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_v_x, __pyx_v_y, __pyx_v_nx, __pyx_t_13, __pyx_v_mx}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 5+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_v_x, __pyx_v_y, __pyx_v_nx, __pyx_t_13, __pyx_v_mx}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 5+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } else + #endif + { + __pyx_t_16 = PyTuple_New(5+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_14) { + __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL; + } + __Pyx_INCREF(__pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_v_x); + __Pyx_INCREF(__pyx_v_y); + __Pyx_GIVEREF(__pyx_v_y); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_y); + __Pyx_INCREF(__pyx_v_nx); + __Pyx_GIVEREF(__pyx_v_nx); + PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_15, __pyx_v_nx); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_15, __pyx_t_13); + __Pyx_INCREF(__pyx_v_mx); + __Pyx_GIVEREF(__pyx_v_mx); + PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_15, __pyx_v_mx); + __pyx_t_13 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":173 - * salto = -1 - * sig = FCpos(fil + salto, col) - * liM.append(sig) # <<<<<<<<<<<<<< - * - * if fil == filaIni: + /* "LCEngine2.pyx":153 + * nx.append(y) + * f = knightmoves(x, y, nx, nv + 1, mx) + * if f: # <<<<<<<<<<<<<< + * li.extend(f) + * if not li: */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_sig); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_f); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 153, __pyx_L1_error) + if (__pyx_t_6) { - /* "LCEngine.pyx":175 - * liM.append(sig) - * - * if fil == filaIni: # <<<<<<<<<<<<<< - * sig2 = FCpos(fil + salto * 2, col) - * liM.append(sig2) + /* "LCEngine2.pyx":154 + * f = knightmoves(x, y, nx, nv + 1, mx) + * if f: + * li.extend(f) # <<<<<<<<<<<<<< + * if not li: + * return li */ - __pyx_t_8 = ((__pyx_v_fil == __pyx_v_filaIni) != 0); - if (__pyx_t_8) { + __pyx_t_10 = __Pyx_PyList_Extend(__pyx_v_li, __pyx_v_f); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 154, __pyx_L1_error) - /* "LCEngine.pyx":176 - * - * if fil == filaIni: - * sig2 = FCpos(fil + salto * 2, col) # <<<<<<<<<<<<<< - * liM.append(sig2) - * + /* "LCEngine2.pyx":153 + * nx.append(y) + * f = knightmoves(x, y, nx, nv + 1, mx) + * if f: # <<<<<<<<<<<<<< + * li.extend(f) + * if not li: + */ + } + + /* "LCEngine2.pyx":148 + * for x in lia: + * for y in lib: + * if x not in no and y not in no: # <<<<<<<<<<<<<< + * nx = no[:] + * nx.append(x) */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_salto, __pyx_int_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL; } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_2); - __pyx_t_3 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_sig2 = __pyx_t_1; - __pyx_t_1 = 0; - /* "LCEngine.pyx":177 - * if fil == filaIni: - * sig2 = FCpos(fil + salto * 2, col) - * liM.append(sig2) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":147 * - * for inc in ( +1, -1 ): + * for x in lia: + * for y in lib: # <<<<<<<<<<<<<< + * if x not in no and y not in no: + * nx = no[:] */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_sig2); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 177, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":175 - * liM.append(sig) + /* "LCEngine2.pyx":146 + * li = [] * - * if fil == filaIni: # <<<<<<<<<<<<<< - * sig2 = FCpos(fil + salto * 2, col) - * liM.append(sig2) + * for x in lia: # <<<<<<<<<<<<<< + * for y in lib: + * if x not in no and y not in no: */ } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":179 - * liM.append(sig2) - * - * for inc in ( +1, -1 ): # <<<<<<<<<<<<<< - * ft = fil + salto - * ct = col + inc + /* "LCEngine2.pyx":155 + * if f: + * li.extend(f) + * if not li: # <<<<<<<<<<<<<< + * return li + * xmin = 9999 */ - __pyx_t_1 = __pyx_tuple__22; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; - for (;;) { - if (__pyx_t_12 >= 2) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 179, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_inc = __pyx_t_7; + __pyx_t_6 = (PyList_GET_SIZE(__pyx_v_li) != 0); + __pyx_t_2 = ((!__pyx_t_6) != 0); + if (__pyx_t_2) { - /* "LCEngine.pyx":180 - * - * for inc in ( +1, -1 ): - * ft = fil + salto # <<<<<<<<<<<<<< - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): + /* "LCEngine2.pyx":156 + * li.extend(f) + * if not li: + * return li # <<<<<<<<<<<<<< + * xmin = 9999 + * for x in li: */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyNumber_Add(__pyx_t_4, __pyx_v_salto); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_ft = __pyx_t_7; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_li); + __pyx_r = __pyx_v_li; + goto __pyx_L0; - /* "LCEngine.pyx":181 - * for inc in ( +1, -1 ): - * ft = fil + salto - * ct = col + inc # <<<<<<<<<<<<<< - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - * t = FCpos(ft, ct) + /* "LCEngine2.pyx":155 + * if f: + * li.extend(f) + * if not li: # <<<<<<<<<<<<<< + * return li + * xmin = 9999 */ - __pyx_v_ct = (__pyx_v_col + __pyx_v_inc); + } - /* "LCEngine.pyx":182 - * ft = fil + salto - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): # <<<<<<<<<<<<<< - * t = FCpos(ft, ct) - * liX.append(t) + /* "LCEngine2.pyx":157 + * if not li: + * return li + * xmin = 9999 # <<<<<<<<<<<<<< + * for x in li: + * nx = len(x) */ - __pyx_t_13 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_13) { - } else { - __pyx_t_8 = __pyx_t_13; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_13 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_13) { - } else { - __pyx_t_8 = __pyx_t_13; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_13 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_13) { - } else { - __pyx_t_8 = __pyx_t_13; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_13 = ((__pyx_v_ct > 7) != 0); - __pyx_t_8 = __pyx_t_13; - __pyx_L10_bool_binop_done:; - __pyx_t_13 = ((!__pyx_t_8) != 0); - if (__pyx_t_13) { + __pyx_v_xmin = 0x270F; - /* "LCEngine.pyx":183 - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - * t = FCpos(ft, ct) # <<<<<<<<<<<<<< - * liX.append(t) - * + /* "LCEngine2.pyx":158 + * return li + * xmin = 9999 + * for x in li: # <<<<<<<<<<<<<< + * nx = len(x) + * if nx < xmin: */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_14 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_7, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_9); - __pyx_t_9 = 0; + __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; + for (;;) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 158, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":184 - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - * t = FCpos(ft, ct) - * liX.append(t) # <<<<<<<<<<<<<< - * - * return tuple(liM), tuple(liX) + /* "LCEngine2.pyx":159 + * xmin = 9999 + * for x in li: + * nx = len(x) # <<<<<<<<<<<<<< + * if nx < xmin: + * xmin = nx */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_liX, __pyx_v_t); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 184, __pyx_L1_error) + __pyx_t_11 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":182 - * ft = fil + salto - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): # <<<<<<<<<<<<<< - * t = FCpos(ft, ct) - * liX.append(t) + /* "LCEngine2.pyx":160 + * for x in li: + * nx = len(x) + * if nx < xmin: # <<<<<<<<<<<<<< + * xmin = nx + * lidef = [] */ - } + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_xmin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_nx, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { - /* "LCEngine.pyx":179 - * liM.append(sig2) - * - * for inc in ( +1, -1 ): # <<<<<<<<<<<<<< - * ft = fil + salto - * ct = col + inc + /* "LCEngine2.pyx":161 + * nx = len(x) + * if nx < xmin: + * xmin = nx # <<<<<<<<<<<<<< + * lidef = [] + * for x in li: */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nx); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_v_xmin = __pyx_t_11; - /* "LCEngine.pyx":186 - * liX.append(t) - * - * return tuple(liM), tuple(liX) # <<<<<<<<<<<<<< - * - * dicK = {} - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyList_AsTuple(__pyx_v_liX); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); - __pyx_t_1 = 0; - __pyx_t_9 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + /* "LCEngine2.pyx":160 + * for x in li: + * nx = len(x) + * if nx < xmin: # <<<<<<<<<<<<<< + * xmin = nx + * lidef = [] + */ + } + + /* "LCEngine2.pyx":158 + * return li + * xmin = 9999 + * for x in li: # <<<<<<<<<<<<<< + * nx = len(x) + * if nx < xmin: + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "LCEngine2.pyx":162 + * if nx < xmin: + * xmin = nx + * lidef = [] # <<<<<<<<<<<<<< + * for x in li: + * if len(x) == xmin: + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_lidef = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "LCEngine2.pyx":163 + * xmin = nx + * lidef = [] + * for x in li: # <<<<<<<<<<<<<< + * if len(x) == xmin: + * x.insert(0, a) + */ + __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; + for (;;) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 163, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); + __pyx_t_4 = 0; + + /* "LCEngine2.pyx":164 + * lidef = [] + * for x in li: + * if len(x) == xmin: # <<<<<<<<<<<<<< + * x.insert(0, a) + * x.append(b) + */ + __pyx_t_11 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_11 == ((Py_ssize_t)-1))) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_2 = ((__pyx_t_11 == __pyx_v_xmin) != 0); + if (__pyx_t_2) { + + /* "LCEngine2.pyx":165 + * for x in li: + * if len(x) == xmin: + * x.insert(0, a) # <<<<<<<<<<<<<< + * x.append(b) + * lidef.append(x) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = NULL; + __pyx_t_15 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_15 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_int_0, __pyx_v_a}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_int_0, __pyx_v_a}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_16); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_int_0); + __Pyx_INCREF(__pyx_v_a); + __Pyx_GIVEREF(__pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_a); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "LCEngine2.pyx":166 + * if len(x) == xmin: + * x.insert(0, a) + * x.append(b) # <<<<<<<<<<<<<< + * lidef.append(x) + * return lidef + */ + __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_x, __pyx_v_b); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 166, __pyx_L1_error) + + /* "LCEngine2.pyx":167 + * x.insert(0, a) + * x.append(b) + * lidef.append(x) # <<<<<<<<<<<<<< + * return lidef + * + */ + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lidef, __pyx_v_x); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 167, __pyx_L1_error) + + /* "LCEngine2.pyx":164 + * lidef = [] + * for x in li: + * if len(x) == xmin: # <<<<<<<<<<<<<< + * x.insert(0, a) + * x.append(b) + */ + } + + /* "LCEngine2.pyx":163 + * xmin = nx + * lidef = [] + * for x in li: # <<<<<<<<<<<<<< + * if len(x) == xmin: + * x.insert(0, a) + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "LCEngine2.pyx":168 + * x.append(b) + * lidef.append(x) + * return lidef # <<<<<<<<<<<<<< + * + * def liNMinimo(x, y, celdas_ocupadas): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_lidef); + __pyx_r = __pyx_v_lidef; goto __pyx_L0; - /* "LCEngine.pyx":160 - * return tuple(liM) + /* "LCEngine2.pyx":130 * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc * + * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< + * if nv > mx: + * return [] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("LCEngine.liP", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_AddTraceback("LCEngine2.knightmoves", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_liX); - __Pyx_XDECREF(__pyx_v_salto); - __Pyx_XDECREF(__pyx_v_sig); - __Pyx_XDECREF(__pyx_v_sig2); - __Pyx_XDECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_lia); + __Pyx_XDECREF(__pyx_v_lib); + __Pyx_XDECREF(__pyx_v_li); + __Pyx_XDECREF(__pyx_v_x); + __Pyx_XDECREF(__pyx_v_y); + __Pyx_XDECREF(__pyx_v_nx); + __Pyx_XDECREF(__pyx_v_f); + __Pyx_XDECREF(__pyx_v_lidef); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":231 - * dicPB[i] = liP(i, False) +/* "LCEngine2.pyx":170 + * return lidef * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] + * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< + * cdef int nv + * ot = celdas_ocupadas[:] */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_23knightmoves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_23knightmoves = {"knightmoves", (PyCFunction)__pyx_pw_8LCEngine_23knightmoves, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_23knightmoves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_a = 0; - PyObject *__pyx_v_b = 0; - PyObject *__pyx_v_no = 0; - PyObject *__pyx_v_nv = 0; - PyObject *__pyx_v_mx = 0; +static PyObject *__pyx_pw_9LCEngine2_19liNMinimo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_19liNMinimo = {"liNMinimo", (PyCFunction)__pyx_pw_9LCEngine2_19liNMinimo, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_19liNMinimo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_x = 0; + PyObject *__pyx_v_y = 0; + PyObject *__pyx_v_celdas_ocupadas = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("knightmoves (wrapper)", 0); + __Pyx_RefNannySetupContext("liNMinimo (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_no,&__pyx_n_s_nv,&__pyx_n_s_mx,0}; - PyObject* values[5] = {0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_celdas_ocupadas,0}; + PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 1); __PYX_ERR(0, 231, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, 1); __PYX_ERR(0, 170, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_no)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 2); __PYX_ERR(0, 231, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nv)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 3); __PYX_ERR(0, 231, __pyx_L3_error) - } - case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mx)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_celdas_ocupadas)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 4); __PYX_ERR(0, 231, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, 2); __PYX_ERR(0, 170, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "knightmoves") < 0)) __PYX_ERR(0, 231, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liNMinimo") < 0)) __PYX_ERR(0, 170, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_a = values[0]; - __pyx_v_b = values[1]; - __pyx_v_no = values[2]; - __pyx_v_nv = values[3]; - __pyx_v_mx = values[4]; + __pyx_v_x = values[0]; + __pyx_v_y = values[1]; + __pyx_v_celdas_ocupadas = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 231, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 170, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.knightmoves", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.liNMinimo", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_22knightmoves(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_no, __pyx_v_nv, __pyx_v_mx); + __pyx_r = __pyx_pf_9LCEngine2_18liNMinimo(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_celdas_ocupadas); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_22knightmoves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_no, PyObject *__pyx_v_nv, PyObject *__pyx_v_mx) { - PyObject *__pyx_v_lia = NULL; - PyObject *__pyx_v_lib = NULL; +static PyObject *__pyx_pf_9LCEngine2_18liNMinimo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_celdas_ocupadas) { + int __pyx_v_nv; + PyObject *__pyx_v_ot = NULL; PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_y = NULL; - PyObject *__pyx_v_nx = NULL; - PyObject *__pyx_v_f = NULL; - Py_ssize_t __pyx_v_xmin; - PyObject *__pyx_v_lidef = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - __Pyx_RefNannySetupContext("knightmoves", 0); + int __pyx_t_8; + __Pyx_RefNannySetupContext("liNMinimo", 0); - /* "LCEngine.pyx":232 - * - * def knightmoves(a, b, no, nv, mx): - * if nv > mx: # <<<<<<<<<<<<<< - * return [] - * lia = liN(a) + /* "LCEngine2.pyx":172 + * def liNMinimo(x, y, celdas_ocupadas): + * cdef int nv + * ot = celdas_ocupadas[:] # <<<<<<<<<<<<<< + * ot.extend([x, y]) + * nv = 1 */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_nv, __pyx_v_mx, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_celdas_ocupadas, 0, 0, NULL, NULL, &__pyx_slice__14, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_ot = __pyx_t_1; + __pyx_t_1 = 0; - /* "LCEngine.pyx":233 - * def knightmoves(a, b, no, nv, mx): - * if nv > mx: - * return [] # <<<<<<<<<<<<<< - * lia = liN(a) - * if b in lia: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":232 - * - * def knightmoves(a, b, no, nv, mx): - * if nv > mx: # <<<<<<<<<<<<<< - * return [] - * lia = liN(a) - */ - } - - /* "LCEngine.pyx":234 - * if nv > mx: - * return [] - * lia = liN(a) # <<<<<<<<<<<<<< - * if b in lia: - * return [[a, b]] + /* "LCEngine2.pyx":173 + * cdef int nv + * ot = celdas_ocupadas[:] + * ot.extend([x, y]) # <<<<<<<<<<<<<< + * nv = 1 + * li = knightmoves(x, y, ot, 0, nv) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ot, __pyx_n_s_extend); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); + __Pyx_INCREF(__pyx_v_y); + __Pyx_GIVEREF(__pyx_v_y); + PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_y); __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_a}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_a}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_lia = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":235 - * return [] - * lia = liN(a) - * if b in lia: # <<<<<<<<<<<<<< - * return [[a, b]] - * lib = liN(b) + /* "LCEngine2.pyx":174 + * ot = celdas_ocupadas[:] + * ot.extend([x, y]) + * nv = 1 # <<<<<<<<<<<<<< + * li = knightmoves(x, y, ot, 0, nv) + * while len(li) == 0: */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_b, __pyx_v_lia, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 235, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_2 != 0); - if (__pyx_t_6) { + __pyx_v_nv = 1; - /* "LCEngine.pyx":236 - * lia = liN(a) - * if b in lia: - * return [[a, b]] # <<<<<<<<<<<<<< - * lib = liN(b) - * li = [] + /* "LCEngine2.pyx":175 + * ot.extend([x, y]) + * nv = 1 + * li = knightmoves(x, y, ot, 0, nv) # <<<<<<<<<<<<<< + * while len(li) == 0: + * nv += 1 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_b); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_5}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else + #endif + { + __pyx_t_4 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_INCREF(__pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x); + __Pyx_INCREF(__pyx_v_y); + __Pyx_GIVEREF(__pyx_v_y); + PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y); + __Pyx_INCREF(__pyx_v_ot); + __Pyx_GIVEREF(__pyx_v_ot); + PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_ot); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_6, __pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_li = __pyx_t_1; + __pyx_t_1 = 0; - /* "LCEngine.pyx":235 - * return [] - * lia = liN(a) - * if b in lia: # <<<<<<<<<<<<<< - * return [[a, b]] - * lib = liN(b) + /* "LCEngine2.pyx":176 + * nv = 1 + * li = knightmoves(x, y, ot, 0, nv) + * while len(li) == 0: # <<<<<<<<<<<<<< + * nv += 1 + * li = knightmoves(x, y, ot, 0, nv) */ - } + while (1) { + __pyx_t_7 = PyObject_Length(__pyx_v_li); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(0, 176, __pyx_L1_error) + __pyx_t_8 = ((__pyx_t_7 == 0) != 0); + if (!__pyx_t_8) break; - /* "LCEngine.pyx":237 - * if b in lia: - * return [[a, b]] - * lib = liN(b) # <<<<<<<<<<<<<< - * li = [] - * for x in lia: + /* "LCEngine2.pyx":177 + * li = knightmoves(x, y, ot, 0, nv) + * while len(li) == 0: + * nv += 1 # <<<<<<<<<<<<<< + * li = knightmoves(x, y, ot, 0, nv) + * return li */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_v_nv = (__pyx_v_nv + 1); + + /* "LCEngine2.pyx":178 + * while len(li) == 0: + * nv += 1 + * li = knightmoves(x, y, ot, 0, nv) # <<<<<<<<<<<<<< + * return li + * + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_b}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_b}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_INCREF(__pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_x); + __Pyx_INCREF(__pyx_v_y); + __Pyx_GIVEREF(__pyx_v_y); + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_y); + __Pyx_INCREF(__pyx_v_ot); + __Pyx_GIVEREF(__pyx_v_ot); + PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_ot); + __Pyx_INCREF(__pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_6, __pyx_int_0); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_6, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF_SET(__pyx_v_li, __pyx_t_1); + __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_lib = __pyx_t_3; - __pyx_t_3 = 0; - /* "LCEngine.pyx":238 - * return [[a, b]] - * lib = liN(b) - * li = [] # <<<<<<<<<<<<<< - * for x in lia: - * if x not in no and x in lib: - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_li = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngine.pyx":239 - * lib = liN(b) - * li = [] - * for x in lia: # <<<<<<<<<<<<<< - * if x not in no and x in lib: - * li.append([a, x, b]) + /* "LCEngine2.pyx":179 + * nv += 1 + * li = knightmoves(x, y, ot, 0, nv) + * return li # <<<<<<<<<<<<<< + * + * def xpv2lipv(xpv): */ - if (likely(PyList_CheckExact(__pyx_v_lia)) || PyTuple_CheckExact(__pyx_v_lia)) { - __pyx_t_3 = __pyx_v_lia; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lia); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 239, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 239, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 239, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 239, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_li); + __pyx_r = __pyx_v_li; + goto __pyx_L0; - /* "LCEngine.pyx":240 - * li = [] - * for x in lia: - * if x not in no and x in lib: # <<<<<<<<<<<<<< - * li.append([a, x, b]) - * if li: + /* "LCEngine2.pyx":170 + * return lidef + * + * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< + * cdef int nv + * ot = celdas_ocupadas[:] */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) - __pyx_t_9 = (__pyx_t_2 != 0); - if (__pyx_t_9) { - } else { - __pyx_t_6 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_lib, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_9 != 0); - __pyx_t_6 = __pyx_t_2; - __pyx_L8_bool_binop_done:; - if (__pyx_t_6) { - /* "LCEngine.pyx":241 - * for x in lia: - * if x not in no and x in lib: - * li.append([a, x, b]) # <<<<<<<<<<<<<< - * if li: - * return li - */ - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_x); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_b); - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("LCEngine2.liNMinimo", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_ot); + __Pyx_XDECREF(__pyx_v_li); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":240 +/* "LCEngine2.pyx":181 + * return li + * + * def xpv2lipv(xpv): # <<<<<<<<<<<<<< * li = [] - * for x in lia: - * if x not in no and x in lib: # <<<<<<<<<<<<<< - * li.append([a, x, b]) - * if li: + * siBlancas = True */ - } - /* "LCEngine.pyx":239 - * lib = liN(b) - * li = [] - * for x in lia: # <<<<<<<<<<<<<< - * if x not in no and x in lib: - * li.append([a, x, b]) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_21xpv2lipv(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_21xpv2lipv = {"xpv2lipv", (PyCFunction)__pyx_pw_9LCEngine2_21xpv2lipv, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_21xpv2lipv(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("xpv2lipv (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_20xpv2lipv(__pyx_self, ((PyObject *)__pyx_v_xpv)); - /* "LCEngine.pyx":242 - * if x not in no and x in lib: - * li.append([a, x, b]) - * if li: # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_6 = (__pyx_v_li != Py_None) && (PyList_GET_SIZE(__pyx_v_li) != 0); - if (__pyx_t_6) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":243 - * li.append([a, x, b]) - * if li: - * return li # <<<<<<<<<<<<<< - * - * li = [] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; +static PyObject *__pyx_pf_9LCEngine2_20xpv2lipv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { + PyObject *__pyx_v_li = NULL; + int __pyx_v_siBlancas; + PyObject *__pyx_v_c = NULL; + PyObject *__pyx_v_x = NULL; + PyObject *__pyx_v_move = NULL; + PyObject *__pyx_v_base = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + long __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + Py_ssize_t __pyx_t_12; + __Pyx_RefNannySetupContext("xpv2lipv", 0); - /* "LCEngine.pyx":242 - * if x not in no and x in lib: - * li.append([a, x, b]) - * if li: # <<<<<<<<<<<<<< - * return li + /* "LCEngine2.pyx":182 * + * def xpv2lipv(xpv): + * li = [] # <<<<<<<<<<<<<< + * siBlancas = True + * for c in xpv: */ - } + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 182, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_li = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":245 - * return li - * - * li = [] # <<<<<<<<<<<<<< - * - * for x in lia: + /* "LCEngine2.pyx":183 + * def xpv2lipv(xpv): + * li = [] + * siBlancas = True # <<<<<<<<<<<<<< + * for c in xpv: + * x = ord(c) */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_li, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; + __pyx_v_siBlancas = 1; - /* "LCEngine.pyx":247 + /* "LCEngine2.pyx":184 * li = [] - * - * for x in lia: # <<<<<<<<<<<<<< - * for y in lib: - * if x not in no and y not in no: + * siBlancas = True + * for c in xpv: # <<<<<<<<<<<<<< + * x = ord(c) + * if x >= 58: */ - if (likely(PyList_CheckExact(__pyx_v_lia)) || PyTuple_CheckExact(__pyx_v_lia)) { - __pyx_t_3 = __pyx_v_lia; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; + if (likely(PyList_CheckExact(__pyx_v_xpv)) || PyTuple_CheckExact(__pyx_v_xpv)) { + __pyx_t_1 = __pyx_v_xpv; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lia); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) } for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 184, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 184, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); #endif } } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 247, __pyx_L1_error) + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 184, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":248 - * - * for x in lia: - * for y in lib: # <<<<<<<<<<<<<< - * if x not in no and y not in no: - * nx = no[:] + /* "LCEngine2.pyx":185 + * siBlancas = True + * for c in xpv: + * x = ord(c) # <<<<<<<<<<<<<< + * if x >= 58: + * move = posA1(x - 58) */ - if (likely(PyList_CheckExact(__pyx_v_lib)) || PyTuple_CheckExact(__pyx_v_lib)) { - __pyx_t_1 = __pyx_v_lib; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_lib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 248, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_12(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 248, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngine.pyx":249 - * for x in lia: - * for y in lib: - * if x not in no and y not in no: # <<<<<<<<<<<<<< - * nx = no[:] - * nx.append(x) - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 249, __pyx_L1_error) - __pyx_t_9 = (__pyx_t_2 != 0); - if (__pyx_t_9) { - } else { - __pyx_t_6 = __pyx_t_9; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_y, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 249, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_9 != 0); - __pyx_t_6 = __pyx_t_2; - __pyx_L16_bool_binop_done:; - if (__pyx_t_6) { - - /* "LCEngine.pyx":250 - * for y in lib: - * if x not in no and y not in no: - * nx = no[:] # <<<<<<<<<<<<<< - * nx.append(x) - * nx.append(y) - */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_no, 0, 0, NULL, NULL, &__pyx_slice__23, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngine.pyx":251 - * if x not in no and y not in no: - * nx = no[:] - * nx.append(x) # <<<<<<<<<<<<<< - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) - */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_nx, __pyx_v_x); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Ord(__pyx_v_c); if (unlikely(__pyx_t_5 == ((long)(long)(Py_UCS4)-1))) __PYX_ERR(0, 185, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":252 - * nx = no[:] - * nx.append(x) - * nx.append(y) # <<<<<<<<<<<<<< - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: + /* "LCEngine2.pyx":186 + * for c in xpv: + * x = ord(c) + * if x >= 58: # <<<<<<<<<<<<<< + * move = posA1(x - 58) + * if siBlancas: */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_nx, __pyx_v_y); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 252, __pyx_L1_error) + __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_int_58, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 186, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_6) { - /* "LCEngine.pyx":253 - * nx.append(x) - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) # <<<<<<<<<<<<<< - * if f: - * li.extend(f) + /* "LCEngine2.pyx":187 + * x = ord(c) + * if x >= 58: + * move = posA1(x - 58) # <<<<<<<<<<<<<< + * if siBlancas: + * base = move */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_v_nv, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = NULL; - __pyx_t_15 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_15 = 1; - } + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_posA1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_x, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); } + } + if (!__pyx_t_9) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else { #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_v_x, __pyx_v_y, __pyx_v_nx, __pyx_t_13, __pyx_v_mx}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 5+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_v_x, __pyx_v_y, __pyx_v_nx, __pyx_t_13, __pyx_v_mx}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 5+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { - __pyx_t_16 = PyTuple_New(5+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_14) { - __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_y); - __Pyx_INCREF(__pyx_v_nx); - __Pyx_GIVEREF(__pyx_v_nx); - PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_15, __pyx_v_nx); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_15, __pyx_t_13); - __Pyx_INCREF(__pyx_v_mx); - __Pyx_GIVEREF(__pyx_v_mx); - PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_15, __pyx_v_mx); - __pyx_t_13 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 187, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 187, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4); - __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":254 - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: # <<<<<<<<<<<<<< - * li.extend(f) - * if not li: + /* "LCEngine2.pyx":188 + * if x >= 58: + * move = posA1(x - 58) + * if siBlancas: # <<<<<<<<<<<<<< + * base = move + * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_f); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) - if (__pyx_t_6) { + __pyx_t_6 = (__pyx_v_siBlancas != 0); + if (__pyx_t_6) { - /* "LCEngine.pyx":255 - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: - * li.extend(f) # <<<<<<<<<<<<<< - * if not li: - * return li + /* "LCEngine2.pyx":189 + * move = posA1(x - 58) + * if siBlancas: + * base = move # <<<<<<<<<<<<<< + * else: + * li.append(base + move) */ - __pyx_t_10 = __Pyx_PyList_Extend(__pyx_v_li, __pyx_v_f); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 255, __pyx_L1_error) + __Pyx_INCREF(__pyx_v_move); + __Pyx_XDECREF_SET(__pyx_v_base, __pyx_v_move); - /* "LCEngine.pyx":254 - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: # <<<<<<<<<<<<<< - * li.extend(f) - * if not li: + /* "LCEngine2.pyx":188 + * if x >= 58: + * move = posA1(x - 58) + * if siBlancas: # <<<<<<<<<<<<<< + * base = move + * else: */ - } + goto __pyx_L6; + } - /* "LCEngine.pyx":249 - * for x in lia: - * for y in lib: - * if x not in no and y not in no: # <<<<<<<<<<<<<< - * nx = no[:] - * nx.append(x) + /* "LCEngine2.pyx":191 + * base = move + * else: + * li.append(base + move) # <<<<<<<<<<<<<< + * siBlancas = not siBlancas + * else: */ + /*else*/ { + if (unlikely(!__pyx_v_base)) { __Pyx_RaiseUnboundLocalError("base"); __PYX_ERR(0, 191, __pyx_L1_error) } + __pyx_t_4 = PyNumber_Add(__pyx_v_base, __pyx_v_move); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_4); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __pyx_L6:; - /* "LCEngine.pyx":248 - * - * for x in lia: - * for y in lib: # <<<<<<<<<<<<<< - * if x not in no and y not in no: - * nx = no[:] + /* "LCEngine2.pyx":192 + * else: + * li.append(base + move) + * siBlancas = not siBlancas # <<<<<<<<<<<<<< + * else: + * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_siBlancas = (!(__pyx_v_siBlancas != 0)); - /* "LCEngine.pyx":247 - * li = [] - * - * for x in lia: # <<<<<<<<<<<<<< - * for y in lib: - * if x not in no and y not in no: + /* "LCEngine2.pyx":186 + * for c in xpv: + * x = ord(c) + * if x >= 58: # <<<<<<<<<<<<<< + * move = posA1(x - 58) + * if siBlancas: */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L5; + } - /* "LCEngine.pyx":256 - * if f: - * li.extend(f) - * if not li: # <<<<<<<<<<<<<< - * return li - * xmin = 9999 + /* "LCEngine2.pyx":194 + * siBlancas = not siBlancas + * else: + * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") # <<<<<<<<<<<<<< + * li[-1] += c + * return li */ - __pyx_t_6 = (__pyx_v_li != Py_None) && (PyList_GET_SIZE(__pyx_v_li) != 0); - __pyx_t_2 = ((!__pyx_t_6) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_4, __pyx_int_50, __pyx_n_s_q) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_51, __pyx_n_s_r) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_52, __pyx_n_s_b) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_int_53, __pyx_n_s_n) < 0) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyDict_GetItemDefault(__pyx_t_4, __pyx_v_x, __pyx_kp_s_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_7); + __pyx_t_7 = 0; - /* "LCEngine.pyx":257 - * li.extend(f) - * if not li: - * return li # <<<<<<<<<<<<<< - * xmin = 9999 - * for x in li: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngine.pyx":256 - * if f: - * li.extend(f) - * if not li: # <<<<<<<<<<<<<< - * return li - * xmin = 9999 - */ - } - - /* "LCEngine.pyx":258 - * if not li: - * return li - * xmin = 9999 # <<<<<<<<<<<<<< - * for x in li: - * nx = len(x) - */ - __pyx_v_xmin = 0x270F; - - /* "LCEngine.pyx":259 - * return li - * xmin = 9999 - * for x in li: # <<<<<<<<<<<<<< - * nx = len(x) - * if nx < xmin: - */ - __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - for (;;) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":260 - * xmin = 9999 - * for x in li: - * nx = len(x) # <<<<<<<<<<<<<< - * if nx < xmin: - * xmin = nx - */ - __pyx_t_11 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 260, __pyx_L1_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":261 - * for x in li: - * nx = len(x) - * if nx < xmin: # <<<<<<<<<<<<<< - * xmin = nx - * lidef = [] - */ - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_xmin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_nx, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "LCEngine.pyx":262 - * nx = len(x) - * if nx < xmin: - * xmin = nx # <<<<<<<<<<<<<< - * lidef = [] - * for x in li: - */ - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nx); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 262, __pyx_L1_error) - __pyx_v_xmin = __pyx_t_11; - - /* "LCEngine.pyx":261 - * for x in li: - * nx = len(x) - * if nx < xmin: # <<<<<<<<<<<<<< - * xmin = nx - * lidef = [] - */ - } - - /* "LCEngine.pyx":259 - * return li - * xmin = 9999 - * for x in li: # <<<<<<<<<<<<<< - * nx = len(x) - * if nx < xmin: - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngine.pyx":263 - * if nx < xmin: - * xmin = nx - * lidef = [] # <<<<<<<<<<<<<< - * for x in li: - * if len(x) == xmin: - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_lidef = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngine.pyx":264 - * xmin = nx - * lidef = [] - * for x in li: # <<<<<<<<<<<<<< - * if len(x) == xmin: - * x.insert(0, a) - */ - __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - for (;;) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 264, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngine.pyx":265 - * lidef = [] - * for x in li: - * if len(x) == xmin: # <<<<<<<<<<<<<< - * x.insert(0, a) - * x.append(b) - */ - __pyx_t_11 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 265, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_11 == __pyx_v_xmin) != 0); - if (__pyx_t_2) { - - /* "LCEngine.pyx":266 - * for x in li: - * if len(x) == xmin: - * x.insert(0, a) # <<<<<<<<<<<<<< - * x.append(b) - * lidef.append(x) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_15 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_15 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_int_0, __pyx_v_a}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_int_0, __pyx_v_a}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_int_0); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_a); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "LCEngine.pyx":267 - * if len(x) == xmin: - * x.insert(0, a) - * x.append(b) # <<<<<<<<<<<<<< - * lidef.append(x) - * return lidef - */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_x, __pyx_v_b); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 267, __pyx_L1_error) - - /* "LCEngine.pyx":268 - * x.insert(0, a) - * x.append(b) - * lidef.append(x) # <<<<<<<<<<<<<< - * return lidef + /* "LCEngine2.pyx":195 + * else: + * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") + * li[-1] += c # <<<<<<<<<<<<<< + * return li * */ - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lidef, __pyx_v_x); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 268, __pyx_L1_error) - - /* "LCEngine.pyx":265 - * lidef = [] - * for x in li: - * if len(x) == xmin: # <<<<<<<<<<<<<< - * x.insert(0, a) - * x.append(b) - */ + __pyx_t_12 = -1L; + __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_li, __pyx_t_12, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(__Pyx_SetItemInt(__pyx_v_li, __pyx_t_12, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __pyx_L5:; - /* "LCEngine.pyx":264 - * xmin = nx - * lidef = [] - * for x in li: # <<<<<<<<<<<<<< - * if len(x) == xmin: - * x.insert(0, a) + /* "LCEngine2.pyx":184 + * li = [] + * siBlancas = True + * for c in xpv: # <<<<<<<<<<<<<< + * x = ord(c) + * if x >= 58: */ } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":269 - * x.append(b) - * lidef.append(x) - * return lidef # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":196 + * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") + * li[-1] += c + * return li # <<<<<<<<<<<<<< * - * def liNMinimo(x, y, celdas_ocupadas): + * def xpv2pv(xpv): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_lidef); - __pyx_r = __pyx_v_lidef; + __Pyx_INCREF(__pyx_v_li); + __pyx_r = __pyx_v_li; goto __pyx_L0; - /* "LCEngine.pyx":231 - * dicPB[i] = liP(i, False) + /* "LCEngine2.pyx":181 + * return li * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] + * def xpv2lipv(xpv): # <<<<<<<<<<<<<< + * li = [] + * siBlancas = True */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_AddTraceback("LCEngine.knightmoves", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("LCEngine2.xpv2lipv", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_lia); - __Pyx_XDECREF(__pyx_v_lib); __Pyx_XDECREF(__pyx_v_li); + __Pyx_XDECREF(__pyx_v_c); __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_y); - __Pyx_XDECREF(__pyx_v_nx); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_lidef); + __Pyx_XDECREF(__pyx_v_move); + __Pyx_XDECREF(__pyx_v_base); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":271 - * return lidef +/* "LCEngine2.pyx":198 + * return li * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] - */ + * def xpv2pv(xpv): # <<<<<<<<<<<<<< + * return " ".join(xpv2lipv(xpv)) + * + */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_25liNMinimo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_25liNMinimo = {"liNMinimo", (PyCFunction)__pyx_pw_8LCEngine_25liNMinimo, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_25liNMinimo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_x = 0; - PyObject *__pyx_v_y = 0; - PyObject *__pyx_v_celdas_ocupadas = 0; +static PyObject *__pyx_pw_9LCEngine2_23xpv2pv(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_23xpv2pv = {"xpv2pv", (PyCFunction)__pyx_pw_9LCEngine2_23xpv2pv, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_23xpv2pv(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liNMinimo (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_celdas_ocupadas,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, 1); __PYX_ERR(0, 271, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_celdas_ocupadas)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, 2); __PYX_ERR(0, 271, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liNMinimo") < 0)) __PYX_ERR(0, 271, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_x = values[0]; - __pyx_v_y = values[1]; - __pyx_v_celdas_ocupadas = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.liNMinimo", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_24liNMinimo(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_celdas_ocupadas); + __Pyx_RefNannySetupContext("xpv2pv (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_22xpv2pv(__pyx_self, ((PyObject *)__pyx_v_xpv)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_24liNMinimo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_celdas_ocupadas) { - int __pyx_v_nv; - PyObject *__pyx_v_ot = NULL; - PyObject *__pyx_v_li = NULL; +static PyObject *__pyx_pf_9LCEngine2_22xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - __Pyx_RefNannySetupContext("liNMinimo", 0); - - /* "LCEngine.pyx":273 - * def liNMinimo(x, y, celdas_ocupadas): - * cdef int nv - * ot = celdas_ocupadas[:] # <<<<<<<<<<<<<< - * ot.extend([x, y]) - * nv = 1 - */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_celdas_ocupadas, 0, 0, NULL, NULL, &__pyx_slice__24, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ot = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("xpv2pv", 0); - /* "LCEngine.pyx":274 - * cdef int nv - * ot = celdas_ocupadas[:] - * ot.extend([x, y]) # <<<<<<<<<<<<<< - * nv = 1 - * li = knightmoves(x, y, ot, 0, nv) + /* "LCEngine2.pyx":199 + * + * def xpv2pv(xpv): + * return " ".join(xpv2lipv(xpv)) # <<<<<<<<<<<<<< + * + * def pv2xpv(pv): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ot, __pyx_n_s_extend); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_xpv2lipv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_y); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_xpv); + __Pyx_GIVEREF(__pyx_v_xpv); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_xpv); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__15, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":275 - * ot = celdas_ocupadas[:] - * ot.extend([x, y]) - * nv = 1 # <<<<<<<<<<<<<< - * li = knightmoves(x, y, ot, 0, nv) - * while len(li) == 0: + /* "LCEngine2.pyx":198 + * return li + * + * def xpv2pv(xpv): # <<<<<<<<<<<<<< + * return " ".join(xpv2lipv(xpv)) + * */ - __pyx_v_nv = 1; - /* "LCEngine.pyx":276 - * ot.extend([x, y]) - * nv = 1 - * li = knightmoves(x, y, ot, 0, nv) # <<<<<<<<<<<<<< - * while len(li) == 0: - * nv += 1 - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y); - __Pyx_INCREF(__pyx_v_ot); - __Pyx_GIVEREF(__pyx_v_ot); - PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_ot); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_6, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_li = __pyx_t_1; - __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("LCEngine2.xpv2pv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":277 - * nv = 1 - * li = knightmoves(x, y, ot, 0, nv) - * while len(li) == 0: # <<<<<<<<<<<<<< - * nv += 1 - * li = knightmoves(x, y, ot, 0, nv) +/* "LCEngine2.pyx":201 + * return " ".join(xpv2lipv(xpv)) + * + * def pv2xpv(pv): # <<<<<<<<<<<<<< + * if pv: + * li = pv.split(" ") */ - while (1) { - __pyx_t_7 = PyObject_Length(__pyx_v_li); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 277, __pyx_L1_error) - __pyx_t_8 = ((__pyx_t_7 == 0) != 0); - if (!__pyx_t_8) break; - /* "LCEngine.pyx":278 - * li = knightmoves(x, y, ot, 0, nv) - * while len(li) == 0: - * nv += 1 # <<<<<<<<<<<<<< - * li = knightmoves(x, y, ot, 0, nv) - * return li - */ - __pyx_v_nv = (__pyx_v_nv + 1); - - /* "LCEngine.pyx":279 - * while len(li) == 0: - * nv += 1 - * li = knightmoves(x, y, ot, 0, nv) # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_y); - __Pyx_INCREF(__pyx_v_ot); - __Pyx_GIVEREF(__pyx_v_ot); - PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_ot); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_6, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_6, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_li, __pyx_t_1); - __pyx_t_1 = 0; - } - - /* "LCEngine.pyx":280 - * nv += 1 - * li = knightmoves(x, y, ot, 0, nv) - * return li # <<<<<<<<<<<<<< - * - * def xpv2lipv(xpv): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngine.pyx":271 - * return lidef - * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("LCEngine.liNMinimo", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ot); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":282 - * return li - * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_27xpv2lipv(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_27xpv2lipv = {"xpv2lipv", (PyCFunction)__pyx_pw_8LCEngine_27xpv2lipv, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_27xpv2lipv(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("xpv2lipv (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_26xpv2lipv(__pyx_self, ((PyObject *)__pyx_v_xpv)); +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_25pv2xpv(PyObject *__pyx_self, PyObject *__pyx_v_pv); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_25pv2xpv = {"pv2xpv", (PyCFunction)__pyx_pw_9LCEngine2_25pv2xpv, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_25pv2xpv(PyObject *__pyx_self, PyObject *__pyx_v_pv) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pv2xpv (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_24pv2xpv(__pyx_self, ((PyObject *)__pyx_v_pv)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_26xpv2lipv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { +static PyObject *__pyx_pf_9LCEngine2_24pv2xpv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv) { PyObject *__pyx_v_li = NULL; - int __pyx_v_siBlancas; - PyObject *__pyx_v_c = NULL; - PyObject *__pyx_v_x = NULL; + PyObject *__pyx_v_lix = NULL; PyObject *__pyx_v_move = NULL; - PyObject *__pyx_v_base = NULL; + PyObject *__pyx_v_d = NULL; + PyObject *__pyx_v_h = NULL; + PyObject *__pyx_v_c = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - int __pyx_t_6; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - __Pyx_RefNannySetupContext("xpv2lipv", 0); + int __pyx_t_10; + __Pyx_RefNannySetupContext("pv2xpv", 0); - /* "LCEngine.pyx":283 + /* "LCEngine2.pyx":202 * - * def xpv2lipv(xpv): - * li = [] # <<<<<<<<<<<<<< - * siBlancas = True - * for c in xpv: + * def pv2xpv(pv): + * if pv: # <<<<<<<<<<<<<< + * li = pv.split(" ") + * lix = [] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pv); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) + if (__pyx_t_1) { - /* "LCEngine.pyx":284 - * def xpv2lipv(xpv): - * li = [] - * siBlancas = True # <<<<<<<<<<<<<< - * for c in xpv: - * x = ord(c) + /* "LCEngine2.pyx":203 + * def pv2xpv(pv): + * if pv: + * li = pv.split(" ") # <<<<<<<<<<<<<< + * lix = [] + * for move in li: */ - __pyx_v_siBlancas = 1; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pv, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_li = __pyx_t_3; + __pyx_t_3 = 0; - /* "LCEngine.pyx":285 - * li = [] - * siBlancas = True - * for c in xpv: # <<<<<<<<<<<<<< - * x = ord(c) - * if x >= 58: + /* "LCEngine2.pyx":204 + * if pv: + * li = pv.split(" ") + * lix = [] # <<<<<<<<<<<<<< + * for move in li: + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 */ - if (likely(PyList_CheckExact(__pyx_v_xpv)) || PyTuple_CheckExact(__pyx_v_xpv)) { - __pyx_t_1 = __pyx_v_xpv; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_lix = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "LCEngine2.pyx":205 + * li = pv.split(" ") + * lix = [] + * for move in li: # <<<<<<<<<<<<<< + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + * h = chr(a1Pos(move[2:4]) + 58) + */ + if (likely(PyList_CheckExact(__pyx_v_li)) || PyTuple_CheckExact(__pyx_v_li)) { + __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 285, __pyx_L1_error) + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_li); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 205, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 205, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 205, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif } - break; + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 205, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngine.pyx":286 - * siBlancas = True - * for c in xpv: - * x = ord(c) # <<<<<<<<<<<<<< - * if x >= 58: - * move = posA1(x - 58) - */ - __pyx_t_5 = __Pyx_PyObject_Ord(__pyx_v_c); if (unlikely(__pyx_t_5 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 286, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngine.pyx":287 - * for c in xpv: - * x = ord(c) - * if x >= 58: # <<<<<<<<<<<<<< - * move = posA1(x - 58) - * if siBlancas: - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_int_58, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { + __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":288 - * x = ord(c) - * if x >= 58: - * move = posA1(x - 58) # <<<<<<<<<<<<<< - * if siBlancas: - * base = move + /* "LCEngine2.pyx":206 + * lix = [] + * for move in li: + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 # <<<<<<<<<<<<<< + * h = chr(a1Pos(move[2:4]) + 58) + * c = move[4:] */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_posA1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error) + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_move, 0, 2, NULL, NULL, &__pyx_slice__17, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_x, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); + __Pyx_DECREF_SET(__pyx_t_6, function); } } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); + if (!__pyx_t_8) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":289 - * if x >= 58: - * move = posA1(x - 58) - * if siBlancas: # <<<<<<<<<<<<<< - * base = move - * else: + /* "LCEngine2.pyx":207 + * for move in li: + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + * h = chr(a1Pos(move[2:4]) + 58) # <<<<<<<<<<<<<< + * c = move[4:] + * if c: */ - __pyx_t_6 = (__pyx_v_siBlancas != 0); - if (__pyx_t_6) { + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_move, 2, 4, NULL, NULL, &__pyx_slice__18, 1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + if (!__pyx_t_7) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_9}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_9}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_chr, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":290 - * move = posA1(x - 58) - * if siBlancas: - * base = move # <<<<<<<<<<<<<< - * else: - * li.append(base + move) + /* "LCEngine2.pyx":208 + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + * h = chr(a1Pos(move[2:4]) + 58) + * c = move[4:] # <<<<<<<<<<<<<< + * if c: + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") */ - __Pyx_INCREF(__pyx_v_move); - __Pyx_XDECREF_SET(__pyx_v_base, __pyx_v_move); + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_move, 4, 0, NULL, NULL, &__pyx_slice__19, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":289 - * if x >= 58: - * move = posA1(x - 58) - * if siBlancas: # <<<<<<<<<<<<<< - * base = move - * else: + /* "LCEngine2.pyx":209 + * h = chr(a1Pos(move[2:4]) + 58) + * c = move[4:] + * if c: # <<<<<<<<<<<<<< + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") + * lix.append(d + h + c) */ - goto __pyx_L6; - } + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_c); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 209, __pyx_L1_error) + if (__pyx_t_1) { - /* "LCEngine.pyx":292 - * base = move - * else: - * li.append(base + move) # <<<<<<<<<<<<<< - * siBlancas = not siBlancas - * else: + /* "LCEngine2.pyx":210 + * c = move[4:] + * if c: + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") # <<<<<<<<<<<<<< + * lix.append(d + h + c) + * return "".join(lix) + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_q, __pyx_t_6) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_r, __pyx_t_6) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_b, __pyx_t_6) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_n, __pyx_t_6) < 0) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_8, function); + } + } + if (__pyx_t_9) { + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } else { + __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_t_2, __pyx_t_6, __pyx_kp_s_); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_8); + __pyx_t_8 = 0; + + /* "LCEngine2.pyx":209 + * h = chr(a1Pos(move[2:4]) + 58) + * c = move[4:] + * if c: # <<<<<<<<<<<<<< + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") + * lix.append(d + h + c) */ - /*else*/ { - if (unlikely(!__pyx_v_base)) { __Pyx_RaiseUnboundLocalError("base"); __PYX_ERR(0, 292, __pyx_L1_error) } - __pyx_t_4 = PyNumber_Add(__pyx_v_base, __pyx_v_move); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_4); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __pyx_L6:; - /* "LCEngine.pyx":293 - * else: - * li.append(base + move) - * siBlancas = not siBlancas # <<<<<<<<<<<<<< - * else: - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") + /* "LCEngine2.pyx":211 + * if c: + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") + * lix.append(d + h + c) # <<<<<<<<<<<<<< + * return "".join(lix) + * else: */ - __pyx_v_siBlancas = (!(__pyx_v_siBlancas != 0)); + __pyx_t_8 = PyNumber_Add(__pyx_v_d, __pyx_v_h); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lix, __pyx_t_6); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 211, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "LCEngine.pyx":287 - * for c in xpv: - * x = ord(c) - * if x >= 58: # <<<<<<<<<<<<<< - * move = posA1(x - 58) - * if siBlancas: + /* "LCEngine2.pyx":205 + * li = pv.split(" ") + * lix = [] + * for move in li: # <<<<<<<<<<<<<< + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + * h = chr(a1Pos(move[2:4]) + 58) */ - goto __pyx_L5; } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":295 - * siBlancas = not siBlancas - * else: - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") # <<<<<<<<<<<<<< - * li[-1] += c - * return li + /* "LCEngine2.pyx":212 + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") + * lix.append(d + h + c) + * return "".join(lix) # <<<<<<<<<<<<<< + * else: + * return "" */ - /*else*/ { - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_int_50, __pyx_n_s_q) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_int_51, __pyx_n_s_r) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_int_52, __pyx_n_s_b) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_int_53, __pyx_n_s_n) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyDict_GetItemDefault(__pyx_t_4, __pyx_v_x, __pyx_kp_s_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_v_lix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 212, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":296 - * else: - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") - * li[-1] += c # <<<<<<<<<<<<<< - * return li + /* "LCEngine2.pyx":202 * - */ - __pyx_t_12 = -1L; - __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_li, __pyx_t_12, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__Pyx_SetItemInt(__pyx_v_li, __pyx_t_12, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_L5:; - - /* "LCEngine.pyx":285 - * li = [] - * siBlancas = True - * for c in xpv: # <<<<<<<<<<<<<< - * x = ord(c) - * if x >= 58: + * def pv2xpv(pv): + * if pv: # <<<<<<<<<<<<<< + * li = pv.split(" ") + * lix = [] */ } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":297 - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") - * li[-1] += c - * return li # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":214 + * return "".join(lix) + * else: + * return "" # <<<<<<<<<<<<<< * - * def xpv2pv(xpv): + * def runFen( fen, depth, ms, level ): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_kp_s_); + __pyx_r = __pyx_kp_s_; + goto __pyx_L0; + } - /* "LCEngine.pyx":282 - * return li + /* "LCEngine2.pyx":201 + * return " ".join(xpv2lipv(xpv)) * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True + * def pv2xpv(pv): # <<<<<<<<<<<<<< + * if pv: + * li = pv.split(" ") */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("LCEngine.xpv2lipv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.pv2xpv", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_c); - __Pyx_XDECREF(__pyx_v_x); + __Pyx_XDECREF(__pyx_v_lix); __Pyx_XDECREF(__pyx_v_move); - __Pyx_XDECREF(__pyx_v_base); + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_h); + __Pyx_XDECREF(__pyx_v_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":299 - * return li - * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) +/* "LCEngine2.pyx":216 + * return "" * + * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< + * set_level(level) + * x = playFen(fen, depth, ms) */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_29xpv2pv(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_29xpv2pv = {"xpv2pv", (PyCFunction)__pyx_pw_8LCEngine_29xpv2pv, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_29xpv2pv(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { +static PyObject *__pyx_pw_9LCEngine2_27runFen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_27runFen = {"runFen", (PyCFunction)__pyx_pw_9LCEngine2_27runFen, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_27runFen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fen = 0; + PyObject *__pyx_v_depth = 0; + PyObject *__pyx_v_ms = 0; + PyObject *__pyx_v_level = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("xpv2pv (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_28xpv2pv(__pyx_self, ((PyObject *)__pyx_v_xpv)); + __Pyx_RefNannySetupContext("runFen (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fen,&__pyx_n_s_depth,&__pyx_n_s_ms,&__pyx_n_s_level,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fen)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 1); __PYX_ERR(0, 216, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ms)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 2); __PYX_ERR(0, 216, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 3); __PYX_ERR(0, 216, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "runFen") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_fen = values[0]; + __pyx_v_depth = values[1]; + __pyx_v_ms = values[2]; + __pyx_v_level = values[3]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("LCEngine2.runFen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9LCEngine2_26runFen(__pyx_self, __pyx_v_fen, __pyx_v_depth, __pyx_v_ms, __pyx_v_level); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_28xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { +static PyObject *__pyx_pf_9LCEngine2_26runFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_depth, PyObject *__pyx_v_ms, PyObject *__pyx_v_level) { + char *__pyx_v_x; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_1; + char *__pyx_t_2; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("xpv2pv", 0); + __Pyx_RefNannySetupContext("runFen", 0); - /* "LCEngine.pyx":300 + /* "LCEngine2.pyx":217 * - * def xpv2pv(xpv): - * return " ".join(xpv2lipv(xpv)) # <<<<<<<<<<<<<< + * def runFen( fen, depth, ms, level ): + * set_level(level) # <<<<<<<<<<<<<< + * x = playFen(fen, depth, ms) + * set_level(0) + */ + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_level); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) + set_level(__pyx_t_1); + + /* "LCEngine2.pyx":218 + * def runFen( fen, depth, ms, level ): + * set_level(level) + * x = playFen(fen, depth, ms) # <<<<<<<<<<<<<< + * set_level(0) + * return x + */ + __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_fen); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_depth); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_ms); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 218, __pyx_L1_error) + __pyx_v_x = playFen(__pyx_t_2, __pyx_t_1, __pyx_t_3); + + /* "LCEngine2.pyx":219 + * set_level(level) + * x = playFen(fen, depth, ms) + * set_level(0) # <<<<<<<<<<<<<< + * return x * - * def pv2xpv(pv): + */ + set_level(0); + + /* "LCEngine2.pyx":220 + * x = playFen(fen, depth, ms) + * set_level(0) + * return x # <<<<<<<<<<<<<< + * + * def setFen(fen): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_xpv2lipv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_xpv); - __Pyx_GIVEREF(__pyx_v_xpv); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_xpv); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__25, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "LCEngine.pyx":299 - * return li - * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) + /* "LCEngine2.pyx":216 + * return "" * + * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< + * set_level(level) + * x = playFen(fen, depth, ms) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.xpv2pv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.runFen", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7300,1692 +6467,1456 @@ static PyObject *__pyx_pf_8LCEngine_28xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "LCEngine.pyx":302 - * return " ".join(xpv2lipv(xpv)) +/* "LCEngine2.pyx":222 + * return x * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") + * def setFen(fen): # <<<<<<<<<<<<<< + * fen_board(fen) + * return movegen() */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_31pv2xpv(PyObject *__pyx_self, PyObject *__pyx_v_pv); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_31pv2xpv = {"pv2xpv", (PyCFunction)__pyx_pw_8LCEngine_31pv2xpv, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_31pv2xpv(PyObject *__pyx_self, PyObject *__pyx_v_pv) { +static PyObject *__pyx_pw_9LCEngine2_29setFen(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_29setFen = {"setFen", (PyCFunction)__pyx_pw_9LCEngine2_29setFen, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_29setFen(PyObject *__pyx_self, PyObject *__pyx_v_fen) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pv2xpv (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_30pv2xpv(__pyx_self, ((PyObject *)__pyx_v_pv)); + __Pyx_RefNannySetupContext("setFen (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_28setFen(__pyx_self, ((PyObject *)__pyx_v_fen)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_30pv2xpv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_lix = NULL; - PyObject *__pyx_v_move = NULL; - PyObject *__pyx_v_d = NULL; - PyObject *__pyx_v_h = NULL; - PyObject *__pyx_v_c = NULL; +static PyObject *__pyx_pf_9LCEngine2_28setFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - __Pyx_RefNannySetupContext("pv2xpv", 0); + __Pyx_RefNannySetupContext("setFen", 0); - /* "LCEngine.pyx":303 + /* "LCEngine2.pyx":223 + * + * def setFen(fen): + * fen_board(fen) # <<<<<<<<<<<<<< + * return movegen() * - * def pv2xpv(pv): - * if pv: # <<<<<<<<<<<<<< - * li = pv.split(" ") - * lix = [] */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pv); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 303, __pyx_L1_error) - if (__pyx_t_1) { + __pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_fen); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L1_error) + fen_board(__pyx_t_1); - /* "LCEngine.pyx":304 - * def pv2xpv(pv): - * if pv: - * li = pv.split(" ") # <<<<<<<<<<<<<< - * lix = [] - * for move in li: + /* "LCEngine2.pyx":224 + * def setFen(fen): + * fen_board(fen) + * return movegen() # <<<<<<<<<<<<<< + * + * def getFen(): */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pv, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_li = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_From_int(movegen()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":305 - * if pv: - * li = pv.split(" ") - * lix = [] # <<<<<<<<<<<<<< - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + /* "LCEngine2.pyx":222 + * return x + * + * def setFen(fen): # <<<<<<<<<<<<<< + * fen_board(fen) + * return movegen() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_lix = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - /* "LCEngine.pyx":306 - * li = pv.split(" ") - * lix = [] - * for move in li: # <<<<<<<<<<<<<< - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - */ - if (likely(PyList_CheckExact(__pyx_v_li)) || PyTuple_CheckExact(__pyx_v_li)) { - __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_li); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 306, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 306, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 306, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_2); - __pyx_t_2 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("LCEngine2.setFen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":307 - * lix = [] - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 # <<<<<<<<<<<<<< - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] +/* "LCEngine2.pyx":226 + * return movegen() + * + * def getFen(): # <<<<<<<<<<<<<< + * cdef char fen[100] + * board_fen(fen) */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_move, 0, 2, NULL, NULL, &__pyx_slice__27, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_6); - __pyx_t_6 = 0; - /* "LCEngine.pyx":308 - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) # <<<<<<<<<<<<<< - * c = move[4:] - * if c: +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_31getFen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_31getFen = {"getFen", (PyCFunction)__pyx_pw_9LCEngine2_31getFen, METH_NOARGS, 0}; +static PyObject *__pyx_pw_9LCEngine2_31getFen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getFen (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_30getFen(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9LCEngine2_30getFen(CYTHON_UNUSED PyObject *__pyx_self) { + char __pyx_v_fen[0x64]; + char *__pyx_v_x; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("getFen", 0); + + /* "LCEngine2.pyx":228 + * def getFen(): + * cdef char fen[100] + * board_fen(fen) # <<<<<<<<<<<<<< + * x = fen + * return x */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_move, 2, 4, NULL, NULL, &__pyx_slice__28, 1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_7) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_2); - __pyx_t_2 = 0; + (void)(board_fen(__pyx_v_fen)); - /* "LCEngine.pyx":309 - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] # <<<<<<<<<<<<<< - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") + /* "LCEngine2.pyx":229 + * cdef char fen[100] + * board_fen(fen) + * x = fen # <<<<<<<<<<<<<< + * return x + * */ - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_move, 4, 0, NULL, NULL, &__pyx_slice__29, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_v_x = __pyx_v_fen; - /* "LCEngine.pyx":310 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] - * if c: # <<<<<<<<<<<<<< - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) + /* "LCEngine2.pyx":230 + * board_fen(fen) + * x = fen + * return x # <<<<<<<<<<<<<< + * + * def getMoves(): */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_c); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 310, __pyx_L1_error) - if (__pyx_t_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":311 - * c = move[4:] - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") # <<<<<<<<<<<<<< - * lix.append(d + h + c) - * return "".join(lix) + /* "LCEngine2.pyx":226 + * return movegen() + * + * def getFen(): # <<<<<<<<<<<<<< + * cdef char fen[100] + * board_fen(fen) */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_q, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_r, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_b, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_n, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (__pyx_t_9) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_t_2, __pyx_t_6, __pyx_kp_s_); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_8); - __pyx_t_8 = 0; - /* "LCEngine.pyx":310 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] - * if c: # <<<<<<<<<<<<<< - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("LCEngine2.getFen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "LCEngine2.pyx":232 + * return x + * + * def getMoves(): # <<<<<<<<<<<<<< + * cdef char pv[10] + * cdef int nmoves, x, nbase */ - } - /* "LCEngine.pyx":312 - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) # <<<<<<<<<<<<<< - * return "".join(lix) - * else: +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_33getMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_33getMoves = {"getMoves", (PyCFunction)__pyx_pw_9LCEngine2_33getMoves, METH_NOARGS, 0}; +static PyObject *__pyx_pw_9LCEngine2_33getMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getMoves (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_32getMoves(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9LCEngine2_32getMoves(CYTHON_UNUSED PyObject *__pyx_self) { + char __pyx_v_pv[10]; + int __pyx_v_nmoves; + int __pyx_v_x; + int __pyx_v_nbase; + PyObject *__pyx_v_li = NULL; + char *__pyx_v_r; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("getMoves", 0); + + /* "LCEngine2.pyx":235 + * cdef char pv[10] + * cdef int nmoves, x, nbase + * nmoves = numMoves() # <<<<<<<<<<<<<< + * + * nbase = numBaseMove() */ - __pyx_t_8 = PyNumber_Add(__pyx_v_d, __pyx_v_h); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lix, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_nmoves = numMoves(); - /* "LCEngine.pyx":306 - * li = pv.split(" ") - * lix = [] - * for move in li: # <<<<<<<<<<<<<< - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) + /* "LCEngine2.pyx":237 + * nmoves = numMoves() + * + * nbase = numBaseMove() # <<<<<<<<<<<<<< + * li = [] + * for x in range(nmoves): */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_nbase = numBaseMove(); - /* "LCEngine.pyx":313 - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) - * return "".join(lix) # <<<<<<<<<<<<<< - * else: - * return "" + /* "LCEngine2.pyx":238 + * + * nbase = numBaseMove() + * li = [] # <<<<<<<<<<<<<< + * for x in range(nmoves): + * getMove(x+nbase, pv) */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_v_lix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_li = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "LCEngine2.pyx":239 + * nbase = numBaseMove() + * li = [] + * for x in range(nmoves): # <<<<<<<<<<<<<< + * getMove(x+nbase, pv) + * r = pv + */ + __pyx_t_2 = __pyx_v_nmoves; + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_x = __pyx_t_4; + + /* "LCEngine2.pyx":240 + * li = [] + * for x in range(nmoves): + * getMove(x+nbase, pv) # <<<<<<<<<<<<<< + * r = pv + * li.append(r) + */ + getMove((__pyx_v_x + __pyx_v_nbase), __pyx_v_pv); + + /* "LCEngine2.pyx":241 + * for x in range(nmoves): + * getMove(x+nbase, pv) + * r = pv # <<<<<<<<<<<<<< + * li.append(r) + * return li + */ + __pyx_v_r = __pyx_v_pv; - /* "LCEngine.pyx":303 + /* "LCEngine2.pyx":242 + * getMove(x+nbase, pv) + * r = pv + * li.append(r) # <<<<<<<<<<<<<< + * return li * - * def pv2xpv(pv): - * if pv: # <<<<<<<<<<<<<< - * li = pv.split(" ") - * lix = [] */ + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_1); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "LCEngine.pyx":315 - * return "".join(lix) - * else: - * return "" # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":243 + * r = pv + * li.append(r) + * return li # <<<<<<<<<<<<<< * - * def runFen( fen, depth, ms, level ): + * def getPGN(desdeA1H8, hastaA1H8, coronacion): */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s_); - __pyx_r = __pyx_kp_s_; - goto __pyx_L0; - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_li); + __pyx_r = __pyx_v_li; + goto __pyx_L0; - /* "LCEngine.pyx":302 - * return " ".join(xpv2lipv(xpv)) + /* "LCEngine2.pyx":232 + * return x * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") + * def getMoves(): # <<<<<<<<<<<<<< + * cdef char pv[10] + * cdef int nmoves, x, nbase */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("LCEngine.pv2xpv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("LCEngine2.getMoves", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_lix); - __Pyx_XDECREF(__pyx_v_move); - __Pyx_XDECREF(__pyx_v_d); - __Pyx_XDECREF(__pyx_v_h); - __Pyx_XDECREF(__pyx_v_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":317 - * return "" +/* "LCEngine2.pyx":245 + * return li + * + * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< + * cdef char san[10] * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_33runFen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_33runFen = {"runFen", (PyCFunction)__pyx_pw_8LCEngine_33runFen, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_33runFen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fen = 0; - PyObject *__pyx_v_depth = 0; - PyObject *__pyx_v_ms = 0; - PyObject *__pyx_v_level = 0; +static PyObject *__pyx_pw_9LCEngine2_35getPGN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_35getPGN = {"getPGN", (PyCFunction)__pyx_pw_9LCEngine2_35getPGN, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_35getPGN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_desdeA1H8 = 0; + PyObject *__pyx_v_hastaA1H8 = 0; + PyObject *__pyx_v_coronacion = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("runFen (wrapper)", 0); + __Pyx_RefNannySetupContext("getPGN (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fen,&__pyx_n_s_depth,&__pyx_n_s_ms,&__pyx_n_s_level,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_desdeA1H8,&__pyx_n_s_hastaA1H8,&__pyx_n_s_coronacion,0}; + PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fen)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_desdeA1H8)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hastaA1H8)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 1); __PYX_ERR(0, 317, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, 1); __PYX_ERR(0, 245, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ms)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 2); __PYX_ERR(0, 317, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 3); __PYX_ERR(0, 317, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, 2); __PYX_ERR(0, 245, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "runFen") < 0)) __PYX_ERR(0, 317, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getPGN") < 0)) __PYX_ERR(0, 245, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } - __pyx_v_fen = values[0]; - __pyx_v_depth = values[1]; - __pyx_v_ms = values[2]; - __pyx_v_level = values[3]; + __pyx_v_desdeA1H8 = values[0]; + __pyx_v_hastaA1H8 = values[1]; + __pyx_v_coronacion = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 317, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 245, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.runFen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.getPGN", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_32runFen(__pyx_self, __pyx_v_fen, __pyx_v_depth, __pyx_v_ms, __pyx_v_level); + __pyx_r = __pyx_pf_9LCEngine2_34getPGN(__pyx_self, __pyx_v_desdeA1H8, __pyx_v_hastaA1H8, __pyx_v_coronacion); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_32runFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_depth, PyObject *__pyx_v_ms, PyObject *__pyx_v_level) { - char *__pyx_v_x; +static PyObject *__pyx_pf_9LCEngine2_34getPGN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desdeA1H8, PyObject *__pyx_v_hastaA1H8, PyObject *__pyx_v_coronacion) { + char __pyx_v_san[10]; + int __pyx_v_num; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - char *__pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("runFen", 0); + int __pyx_t_2; + char *__pyx_t_3; + char *__pyx_t_4; + char *__pyx_t_5; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("getPGN", 0); + __Pyx_INCREF(__pyx_v_coronacion); - /* "LCEngine.pyx":318 + /* "LCEngine2.pyx":248 + * cdef char san[10] + * + * if not coronacion: # <<<<<<<<<<<<<< + * coronacion = "" * - * def runFen( fen, depth, ms, level ): - * set_level(level) # <<<<<<<<<<<<<< - * x = playFen(fen, depth, ms) - * set_level(0) */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_level); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 318, __pyx_L1_error) - set_level(__pyx_t_1); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { - /* "LCEngine.pyx":319 - * def runFen( fen, depth, ms, level ): - * set_level(level) - * x = playFen(fen, depth, ms) # <<<<<<<<<<<<<< - * set_level(0) - * return x + /* "LCEngine2.pyx":249 + * + * if not coronacion: + * coronacion = "" # <<<<<<<<<<<<<< + * + * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_fen); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_depth); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_ms); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_v_x = playFen(__pyx_t_2, __pyx_t_1, __pyx_t_3); + __Pyx_INCREF(__pyx_kp_s_); + __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); - /* "LCEngine.pyx":320 - * set_level(level) - * x = playFen(fen, depth, ms) - * set_level(0) # <<<<<<<<<<<<<< - * return x + /* "LCEngine2.pyx":248 + * cdef char san[10] + * + * if not coronacion: # <<<<<<<<<<<<<< + * coronacion = "" * */ - set_level(0); + } - /* "LCEngine.pyx":321 - * x = playFen(fen, depth, ms) - * set_level(0) - * return x # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":251 + * coronacion = "" * - * def setFen(fen): + * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) # <<<<<<<<<<<<<< + * if num == -1: + * return None */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_desdeA1H8); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_hastaA1H8); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); - /* "LCEngine.pyx":317 - * return "" + /* "LCEngine2.pyx":252 + * + * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) + * if num == -1: # <<<<<<<<<<<<<< + * return None * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) */ + __pyx_t_2 = ((__pyx_v_num == -1L) != 0); + if (__pyx_t_2) { - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.runFen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":323 - * return x + /* "LCEngine2.pyx":253 + * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) + * if num == -1: + * return None # <<<<<<<<<<<<<< * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() + * toSan(num, san) */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_35setFen(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_35setFen = {"setFen", (PyCFunction)__pyx_pw_8LCEngine_35setFen, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_35setFen(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("setFen (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_34setFen(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_34setFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("setFen", 0); + /* "LCEngine2.pyx":252 + * + * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) + * if num == -1: # <<<<<<<<<<<<<< + * return None + * + */ + } - /* "LCEngine.pyx":324 + /* "LCEngine2.pyx":255 + * return None * - * def setFen(fen): - * fen_board(fen) # <<<<<<<<<<<<<< - * return movegen() + * toSan(num, san) # <<<<<<<<<<<<<< + * return san * */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_fen); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L1_error) - fen_board(__pyx_t_1); + (void)(toSan(__pyx_v_num, __pyx_v_san)); - /* "LCEngine.pyx":325 - * def setFen(fen): - * fen_board(fen) - * return movegen() # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":256 * - * def getFen(): + * toSan(num, san) + * return san # <<<<<<<<<<<<<< + * + * def xpv2pgn(xpv): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(movegen()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_6 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; - /* "LCEngine.pyx":323 - * return x + /* "LCEngine2.pyx":245 + * return li + * + * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< + * cdef char san[10] * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("LCEngine.setFen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("LCEngine2.getPGN", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_coronacion); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":327 - * return movegen() +/* "LCEngine2.pyx":258 + * return san * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) + * def xpv2pgn(xpv): # <<<<<<<<<<<<<< + * cdef char san[10] + * setFenInicial() */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_37getFen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_37getFen = {"getFen", (PyCFunction)__pyx_pw_8LCEngine_37getFen, METH_NOARGS, 0}; -static PyObject *__pyx_pw_8LCEngine_37getFen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_9LCEngine2_37xpv2pgn(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_37xpv2pgn = {"xpv2pgn", (PyCFunction)__pyx_pw_9LCEngine2_37xpv2pgn, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_37xpv2pgn(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getFen (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_36getFen(__pyx_self); + __Pyx_RefNannySetupContext("xpv2pgn (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_36xpv2pgn(__pyx_self, ((PyObject *)__pyx_v_xpv)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_36getFen(CYTHON_UNUSED PyObject *__pyx_self) { - char __pyx_v_fen[0x64]; - char *__pyx_v_x; +static PyObject *__pyx_pf_9LCEngine2_36xpv2pgn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { + char __pyx_v_san[10]; + int __pyx_v_siW; + PyObject *__pyx_v_num = NULL; + PyObject *__pyx_v_li = NULL; + PyObject *__pyx_v_tam = NULL; + PyObject *__pyx_v_pv = NULL; + PyObject *__pyx_v_x = NULL; + int __pyx_v_numMove; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("getFen", 0); + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + Py_ssize_t __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + char *__pyx_t_11; + char *__pyx_t_12; + __Pyx_RefNannySetupContext("xpv2pgn", 0); - /* "LCEngine.pyx":329 - * def getFen(): - * cdef char fen[100] - * board_fen(fen) # <<<<<<<<<<<<<< - * x = fen - * return x + /* "LCEngine2.pyx":260 + * def xpv2pgn(xpv): + * cdef char san[10] + * setFenInicial() # <<<<<<<<<<<<<< + * siW = True + * num = 1 */ - board_fen(__pyx_v_fen); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFenInicial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":330 - * cdef char fen[100] - * board_fen(fen) - * x = fen # <<<<<<<<<<<<<< - * return x - * + /* "LCEngine2.pyx":261 + * cdef char san[10] + * setFenInicial() + * siW = True # <<<<<<<<<<<<<< + * num = 1 + * li = [] */ - __pyx_v_x = __pyx_v_fen; + __pyx_v_siW = 1; - /* "LCEngine.pyx":331 - * board_fen(fen) - * x = fen - * return x # <<<<<<<<<<<<<< - * - * def getMoves(): + /* "LCEngine2.pyx":262 + * setFenInicial() + * siW = True + * num = 1 # <<<<<<<<<<<<<< + * li = [] + * tam = 0 */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) + __Pyx_INCREF(__pyx_int_1); + __pyx_v_num = __pyx_int_1; + + /* "LCEngine2.pyx":263 + * siW = True + * num = 1 + * li = [] # <<<<<<<<<<<<<< + * tam = 0 + * for pv in xpv2lipv(xpv): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 263, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_v_li = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L0; - /* "LCEngine.pyx":327 - * return movegen() - * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) + /* "LCEngine2.pyx":264 + * num = 1 + * li = [] + * tam = 0 # <<<<<<<<<<<<<< + * for pv in xpv2lipv(xpv): + * if siW: */ + __Pyx_INCREF(__pyx_int_0); + __pyx_v_tam = __pyx_int_0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.getFen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":333 - * return x - * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase + /* "LCEngine2.pyx":265 + * li = [] + * tam = 0 + * for pv in xpv2lipv(xpv): # <<<<<<<<<<<<<< + * if siW: + * x = str(num)+"." */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_xpv2lipv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_xpv); + __Pyx_GIVEREF(__pyx_v_xpv); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_xpv); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 265, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 265, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 265, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_6(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 265, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v_pv, __pyx_t_1); + __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_39getMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_39getMoves = {"getMoves", (PyCFunction)__pyx_pw_8LCEngine_39getMoves, METH_NOARGS, 0}; -static PyObject *__pyx_pw_8LCEngine_39getMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getMoves (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_38getMoves(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_38getMoves(CYTHON_UNUSED PyObject *__pyx_self) { - char __pyx_v_pv[10]; - int __pyx_v_nmoves; - int __pyx_v_x; - int __pyx_v_nbase; - PyObject *__pyx_v_li = NULL; - char *__pyx_v_r; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("getMoves", 0); - - /* "LCEngine.pyx":336 - * cdef char pv[10] - * cdef int nmoves, x, nbase - * nmoves = numMoves() # <<<<<<<<<<<<<< - * - * nbase = numBaseMove() + /* "LCEngine2.pyx":266 + * tam = 0 + * for pv in xpv2lipv(xpv): + * if siW: # <<<<<<<<<<<<<< + * x = str(num)+"." + * tam += len(x) */ - __pyx_v_nmoves = numMoves(); + __pyx_t_7 = (__pyx_v_siW != 0); + if (__pyx_t_7) { - /* "LCEngine.pyx":338 - * nmoves = numMoves() - * - * nbase = numBaseMove() # <<<<<<<<<<<<<< - * li = [] - * for x in range(nmoves): + /* "LCEngine2.pyx":267 + * for pv in xpv2lipv(xpv): + * if siW: + * x = str(num)+"." # <<<<<<<<<<<<<< + * tam += len(x) + * li.append(x) */ - __pyx_v_nbase = numBaseMove(); + __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_num); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_kp_s__24); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 267, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); + __pyx_t_4 = 0; - /* "LCEngine.pyx":339 - * - * nbase = numBaseMove() - * li = [] # <<<<<<<<<<<<<< - * for x in range(nmoves): - * getMove(x+nbase, pv) + /* "LCEngine2.pyx":268 + * if siW: + * x = str(num)+"." + * tam += len(x) # <<<<<<<<<<<<<< + * li.append(x) + * num += 1 */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_8 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 268, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_tam, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":340 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * getMove(x+nbase, pv) - * r = pv + /* "LCEngine2.pyx":269 + * x = str(num)+"." + * tam += len(x) + * li.append(x) # <<<<<<<<<<<<<< + * num += 1 + * siW = not siW */ - __pyx_t_2 = __pyx_v_nmoves; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_x = __pyx_t_3; + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_x); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 269, __pyx_L1_error) - /* "LCEngine.pyx":341 - * li = [] - * for x in range(nmoves): - * getMove(x+nbase, pv) # <<<<<<<<<<<<<< - * r = pv - * li.append(r) + /* "LCEngine2.pyx":270 + * tam += len(x) + * li.append(x) + * num += 1 # <<<<<<<<<<<<<< + * siW = not siW + * */ - getMove((__pyx_v_x + __pyx_v_nbase), __pyx_v_pv); + __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_num, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":342 - * for x in range(nmoves): - * getMove(x+nbase, pv) - * r = pv # <<<<<<<<<<<<<< - * li.append(r) - * return li + /* "LCEngine2.pyx":266 + * tam = 0 + * for pv in xpv2lipv(xpv): + * if siW: # <<<<<<<<<<<<<< + * x = str(num)+"." + * tam += len(x) */ - __pyx_v_r = __pyx_v_pv; + } - /* "LCEngine.pyx":343 - * getMove(x+nbase, pv) - * r = pv - * li.append(r) # <<<<<<<<<<<<<< - * return li + /* "LCEngine2.pyx":271 + * li.append(x) + * num += 1 + * siW = not siW # <<<<<<<<<<<<<< + * + * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) + */ + __pyx_v_siW = (!(__pyx_v_siW != 0)); + + /* "LCEngine2.pyx":273 + * siW = not siW * + * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) # <<<<<<<<<<<<<< + * if numMove == -1: + * break */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 0, 2, NULL, NULL, &__pyx_slice__25, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 343, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_AsWritableString(__pyx_t_1); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 2, 4, NULL, NULL, &__pyx_slice__26, 1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_11 = __Pyx_PyObject_AsWritableString(__pyx_t_4); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 4, 0, NULL, NULL, &__pyx_slice__27, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __Pyx_PyObject_AsWritableString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 273, __pyx_L1_error) + __pyx_v_numMove = searchMove(__pyx_t_10, __pyx_t_11, __pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":344 - * r = pv - * li.append(r) - * return li # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":274 * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): + * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) + * if numMove == -1: # <<<<<<<<<<<<<< + * break + * toSan(numMove, san) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; + __pyx_t_7 = ((__pyx_v_numMove == -1L) != 0); + if (__pyx_t_7) { - /* "LCEngine.pyx":333 - * return x + /* "LCEngine2.pyx":275 + * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) + * if numMove == -1: + * break # <<<<<<<<<<<<<< + * toSan(numMove, san) + * x = str(san) + */ + goto __pyx_L4_break; + + /* "LCEngine2.pyx":274 * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase + * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) + * if numMove == -1: # <<<<<<<<<<<<<< + * break + * toSan(numMove, san) */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.getMoves", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "LCEngine2.pyx":276 + * if numMove == -1: + * break + * toSan(numMove, san) # <<<<<<<<<<<<<< + * x = str(san) + * li.append(x) + */ + (void)(toSan(__pyx_v_numMove, __pyx_v_san)); -/* "LCEngine.pyx":346 - * return li - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< - * cdef char san[10] - * + /* "LCEngine2.pyx":277 + * break + * toSan(numMove, san) + * x = str(san) # <<<<<<<<<<<<<< + * li.append(x) + * tam += len(x) */ + __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); + __pyx_t_4 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_41getPGN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_41getPGN = {"getPGN", (PyCFunction)__pyx_pw_8LCEngine_41getPGN, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_41getPGN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_desdeA1H8 = 0; - PyObject *__pyx_v_hastaA1H8 = 0; - PyObject *__pyx_v_coronacion = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getPGN (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_desdeA1H8,&__pyx_n_s_hastaA1H8,&__pyx_n_s_coronacion,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_desdeA1H8)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hastaA1H8)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, 1); __PYX_ERR(0, 346, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, 2); __PYX_ERR(0, 346, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getPGN") < 0)) __PYX_ERR(0, 346, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_desdeA1H8 = values[0]; - __pyx_v_hastaA1H8 = values[1]; - __pyx_v_coronacion = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 346, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.getPGN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_40getPGN(__pyx_self, __pyx_v_desdeA1H8, __pyx_v_hastaA1H8, __pyx_v_coronacion); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "LCEngine2.pyx":278 + * toSan(numMove, san) + * x = str(san) + * li.append(x) # <<<<<<<<<<<<<< + * tam += len(x) + * if tam >= 80: + */ + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_x); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 278, __pyx_L1_error) -static PyObject *__pyx_pf_8LCEngine_40getPGN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desdeA1H8, PyObject *__pyx_v_hastaA1H8, PyObject *__pyx_v_coronacion) { - char __pyx_v_san[10]; - int __pyx_v_num; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - char *__pyx_t_3; - char *__pyx_t_4; - char *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("getPGN", 0); - __Pyx_INCREF(__pyx_v_coronacion); + /* "LCEngine2.pyx":279 + * x = str(san) + * li.append(x) + * tam += len(x) # <<<<<<<<<<<<<< + * if tam >= 80: + * li.append("\n") + */ + __pyx_t_8 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_tam, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_3); + __pyx_t_3 = 0; - /* "LCEngine.pyx":349 - * cdef char san[10] - * - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * + /* "LCEngine2.pyx":280 + * li.append(x) + * tam += len(x) + * if tam >= 80: # <<<<<<<<<<<<<< + * li.append("\n") + * tam = 0 */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 349, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { + __pyx_t_3 = PyObject_RichCompare(__pyx_v_tam, __pyx_int_80, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 280, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { - /* "LCEngine.pyx":350 - * - * if not coronacion: - * coronacion = "" # <<<<<<<<<<<<<< - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) + /* "LCEngine2.pyx":281 + * tam += len(x) + * if tam >= 80: + * li.append("\n") # <<<<<<<<<<<<<< + * tam = 0 + * else: */ - __Pyx_INCREF(__pyx_kp_s_); - __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_kp_s__28); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 281, __pyx_L1_error) - /* "LCEngine.pyx":349 - * cdef char san[10] - * - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * + /* "LCEngine2.pyx":282 + * if tam >= 80: + * li.append("\n") + * tam = 0 # <<<<<<<<<<<<<< + * else: + * li.append(" ") */ - } + __Pyx_INCREF(__pyx_int_0); + __Pyx_DECREF_SET(__pyx_v_tam, __pyx_int_0); - /* "LCEngine.pyx":352 - * coronacion = "" - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) # <<<<<<<<<<<<<< - * if num == -1: - * return None + /* "LCEngine2.pyx":280 + * li.append(x) + * tam += len(x) + * if tam >= 80: # <<<<<<<<<<<<<< + * li.append("\n") + * tam = 0 */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_desdeA1H8); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_hastaA1H8); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L7; + } - /* "LCEngine.pyx":353 - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return None - * + /* "LCEngine2.pyx":284 + * tam = 0 + * else: + * li.append(" ") # <<<<<<<<<<<<<< + * tam += 1 + * make_nummove(numMove) */ - __pyx_t_2 = ((__pyx_v_num == -1L) != 0); - if (__pyx_t_2) { + /*else*/ { + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_kp_s__15); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 284, __pyx_L1_error) - /* "LCEngine.pyx":354 - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - * if num == -1: - * return None # <<<<<<<<<<<<<< - * - * toSan(num, san) + /* "LCEngine2.pyx":285 + * else: + * li.append(" ") + * tam += 1 # <<<<<<<<<<<<<< + * make_nummove(numMove) + * return "".join(li) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; + __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_tam, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L7:; - /* "LCEngine.pyx":353 - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return None + /* "LCEngine2.pyx":286 + * li.append(" ") + * tam += 1 + * make_nummove(numMove) # <<<<<<<<<<<<<< + * return "".join(li) * */ - } + (void)(make_nummove(__pyx_v_numMove)); - /* "LCEngine.pyx":356 - * return None - * - * toSan(num, san) # <<<<<<<<<<<<<< - * return san - * + /* "LCEngine2.pyx":265 + * li = [] + * tam = 0 + * for pv in xpv2lipv(xpv): # <<<<<<<<<<<<<< + * if siW: + * x = str(num)+"." */ - toSan(__pyx_v_num, __pyx_v_san); + } + __pyx_L4_break:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":357 - * - * toSan(num, san) - * return san # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":287 + * tam += 1 + * make_nummove(numMove) + * return "".join(li) # <<<<<<<<<<<<<< * - * def xpv2pgn(xpv): + * def isCheck(): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_v_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 287, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "LCEngine.pyx":346 - * return li + /* "LCEngine2.pyx":258 + * return san * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< + * def xpv2pgn(xpv): # <<<<<<<<<<<<<< * cdef char san[10] - * + * setFenInicial() */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("LCEngine.getPGN", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("LCEngine2.xpv2pgn", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_coronacion); + __Pyx_XDECREF(__pyx_v_num); + __Pyx_XDECREF(__pyx_v_li); + __Pyx_XDECREF(__pyx_v_tam); + __Pyx_XDECREF(__pyx_v_pv); + __Pyx_XDECREF(__pyx_v_x); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":359 - * return san +/* "LCEngine2.pyx":289 + * return "".join(li) + * + * def isCheck(): # <<<<<<<<<<<<<< + * return inCheck() * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_43xpv2pgn(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_43xpv2pgn = {"xpv2pgn", (PyCFunction)__pyx_pw_8LCEngine_43xpv2pgn, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_43xpv2pgn(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { +static PyObject *__pyx_pw_9LCEngine2_39isCheck(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_39isCheck = {"isCheck", (PyCFunction)__pyx_pw_9LCEngine2_39isCheck, METH_NOARGS, 0}; +static PyObject *__pyx_pw_9LCEngine2_39isCheck(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("xpv2pgn (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_42xpv2pgn(__pyx_self, ((PyObject *)__pyx_v_xpv)); + __Pyx_RefNannySetupContext("isCheck (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_38isCheck(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_42xpv2pgn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - char __pyx_v_san[10]; - int __pyx_v_siW; - PyObject *__pyx_v_num = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_tam = NULL; - PyObject *__pyx_v_pv = NULL; - PyObject *__pyx_v_x = NULL; - int __pyx_v_numMove; +static PyObject *__pyx_pf_9LCEngine2_38isCheck(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - char *__pyx_t_10; - char *__pyx_t_11; - char *__pyx_t_12; - __Pyx_RefNannySetupContext("xpv2pgn", 0); + __Pyx_RefNannySetupContext("isCheck", 0); - /* "LCEngine.pyx":361 - * def xpv2pgn(xpv): - * cdef char san[10] - * setFenInicial() # <<<<<<<<<<<<<< - * siW = True - * num = 1 + /* "LCEngine2.pyx":290 + * + * def isCheck(): + * return inCheck() # <<<<<<<<<<<<<< + * + * class InfoMove(object): */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFenInicial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) - } + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_From_char(inCheck()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngine.pyx":362 - * cdef char san[10] - * setFenInicial() - * siW = True # <<<<<<<<<<<<<< - * num = 1 - * li = [] - */ - __pyx_v_siW = 1; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":363 - * setFenInicial() - * siW = True - * num = 1 # <<<<<<<<<<<<<< - * li = [] - * tam = 0 + /* "LCEngine2.pyx":289 + * return "".join(li) + * + * def isCheck(): # <<<<<<<<<<<<<< + * return inCheck() + * */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_num = __pyx_int_1; - /* "LCEngine.pyx":364 - * siW = True - * num = 1 - * li = [] # <<<<<<<<<<<<<< - * tam = 0 - * for pv in xpv2lipv(xpv): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("LCEngine2.isCheck", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":365 - * num = 1 - * li = [] - * tam = 0 # <<<<<<<<<<<<<< - * for pv in xpv2lipv(xpv): - * if siW: +/* "LCEngine2.pyx":293 + * + * class InfoMove(object): + * def __init__(self, num): # <<<<<<<<<<<<<< + * cdef char pv[10] + * cdef char info[10] */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_tam = __pyx_int_0; - /* "LCEngine.pyx":366 - * li = [] - * tam = 0 - * for pv in xpv2lipv(xpv): # <<<<<<<<<<<<<< - * if siW: - * x = str(num)+"." - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_xpv2lipv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_xpv); - __Pyx_GIVEREF(__pyx_v_xpv); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_xpv); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 366, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 366, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 366, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_1__init__ = {"__init__", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_num = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_num,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 366, __pyx_L1_error) + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 293, __pyx_L3_error) } - break; } - __Pyx_GOTREF(__pyx_t_1); + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 293, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __Pyx_XDECREF_SET(__pyx_v_pv, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_self = values[0]; + __pyx_v_num = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 293, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("LCEngine2.InfoMove.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove___init__(__pyx_self, __pyx_v_self, __pyx_v_num); - /* "LCEngine.pyx":367 - * tam = 0 - * for pv in xpv2lipv(xpv): - * if siW: # <<<<<<<<<<<<<< - * x = str(num)+"." - * tam += len(x) - */ - __pyx_t_7 = (__pyx_v_siW != 0); - if (__pyx_t_7) { + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":368 - * for pv in xpv2lipv(xpv): - * if siW: - * x = str(num)+"." # <<<<<<<<<<<<<< - * tam += len(x) - * li.append(x) +static PyObject *__pyx_pf_9LCEngine2_8InfoMove___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_num) { + char __pyx_v_pv[10]; + char __pyx_v_info[10]; + char __pyx_v_san[10]; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "LCEngine2.pyx":298 + * cdef char san[10] + * + * getMove(num, pv) # <<<<<<<<<<<<<< + * getMoveEx(num, info) + * toSan(num, san) */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_num); - __Pyx_GIVEREF(__pyx_v_num); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_num); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__34); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 298, __pyx_L1_error) + getMove(__pyx_t_1, __pyx_v_pv); - /* "LCEngine.pyx":369 - * if siW: - * x = str(num)+"." - * tam += len(x) # <<<<<<<<<<<<<< - * li.append(x) - * num += 1 + /* "LCEngine2.pyx":299 + * + * getMove(num, pv) + * getMoveEx(num, info) # <<<<<<<<<<<<<< + * toSan(num, san) + * */ - __pyx_t_8 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 369, __pyx_L1_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tam, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 299, __pyx_L1_error) + getMoveEx(__pyx_t_1, __pyx_v_info); - /* "LCEngine.pyx":370 - * x = str(num)+"." - * tam += len(x) - * li.append(x) # <<<<<<<<<<<<<< - * num += 1 - * siW = not siW + /* "LCEngine2.pyx":300 + * getMove(num, pv) + * getMoveEx(num, info) + * toSan(num, san) # <<<<<<<<<<<<<< + * + * # info = P a1 h8 q [K|Q|] */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_x); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 370, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 300, __pyx_L1_error) + (void)(toSan(__pyx_t_1, __pyx_v_san)); - /* "LCEngine.pyx":371 - * tam += len(x) - * li.append(x) - * num += 1 # <<<<<<<<<<<<<< - * siW = not siW + /* "LCEngine2.pyx":304 + * # info = P a1 h8 q [K|Q|] * + * self._castle_K = info[6] == "K" # <<<<<<<<<<<<<< + * self._castle_Q = info[6] == "Q" + * self._ep = info[7]=="E" */ - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_num, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[6]) == 'K')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_castle_K, __pyx_t_2) < 0) __PYX_ERR(0, 304, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":367 - * tam = 0 - * for pv in xpv2lipv(xpv): - * if siW: # <<<<<<<<<<<<<< - * x = str(num)+"." - * tam += len(x) - */ - } - - /* "LCEngine.pyx":372 - * li.append(x) - * num += 1 - * siW = not siW # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":305 * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) + * self._castle_K = info[6] == "K" + * self._castle_Q = info[6] == "Q" # <<<<<<<<<<<<<< + * self._ep = info[7]=="E" + * self._pv = pv */ - __pyx_v_siW = (!(__pyx_v_siW != 0)); + __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[6]) == 'Q')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_castle_Q, __pyx_t_2) < 0) __PYX_ERR(0, 305, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":374 - * siW = not siW - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) # <<<<<<<<<<<<<< - * if numMove == -1: - * break + /* "LCEngine2.pyx":306 + * self._castle_K = info[6] == "K" + * self._castle_Q = info[6] == "Q" + * self._ep = info[7]=="E" # <<<<<<<<<<<<<< + * self._pv = pv + * self._san = san */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 0, 2, NULL, NULL, &__pyx_slice__35, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 2, 4, NULL, NULL, &__pyx_slice__36, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 4, 0, NULL, NULL, &__pyx_slice__37, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) - __pyx_v_numMove = searchMove(__pyx_t_10, __pyx_t_11, __pyx_t_12); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[7]) == 'E')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ep, __pyx_t_2) < 0) __PYX_ERR(0, 306, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":375 + /* "LCEngine2.pyx":307 + * self._castle_Q = info[6] == "Q" + * self._ep = info[7]=="E" + * self._pv = pv # <<<<<<<<<<<<<< + * self._san = san * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - * if numMove == -1: # <<<<<<<<<<<<<< - * break - * toSan(numMove, san) - */ - __pyx_t_7 = ((__pyx_v_numMove == -1L) != 0); - if (__pyx_t_7) { - - /* "LCEngine.pyx":376 - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - * if numMove == -1: - * break # <<<<<<<<<<<<<< - * toSan(numMove, san) - * x = str(san) */ - goto __pyx_L4_break; + __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pv, __pyx_t_2) < 0) __PYX_ERR(0, 307, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":375 + /* "LCEngine2.pyx":308 + * self._ep = info[7]=="E" + * self._pv = pv + * self._san = san # <<<<<<<<<<<<<< * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - * if numMove == -1: # <<<<<<<<<<<<<< - * break - * toSan(numMove, san) - */ - } - - /* "LCEngine.pyx":377 - * if numMove == -1: - * break - * toSan(numMove, san) # <<<<<<<<<<<<<< - * x = str(san) - * li.append(x) - */ - toSan(__pyx_v_numMove, __pyx_v_san); - - /* "LCEngine.pyx":378 - * break - * toSan(numMove, san) - * x = str(san) # <<<<<<<<<<<<<< - * li.append(x) - * tam += len(x) - */ - __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngine.pyx":379 - * toSan(numMove, san) - * x = str(san) - * li.append(x) # <<<<<<<<<<<<<< - * tam += len(x) - * if tam >= 80: - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_x); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 379, __pyx_L1_error) - - /* "LCEngine.pyx":380 - * x = str(san) - * li.append(x) - * tam += len(x) # <<<<<<<<<<<<<< - * if tam >= 80: - * li.append("\n") + * self._piece = info[0:1] */ - __pyx_t_8 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 380, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_tam, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_san, __pyx_t_2) < 0) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":381 - * li.append(x) - * tam += len(x) - * if tam >= 80: # <<<<<<<<<<<<<< - * li.append("\n") - * tam = 0 + /* "LCEngine2.pyx":310 + * self._san = san + * + * self._piece = info[0:1] # <<<<<<<<<<<<<< + * self._from = info[1:3] + * self._to = info[3:5] */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_tam, __pyx_int_80, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_7) { + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 0, 1 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_piece, __pyx_t_2) < 0) __PYX_ERR(0, 310, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":382 - * tam += len(x) - * if tam >= 80: - * li.append("\n") # <<<<<<<<<<<<<< - * tam = 0 - * else: + /* "LCEngine2.pyx":311 + * + * self._piece = info[0:1] + * self._from = info[1:3] # <<<<<<<<<<<<<< + * self._to = info[3:5] + * self._promotion = info[5:6].strip() */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_kp_s__38); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 382, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 1, 3 - 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_from, __pyx_t_2) < 0) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":383 - * if tam >= 80: - * li.append("\n") - * tam = 0 # <<<<<<<<<<<<<< - * else: - * li.append(" ") + /* "LCEngine2.pyx":312 + * self._piece = info[0:1] + * self._from = info[1:3] + * self._to = info[3:5] # <<<<<<<<<<<<<< + * self._promotion = info[5:6].strip() + * self._check = "+" in san */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_int_0); + __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 3, 5 - 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_to, __pyx_t_2) < 0) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":381 - * li.append(x) - * tam += len(x) - * if tam >= 80: # <<<<<<<<<<<<<< - * li.append("\n") - * tam = 0 + /* "LCEngine2.pyx":313 + * self._from = info[1:3] + * self._to = info[3:5] + * self._promotion = info[5:6].strip() # <<<<<<<<<<<<<< + * self._check = "+" in san + * self._mate = "#" in san */ - goto __pyx_L7; + __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 5, 6 - 5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_promotion, __pyx_t_2) < 0) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":385 - * tam = 0 - * else: - * li.append(" ") # <<<<<<<<<<<<<< - * tam += 1 - * make_nummove(numMove) - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_kp_s__25); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 385, __pyx_L1_error) - - /* "LCEngine.pyx":386 - * else: - * li.append(" ") - * tam += 1 # <<<<<<<<<<<<<< - * make_nummove(numMove) - * return "".join(li) + /* "LCEngine2.pyx":314 + * self._to = info[3:5] + * self._promotion = info[5:6].strip() + * self._check = "+" in san # <<<<<<<<<<<<<< + * self._mate = "#" in san + * self._capture = "x" in san */ - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_tam, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L7:; + __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__29, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_check, __pyx_t_2) < 0) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":387 - * li.append(" ") - * tam += 1 - * make_nummove(numMove) # <<<<<<<<<<<<<< - * return "".join(li) + /* "LCEngine2.pyx":315 + * self._promotion = info[5:6].strip() + * self._check = "+" in san + * self._mate = "#" in san # <<<<<<<<<<<<<< + * self._capture = "x" in san * */ - make_nummove(__pyx_v_numMove); - - /* "LCEngine.pyx":366 - * li = [] - * tam = 0 - * for pv in xpv2lipv(xpv): # <<<<<<<<<<<<<< - * if siW: - * x = str(num)+"." - */ - } - __pyx_L4_break:; + __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__30, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mate, __pyx_t_2) < 0) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":388 - * tam += 1 - * make_nummove(numMove) - * return "".join(li) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":316 + * self._check = "+" in san + * self._mate = "#" in san + * self._capture = "x" in san # <<<<<<<<<<<<<< * - * def isCheck(): + * def desde(self): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_v_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; + __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_x, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_capture, __pyx_t_2) < 0) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":359 - * return san + /* "LCEngine2.pyx":293 * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() + * class InfoMove(object): + * def __init__(self, num): # <<<<<<<<<<<<<< + * cdef char pv[10] + * cdef char info[10] */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.xpv2pgn", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_num); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_tam); - __Pyx_XDECREF(__pyx_v_pv); - __Pyx_XDECREF(__pyx_v_x); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "LCEngine.pyx":390 - * return "".join(li) +/* "LCEngine2.pyx":318 + * self._capture = "x" in san * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() + * def desde(self): # <<<<<<<<<<<<<< + * return self._from * */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_45isCheck(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_45isCheck = {"isCheck", (PyCFunction)__pyx_pw_8LCEngine_45isCheck, METH_NOARGS, 0}; -static PyObject *__pyx_pw_8LCEngine_45isCheck(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_3desde(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_3desde = {"desde", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_3desde, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_3desde(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isCheck (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_44isCheck(__pyx_self); + __Pyx_RefNannySetupContext("desde (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_2desde(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_44isCheck(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_2desde(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("isCheck", 0); + __Pyx_RefNannySetupContext("desde", 0); - /* "LCEngine.pyx":391 + /* "LCEngine2.pyx":319 * - * def isCheck(): - * return inCheck() # <<<<<<<<<<<<<< + * def desde(self): + * return self._from # <<<<<<<<<<<<<< * - * class InfoMove(object): + * def hasta(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_char(inCheck()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_from); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":390 - * return "".join(li) + /* "LCEngine2.pyx":318 + * self._capture = "x" in san * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() + * def desde(self): # <<<<<<<<<<<<<< + * return self._from * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.isCheck", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.desde", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8993,508 +7924,137 @@ static PyObject *__pyx_pf_8LCEngine_44isCheck(CYTHON_UNUSED PyObject *__pyx_self return __pyx_r; } -/* "LCEngine.pyx":394 +/* "LCEngine2.pyx":321 + * return self._from + * + * def hasta(self): # <<<<<<<<<<<<<< + * return self._to * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_1__init__ = {"__init__", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_num = 0; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_5hasta(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_5hasta = {"hasta", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_5hasta, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_5hasta(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_num,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 394, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 394, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_num = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 394, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.InfoMove.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_8InfoMove___init__(__pyx_self, __pyx_v_self, __pyx_v_num); + __Pyx_RefNannySetupContext("hasta (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_4hasta(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_num) { - char __pyx_v_pv[10]; - char __pyx_v_info[10]; - char __pyx_v_san[10]; +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_4hasta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__init__", 0); + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("hasta", 0); - /* "LCEngine.pyx":399 - * cdef char san[10] + /* "LCEngine2.pyx":322 * - * getMove(num, pv) # <<<<<<<<<<<<<< - * getMoveEx(num, info) - * toSan(num, san) + * def hasta(self): + * return self._to # <<<<<<<<<<<<<< + * + * def coronacion(self): */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error) - getMove(__pyx_t_1, __pyx_v_pv); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 322, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":400 + /* "LCEngine2.pyx":321 + * return self._from * - * getMove(num, pv) - * getMoveEx(num, info) # <<<<<<<<<<<<<< - * toSan(num, san) + * def hasta(self): # <<<<<<<<<<<<<< + * return self._to * */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L1_error) - getMoveEx(__pyx_t_1, __pyx_v_info); - /* "LCEngine.pyx":401 - * getMove(num, pv) - * getMoveEx(num, info) - * toSan(num, san) # <<<<<<<<<<<<<< - * - * # info = P a1 h8 q [K|Q|] - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 401, __pyx_L1_error) - toSan(__pyx_t_1, __pyx_v_san); + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("LCEngine2.InfoMove.hasta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":405 - * # info = P a1 h8 q [K|Q|] +/* "LCEngine2.pyx":324 + * return self._to * - * self._castle_K = info[6] == "K" # <<<<<<<<<<<<<< - * self._castle_Q = info[6] == "Q" - * self._ep = info[7]=="E" - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[6]) == 'K')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_castle_K, __pyx_t_2) < 0) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":406 + * def coronacion(self): # <<<<<<<<<<<<<< + * return self._promotion.lower() * - * self._castle_K = info[6] == "K" - * self._castle_Q = info[6] == "Q" # <<<<<<<<<<<<<< - * self._ep = info[7]=="E" - * self._pv = pv */ - __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[6]) == 'Q')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_castle_Q, __pyx_t_2) < 0) __PYX_ERR(0, 406, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":407 - * self._castle_K = info[6] == "K" - * self._castle_Q = info[6] == "Q" - * self._ep = info[7]=="E" # <<<<<<<<<<<<<< - * self._pv = pv - * self._san = san - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[7]) == 'E')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ep, __pyx_t_2) < 0) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_7coronacion(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_7coronacion = {"coronacion", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_7coronacion, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_7coronacion(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("coronacion (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_6coronacion(__pyx_self, ((PyObject *)__pyx_v_self)); - /* "LCEngine.pyx":408 - * self._castle_Q = info[6] == "Q" - * self._ep = info[7]=="E" - * self._pv = pv # <<<<<<<<<<<<<< - * self._san = san - * - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pv, __pyx_t_2) < 0) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":409 - * self._ep = info[7]=="E" - * self._pv = pv - * self._san = san # <<<<<<<<<<<<<< - * - * self._piece = info[0:1] - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_san, __pyx_t_2) < 0) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_6coronacion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannySetupContext("coronacion", 0); - /* "LCEngine.pyx":411 - * self._san = san + /* "LCEngine2.pyx":325 * - * self._piece = info[0:1] # <<<<<<<<<<<<<< - * self._from = info[1:3] - * self._to = info[3:5] - */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 0, 1 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_piece, __pyx_t_2) < 0) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":412 + * def coronacion(self): + * return self._promotion.lower() # <<<<<<<<<<<<<< * - * self._piece = info[0:1] - * self._from = info[1:3] # <<<<<<<<<<<<<< - * self._to = info[3:5] - * self._promotion = info[5:6].strip() - */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 1, 3 - 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_from, __pyx_t_2) < 0) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":413 - * self._piece = info[0:1] - * self._from = info[1:3] - * self._to = info[3:5] # <<<<<<<<<<<<<< - * self._promotion = info[5:6].strip() - * self._check = "+" in san + * def movimiento(self): */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 3, 5 - 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_promotion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_to, __pyx_t_2) < 0) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":414 - * self._from = info[1:3] - * self._to = info[3:5] - * self._promotion = info[5:6].strip() # <<<<<<<<<<<<<< - * self._check = "+" in san - * self._mate = "#" in san - */ - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 5, 6 - 5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 325, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_2) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 325, __pyx_L1_error) } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_promotion, __pyx_t_2) < 0) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":415 - * self._to = info[3:5] - * self._promotion = info[5:6].strip() - * self._check = "+" in san # <<<<<<<<<<<<<< - * self._mate = "#" in san - * self._capture = "x" in san - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__39, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_check, __pyx_t_2) < 0) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":416 - * self._promotion = info[5:6].strip() - * self._check = "+" in san - * self._mate = "#" in san # <<<<<<<<<<<<<< - * self._capture = "x" in san - * - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__40, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mate, __pyx_t_2) < 0) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":417 - * self._check = "+" in san - * self._mate = "#" in san - * self._capture = "x" in san # <<<<<<<<<<<<<< - * - * def desde(self): - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_x, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_capture, __pyx_t_2) < 0) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":394 - * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.InfoMove.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":419 - * self._capture = "x" in san - * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_3desde(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_3desde = {"desde", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_3desde, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_3desde(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("desde (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_2desde(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_8InfoMove_2desde(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("desde", 0); - - /* "LCEngine.pyx":420 - * - * def desde(self): - * return self._from # <<<<<<<<<<<<<< - * - * def hasta(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_from); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":419 - * self._capture = "x" in san - * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.desde", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":422 - * return self._from - * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_5hasta(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_5hasta = {"hasta", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_5hasta, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_5hasta(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("hasta (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_4hasta(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_8InfoMove_4hasta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("hasta", 0); - - /* "LCEngine.pyx":423 - * - * def hasta(self): - * return self._to # <<<<<<<<<<<<<< - * - * def coronacion(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":422 - * return self._from - * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.hasta", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":425 - * return self._to - * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_7coronacion(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_7coronacion = {"coronacion", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_7coronacion, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_7coronacion(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("coronacion (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_6coronacion(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_8InfoMove_6coronacion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("coronacion", 0); - - /* "LCEngine.pyx":426 - * - * def coronacion(self): - * return self._promotion.lower() # <<<<<<<<<<<<<< - * - * def movimiento(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_promotion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":425 - * return self._to - * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() + /* "LCEngine2.pyx":324 + * return self._to + * + * def coronacion(self): # <<<<<<<<<<<<<< + * return self._promotion.lower() * */ @@ -9503,7 +8063,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_6coronacion(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngine.InfoMove.coronacion", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.coronacion", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9511,7 +8071,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_6coronacion(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":428 +/* "LCEngine2.pyx":327 * return self._promotion.lower() * * def movimiento(self): # <<<<<<<<<<<<<< @@ -9520,20 +8080,20 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_6coronacion(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_9movimiento(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_9movimiento = {"movimiento", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_9movimiento, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_9movimiento(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_9movimiento(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_9movimiento = {"movimiento", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_9movimiento, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_9movimiento(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("movimiento (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_8movimiento(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_8movimiento(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_8movimiento(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9542,7 +8102,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("movimiento", 0); - /* "LCEngine.pyx":429 + /* "LCEngine2.pyx":328 * * def movimiento(self): * return self._from+self._to+self._promotion.lower() # <<<<<<<<<<<<<< @@ -9550,17 +8110,17 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject * def jaque(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_from); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_from); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_promotion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_promotion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; @@ -9574,14 +8134,14 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject } } if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 328, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 328, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -9589,7 +8149,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject __pyx_t_4 = 0; goto __pyx_L0; - /* "LCEngine.pyx":428 + /* "LCEngine2.pyx":327 * return self._promotion.lower() * * def movimiento(self): # <<<<<<<<<<<<<< @@ -9603,7 +8163,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.InfoMove.movimiento", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.movimiento", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9611,7 +8171,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":431 +/* "LCEngine2.pyx":330 * return self._from+self._to+self._promotion.lower() * * def jaque(self): # <<<<<<<<<<<<<< @@ -9620,26 +8180,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_8movimiento(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_11jaque(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_11jaque = {"jaque", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_11jaque, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_11jaque(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_11jaque(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_11jaque = {"jaque", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_11jaque, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_11jaque(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("jaque (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_10jaque(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_10jaque(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("jaque", 0); - /* "LCEngine.pyx":432 + /* "LCEngine2.pyx":331 * * def jaque(self): * return self._check # <<<<<<<<<<<<<< @@ -9647,13 +8207,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__ * def mate(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":431 + /* "LCEngine2.pyx":330 * return self._from+self._to+self._promotion.lower() * * def jaque(self): # <<<<<<<<<<<<<< @@ -9664,7 +8224,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.jaque", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.jaque", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9672,7 +8232,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__ return __pyx_r; } -/* "LCEngine.pyx":434 +/* "LCEngine2.pyx":333 * return self._check * * def mate(self): # <<<<<<<<<<<<<< @@ -9681,26 +8241,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__ */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_13mate(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_13mate = {"mate", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_13mate, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_13mate(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_13mate(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_13mate = {"mate", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_13mate, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_13mate(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mate (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_12mate(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_12mate(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_12mate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_12mate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("mate", 0); - /* "LCEngine.pyx":435 + /* "LCEngine2.pyx":334 * * def mate(self): * return self._mate # <<<<<<<<<<<<<< @@ -9708,13 +8268,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_12mate(CYTHON_UNUSED PyObject *__p * def captura(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":434 + /* "LCEngine2.pyx":333 * return self._check * * def mate(self): # <<<<<<<<<<<<<< @@ -9725,7 +8285,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_12mate(CYTHON_UNUSED PyObject *__p /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.mate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.mate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9733,7 +8293,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_12mate(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "LCEngine.pyx":437 +/* "LCEngine2.pyx":336 * return self._mate * * def captura(self): # <<<<<<<<<<<<<< @@ -9742,26 +8302,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_12mate(CYTHON_UNUSED PyObject *__p */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_15captura(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_15captura = {"captura", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_15captura, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_15captura(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_15captura(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_15captura = {"captura", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_15captura, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_15captura(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("captura (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_14captura(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_14captura(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_14captura(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_14captura(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("captura", 0); - /* "LCEngine.pyx":438 + /* "LCEngine2.pyx":337 * * def captura(self): * return self._capture # <<<<<<<<<<<<<< @@ -9769,13 +8329,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_14captura(CYTHON_UNUSED PyObject * * def pieza(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":437 + /* "LCEngine2.pyx":336 * return self._mate * * def captura(self): # <<<<<<<<<<<<<< @@ -9786,7 +8346,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_14captura(CYTHON_UNUSED PyObject * /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.captura", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.captura", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9794,7 +8354,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_14captura(CYTHON_UNUSED PyObject * return __pyx_r; } -/* "LCEngine.pyx":440 +/* "LCEngine2.pyx":339 * return self._capture * * def pieza(self): # <<<<<<<<<<<<<< @@ -9803,26 +8363,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_14captura(CYTHON_UNUSED PyObject * */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_17pieza(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_17pieza = {"pieza", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_17pieza, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_17pieza(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_17pieza(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_17pieza = {"pieza", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_17pieza, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_17pieza(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("pieza (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_16pieza(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_16pieza(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("pieza", 0); - /* "LCEngine.pyx":441 + /* "LCEngine2.pyx":340 * * def pieza(self): * return self._piece # <<<<<<<<<<<<<< @@ -9830,13 +8390,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__ * def isCastleK(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_piece); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_piece); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":440 + /* "LCEngine2.pyx":339 * return self._capture * * def pieza(self): # <<<<<<<<<<<<<< @@ -9847,7 +8407,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.pieza", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.pieza", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9855,7 +8415,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__ return __pyx_r; } -/* "LCEngine.pyx":443 +/* "LCEngine2.pyx":342 * return self._piece * * def isCastleK(self): # <<<<<<<<<<<<<< @@ -9864,26 +8424,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__ */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_19isCastleK(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_19isCastleK = {"isCastleK", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_19isCastleK, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_19isCastleK(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_19isCastleK(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_19isCastleK = {"isCastleK", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_19isCastleK, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_19isCastleK(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isCastleK (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_18isCastleK(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_18isCastleK(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("isCastleK", 0); - /* "LCEngine.pyx":444 + /* "LCEngine2.pyx":343 * * def isCastleK(self): * return self._castle_K # <<<<<<<<<<<<<< @@ -9891,13 +8451,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject * def isCastleQ(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_castle_K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_castle_K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":443 + /* "LCEngine2.pyx":342 * return self._piece * * def isCastleK(self): # <<<<<<<<<<<<<< @@ -9908,7 +8468,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.isCastleK", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.isCastleK", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9916,7 +8476,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":446 +/* "LCEngine2.pyx":345 * return self._castle_K * * def isCastleQ(self): # <<<<<<<<<<<<<< @@ -9925,26 +8485,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_21isCastleQ(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_21isCastleQ = {"isCastleQ", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_21isCastleQ, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_21isCastleQ(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_21isCastleQ(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_21isCastleQ = {"isCastleQ", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_21isCastleQ, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_21isCastleQ(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isCastleQ (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_20isCastleQ(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_20isCastleQ(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("isCastleQ", 0); - /* "LCEngine.pyx":447 + /* "LCEngine2.pyx":346 * * def isCastleQ(self): * return self._castle_Q # <<<<<<<<<<<<<< @@ -9952,13 +8512,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject * def isEnPassant(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_castle_Q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_castle_Q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":446 + /* "LCEngine2.pyx":345 * return self._castle_K * * def isCastleQ(self): # <<<<<<<<<<<<<< @@ -9969,7 +8529,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.isCastleQ", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.isCastleQ", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9977,7 +8537,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject return __pyx_r; } -/* "LCEngine.pyx":449 +/* "LCEngine2.pyx":348 * return self._castle_Q * * def isEnPassant(self): # <<<<<<<<<<<<<< @@ -9986,26 +8546,26 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_8InfoMove_23isEnPassant(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_8InfoMove_23isEnPassant = {"isEnPassant", (PyCFunction)__pyx_pw_8LCEngine_8InfoMove_23isEnPassant, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_8InfoMove_23isEnPassant(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_23isEnPassant(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_8InfoMove_23isEnPassant = {"isEnPassant", (PyCFunction)__pyx_pw_9LCEngine2_8InfoMove_23isEnPassant, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_8InfoMove_23isEnPassant(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isEnPassant (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_8InfoMove_22isEnPassant(__pyx_self, ((PyObject *)__pyx_v_self)); + __pyx_r = __pyx_pf_9LCEngine2_8InfoMove_22isEnPassant(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_9LCEngine2_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("isEnPassant", 0); - /* "LCEngine.pyx":450 + /* "LCEngine2.pyx":349 * * def isEnPassant(self): * return self._ep # <<<<<<<<<<<<<< @@ -10013,13 +8573,13 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObje * def getExMoves(): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 349, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "LCEngine.pyx":449 + /* "LCEngine2.pyx":348 * return self._castle_Q * * def isEnPassant(self): # <<<<<<<<<<<<<< @@ -10030,7 +8590,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObje /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.InfoMove.isEnPassant", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.InfoMove.isEnPassant", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10038,7 +8598,7 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObje return __pyx_r; } -/* "LCEngine.pyx":452 +/* "LCEngine2.pyx":351 * return self._ep * * def getExMoves(): # <<<<<<<<<<<<<< @@ -10047,20 +8607,20 @@ static PyObject *__pyx_pf_8LCEngine_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObje */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_47getExMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_47getExMoves = {"getExMoves", (PyCFunction)__pyx_pw_8LCEngine_47getExMoves, METH_NOARGS, 0}; -static PyObject *__pyx_pw_8LCEngine_47getExMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_9LCEngine2_41getExMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_41getExMoves = {"getExMoves", (PyCFunction)__pyx_pw_9LCEngine2_41getExMoves, METH_NOARGS, 0}; +static PyObject *__pyx_pw_9LCEngine2_41getExMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("getExMoves (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_46getExMoves(__pyx_self); + __pyx_r = __pyx_pf_9LCEngine2_40getExMoves(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_9LCEngine2_40getExMoves(CYTHON_UNUSED PyObject *__pyx_self) { int __pyx_v_nmoves; PyObject *__pyx_v_nbase = NULL; PyObject *__pyx_v_li = NULL; @@ -10079,7 +8639,7 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s int __pyx_t_9; __Pyx_RefNannySetupContext("getExMoves", 0); - /* "LCEngine.pyx":453 + /* "LCEngine2.pyx":352 * * def getExMoves(): * nmoves = numMoves() # <<<<<<<<<<<<<< @@ -10088,100 +8648,95 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s */ __pyx_v_nmoves = numMoves(); - /* "LCEngine.pyx":455 + /* "LCEngine2.pyx":354 * nmoves = numMoves() * * nbase = numBaseMove() # <<<<<<<<<<<<<< * li = [] * for x in range(nmoves): */ - __pyx_t_1 = __Pyx_PyInt_From_int(numBaseMove()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(numBaseMove()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_nbase = __pyx_t_1; __pyx_t_1 = 0; - /* "LCEngine.pyx":456 + /* "LCEngine2.pyx":355 * * nbase = numBaseMove() * li = [] # <<<<<<<<<<<<<< * for x in range(nmoves): * mv = InfoMove(x + nbase) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_li = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":457 + /* "LCEngine2.pyx":356 * nbase = numBaseMove() * li = [] * for x in range(nmoves): # <<<<<<<<<<<<<< * mv = InfoMove(x + nbase) * li.append(mv) */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmoves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmoves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 356, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 356, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 356, __pyx_L1_error) #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); #endif } } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { + __pyx_t_2 = __pyx_t_4(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 457, __pyx_L1_error) + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 356, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":458 + /* "LCEngine2.pyx":357 * li = [] * for x in range(nmoves): * mv = InfoMove(x + nbase) # <<<<<<<<<<<<<< * li.append(mv) * return li */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyNumber_Add(__pyx_v_x, __pyx_v_nbase); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_6 = PyNumber_Add(__pyx_v_x, __pyx_v_nbase); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { @@ -10194,54 +8749,54 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s } } if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 357, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 357, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_mv, __pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_mv, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":459 + /* "LCEngine2.pyx":358 * for x in range(nmoves): * mv = InfoMove(x + nbase) * li.append(mv) # <<<<<<<<<<<<<< * return li * */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_mv); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 459, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_mv); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(0, 358, __pyx_L1_error) - /* "LCEngine.pyx":457 + /* "LCEngine2.pyx":356 * nbase = numBaseMove() * li = [] * for x in range(nmoves): # <<<<<<<<<<<<<< @@ -10249,9 +8804,9 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s * li.append(mv) */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":460 + /* "LCEngine2.pyx":359 * mv = InfoMove(x + nbase) * li.append(mv) * return li # <<<<<<<<<<<<<< @@ -10263,7 +8818,7 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s __pyx_r = __pyx_v_li; goto __pyx_L0; - /* "LCEngine.pyx":452 + /* "LCEngine2.pyx":351 * return self._ep * * def getExMoves(): # <<<<<<<<<<<<<< @@ -10279,7 +8834,7 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("LCEngine.getExMoves", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.getExMoves", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_nbase); @@ -10291,7 +8846,7 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s return __pyx_r; } -/* "LCEngine.pyx":462 +/* "LCEngine2.pyx":361 * return li * * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< @@ -10300,9 +8855,9 @@ static PyObject *__pyx_pf_8LCEngine_46getExMoves(CYTHON_UNUSED PyObject *__pyx_s */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_49moveExPV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_49moveExPV = {"moveExPV", (PyCFunction)__pyx_pw_8LCEngine_49moveExPV, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_49moveExPV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_9LCEngine2_43moveExPV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_43moveExPV = {"moveExPV", (PyCFunction)__pyx_pw_9LCEngine2_43moveExPV, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_43moveExPV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_desde = 0; PyObject *__pyx_v_hasta = 0; PyObject *__pyx_v_coronacion = 0; @@ -10317,29 +8872,34 @@ static PyObject *__pyx_pw_8LCEngine_49moveExPV(PyObject *__pyx_self, PyObject *_ const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_desde)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_desde)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hasta)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, 1); __PYX_ERR(0, 462, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, 1); __PYX_ERR(0, 361, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, 2); __PYX_ERR(0, 462, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, 2); __PYX_ERR(0, 361, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "moveExPV") < 0)) __PYX_ERR(0, 462, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "moveExPV") < 0)) __PYX_ERR(0, 361, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -10354,20 +8914,20 @@ static PyObject *__pyx_pw_8LCEngine_49moveExPV(PyObject *__pyx_self, PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 462, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 361, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.moveExPV", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.moveExPV", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_48moveExPV(__pyx_self, __pyx_v_desde, __pyx_v_hasta, __pyx_v_coronacion); + __pyx_r = __pyx_pf_9LCEngine2_42moveExPV(__pyx_self, __pyx_v_desde, __pyx_v_hasta, __pyx_v_coronacion); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion) { +static PyObject *__pyx_pf_9LCEngine2_42moveExPV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion) { int __pyx_v_num; PyObject *__pyx_v_infoMove = NULL; PyObject *__pyx_r = NULL; @@ -10385,18 +8945,18 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_RefNannySetupContext("moveExPV", 0); __Pyx_INCREF(__pyx_v_coronacion); - /* "LCEngine.pyx":463 + /* "LCEngine2.pyx":362 * * def moveExPV(desde, hasta, coronacion): * if not coronacion: # <<<<<<<<<<<<<< * coronacion = "" * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 463, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 362, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "LCEngine.pyx":464 + /* "LCEngine2.pyx":363 * def moveExPV(desde, hasta, coronacion): * if not coronacion: * coronacion = "" # <<<<<<<<<<<<<< @@ -10406,7 +8966,7 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_INCREF(__pyx_kp_s_); __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); - /* "LCEngine.pyx":463 + /* "LCEngine2.pyx":362 * * def moveExPV(desde, hasta, coronacion): * if not coronacion: # <<<<<<<<<<<<<< @@ -10415,19 +8975,19 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel */ } - /* "LCEngine.pyx":466 + /* "LCEngine2.pyx":365 * coronacion = "" * * num = searchMove( desde, hasta, coronacion ) # <<<<<<<<<<<<<< * if num == -1: * return None */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_desde); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_hasta); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_desde); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_hasta); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 365, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 365, __pyx_L1_error) __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); - /* "LCEngine.pyx":467 + /* "LCEngine2.pyx":366 * * num = searchMove( desde, hasta, coronacion ) * if num == -1: # <<<<<<<<<<<<<< @@ -10437,7 +8997,7 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel __pyx_t_2 = ((__pyx_v_num == -1L) != 0); if (__pyx_t_2) { - /* "LCEngine.pyx":468 + /* "LCEngine2.pyx":367 * num = searchMove( desde, hasta, coronacion ) * if num == -1: * return None # <<<<<<<<<<<<<< @@ -10445,11 +9005,10 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel * infoMove = InfoMove(num) */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - /* "LCEngine.pyx":467 + /* "LCEngine2.pyx":366 * * num = searchMove( desde, hasta, coronacion ) * if num == -1: # <<<<<<<<<<<<<< @@ -10458,16 +9017,16 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel */ } - /* "LCEngine.pyx":470 + /* "LCEngine2.pyx":369 * return None * * infoMove = InfoMove(num) # <<<<<<<<<<<<<< * make_nummove(num) * */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_num); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_num); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -10480,14 +9039,14 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel } } if (!__pyx_t_9) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_6); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_7)) { PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -10496,20 +9055,20 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8); __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } @@ -10518,16 +9077,16 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel __pyx_v_infoMove = __pyx_t_6; __pyx_t_6 = 0; - /* "LCEngine.pyx":471 + /* "LCEngine2.pyx":370 * * infoMove = InfoMove(num) * make_nummove(num) # <<<<<<<<<<<<<< * * return infoMove */ - make_nummove(__pyx_v_num); + (void)(make_nummove(__pyx_v_num)); - /* "LCEngine.pyx":473 + /* "LCEngine2.pyx":372 * make_nummove(num) * * return infoMove # <<<<<<<<<<<<<< @@ -10539,7 +9098,7 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel __pyx_r = __pyx_v_infoMove; goto __pyx_L0; - /* "LCEngine.pyx":462 + /* "LCEngine2.pyx":361 * return li * * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< @@ -10554,7 +9113,7 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("LCEngine.moveExPV", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.moveExPV", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_infoMove); @@ -10564,7 +9123,7 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "LCEngine.pyx":475 +/* "LCEngine2.pyx":374 * return infoMove * * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< @@ -10573,9 +9132,9 @@ static PyObject *__pyx_pf_8LCEngine_48moveExPV(CYTHON_UNUSED PyObject *__pyx_sel */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_51movePV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_51movePV = {"movePV", (PyCFunction)__pyx_pw_8LCEngine_51movePV, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_51movePV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_9LCEngine2_45movePV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_45movePV = {"movePV", (PyCFunction)__pyx_pw_9LCEngine2_45movePV, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_45movePV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_desde = 0; PyObject *__pyx_v_hasta = 0; PyObject *__pyx_v_coronacion = 0; @@ -10590,29 +9149,34 @@ static PyObject *__pyx_pw_8LCEngine_51movePV(PyObject *__pyx_self, PyObject *__p const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_desde)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_desde)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hasta)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_hasta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, 1); __PYX_ERR(0, 475, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, 1); __PYX_ERR(0, 374, __pyx_L3_error) } + CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, 2); __PYX_ERR(0, 475, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, 2); __PYX_ERR(0, 374, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "movePV") < 0)) __PYX_ERR(0, 475, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "movePV") < 0)) __PYX_ERR(0, 374, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -10627,20 +9191,20 @@ static PyObject *__pyx_pw_8LCEngine_51movePV(PyObject *__pyx_self, PyObject *__p } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 475, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 374, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.movePV", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.movePV", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_50movePV(__pyx_self, __pyx_v_desde, __pyx_v_hasta, __pyx_v_coronacion); + __pyx_r = __pyx_pf_9LCEngine2_44movePV(__pyx_self, __pyx_v_desde, __pyx_v_hasta, __pyx_v_coronacion); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion) { +static PyObject *__pyx_pf_9LCEngine2_44movePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion) { int __pyx_v_num; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10652,18 +9216,18 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_RefNannySetupContext("movePV", 0); __Pyx_INCREF(__pyx_v_coronacion); - /* "LCEngine.pyx":476 + /* "LCEngine2.pyx":375 * * def movePV(desde, hasta, coronacion): * if not coronacion: # <<<<<<<<<<<<<< * coronacion = "" * */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 476, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 375, __pyx_L1_error) __pyx_t_2 = ((!__pyx_t_1) != 0); if (__pyx_t_2) { - /* "LCEngine.pyx":477 + /* "LCEngine2.pyx":376 * def movePV(desde, hasta, coronacion): * if not coronacion: * coronacion = "" # <<<<<<<<<<<<<< @@ -10673,7 +9237,7 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, __Pyx_INCREF(__pyx_kp_s_); __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); - /* "LCEngine.pyx":476 + /* "LCEngine2.pyx":375 * * def movePV(desde, hasta, coronacion): * if not coronacion: # <<<<<<<<<<<<<< @@ -10682,19 +9246,19 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, */ } - /* "LCEngine.pyx":479 + /* "LCEngine2.pyx":378 * coronacion = "" * * num = searchMove( desde, hasta, coronacion ) # <<<<<<<<<<<<<< * if num == -1: * return False */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_desde); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_hasta); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_desde); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_hasta); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_AsWritableString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 378, __pyx_L1_error) __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); - /* "LCEngine.pyx":480 + /* "LCEngine2.pyx":379 * * num = searchMove( desde, hasta, coronacion ) * if num == -1: # <<<<<<<<<<<<<< @@ -10704,7 +9268,7 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_2 = ((__pyx_v_num == -1L) != 0); if (__pyx_t_2) { - /* "LCEngine.pyx":481 + /* "LCEngine2.pyx":380 * num = searchMove( desde, hasta, coronacion ) * if num == -1: * return False # <<<<<<<<<<<<<< @@ -10716,7 +9280,7 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, __pyx_r = Py_False; goto __pyx_L0; - /* "LCEngine.pyx":480 + /* "LCEngine2.pyx":379 * * num = searchMove( desde, hasta, coronacion ) * if num == -1: # <<<<<<<<<<<<<< @@ -10725,16 +9289,16 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, */ } - /* "LCEngine.pyx":483 + /* "LCEngine2.pyx":382 * return False * * make_nummove(num) # <<<<<<<<<<<<<< * * return True */ - make_nummove(__pyx_v_num); + (void)(make_nummove(__pyx_v_num)); - /* "LCEngine.pyx":485 + /* "LCEngine2.pyx":384 * make_nummove(num) * * return True # <<<<<<<<<<<<<< @@ -10746,7 +9310,7 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, __pyx_r = Py_True; goto __pyx_L0; - /* "LCEngine.pyx":475 + /* "LCEngine2.pyx":374 * return infoMove * * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< @@ -10756,7 +9320,7 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, /* function exit code */ __pyx_L1_error:; - __Pyx_AddTraceback("LCEngine.movePV", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.movePV", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_coronacion); @@ -10765,7 +9329,7 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "LCEngine.pyx":487 +/* "LCEngine2.pyx":386 * return True * * def makeMove(move): # <<<<<<<<<<<<<< @@ -10774,20 +9338,20 @@ static PyObject *__pyx_pf_8LCEngine_50movePV(CYTHON_UNUSED PyObject *__pyx_self, */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_53makeMove(PyObject *__pyx_self, PyObject *__pyx_v_move); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_53makeMove = {"makeMove", (PyCFunction)__pyx_pw_8LCEngine_53makeMove, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_53makeMove(PyObject *__pyx_self, PyObject *__pyx_v_move) { +static PyObject *__pyx_pw_9LCEngine2_47makeMove(PyObject *__pyx_self, PyObject *__pyx_v_move); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_47makeMove = {"makeMove", (PyCFunction)__pyx_pw_9LCEngine2_47makeMove, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_47makeMove(PyObject *__pyx_self, PyObject *__pyx_v_move) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("makeMove (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_52makeMove(__pyx_self, ((PyObject *)__pyx_v_move)); + __pyx_r = __pyx_pf_9LCEngine2_46makeMove(__pyx_self, ((PyObject *)__pyx_v_move)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_move) { +static PyObject *__pyx_pf_9LCEngine2_46makeMove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_move) { PyObject *__pyx_v_desde = NULL; PyObject *__pyx_v_hasta = NULL; PyObject *__pyx_v_coronacion = NULL; @@ -10801,55 +9365,55 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel int __pyx_t_5; __Pyx_RefNannySetupContext("makeMove", 0); - /* "LCEngine.pyx":488 + /* "LCEngine2.pyx":387 * * def makeMove(move): * desde = move[:2] # <<<<<<<<<<<<<< * hasta = move[2:4] * coronacion = move[4:] */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 0, 2, NULL, NULL, &__pyx_slice__41, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 0, 2, NULL, NULL, &__pyx_slice__31, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_desde = __pyx_t_1; __pyx_t_1 = 0; - /* "LCEngine.pyx":489 + /* "LCEngine2.pyx":388 * def makeMove(move): * desde = move[:2] * hasta = move[2:4] # <<<<<<<<<<<<<< * coronacion = move[4:] * num = searchMove( desde, hasta, coronacion ) */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 2, 4, NULL, NULL, &__pyx_slice__42, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 2, 4, NULL, NULL, &__pyx_slice__32, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_hasta = __pyx_t_1; __pyx_t_1 = 0; - /* "LCEngine.pyx":490 + /* "LCEngine2.pyx":389 * desde = move[:2] * hasta = move[2:4] * coronacion = move[4:] # <<<<<<<<<<<<<< * num = searchMove( desde, hasta, coronacion ) * if num == -1: */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 4, 0, NULL, NULL, &__pyx_slice__43, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 4, 0, NULL, NULL, &__pyx_slice__33, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 389, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_coronacion = __pyx_t_1; __pyx_t_1 = 0; - /* "LCEngine.pyx":491 + /* "LCEngine2.pyx":390 * hasta = move[2:4] * coronacion = move[4:] * num = searchMove( desde, hasta, coronacion ) # <<<<<<<<<<<<<< * if num == -1: * return False */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_desde); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_hasta); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_AsWritableString(__pyx_v_desde); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_AsWritableString(__pyx_v_hasta); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 390, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsWritableString(__pyx_v_coronacion); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 390, __pyx_L1_error) __pyx_v_num = searchMove(__pyx_t_2, __pyx_t_3, __pyx_t_4); - /* "LCEngine.pyx":492 + /* "LCEngine2.pyx":391 * coronacion = move[4:] * num = searchMove( desde, hasta, coronacion ) * if num == -1: # <<<<<<<<<<<<<< @@ -10859,7 +9423,7 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel __pyx_t_5 = ((__pyx_v_num == -1L) != 0); if (__pyx_t_5) { - /* "LCEngine.pyx":493 + /* "LCEngine2.pyx":392 * num = searchMove( desde, hasta, coronacion ) * if num == -1: * return False # <<<<<<<<<<<<<< @@ -10871,7 +9435,7 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel __pyx_r = Py_False; goto __pyx_L0; - /* "LCEngine.pyx":492 + /* "LCEngine2.pyx":391 * coronacion = move[4:] * num = searchMove( desde, hasta, coronacion ) * if num == -1: # <<<<<<<<<<<<<< @@ -10880,16 +9444,16 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel */ } - /* "LCEngine.pyx":495 + /* "LCEngine2.pyx":394 * return False * * make_nummove(num) # <<<<<<<<<<<<<< * return True * */ - make_nummove(__pyx_v_num); + (void)(make_nummove(__pyx_v_num)); - /* "LCEngine.pyx":496 + /* "LCEngine2.pyx":395 * * make_nummove(num) * return True # <<<<<<<<<<<<<< @@ -10901,7 +9465,7 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel __pyx_r = Py_True; goto __pyx_L0; - /* "LCEngine.pyx":487 + /* "LCEngine2.pyx":386 * return True * * def makeMove(move): # <<<<<<<<<<<<<< @@ -10912,7 +9476,7 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngine.makeMove", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.makeMove", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_desde); @@ -10923,7 +9487,7 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel return __pyx_r; } -/* "LCEngine.pyx":498 +/* "LCEngine2.pyx":397 * return True * * def fen2fenM2(fen): # <<<<<<<<<<<<<< @@ -10932,20 +9496,20 @@ static PyObject *__pyx_pf_8LCEngine_52makeMove(CYTHON_UNUSED PyObject *__pyx_sel */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_55fen2fenM2(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_55fen2fenM2 = {"fen2fenM2", (PyCFunction)__pyx_pw_8LCEngine_55fen2fenM2, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_55fen2fenM2(PyObject *__pyx_self, PyObject *__pyx_v_fen) { +static PyObject *__pyx_pw_9LCEngine2_49fen2fenM2(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_49fen2fenM2 = {"fen2fenM2", (PyCFunction)__pyx_pw_9LCEngine2_49fen2fenM2, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_49fen2fenM2(PyObject *__pyx_self, PyObject *__pyx_v_fen) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fen2fenM2 (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_54fen2fenM2(__pyx_self, ((PyObject *)__pyx_v_fen)); + __pyx_r = __pyx_pf_9LCEngine2_48fen2fenM2(__pyx_self, ((PyObject *)__pyx_v_fen)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { +static PyObject *__pyx_pf_9LCEngine2_48fen2fenM2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { PyObject *__pyx_v_sp1 = NULL; PyObject *__pyx_v_sp2 = NULL; PyObject *__pyx_r = NULL; @@ -10957,29 +9521,29 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("fen2fenM2", 0); - /* "LCEngine.pyx":499 + /* "LCEngine2.pyx":398 * * def fen2fenM2(fen): * sp1 = fen.rfind(" ") # <<<<<<<<<<<<<< * sp2 = fen.rfind(" ", 0, sp1) * return fen[:sp2] */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_sp1 = __pyx_t_2; __pyx_t_2 = 0; - /* "LCEngine.pyx":500 + /* "LCEngine2.pyx":399 * def fen2fenM2(fen): * sp1 = fen.rfind(" ") * sp2 = fen.rfind(" ", 0, sp1) # <<<<<<<<<<<<<< * return fen[:sp2] * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = NULL; __pyx_t_4 = 0; @@ -10995,36 +9559,36 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s__25, __pyx_int_0, __pyx_v_sp1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) + PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s__15, __pyx_int_0, __pyx_v_sp1}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s__25, __pyx_int_0, __pyx_v_sp1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) + PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s__15, __pyx_int_0, __pyx_v_sp1}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { - __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 500, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s__25); + __Pyx_INCREF(__pyx_kp_s__15); + __Pyx_GIVEREF(__pyx_kp_s__15); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s__15); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_0); __Pyx_INCREF(__pyx_v_sp1); __Pyx_GIVEREF(__pyx_v_sp1); PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_sp1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 399, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -11032,7 +9596,7 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se __pyx_v_sp2 = __pyx_t_2; __pyx_t_2 = 0; - /* "LCEngine.pyx":501 + /* "LCEngine2.pyx":400 * sp1 = fen.rfind(" ") * sp2 = fen.rfind(" ", 0, sp1) * return fen[:sp2] # <<<<<<<<<<<<<< @@ -11040,13 +9604,13 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se * def setFenInicial(): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_fen, 0, 0, NULL, &__pyx_v_sp2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_fen, 0, 0, NULL, &__pyx_v_sp2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 400, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "LCEngine.pyx":498 + /* "LCEngine2.pyx":397 * return True * * def fen2fenM2(fen): # <<<<<<<<<<<<<< @@ -11060,7 +9624,7 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("LCEngine.fen2fenM2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("LCEngine2.fen2fenM2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_sp1); @@ -11070,7 +9634,7 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se return __pyx_r; } -/* "LCEngine.pyx":503 +/* "LCEngine2.pyx":402 * return fen[:sp2] * * def setFenInicial(): # <<<<<<<<<<<<<< @@ -11079,20 +9643,20 @@ static PyObject *__pyx_pf_8LCEngine_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_se */ /* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_57setFenInicial(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_57setFenInicial = {"setFenInicial", (PyCFunction)__pyx_pw_8LCEngine_57setFenInicial, METH_NOARGS, 0}; -static PyObject *__pyx_pw_8LCEngine_57setFenInicial(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_9LCEngine2_51setFenInicial(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_51setFenInicial = {"setFenInicial", (PyCFunction)__pyx_pw_9LCEngine2_51setFenInicial, METH_NOARGS, 0}; +static PyObject *__pyx_pw_9LCEngine2_51setFenInicial(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("setFenInicial (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_56setFenInicial(__pyx_self); + __pyx_r = __pyx_pf_9LCEngine2_50setFenInicial(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_8LCEngine_56setFenInicial(CYTHON_UNUSED PyObject *__pyx_self) { +static PyObject *__pyx_pf_9LCEngine2_50setFenInicial(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_v_inifen = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -11102,7 +9666,7 @@ static PyObject *__pyx_pf_8LCEngine_56setFenInicial(CYTHON_UNUSED PyObject *__py PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("setFenInicial", 0); - /* "LCEngine.pyx":504 + /* "LCEngine2.pyx":403 * * def setFenInicial(): * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" # <<<<<<<<<<<<<< @@ -11112,4616 +9676,3087 @@ static PyObject *__pyx_pf_8LCEngine_56setFenInicial(CYTHON_UNUSED PyObject *__py __Pyx_INCREF(__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP); __pyx_v_inifen = __pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP; - /* "LCEngine.pyx":505 + /* "LCEngine2.pyx":404 * def setFenInicial(): - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) # <<<<<<<<<<<<<< - * - * def makePV(pv): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inifen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inifen}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inifen}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_inifen); - __Pyx_GIVEREF(__pyx_v_inifen); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_inifen); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngine.pyx":503 - * return fen[:sp2] - * - * def setFenInicial(): # <<<<<<<<<<<<<< - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.setFenInicial", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_inifen); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_59makePV(PyObject *__pyx_self, PyObject *__pyx_v_pv); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_59makePV = {"makePV", (PyCFunction)__pyx_pw_8LCEngine_59makePV, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_59makePV(PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("makePV (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_58makePV(__pyx_self, ((PyObject *)__pyx_v_pv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_58makePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_v_move = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("makePV", 0); - - /* "LCEngine.pyx":508 - * - * def makePV(pv): - * setFenInicial() # <<<<<<<<<<<<<< - * if pv: - * for move in pv.split(" "): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFenInicial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngine.pyx":509 - * def makePV(pv): - * setFenInicial() - * if pv: # <<<<<<<<<<<<<< - * for move in pv.split(" "): - * makeMove(move) - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_pv); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 509, __pyx_L1_error) - if (__pyx_t_4) { - - /* "LCEngine.pyx":510 - * setFenInicial() - * if pv: - * for move in pv.split(" "): # <<<<<<<<<<<<<< - * makeMove(move) - * return getFen() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pv, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 510, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 510, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_6(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 510, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngine.pyx":511 - * if pv: - * for move in pv.split(" "): - * makeMove(move) # <<<<<<<<<<<<<< - * return getFen() - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_makeMove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_move); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_move}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_move}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_move); - __Pyx_GIVEREF(__pyx_v_move); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_move); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":510 - * setFenInicial() - * if pv: - * for move in pv.split(" "): # <<<<<<<<<<<<<< - * makeMove(move) - * return getFen() - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngine.pyx":509 - * def makePV(pv): - * setFenInicial() - * if pv: # <<<<<<<<<<<<<< - * for move in pv.split(" "): - * makeMove(move) - */ - } - - /* "LCEngine.pyx":512 - * for move in pv.split(" "): - * makeMove(move) - * return getFen() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_getFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("LCEngine.makePV", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_move); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_61getCapturesFEN(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_61getCapturesFEN = {"getCapturesFEN", (PyCFunction)__pyx_pw_8LCEngine_61getCapturesFEN, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_61getCapturesFEN(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getCapturesFEN (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_60getCapturesFEN(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_60getCapturesFEN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - int __pyx_v_nmoves; - PyObject *__pyx_v_nbase = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_mv = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - __Pyx_RefNannySetupContext("getCapturesFEN", 0); - - /* "LCEngine.pyx":516 - * - * def getCapturesFEN(fen): - * setFen(fen) # <<<<<<<<<<<<<< - * nmoves = numMoves() - * nbase = numBaseMove() - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fen); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngine.pyx":517 - * def getCapturesFEN(fen): - * setFen(fen) - * nmoves = numMoves() # <<<<<<<<<<<<<< - * nbase = numBaseMove() - * li = [] - */ - __pyx_v_nmoves = numMoves(); - - /* "LCEngine.pyx":518 - * setFen(fen) - * nmoves = numMoves() - * nbase = numBaseMove() # <<<<<<<<<<<<<< - * li = [] - * for x in range(nmoves): - */ - __pyx_t_1 = __Pyx_PyInt_From_int(numBaseMove()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_nbase = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngine.pyx":519 - * nmoves = numMoves() - * nbase = numBaseMove() - * li = [] # <<<<<<<<<<<<<< - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":520 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * mv = InfoMove(x + nbase) - * if mv.captura(): - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmoves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 520, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":521 - * li = [] - * for x in range(nmoves): - * mv = InfoMove(x + nbase) # <<<<<<<<<<<<<< - * if mv.captura(): - * li.append(mv) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_v_nbase); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_mv, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngine.pyx":522 - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - * if mv.captura(): # <<<<<<<<<<<<<< - * li.append(mv) - * return li - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mv, __pyx_n_s_captura); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_8) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 522, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_9) { - - /* "LCEngine.pyx":523 - * mv = InfoMove(x + nbase) - * if mv.captura(): - * li.append(mv) # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_mv); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 523, __pyx_L1_error) - - /* "LCEngine.pyx":522 - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - * if mv.captura(): # <<<<<<<<<<<<<< - * li.append(mv) - * return li - */ - } - - /* "LCEngine.pyx":520 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * mv = InfoMove(x + nbase) - * if mv.captura(): - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":524 - * if mv.captura(): - * li.append(mv) - * return li # <<<<<<<<<<<<<< - * - * def getCaptures(fen, siMB): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngine.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("LCEngine.getCapturesFEN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_nbase); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_mv); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_63getCaptures(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_63getCaptures = {"getCaptures", (PyCFunction)__pyx_pw_8LCEngine_63getCaptures, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_8LCEngine_63getCaptures(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fen = 0; - PyObject *__pyx_v_siMB = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getCaptures (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fen,&__pyx_n_s_siMB,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fen)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_siMB)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getCaptures", 1, 2, 2, 1); __PYX_ERR(0, 526, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCaptures") < 0)) __PYX_ERR(0, 526, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_fen = values[0]; - __pyx_v_siMB = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getCaptures", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 526, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngine.getCaptures", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8LCEngine_62getCaptures(__pyx_self, __pyx_v_fen, __pyx_v_siMB); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_62getCaptures(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_siMB) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("getCaptures", 0); - __Pyx_INCREF(__pyx_v_fen); - - /* "LCEngine.pyx":527 - * - * def getCaptures(fen, siMB): - * if not siMB: # <<<<<<<<<<<<<< - * fen = fenOB(fen) - * return getCapturesFEN(fen) - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_siMB); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 527, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "LCEngine.pyx":528 - * def getCaptures(fen, siMB): - * if not siMB: - * fen = fenOB(fen) # <<<<<<<<<<<<<< - * return getCapturesFEN(fen) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_fenOB); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_fen); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_fen, __pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngine.pyx":527 - * - * def getCaptures(fen, siMB): - * if not siMB: # <<<<<<<<<<<<<< - * fen = fenOB(fen) - * return getCapturesFEN(fen) - */ - } - - /* "LCEngine.pyx":529 - * if not siMB: - * fen = fenOB(fen) - * return getCapturesFEN(fen) # <<<<<<<<<<<<<< - * - * def fenOB(fen): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_getCapturesFEN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_fen); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("LCEngine.getCaptures", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_fen); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_65fenOB(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_65fenOB = {"fenOB", (PyCFunction)__pyx_pw_8LCEngine_65fenOB, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_65fenOB(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fenOB (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_64fenOB(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_64fenOB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __Pyx_RefNannySetupContext("fenOB", 0); - - /* "LCEngine.pyx":532 - * - * def fenOB(fen): - * li = fen.split(" ") # <<<<<<<<<<<<<< - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_li = __pyx_t_2; - __pyx_t_2 = 0; - - /* "LCEngine.pyx":533 - * def fenOB(fen): - * li = fen.split(" ") - * li[3] = "-" # <<<<<<<<<<<<<< - * li[1] = "w" if li[1] == "b" else "b" - * return " ".join(li) - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_li, 3, __pyx_kp_s__47, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 533, __pyx_L1_error) - - /* "LCEngine.pyx":534 - * li = fen.split(" ") - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" # <<<<<<<<<<<<<< - * return " ".join(li) - * - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_li, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_b, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - __Pyx_INCREF(__pyx_n_s_w); - __pyx_t_2 = __pyx_n_s_w; - } else { - __Pyx_INCREF(__pyx_n_s_b); - __pyx_t_2 = __pyx_n_s_b; - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_li, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":535 - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" - * return " ".join(li) # <<<<<<<<<<<<<< - * - * def fenTerminado(fen): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__25, __pyx_v_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("LCEngine.fenOB", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngine.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_8LCEngine_67fenTerminado(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_8LCEngine_67fenTerminado = {"fenTerminado", (PyCFunction)__pyx_pw_8LCEngine_67fenTerminado, METH_O, 0}; -static PyObject *__pyx_pw_8LCEngine_67fenTerminado(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fenTerminado (wrapper)", 0); - __pyx_r = __pyx_pf_8LCEngine_66fenTerminado(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_8LCEngine_66fenTerminado(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("fenTerminado", 0); - - /* "LCEngine.pyx":538 - * - * def fenTerminado(fen): - * return setFen(fen) == 0 # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fen); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngine.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngine.fenTerminado", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "LCEngine", - 0, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_n_s_FCpos, __pyx_k_FCpos, sizeof(__pyx_k_FCpos), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove, __pyx_k_InfoMove, sizeof(__pyx_k_InfoMove), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove___init, __pyx_k_InfoMove___init, sizeof(__pyx_k_InfoMove___init), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_captura, __pyx_k_InfoMove_captura, sizeof(__pyx_k_InfoMove_captura), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_coronacion, __pyx_k_InfoMove_coronacion, sizeof(__pyx_k_InfoMove_coronacion), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_desde, __pyx_k_InfoMove_desde, sizeof(__pyx_k_InfoMove_desde), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_hasta, __pyx_k_InfoMove_hasta, sizeof(__pyx_k_InfoMove_hasta), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_isCastleK, __pyx_k_InfoMove_isCastleK, sizeof(__pyx_k_InfoMove_isCastleK), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_isCastleQ, __pyx_k_InfoMove_isCastleQ, sizeof(__pyx_k_InfoMove_isCastleQ), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_isEnPassant, __pyx_k_InfoMove_isEnPassant, sizeof(__pyx_k_InfoMove_isEnPassant), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_jaque, __pyx_k_InfoMove_jaque, sizeof(__pyx_k_InfoMove_jaque), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_mate, __pyx_k_InfoMove_mate, sizeof(__pyx_k_InfoMove_mate), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_movimiento, __pyx_k_InfoMove_movimiento, sizeof(__pyx_k_InfoMove_movimiento), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_pieza, __pyx_k_InfoMove_pieza, sizeof(__pyx_k_InfoMove_pieza), 0, 0, 1, 1}, - {&__pyx_n_s_LCEngine, __pyx_k_LCEngine, sizeof(__pyx_k_LCEngine), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader, __pyx_k_PGNreader, sizeof(__pyx_k_PGNreader), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___enter, __pyx_k_PGNreader___enter, sizeof(__pyx_k_PGNreader___enter), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___exit, __pyx_k_PGNreader___exit, sizeof(__pyx_k_PGNreader___exit), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___init, __pyx_k_PGNreader___init, sizeof(__pyx_k_PGNreader___init), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___iter, __pyx_k_PGNreader___iter, sizeof(__pyx_k_PGNreader___iter), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader_next, __pyx_k_PGNreader_next, sizeof(__pyx_k_PGNreader_next), 0, 0, 1, 1}, - {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, - {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0}, - {&__pyx_kp_s__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 1, 0}, - {&__pyx_kp_s__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 0, 1, 0}, - {&__pyx_kp_s__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 0, 1, 0}, - {&__pyx_kp_s__40, __pyx_k__40, sizeof(__pyx_k__40), 0, 0, 1, 0}, - {&__pyx_kp_s__47, __pyx_k__47, sizeof(__pyx_k__47), 0, 0, 1, 0}, - {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, - {&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1}, - {&__pyx_n_s_a1Pos, __pyx_k_a1Pos, sizeof(__pyx_k_a1Pos), 0, 0, 1, 1}, - {&__pyx_n_s_a1h8q, __pyx_k_a1h8q, sizeof(__pyx_k_a1h8q), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_k_c_correr_lucaschess_pyLC12_LCEng, sizeof(__pyx_k_c_correr_lucaschess_pyLC12_LCEng), 0, 0, 1, 0}, - {&__pyx_n_s_c_i, __pyx_k_c_i, sizeof(__pyx_k_c_i), 0, 0, 1, 1}, - {&__pyx_n_s_captura, __pyx_k_captura, sizeof(__pyx_k_captura), 0, 0, 1, 1}, - {&__pyx_n_s_capture, __pyx_k_capture, sizeof(__pyx_k_capture), 0, 0, 1, 1}, - {&__pyx_n_s_castle_K, __pyx_k_castle_K, sizeof(__pyx_k_castle_K), 0, 0, 1, 1}, - {&__pyx_n_s_castle_Q, __pyx_k_castle_Q, sizeof(__pyx_k_castle_Q), 0, 0, 1, 1}, - {&__pyx_n_s_celdas_ocupadas, __pyx_k_celdas_ocupadas, sizeof(__pyx_k_celdas_ocupadas), 0, 0, 1, 1}, - {&__pyx_n_s_check, __pyx_k_check, sizeof(__pyx_k_check), 0, 0, 1, 1}, - {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, - {&__pyx_n_s_ci, __pyx_k_ci, sizeof(__pyx_k_ci), 0, 0, 1, 1}, - {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1}, - {&__pyx_n_s_coronacion, __pyx_k_coronacion, sizeof(__pyx_k_coronacion), 0, 0, 1, 1}, - {&__pyx_n_s_ct, __pyx_k_ct, sizeof(__pyx_k_ct), 0, 0, 1, 1}, - {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, - {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1}, - {&__pyx_n_s_desde, __pyx_k_desde, sizeof(__pyx_k_desde), 0, 0, 1, 1}, - {&__pyx_n_s_desdeA1H8, __pyx_k_desdeA1H8, sizeof(__pyx_k_desdeA1H8), 0, 0, 1, 1}, - {&__pyx_n_s_dicB, __pyx_k_dicB, sizeof(__pyx_k_dicB), 0, 0, 1, 1}, - {&__pyx_n_s_dicK, __pyx_k_dicK, sizeof(__pyx_k_dicK), 0, 0, 1, 1}, - {&__pyx_n_s_dicN, __pyx_k_dicN, sizeof(__pyx_k_dicN), 0, 0, 1, 1}, - {&__pyx_n_s_dicPB, __pyx_k_dicPB, sizeof(__pyx_k_dicPB), 0, 0, 1, 1}, - {&__pyx_n_s_dicPW, __pyx_k_dicPW, sizeof(__pyx_k_dicPW), 0, 0, 1, 1}, - {&__pyx_n_s_dicQ, __pyx_k_dicQ, sizeof(__pyx_k_dicQ), 0, 0, 1, 1}, - {&__pyx_n_s_dicR, __pyx_k_dicR, sizeof(__pyx_k_dicR), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, - {&__pyx_n_s_ep, __pyx_k_ep, sizeof(__pyx_k_ep), 0, 0, 1, 1}, - {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, - {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1}, - {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, - {&__pyx_n_s_f_i, __pyx_k_f_i, sizeof(__pyx_k_f_i), 0, 0, 1, 1}, - {&__pyx_n_s_fen, __pyx_k_fen, sizeof(__pyx_k_fen), 0, 0, 1, 1}, - {&__pyx_n_s_fen2fenM2, __pyx_k_fen2fenM2, sizeof(__pyx_k_fen2fenM2), 0, 0, 1, 1}, - {&__pyx_n_s_fenOB, __pyx_k_fenOB, sizeof(__pyx_k_fenOB), 0, 0, 1, 1}, - {&__pyx_n_s_fenTerminado, __pyx_k_fenTerminado, sizeof(__pyx_k_fenTerminado), 0, 0, 1, 1}, - {&__pyx_n_s_fens, __pyx_k_fens, sizeof(__pyx_k_fens), 0, 0, 1, 1}, - {&__pyx_n_s_fi, __pyx_k_fi, sizeof(__pyx_k_fi), 0, 0, 1, 1}, - {&__pyx_n_s_fich, __pyx_k_fich, sizeof(__pyx_k_fich), 0, 0, 1, 1}, - {&__pyx_n_s_fil, __pyx_k_fil, sizeof(__pyx_k_fil), 0, 0, 1, 1}, - {&__pyx_n_s_filaIni, __pyx_k_filaIni, sizeof(__pyx_k_filaIni), 0, 0, 1, 1}, - {&__pyx_n_s_from, __pyx_k_from, sizeof(__pyx_k_from), 0, 0, 1, 1}, - {&__pyx_n_s_ft, __pyx_k_ft, sizeof(__pyx_k_ft), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getCaptures, __pyx_k_getCaptures, sizeof(__pyx_k_getCaptures), 0, 0, 1, 1}, - {&__pyx_n_s_getCapturesFEN, __pyx_k_getCapturesFEN, sizeof(__pyx_k_getCapturesFEN), 0, 0, 1, 1}, - {&__pyx_n_s_getExMoves, __pyx_k_getExMoves, sizeof(__pyx_k_getExMoves), 0, 0, 1, 1}, - {&__pyx_n_s_getFen, __pyx_k_getFen, sizeof(__pyx_k_getFen), 0, 0, 1, 1}, - {&__pyx_n_s_getMoves, __pyx_k_getMoves, sizeof(__pyx_k_getMoves), 0, 0, 1, 1}, - {&__pyx_n_s_getPGN, __pyx_k_getPGN, sizeof(__pyx_k_getPGN), 0, 0, 1, 1}, - {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1}, - {&__pyx_n_s_h8, __pyx_k_h8, sizeof(__pyx_k_h8), 0, 0, 1, 1}, - {&__pyx_n_s_hasta, __pyx_k_hasta, sizeof(__pyx_k_hasta), 0, 0, 1, 1}, - {&__pyx_n_s_hastaA1H8, __pyx_k_hastaA1H8, sizeof(__pyx_k_hastaA1H8), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_inc, __pyx_k_inc, sizeof(__pyx_k_inc), 0, 0, 1, 1}, - {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1}, - {&__pyx_n_s_infoMove, __pyx_k_infoMove, sizeof(__pyx_k_infoMove), 0, 0, 1, 1}, - {&__pyx_n_s_inifen, __pyx_k_inifen, sizeof(__pyx_k_inifen), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1}, - {&__pyx_n_s_isCastleK, __pyx_k_isCastleK, sizeof(__pyx_k_isCastleK), 0, 0, 1, 1}, - {&__pyx_n_s_isCastleQ, __pyx_k_isCastleQ, sizeof(__pyx_k_isCastleQ), 0, 0, 1, 1}, - {&__pyx_n_s_isCheck, __pyx_k_isCheck, sizeof(__pyx_k_isCheck), 0, 0, 1, 1}, - {&__pyx_n_s_isEnPassant, __pyx_k_isEnPassant, sizeof(__pyx_k_isEnPassant), 0, 0, 1, 1}, - {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, - {&__pyx_n_s_jaque, __pyx_k_jaque, sizeof(__pyx_k_jaque), 0, 0, 1, 1}, - {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, - {&__pyx_n_s_knightmoves, __pyx_k_knightmoves, sizeof(__pyx_k_knightmoves), 0, 0, 1, 1}, - {&__pyx_n_s_lc_pgn2pv, __pyx_k_lc_pgn2pv, sizeof(__pyx_k_lc_pgn2pv), 0, 0, 1, 1}, - {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1}, - {&__pyx_n_s_li, __pyx_k_li, sizeof(__pyx_k_li), 0, 0, 1, 1}, - {&__pyx_n_s_liBR, __pyx_k_liBR, sizeof(__pyx_k_liBR), 0, 0, 1, 1}, - {&__pyx_n_s_liK, __pyx_k_liK, sizeof(__pyx_k_liK), 0, 0, 1, 1}, - {&__pyx_n_s_liM, __pyx_k_liM, sizeof(__pyx_k_liM), 0, 0, 1, 1}, - {&__pyx_n_s_liN, __pyx_k_liN, sizeof(__pyx_k_liN), 0, 0, 1, 1}, - {&__pyx_n_s_liNMinimo, __pyx_k_liNMinimo, sizeof(__pyx_k_liNMinimo), 0, 0, 1, 1}, - {&__pyx_n_s_liP, __pyx_k_liP, sizeof(__pyx_k_liP), 0, 0, 1, 1}, - {&__pyx_n_s_liX, __pyx_k_liX, sizeof(__pyx_k_liX), 0, 0, 1, 1}, - {&__pyx_n_s_lia, __pyx_k_lia, sizeof(__pyx_k_lia), 0, 0, 1, 1}, - {&__pyx_n_s_lib, __pyx_k_lib, sizeof(__pyx_k_lib), 0, 0, 1, 1}, - {&__pyx_n_s_lidef, __pyx_k_lidef, sizeof(__pyx_k_lidef), 0, 0, 1, 1}, - {&__pyx_n_s_lin, __pyx_k_lin, sizeof(__pyx_k_lin), 0, 0, 1, 1}, - {&__pyx_n_s_lix, __pyx_k_lix, sizeof(__pyx_k_lix), 0, 0, 1, 1}, - {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_makeMove, __pyx_k_makeMove, sizeof(__pyx_k_makeMove), 0, 0, 1, 1}, - {&__pyx_n_s_makePV, __pyx_k_makePV, sizeof(__pyx_k_makePV), 0, 0, 1, 1}, - {&__pyx_n_s_mate, __pyx_k_mate, sizeof(__pyx_k_mate), 0, 0, 1, 1}, - {&__pyx_n_s_mate_2, __pyx_k_mate_2, sizeof(__pyx_k_mate_2), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_move, __pyx_k_move, sizeof(__pyx_k_move), 0, 0, 1, 1}, - {&__pyx_n_s_move2num, __pyx_k_move2num, sizeof(__pyx_k_move2num), 0, 0, 1, 1}, - {&__pyx_n_s_moveExPV, __pyx_k_moveExPV, sizeof(__pyx_k_moveExPV), 0, 0, 1, 1}, - {&__pyx_n_s_movePV, __pyx_k_movePV, sizeof(__pyx_k_movePV), 0, 0, 1, 1}, - {&__pyx_n_s_movimiento, __pyx_k_movimiento, sizeof(__pyx_k_movimiento), 0, 0, 1, 1}, - {&__pyx_n_s_ms, __pyx_k_ms, sizeof(__pyx_k_ms), 0, 0, 1, 1}, - {&__pyx_n_s_mv, __pyx_k_mv, sizeof(__pyx_k_mv), 0, 0, 1, 1}, - {&__pyx_n_s_mx, __pyx_k_mx, sizeof(__pyx_k_mx), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_nbase, __pyx_k_nbase, sizeof(__pyx_k_nbase), 0, 0, 1, 1}, - {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1}, - {&__pyx_n_s_nmoves, __pyx_k_nmoves, sizeof(__pyx_k_nmoves), 0, 0, 1, 1}, - {&__pyx_n_s_no, __pyx_k_no, sizeof(__pyx_k_no), 0, 0, 1, 1}, - {&__pyx_n_s_npos, __pyx_k_npos, sizeof(__pyx_k_npos), 0, 0, 1, 1}, - {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1}, - {&__pyx_n_s_num2move, __pyx_k_num2move, sizeof(__pyx_k_num2move), 0, 0, 1, 1}, - {&__pyx_n_s_numMove, __pyx_k_numMove, sizeof(__pyx_k_numMove), 0, 0, 1, 1}, - {&__pyx_n_s_nv, __pyx_k_nv, sizeof(__pyx_k_nv), 0, 0, 1, 1}, - {&__pyx_n_s_nx, __pyx_k_nx, sizeof(__pyx_k_nx), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_ot, __pyx_k_ot, sizeof(__pyx_k_ot), 0, 0, 1, 1}, - {&__pyx_n_s_pgn, __pyx_k_pgn, sizeof(__pyx_k_pgn), 0, 0, 1, 1}, - {&__pyx_n_s_pgn1, __pyx_k_pgn1, sizeof(__pyx_k_pgn1), 0, 0, 1, 1}, - {&__pyx_n_s_piece, __pyx_k_piece, sizeof(__pyx_k_piece), 0, 0, 1, 1}, - {&__pyx_n_s_pieza, __pyx_k_pieza, sizeof(__pyx_k_pieza), 0, 0, 1, 1}, - {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, - {&__pyx_n_s_posA1, __pyx_k_posA1, sizeof(__pyx_k_posA1), 0, 0, 1, 1}, - {&__pyx_n_s_posFC, __pyx_k_posFC, sizeof(__pyx_k_posFC), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_promotion, __pyx_k_promotion, sizeof(__pyx_k_promotion), 0, 0, 1, 1}, - {&__pyx_n_s_pv, __pyx_k_pv, sizeof(__pyx_k_pv), 0, 0, 1, 1}, - {&__pyx_n_s_pv2xpv, __pyx_k_pv2xpv, sizeof(__pyx_k_pv2xpv), 0, 0, 1, 1}, - {&__pyx_n_s_pv_2, __pyx_k_pv_2, sizeof(__pyx_k_pv_2), 0, 0, 1, 1}, - {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_resp, __pyx_k_resp, sizeof(__pyx_k_resp), 0, 0, 1, 1}, - {&__pyx_n_s_rfind, __pyx_k_rfind, sizeof(__pyx_k_rfind), 0, 0, 1, 1}, - {&__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP, __pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP, sizeof(__pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP), 0, 0, 1, 0}, - {&__pyx_n_s_runFen, __pyx_k_runFen, sizeof(__pyx_k_runFen), 0, 0, 1, 1}, - {&__pyx_n_s_salto, __pyx_k_salto, sizeof(__pyx_k_salto), 0, 0, 1, 1}, - {&__pyx_n_s_san, __pyx_k_san, sizeof(__pyx_k_san), 0, 0, 1, 1}, - {&__pyx_n_s_san_2, __pyx_k_san_2, sizeof(__pyx_k_san_2), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_setFen, __pyx_k_setFen, sizeof(__pyx_k_setFen), 0, 0, 1, 1}, - {&__pyx_n_s_setFenInicial, __pyx_k_setFenInicial, sizeof(__pyx_k_setFenInicial), 0, 0, 1, 1}, - {&__pyx_n_s_siBlancas, __pyx_k_siBlancas, sizeof(__pyx_k_siBlancas), 0, 0, 1, 1}, - {&__pyx_n_s_siMB, __pyx_k_siMB, sizeof(__pyx_k_siMB), 0, 0, 1, 1}, - {&__pyx_n_s_siW, __pyx_k_siW, sizeof(__pyx_k_siW), 0, 0, 1, 1}, - {&__pyx_n_s_sig, __pyx_k_sig, sizeof(__pyx_k_sig), 0, 0, 1, 1}, - {&__pyx_n_s_sig2, __pyx_k_sig2, sizeof(__pyx_k_sig2), 0, 0, 1, 1}, - {&__pyx_n_s_sp1, __pyx_k_sp1, sizeof(__pyx_k_sp1), 0, 0, 1, 1}, - {&__pyx_n_s_sp2, __pyx_k_sp2, sizeof(__pyx_k_sp2), 0, 0, 1, 1}, - {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, - {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1}, - {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, - {&__pyx_n_s_tam, __pyx_k_tam, sizeof(__pyx_k_tam), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_to, __pyx_k_to, sizeof(__pyx_k_to), 0, 0, 1, 1}, - {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, - {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_xmin, __pyx_k_xmin, sizeof(__pyx_k_xmin), 0, 0, 1, 1}, - {&__pyx_n_s_xpv, __pyx_k_xpv, sizeof(__pyx_k_xpv), 0, 0, 1, 1}, - {&__pyx_n_s_xpv2lipv, __pyx_k_xpv2lipv, sizeof(__pyx_k_xpv2lipv), 0, 0, 1, 1}, - {&__pyx_n_s_xpv2pgn, __pyx_k_xpv2pgn, sizeof(__pyx_k_xpv2pgn), 0, 0, 1, 1}, - {&__pyx_n_s_xpv2pv, __pyx_k_xpv2pv, sizeof(__pyx_k_xpv2pv), 0, 0, 1, 1}, - {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 189, __pyx_L1_error) - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 393, __pyx_L1_error) - __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 70, __pyx_L1_error) - __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 89, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "LCEngine.pyx":98 - * - * def move2num(a1h8q): - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 # <<<<<<<<<<<<<< - * if len(a1h8q)>4: - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - */ - __pyx_slice__2 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); - __pyx_slice__3 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__3); - __Pyx_GIVEREF(__pyx_slice__3); - - /* "LCEngine.pyx":118 - * liM = [] - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_tuple__5 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_tuple__6 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_tuple__7 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_tuple__8 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_tuple__12 = PyTuple_Pack(8, __pyx_tuple__4, __pyx_tuple__5, __pyx_tuple__6, __pyx_tuple__7, __pyx_tuple__8, __pyx_tuple__9, __pyx_tuple__10, __pyx_tuple__11); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "LCEngine.pyx":150 - * fil, col = posFC(npos) - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_tuple__13 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_tuple__14 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_2); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_2); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_tuple__16 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_2); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_tuple__18 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_tuple__19 = PyTuple_Pack(2, __pyx_int_neg_2, __pyx_int_1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_tuple__20 = PyTuple_Pack(2, __pyx_int_neg_2, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_tuple__21 = PyTuple_Pack(8, __pyx_tuple__13, __pyx_tuple__14, __pyx_tuple__15, __pyx_tuple__16, __pyx_tuple__17, __pyx_tuple__18, __pyx_tuple__19, __pyx_tuple__20); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - - /* "LCEngine.pyx":179 - * liM.append(sig2) + * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" + * setFen(inifen) # <<<<<<<<<<<<<< * - * for inc in ( +1, -1 ): # <<<<<<<<<<<<<< - * ft = fil + salto - * ct = col + inc + * def makePV(pv): */ - __pyx_tuple__22 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inifen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inifen}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inifen}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_inifen); + __Pyx_GIVEREF(__pyx_v_inifen); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_inifen); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 404, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":250 - * for y in lib: - * if x not in no and y not in no: - * nx = no[:] # <<<<<<<<<<<<<< - * nx.append(x) - * nx.append(y) + /* "LCEngine2.pyx":402 + * return fen[:sp2] + * + * def setFenInicial(): # <<<<<<<<<<<<<< + * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" + * setFen(inifen) */ - __pyx_slice__23 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__23)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__23); - __Pyx_GIVEREF(__pyx_slice__23); - /* "LCEngine.pyx":273 - * def liNMinimo(x, y, celdas_ocupadas): - * cdef int nv - * ot = celdas_ocupadas[:] # <<<<<<<<<<<<<< - * ot.extend([x, y]) - * nv = 1 - */ - __pyx_slice__24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__24); - __Pyx_GIVEREF(__pyx_slice__24); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("LCEngine2.setFenInicial", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_inifen); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":304 - * def pv2xpv(pv): +/* "LCEngine2.pyx":406 + * setFen(inifen) + * + * def makePV(pv): # <<<<<<<<<<<<<< + * setFenInicial() * if pv: - * li = pv.split(" ") # <<<<<<<<<<<<<< - * lix = [] - * for move in li: - */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - - /* "LCEngine.pyx":307 - * lix = [] - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 # <<<<<<<<<<<<<< - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] */ - __pyx_slice__27 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); - /* "LCEngine.pyx":308 - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) # <<<<<<<<<<<<<< - * c = move[4:] - * if c: - */ - __pyx_slice__28 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__28)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__28); - __Pyx_GIVEREF(__pyx_slice__28); +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_53makePV(PyObject *__pyx_self, PyObject *__pyx_v_pv); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_53makePV = {"makePV", (PyCFunction)__pyx_pw_9LCEngine2_53makePV, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_53makePV(PyObject *__pyx_self, PyObject *__pyx_v_pv) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("makePV (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_52makePV(__pyx_self, ((PyObject *)__pyx_v_pv)); - /* "LCEngine.pyx":309 - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] # <<<<<<<<<<<<<< - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - */ - __pyx_slice__29 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__29)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__29); - __Pyx_GIVEREF(__pyx_slice__29); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":311 - * c = move[4:] - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") # <<<<<<<<<<<<<< - * lix.append(d + h + c) - * return "".join(lix) - */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_int_50); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_int_51); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_int_52); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_int_53); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - - /* "LCEngine.pyx":374 - * siW = not siW - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) # <<<<<<<<<<<<<< - * if numMove == -1: - * break - */ - __pyx_slice__35 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__35)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__35); - __Pyx_GIVEREF(__pyx_slice__35); - __pyx_slice__36 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__36)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__36); - __Pyx_GIVEREF(__pyx_slice__36); - __pyx_slice__37 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__37)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__37); - __Pyx_GIVEREF(__pyx_slice__37); +static PyObject *__pyx_pf_9LCEngine2_52makePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv) { + PyObject *__pyx_v_move = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __Pyx_RefNannySetupContext("makePV", 0); - /* "LCEngine.pyx":488 + /* "LCEngine2.pyx":407 * - * def makeMove(move): - * desde = move[:2] # <<<<<<<<<<<<<< - * hasta = move[2:4] - * coronacion = move[4:] + * def makePV(pv): + * setFenInicial() # <<<<<<<<<<<<<< + * if pv: + * for move in pv.split(" "): */ - __pyx_slice__41 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__41)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__41); - __Pyx_GIVEREF(__pyx_slice__41); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFenInicial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 407, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":489 - * def makeMove(move): - * desde = move[:2] - * hasta = move[2:4] # <<<<<<<<<<<<<< - * coronacion = move[4:] - * num = searchMove( desde, hasta, coronacion ) + /* "LCEngine2.pyx":408 + * def makePV(pv): + * setFenInicial() + * if pv: # <<<<<<<<<<<<<< + * for move in pv.split(" "): + * makeMove(move) */ - __pyx_slice__42 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__42)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__42); - __Pyx_GIVEREF(__pyx_slice__42); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_pv); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 408, __pyx_L1_error) + if (__pyx_t_4) { - /* "LCEngine.pyx":490 - * desde = move[:2] - * hasta = move[2:4] - * coronacion = move[4:] # <<<<<<<<<<<<<< - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: + /* "LCEngine2.pyx":409 + * setFenInicial() + * if pv: + * for move in pv.split(" "): # <<<<<<<<<<<<<< + * makeMove(move) + * return getFen() */ - __pyx_slice__43 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__43)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__43); - __Pyx_GIVEREF(__pyx_slice__43); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pv, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 409, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 409, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 409, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 409, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":499 + /* "LCEngine2.pyx":410 + * if pv: + * for move in pv.split(" "): + * makeMove(move) # <<<<<<<<<<<<<< + * return getFen() * - * def fen2fenM2(fen): - * sp1 = fen.rfind(" ") # <<<<<<<<<<<<<< - * sp2 = fen.rfind(" ", 0, sp1) - * return fen[:sp2] */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_makeMove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_7) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_move); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_move}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_move}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_INCREF(__pyx_v_move); + __Pyx_GIVEREF(__pyx_v_move); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_move); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 410, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":510 + /* "LCEngine2.pyx":409 * setFenInicial() * if pv: * for move in pv.split(" "): # <<<<<<<<<<<<<< * makeMove(move) * return getFen() */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - - /* "LCEngine.pyx":532 - * - * def fenOB(fen): - * li = fen.split(" ") # <<<<<<<<<<<<<< - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" - */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - - /* "LCEngine.pyx":42 - * - * class PGNreader: - * def __init__(self, fich, depth): # <<<<<<<<<<<<<< - * self.fich = fich - * self.depth = depth - */ - __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_fich, __pyx_n_s_depth); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_init, 42, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 42, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":46 - * self.depth = depth - * - * def __enter__(self): # <<<<<<<<<<<<<< - * pgn_start(self.fich, self.depth) - * return self + /* "LCEngine2.pyx":408 + * def makePV(pv): + * setFenInicial() + * if pv: # <<<<<<<<<<<<<< + * for move in pv.split(" "): + * makeMove(move) */ - __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_enter, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 46, __pyx_L1_error) + } - /* "LCEngine.pyx":50 - * return self + /* "LCEngine2.pyx":411 + * for move in pv.split(" "): + * makeMove(move) + * return getFen() # <<<<<<<<<<<<<< * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * pgn_stop() * */ - __pyx_tuple__52 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_type, __pyx_n_s_value, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_exit, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_getFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 411, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":53 - * pgn_stop() - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self + /* "LCEngine2.pyx":406 + * setFen(inifen) * + * def makePV(pv): # <<<<<<<<<<<<<< + * setFenInicial() + * if pv: */ - __pyx_tuple__54 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_iter, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 53, __pyx_L1_error) - /* "LCEngine.pyx":56 - * return self - * - * def next(self): # <<<<<<<<<<<<<< - * n = pgn_read() - * if n: - */ - __pyx_tuple__56 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_pgn, __pyx_n_s_pv_2, __pyx_n_s_d, __pyx_n_s_r, __pyx_n_s_fens, __pyx_n_s_x, __pyx_n_s_num); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_next, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 56, __pyx_L1_error) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("LCEngine2.makePV", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_move); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":73 +/* "LCEngine2.pyx":414 * * - * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) + * def getCapturesFEN(fen): # <<<<<<<<<<<<<< + * setFen(fen) + * nmoves = numMoves() */ - __pyx_tuple__58 = PyTuple_Pack(3, __pyx_n_s_pgn1, __pyx_n_s_pv_2, __pyx_n_s_resp); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); - __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_lc_pgn2pv, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 73, __pyx_L1_error) - /* "LCEngine.pyx":82 - * - * - * def posFC(pos): # <<<<<<<<<<<<<< - * return pos / 8, pos % 8 - * - */ - __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_posFC, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 82, __pyx_L1_error) +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_55getCapturesFEN(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_55getCapturesFEN = {"getCapturesFEN", (PyCFunction)__pyx_pw_9LCEngine2_55getCapturesFEN, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_55getCapturesFEN(PyObject *__pyx_self, PyObject *__pyx_v_fen) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getCapturesFEN (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_54getCapturesFEN(__pyx_self, ((PyObject *)__pyx_v_fen)); - /* "LCEngine.pyx":85 - * return pos / 8, pos % 8 - * - * def FCpos(f, c): # <<<<<<<<<<<<<< - * return f * 8 + c - * - */ - __pyx_tuple__62 = PyTuple_Pack(2, __pyx_n_s_f, __pyx_n_s_c); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_FCpos, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 85, __pyx_L1_error) + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":88 - * return f * 8 + c - * - * def posA1(pos): # <<<<<<<<<<<<<< - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - */ - __pyx_tuple__64 = PyTuple_Pack(1, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__64); - __Pyx_GIVEREF(__pyx_tuple__64); - __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_posA1, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 88, __pyx_L1_error) +static PyObject *__pyx_pf_9LCEngine2_54getCapturesFEN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { + int __pyx_v_nmoves; + PyObject *__pyx_v_nbase = NULL; + PyObject *__pyx_v_li = NULL; + PyObject *__pyx_v_x = NULL; + PyObject *__pyx_v_mv = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *(*__pyx_t_6)(PyObject *); + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + __Pyx_RefNannySetupContext("getCapturesFEN", 0); - /* "LCEngine.pyx":91 - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) + /* "LCEngine2.pyx":415 * - * def a1Pos(a1): # <<<<<<<<<<<<<< - * cdef int f, c - * f = ord(a1[1]) - 49 + * def getCapturesFEN(fen): + * setFen(fen) # <<<<<<<<<<<<<< + * nmoves = numMoves() + * nbase = numBaseMove() */ - __pyx_tuple__66 = PyTuple_Pack(3, __pyx_n_s_a1, __pyx_n_s_f, __pyx_n_s_c); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__66); - __Pyx_GIVEREF(__pyx_tuple__66); - __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_a1Pos, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_fen); + __Pyx_GIVEREF(__pyx_v_fen); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fen); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 415, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":97 - * return f * 8 + c - * - * def move2num(a1h8q): # <<<<<<<<<<<<<< - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: + /* "LCEngine2.pyx":416 + * def getCapturesFEN(fen): + * setFen(fen) + * nmoves = numMoves() # <<<<<<<<<<<<<< + * nbase = numBaseMove() + * li = [] */ - __pyx_tuple__68 = PyTuple_Pack(2, __pyx_n_s_a1h8q, __pyx_n_s_num); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__68); - __Pyx_GIVEREF(__pyx_tuple__68); - __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_move2num, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_v_nmoves = numMoves(); - /* "LCEngine.pyx":103 - * return num - * - * def num2move(num): # <<<<<<<<<<<<<< - * a1 = posA1(num%64) - * num /= 64 + /* "LCEngine2.pyx":417 + * setFen(fen) + * nmoves = numMoves() + * nbase = numBaseMove() # <<<<<<<<<<<<<< + * li = [] + * for x in range(nmoves): */ - __pyx_tuple__70 = PyTuple_Pack(4, __pyx_n_s_num, __pyx_n_s_a1, __pyx_n_s_h8, __pyx_n_s_q); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__70); - __Pyx_GIVEREF(__pyx_tuple__70); - __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_num2move, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(numBaseMove()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 417, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_nbase = __pyx_t_1; + __pyx_t_1 = 0; - /* "LCEngine.pyx":114 - * return a1 + h8 + q - * - * def liK(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * liM = [] + /* "LCEngine2.pyx":418 + * nmoves = numMoves() + * nbase = numBaseMove() + * li = [] # <<<<<<<<<<<<<< + * for x in range(nmoves): + * mv = InfoMove(x + nbase) */ - __pyx_tuple__72 = PyTuple_Pack(8, __pyx_n_s_npos, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_fi, __pyx_n_s_ci); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__72); - __Pyx_GIVEREF(__pyx_tuple__72); - __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liK, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 418, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_li = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "LCEngine.pyx":127 - * - * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * + /* "LCEngine2.pyx":419 + * nbase = numBaseMove() + * li = [] + * for x in range(nmoves): # <<<<<<<<<<<<<< + * mv = InfoMove(x + nbase) + * if mv.captura(): */ - __pyx_tuple__74 = PyTuple_Pack(9, __pyx_n_s_npos, __pyx_n_s_fi, __pyx_n_s_ci, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_t); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__74); - __Pyx_GIVEREF(__pyx_tuple__74); - __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liBR, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmoves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + } else { + __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 419, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_6)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 419, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 419, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 419, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_6(__pyx_t_1); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 419, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * + /* "LCEngine2.pyx":420 + * li = [] + * for x in range(nmoves): + * mv = InfoMove(x + nbase) # <<<<<<<<<<<<<< + * if mv.captura(): + * li.append(mv) */ - __pyx_tuple__76 = PyTuple_Pack(9, __pyx_n_s_npos, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_fi, __pyx_n_s_ci, __pyx_n_s_t); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__76); - __Pyx_GIVEREF(__pyx_tuple__76); - __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liN, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_v_nbase); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_7) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_2); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else + #endif + { + __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 420, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_mv, __pyx_t_2); + __pyx_t_2 = 0; - /* "LCEngine.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc - * + /* "LCEngine2.pyx":421 + * for x in range(nmoves): + * mv = InfoMove(x + nbase) + * if mv.captura(): # <<<<<<<<<<<<<< + * li.append(mv) + * return li */ - __pyx_tuple__78 = PyTuple_Pack(14, __pyx_n_s_npos, __pyx_n_s_siW, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_inc, __pyx_n_s_liM, __pyx_n_s_liX, __pyx_n_s_filaIni, __pyx_n_s_salto, __pyx_n_s_sig, __pyx_n_s_sig2, __pyx_n_s_t); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__78); - __Pyx_GIVEREF(__pyx_tuple__78); - __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(2, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liP, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mv, __pyx_n_s_captura); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_8) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 421, __pyx_L1_error) + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 421, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_9) { - /* "LCEngine.pyx":189 - * - * dicK = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicK[i] = liK(i) + /* "LCEngine2.pyx":422 + * mv = InfoMove(x + nbase) + * if mv.captura(): + * li.append(mv) # <<<<<<<<<<<<<< + * return li * */ - __pyx_tuple__80 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__80); - __Pyx_GIVEREF(__pyx_tuple__80); + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_mv); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 422, __pyx_L1_error) - /* "LCEngine.pyx":193 - * - * dicQ = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): + /* "LCEngine2.pyx":421 + * for x in range(nmoves): + * mv = InfoMove(x + nbase) + * if mv.captura(): # <<<<<<<<<<<<<< + * li.append(mv) + * return li */ - __pyx_tuple__81 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); + } - /* "LCEngine.pyx":195 - * for i in range(64): + /* "LCEngine2.pyx":419 + * nbase = numBaseMove() * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: + * for x in range(nmoves): # <<<<<<<<<<<<<< + * mv = InfoMove(x + nbase) + * if mv.captura(): */ - __pyx_tuple__82 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__82); - __Pyx_GIVEREF(__pyx_tuple__82); - __pyx_tuple__83 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); - __pyx_tuple__84 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__84); - __Pyx_GIVEREF(__pyx_tuple__84); - __pyx_tuple__85 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__85); - __Pyx_GIVEREF(__pyx_tuple__85); - __pyx_tuple__86 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__86); - __Pyx_GIVEREF(__pyx_tuple__86); - __pyx_tuple__87 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__87); - __Pyx_GIVEREF(__pyx_tuple__87); - __pyx_tuple__88 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__88); - __Pyx_GIVEREF(__pyx_tuple__88); - __pyx_tuple__89 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__89); - __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_tuple__90 = PyTuple_Pack(8, __pyx_tuple__82, __pyx_tuple__83, __pyx_tuple__84, __pyx_tuple__85, __pyx_tuple__86, __pyx_tuple__87, __pyx_tuple__88, __pyx_tuple__89); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__90); - __Pyx_GIVEREF(__pyx_tuple__90); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":202 + /* "LCEngine2.pyx":423 + * if mv.captura(): + * li.append(mv) + * return li # <<<<<<<<<<<<<< * - * dicB = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): + * def getCaptures(fen, siMB): */ - __pyx_tuple__91 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__91); - __Pyx_GIVEREF(__pyx_tuple__91); + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_li); + __pyx_r = __pyx_v_li; + goto __pyx_L0; - /* "LCEngine.pyx":204 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: + /* "LCEngine2.pyx":414 + * + * + * def getCapturesFEN(fen): # <<<<<<<<<<<<<< + * setFen(fen) + * nmoves = numMoves() */ - __pyx_tuple__92 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__92); - __Pyx_GIVEREF(__pyx_tuple__92); - __pyx_tuple__93 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__93); - __Pyx_GIVEREF(__pyx_tuple__93); - __pyx_tuple__94 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__94); - __Pyx_GIVEREF(__pyx_tuple__94); - __pyx_tuple__95 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__95); - __Pyx_GIVEREF(__pyx_tuple__95); - __pyx_tuple__96 = PyTuple_Pack(4, __pyx_tuple__92, __pyx_tuple__93, __pyx_tuple__94, __pyx_tuple__95); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__96); - __Pyx_GIVEREF(__pyx_tuple__96); - /* "LCEngine.pyx":211 + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("LCEngine2.getCapturesFEN", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_nbase); + __Pyx_XDECREF(__pyx_v_li); + __Pyx_XDECREF(__pyx_v_x); + __Pyx_XDECREF(__pyx_v_mv); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "LCEngine2.pyx":425 + * return li * - * dicR = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): + * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< + * if not siMB: + * fen = fenOB(fen) */ - __pyx_tuple__97 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__97); - __Pyx_GIVEREF(__pyx_tuple__97); - /* "LCEngine.pyx":213 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_tuple__98 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__98); - __Pyx_GIVEREF(__pyx_tuple__98); - __pyx_tuple__99 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__99); - __Pyx_GIVEREF(__pyx_tuple__99); - __pyx_tuple__100 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__100); - __Pyx_GIVEREF(__pyx_tuple__100); - __pyx_tuple__101 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__101); - __Pyx_GIVEREF(__pyx_tuple__101); - __pyx_tuple__102 = PyTuple_Pack(4, __pyx_tuple__98, __pyx_tuple__99, __pyx_tuple__100, __pyx_tuple__101); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__102); - __Pyx_GIVEREF(__pyx_tuple__102); +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_57getCaptures(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_57getCaptures = {"getCaptures", (PyCFunction)__pyx_pw_9LCEngine2_57getCaptures, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_9LCEngine2_57getCaptures(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_fen = 0; + PyObject *__pyx_v_siMB = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("getCaptures (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fen,&__pyx_n_s_siMB,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_fen)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_siMB)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("getCaptures", 1, 2, 2, 1); __PYX_ERR(0, 425, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCaptures") < 0)) __PYX_ERR(0, 425, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_fen = values[0]; + __pyx_v_siMB = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("getCaptures", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 425, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("LCEngine2.getCaptures", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_9LCEngine2_56getCaptures(__pyx_self, __pyx_v_fen, __pyx_v_siMB); - /* "LCEngine.pyx":220 - * - * dicN = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicN[i] = liN(i) - * - */ - __pyx_tuple__103 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__103); - __Pyx_GIVEREF(__pyx_tuple__103); + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":224 - * - * dicPW = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPW[i] = liP(i, True) - * - */ - __pyx_tuple__104 = PyTuple_Pack(2, __pyx_int_8, __pyx_int_56); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__104); - __Pyx_GIVEREF(__pyx_tuple__104); +static PyObject *__pyx_pf_9LCEngine2_56getCaptures(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_siMB) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __Pyx_RefNannySetupContext("getCaptures", 0); + __Pyx_INCREF(__pyx_v_fen); - /* "LCEngine.pyx":228 - * - * dicPB = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPB[i] = liP(i, False) + /* "LCEngine2.pyx":426 * + * def getCaptures(fen, siMB): + * if not siMB: # <<<<<<<<<<<<<< + * fen = fenOB(fen) + * return getCapturesFEN(fen) */ - __pyx_tuple__105 = PyTuple_Pack(2, __pyx_int_8, __pyx_int_56); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__105); - __Pyx_GIVEREF(__pyx_tuple__105); + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_siMB); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 426, __pyx_L1_error) + __pyx_t_2 = ((!__pyx_t_1) != 0); + if (__pyx_t_2) { - /* "LCEngine.pyx":231 - * dicPB[i] = liP(i, False) + /* "LCEngine2.pyx":427 + * def getCaptures(fen, siMB): + * if not siMB: + * fen = fenOB(fen) # <<<<<<<<<<<<<< + * return getCapturesFEN(fen) * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] */ - __pyx_tuple__106 = PyTuple_Pack(14, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_no, __pyx_n_s_nv, __pyx_n_s_mx, __pyx_n_s_lia, __pyx_n_s_lib, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_nx, __pyx_n_s_f, __pyx_n_s_xmin, __pyx_n_s_lidef); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__106); - __Pyx_GIVEREF(__pyx_tuple__106); - __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_knightmoves, 231, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 231, __pyx_L1_error) + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_fenOB); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_fen}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_fen}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; + __Pyx_INCREF(__pyx_v_fen); + __Pyx_GIVEREF(__pyx_v_fen); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_fen); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 427, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_fen, __pyx_t_3); + __pyx_t_3 = 0; - /* "LCEngine.pyx":271 - * return lidef + /* "LCEngine2.pyx":426 * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] + * def getCaptures(fen, siMB): + * if not siMB: # <<<<<<<<<<<<<< + * fen = fenOB(fen) + * return getCapturesFEN(fen) */ - __pyx_tuple__108 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_celdas_ocupadas, __pyx_n_s_nv, __pyx_n_s_ot, __pyx_n_s_li); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__108); - __Pyx_GIVEREF(__pyx_tuple__108); - __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liNMinimo, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 271, __pyx_L1_error) + } - /* "LCEngine.pyx":282 - * return li + /* "LCEngine2.pyx":428 + * if not siMB: + * fen = fenOB(fen) + * return getCapturesFEN(fen) # <<<<<<<<<<<<<< * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True + * def fenOB(fen): */ - __pyx_tuple__110 = PyTuple_Pack(7, __pyx_n_s_xpv, __pyx_n_s_li, __pyx_n_s_siBlancas, __pyx_n_s_c, __pyx_n_s_x, __pyx_n_s_move, __pyx_n_s_base); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__110); - __Pyx_GIVEREF(__pyx_tuple__110); - __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_xpv2lipv, 282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_getCapturesFEN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_fen}; + __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { + PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_fen}; + __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else + #endif + { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; + __Pyx_INCREF(__pyx_v_fen); + __Pyx_GIVEREF(__pyx_v_fen); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_fen); + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 428, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":299 + /* "LCEngine2.pyx":425 * return li * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) - * + * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< + * if not siMB: + * fen = fenOB(fen) */ - __pyx_tuple__112 = PyTuple_Pack(1, __pyx_n_s_xpv); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__112); - __Pyx_GIVEREF(__pyx_tuple__112); - __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_xpv2pv, 299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 299, __pyx_L1_error) - /* "LCEngine.pyx":302 - * return " ".join(xpv2lipv(xpv)) - * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") - */ - __pyx_tuple__114 = PyTuple_Pack(7, __pyx_n_s_pv_2, __pyx_n_s_li, __pyx_n_s_lix, __pyx_n_s_move, __pyx_n_s_d, __pyx_n_s_h, __pyx_n_s_c); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__114); - __Pyx_GIVEREF(__pyx_tuple__114); - __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_pv2xpv, 302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 302, __pyx_L1_error) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("LCEngine2.getCaptures", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_fen); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":317 - * return "" +/* "LCEngine2.pyx":430 + * return getCapturesFEN(fen) * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) + * def fenOB(fen): # <<<<<<<<<<<<<< + * li = fen.split(" ") + * li[3] = "-" */ - __pyx_tuple__116 = PyTuple_Pack(5, __pyx_n_s_fen, __pyx_n_s_depth, __pyx_n_s_ms, __pyx_n_s_level, __pyx_n_s_x); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__116); - __Pyx_GIVEREF(__pyx_tuple__116); - __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_runFen, 317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 317, __pyx_L1_error) - /* "LCEngine.pyx":323 - * return x - * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() - */ - __pyx_tuple__118 = PyTuple_Pack(1, __pyx_n_s_fen); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__118); - __Pyx_GIVEREF(__pyx_tuple__118); - __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_setFen, 323, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 323, __pyx_L1_error) +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_59fenOB(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_59fenOB = {"fenOB", (PyCFunction)__pyx_pw_9LCEngine2_59fenOB, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_59fenOB(PyObject *__pyx_self, PyObject *__pyx_v_fen) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fenOB (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_58fenOB(__pyx_self, ((PyObject *)__pyx_v_fen)); - /* "LCEngine.pyx":327 - * return movegen() + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9LCEngine2_58fenOB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { + PyObject *__pyx_v_li = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + __Pyx_RefNannySetupContext("fenOB", 0); + + /* "LCEngine2.pyx":431 * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) + * def fenOB(fen): + * li = fen.split(" ") # <<<<<<<<<<<<<< + * li[3] = "-" + * li[1] = "w" if li[1] == "b" else "b" */ - __pyx_tuple__120 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_x); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__120); - __Pyx_GIVEREF(__pyx_tuple__120); - __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getFen, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 327, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_li = __pyx_t_2; + __pyx_t_2 = 0; - /* "LCEngine.pyx":333 - * return x - * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase + /* "LCEngine2.pyx":432 + * def fenOB(fen): + * li = fen.split(" ") + * li[3] = "-" # <<<<<<<<<<<<<< + * li[1] = "w" if li[1] == "b" else "b" + * return " ".join(li) */ - __pyx_tuple__122 = PyTuple_Pack(6, __pyx_n_s_pv_2, __pyx_n_s_nmoves, __pyx_n_s_x, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_r); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__122); - __Pyx_GIVEREF(__pyx_tuple__122); - __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(0, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getMoves, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 333, __pyx_L1_error) + if (unlikely(__Pyx_SetItemInt(__pyx_v_li, 3, __pyx_kp_s__37, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 432, __pyx_L1_error) - /* "LCEngine.pyx":346 - * return li - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< - * cdef char san[10] + /* "LCEngine2.pyx":433 + * li = fen.split(" ") + * li[3] = "-" + * li[1] = "w" if li[1] == "b" else "b" # <<<<<<<<<<<<<< + * return " ".join(li) * */ - __pyx_tuple__124 = PyTuple_Pack(5, __pyx_n_s_desdeA1H8, __pyx_n_s_hastaA1H8, __pyx_n_s_coronacion, __pyx_n_s_san_2, __pyx_n_s_num); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__124); - __Pyx_GIVEREF(__pyx_tuple__124); - __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getPGN, 346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 346, __pyx_L1_error) + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_li, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_b, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + __Pyx_INCREF(__pyx_n_s_w); + __pyx_t_2 = __pyx_n_s_w; + } else { + __Pyx_INCREF(__pyx_n_s_b); + __pyx_t_2 = __pyx_n_s_b; + } + if (unlikely(__Pyx_SetItemInt(__pyx_v_li, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 433, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":359 - * return san + /* "LCEngine2.pyx":434 + * li[3] = "-" + * li[1] = "w" if li[1] == "b" else "b" + * return " ".join(li) # <<<<<<<<<<<<<< * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() + * def fenTerminado(fen): */ - __pyx_tuple__126 = PyTuple_Pack(9, __pyx_n_s_xpv, __pyx_n_s_san_2, __pyx_n_s_siW, __pyx_n_s_num, __pyx_n_s_li, __pyx_n_s_tam, __pyx_n_s_pv_2, __pyx_n_s_x, __pyx_n_s_numMove); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__126); - __Pyx_GIVEREF(__pyx_tuple__126); - __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_xpv2pgn, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 359, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__15, __pyx_v_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 434, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":390 - * return "".join(li) - * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() + /* "LCEngine2.pyx":430 + * return getCapturesFEN(fen) * + * def fenOB(fen): # <<<<<<<<<<<<<< + * li = fen.split(" ") + * li[3] = "-" */ - __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isCheck, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 390, __pyx_L1_error) - /* "LCEngine.pyx":394 - * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] - */ - __pyx_tuple__129 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_num, __pyx_n_s_pv_2, __pyx_n_s_info, __pyx_n_s_san_2); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__129); - __Pyx_GIVEREF(__pyx_tuple__129); - __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_init, 394, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 394, __pyx_L1_error) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("LCEngine2.fenOB", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_li); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "LCEngine.pyx":419 - * self._capture = "x" in san +/* "LCEngine2.pyx":436 + * return " ".join(li) * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from + * def fenTerminado(fen): # <<<<<<<<<<<<<< + * return setFen(fen) == 0 * */ - __pyx_tuple__131 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 419, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__131); - __Pyx_GIVEREF(__pyx_tuple__131); - __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_desde, 419, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 419, __pyx_L1_error) - /* "LCEngine.pyx":422 - * return self._from +/* Python wrapper */ +static PyObject *__pyx_pw_9LCEngine2_61fenTerminado(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ +static PyMethodDef __pyx_mdef_9LCEngine2_61fenTerminado = {"fenTerminado", (PyCFunction)__pyx_pw_9LCEngine2_61fenTerminado, METH_O, 0}; +static PyObject *__pyx_pw_9LCEngine2_61fenTerminado(PyObject *__pyx_self, PyObject *__pyx_v_fen) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fenTerminado (wrapper)", 0); + __pyx_r = __pyx_pf_9LCEngine2_60fenTerminado(__pyx_self, ((PyObject *)__pyx_v_fen)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_9LCEngine2_60fenTerminado(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("fenTerminado", 0); + + /* "LCEngine2.pyx":437 * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to + * def fenTerminado(fen): + * return setFen(fen) == 0 # <<<<<<<<<<<<<< * */ - __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__133); - __Pyx_GIVEREF(__pyx_tuple__133); - __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_hasta, 422, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(0, 422, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + } else { + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_fen); + __Pyx_GIVEREF(__pyx_v_fen); + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fen); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 437, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "LCEngine.pyx":425 - * return self._to + /* "LCEngine2.pyx":436 + * return " ".join(li) * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() + * def fenTerminado(fen): # <<<<<<<<<<<<<< + * return setFen(fen) == 0 * */ - __pyx_tuple__135 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__135); - __Pyx_GIVEREF(__pyx_tuple__135); - __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_coronacion, 425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(0, 425, __pyx_L1_error) - /* "LCEngine.pyx":428 - * return self._promotion.lower() - * - * def movimiento(self): # <<<<<<<<<<<<<< - * return self._from+self._to+self._promotion.lower() - * - */ - __pyx_tuple__137 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__137); - __Pyx_GIVEREF(__pyx_tuple__137); - __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_movimiento, 428, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(0, 428, __pyx_L1_error) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("LCEngine2.fenTerminado", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_LCEngine2(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_LCEngine2}, + {0, NULL} +}; +#endif + +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + "LCEngine2", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, + {&__pyx_n_s_FCpos, __pyx_k_FCpos, sizeof(__pyx_k_FCpos), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove, __pyx_k_InfoMove, sizeof(__pyx_k_InfoMove), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove___init, __pyx_k_InfoMove___init, sizeof(__pyx_k_InfoMove___init), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_captura, __pyx_k_InfoMove_captura, sizeof(__pyx_k_InfoMove_captura), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_coronacion, __pyx_k_InfoMove_coronacion, sizeof(__pyx_k_InfoMove_coronacion), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_desde, __pyx_k_InfoMove_desde, sizeof(__pyx_k_InfoMove_desde), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_hasta, __pyx_k_InfoMove_hasta, sizeof(__pyx_k_InfoMove_hasta), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_isCastleK, __pyx_k_InfoMove_isCastleK, sizeof(__pyx_k_InfoMove_isCastleK), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_isCastleQ, __pyx_k_InfoMove_isCastleQ, sizeof(__pyx_k_InfoMove_isCastleQ), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_isEnPassant, __pyx_k_InfoMove_isEnPassant, sizeof(__pyx_k_InfoMove_isEnPassant), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_jaque, __pyx_k_InfoMove_jaque, sizeof(__pyx_k_InfoMove_jaque), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_mate, __pyx_k_InfoMove_mate, sizeof(__pyx_k_InfoMove_mate), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_movimiento, __pyx_k_InfoMove_movimiento, sizeof(__pyx_k_InfoMove_movimiento), 0, 0, 1, 1}, + {&__pyx_n_s_InfoMove_pieza, __pyx_k_InfoMove_pieza, sizeof(__pyx_k_InfoMove_pieza), 0, 0, 1, 1}, + {&__pyx_n_s_LCEngine2, __pyx_k_LCEngine2, sizeof(__pyx_k_LCEngine2), 0, 0, 1, 1}, + {&__pyx_kp_s_LCEngine2_pyx, __pyx_k_LCEngine2_pyx, sizeof(__pyx_k_LCEngine2_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_PGNreader, __pyx_k_PGNreader, sizeof(__pyx_k_PGNreader), 0, 0, 1, 1}, + {&__pyx_n_s_PGNreader___enter, __pyx_k_PGNreader___enter, sizeof(__pyx_k_PGNreader___enter), 0, 0, 1, 1}, + {&__pyx_n_s_PGNreader___exit, __pyx_k_PGNreader___exit, sizeof(__pyx_k_PGNreader___exit), 0, 0, 1, 1}, + {&__pyx_n_s_PGNreader___init, __pyx_k_PGNreader___init, sizeof(__pyx_k_PGNreader___init), 0, 0, 1, 1}, + {&__pyx_n_s_PGNreader___iter, __pyx_k_PGNreader___iter, sizeof(__pyx_k_PGNreader___iter), 0, 0, 1, 1}, + {&__pyx_n_s_PGNreader_next, __pyx_k_PGNreader_next, sizeof(__pyx_k_PGNreader_next), 0, 0, 1, 1}, + {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, + {&__pyx_kp_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 0}, + {&__pyx_kp_s__24, __pyx_k__24, sizeof(__pyx_k__24), 0, 0, 1, 0}, + {&__pyx_kp_s__28, __pyx_k__28, sizeof(__pyx_k__28), 0, 0, 1, 0}, + {&__pyx_kp_s__29, __pyx_k__29, sizeof(__pyx_k__29), 0, 0, 1, 0}, + {&__pyx_kp_s__30, __pyx_k__30, sizeof(__pyx_k__30), 0, 0, 1, 0}, + {&__pyx_kp_s__37, __pyx_k__37, sizeof(__pyx_k__37), 0, 0, 1, 0}, + {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, + {&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1}, + {&__pyx_n_s_a1Pos, __pyx_k_a1Pos, sizeof(__pyx_k_a1Pos), 0, 0, 1, 1}, + {&__pyx_n_s_a1h8q, __pyx_k_a1h8q, sizeof(__pyx_k_a1h8q), 0, 0, 1, 1}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, + {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, + {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, + {&__pyx_n_s_captura, __pyx_k_captura, sizeof(__pyx_k_captura), 0, 0, 1, 1}, + {&__pyx_n_s_capture, __pyx_k_capture, sizeof(__pyx_k_capture), 0, 0, 1, 1}, + {&__pyx_n_s_castle_K, __pyx_k_castle_K, sizeof(__pyx_k_castle_K), 0, 0, 1, 1}, + {&__pyx_n_s_castle_Q, __pyx_k_castle_Q, sizeof(__pyx_k_castle_Q), 0, 0, 1, 1}, + {&__pyx_n_s_celdas_ocupadas, __pyx_k_celdas_ocupadas, sizeof(__pyx_k_celdas_ocupadas), 0, 0, 1, 1}, + {&__pyx_n_s_check, __pyx_k_check, sizeof(__pyx_k_check), 0, 0, 1, 1}, + {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, + {&__pyx_n_s_ci, __pyx_k_ci, sizeof(__pyx_k_ci), 0, 0, 1, 1}, + {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1}, + {&__pyx_n_s_coronacion, __pyx_k_coronacion, sizeof(__pyx_k_coronacion), 0, 0, 1, 1}, + {&__pyx_n_s_ct, __pyx_k_ct, sizeof(__pyx_k_ct), 0, 0, 1, 1}, + {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, + {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1}, + {&__pyx_n_s_desde, __pyx_k_desde, sizeof(__pyx_k_desde), 0, 0, 1, 1}, + {&__pyx_n_s_desdeA1H8, __pyx_k_desdeA1H8, sizeof(__pyx_k_desdeA1H8), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, + {&__pyx_n_s_ep, __pyx_k_ep, sizeof(__pyx_k_ep), 0, 0, 1, 1}, + {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, + {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1}, + {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, + {&__pyx_n_s_fen, __pyx_k_fen, sizeof(__pyx_k_fen), 0, 0, 1, 1}, + {&__pyx_n_s_fen2fenM2, __pyx_k_fen2fenM2, sizeof(__pyx_k_fen2fenM2), 0, 0, 1, 1}, + {&__pyx_n_s_fenOB, __pyx_k_fenOB, sizeof(__pyx_k_fenOB), 0, 0, 1, 1}, + {&__pyx_n_s_fenTerminado, __pyx_k_fenTerminado, sizeof(__pyx_k_fenTerminado), 0, 0, 1, 1}, + {&__pyx_n_s_fens, __pyx_k_fens, sizeof(__pyx_k_fens), 0, 0, 1, 1}, + {&__pyx_n_s_fi, __pyx_k_fi, sizeof(__pyx_k_fi), 0, 0, 1, 1}, + {&__pyx_n_s_fich, __pyx_k_fich, sizeof(__pyx_k_fich), 0, 0, 1, 1}, + {&__pyx_n_s_fil, __pyx_k_fil, sizeof(__pyx_k_fil), 0, 0, 1, 1}, + {&__pyx_n_s_from, __pyx_k_from, sizeof(__pyx_k_from), 0, 0, 1, 1}, + {&__pyx_n_s_ft, __pyx_k_ft, sizeof(__pyx_k_ft), 0, 0, 1, 1}, + {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, + {&__pyx_n_s_getCaptures, __pyx_k_getCaptures, sizeof(__pyx_k_getCaptures), 0, 0, 1, 1}, + {&__pyx_n_s_getCapturesFEN, __pyx_k_getCapturesFEN, sizeof(__pyx_k_getCapturesFEN), 0, 0, 1, 1}, + {&__pyx_n_s_getExMoves, __pyx_k_getExMoves, sizeof(__pyx_k_getExMoves), 0, 0, 1, 1}, + {&__pyx_n_s_getFen, __pyx_k_getFen, sizeof(__pyx_k_getFen), 0, 0, 1, 1}, + {&__pyx_n_s_getMoves, __pyx_k_getMoves, sizeof(__pyx_k_getMoves), 0, 0, 1, 1}, + {&__pyx_n_s_getPGN, __pyx_k_getPGN, sizeof(__pyx_k_getPGN), 0, 0, 1, 1}, + {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1}, + {&__pyx_n_s_h8, __pyx_k_h8, sizeof(__pyx_k_h8), 0, 0, 1, 1}, + {&__pyx_n_s_hasta, __pyx_k_hasta, sizeof(__pyx_k_hasta), 0, 0, 1, 1}, + {&__pyx_n_s_hastaA1H8, __pyx_k_hastaA1H8, sizeof(__pyx_k_hastaA1H8), 0, 0, 1, 1}, + {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1}, + {&__pyx_n_s_infoMove, __pyx_k_infoMove, sizeof(__pyx_k_infoMove), 0, 0, 1, 1}, + {&__pyx_n_s_inifen, __pyx_k_inifen, sizeof(__pyx_k_inifen), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1}, + {&__pyx_n_s_isCastleK, __pyx_k_isCastleK, sizeof(__pyx_k_isCastleK), 0, 0, 1, 1}, + {&__pyx_n_s_isCastleQ, __pyx_k_isCastleQ, sizeof(__pyx_k_isCastleQ), 0, 0, 1, 1}, + {&__pyx_n_s_isCheck, __pyx_k_isCheck, sizeof(__pyx_k_isCheck), 0, 0, 1, 1}, + {&__pyx_n_s_isEnPassant, __pyx_k_isEnPassant, sizeof(__pyx_k_isEnPassant), 0, 0, 1, 1}, + {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, + {&__pyx_n_s_jaque, __pyx_k_jaque, sizeof(__pyx_k_jaque), 0, 0, 1, 1}, + {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, + {&__pyx_n_s_knightmoves, __pyx_k_knightmoves, sizeof(__pyx_k_knightmoves), 0, 0, 1, 1}, + {&__pyx_n_s_lc_pgn2pv, __pyx_k_lc_pgn2pv, sizeof(__pyx_k_lc_pgn2pv), 0, 0, 1, 1}, + {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1}, + {&__pyx_n_s_li, __pyx_k_li, sizeof(__pyx_k_li), 0, 0, 1, 1}, + {&__pyx_n_s_liM, __pyx_k_liM, sizeof(__pyx_k_liM), 0, 0, 1, 1}, + {&__pyx_n_s_liN, __pyx_k_liN, sizeof(__pyx_k_liN), 0, 0, 1, 1}, + {&__pyx_n_s_liNMinimo, __pyx_k_liNMinimo, sizeof(__pyx_k_liNMinimo), 0, 0, 1, 1}, + {&__pyx_n_s_lia, __pyx_k_lia, sizeof(__pyx_k_lia), 0, 0, 1, 1}, + {&__pyx_n_s_lib, __pyx_k_lib, sizeof(__pyx_k_lib), 0, 0, 1, 1}, + {&__pyx_n_s_lidef, __pyx_k_lidef, sizeof(__pyx_k_lidef), 0, 0, 1, 1}, + {&__pyx_n_s_lix, __pyx_k_lix, sizeof(__pyx_k_lix), 0, 0, 1, 1}, + {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_makeMove, __pyx_k_makeMove, sizeof(__pyx_k_makeMove), 0, 0, 1, 1}, + {&__pyx_n_s_makePV, __pyx_k_makePV, sizeof(__pyx_k_makePV), 0, 0, 1, 1}, + {&__pyx_n_s_mate, __pyx_k_mate, sizeof(__pyx_k_mate), 0, 0, 1, 1}, + {&__pyx_n_s_mate_2, __pyx_k_mate_2, sizeof(__pyx_k_mate_2), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_move, __pyx_k_move, sizeof(__pyx_k_move), 0, 0, 1, 1}, + {&__pyx_n_s_move2num, __pyx_k_move2num, sizeof(__pyx_k_move2num), 0, 0, 1, 1}, + {&__pyx_n_s_moveExPV, __pyx_k_moveExPV, sizeof(__pyx_k_moveExPV), 0, 0, 1, 1}, + {&__pyx_n_s_movePV, __pyx_k_movePV, sizeof(__pyx_k_movePV), 0, 0, 1, 1}, + {&__pyx_n_s_movimiento, __pyx_k_movimiento, sizeof(__pyx_k_movimiento), 0, 0, 1, 1}, + {&__pyx_n_s_ms, __pyx_k_ms, sizeof(__pyx_k_ms), 0, 0, 1, 1}, + {&__pyx_n_s_mv, __pyx_k_mv, sizeof(__pyx_k_mv), 0, 0, 1, 1}, + {&__pyx_n_s_mx, __pyx_k_mx, sizeof(__pyx_k_mx), 0, 0, 1, 1}, + {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, + {&__pyx_n_s_nbase, __pyx_k_nbase, sizeof(__pyx_k_nbase), 0, 0, 1, 1}, + {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1}, + {&__pyx_n_s_nmoves, __pyx_k_nmoves, sizeof(__pyx_k_nmoves), 0, 0, 1, 1}, + {&__pyx_n_s_no, __pyx_k_no, sizeof(__pyx_k_no), 0, 0, 1, 1}, + {&__pyx_n_s_npos, __pyx_k_npos, sizeof(__pyx_k_npos), 0, 0, 1, 1}, + {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1}, + {&__pyx_n_s_num2move, __pyx_k_num2move, sizeof(__pyx_k_num2move), 0, 0, 1, 1}, + {&__pyx_n_s_numMove, __pyx_k_numMove, sizeof(__pyx_k_numMove), 0, 0, 1, 1}, + {&__pyx_n_s_nv, __pyx_k_nv, sizeof(__pyx_k_nv), 0, 0, 1, 1}, + {&__pyx_n_s_nx, __pyx_k_nx, sizeof(__pyx_k_nx), 0, 0, 1, 1}, + {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, + {&__pyx_n_s_ot, __pyx_k_ot, sizeof(__pyx_k_ot), 0, 0, 1, 1}, + {&__pyx_n_s_pgn, __pyx_k_pgn, sizeof(__pyx_k_pgn), 0, 0, 1, 1}, + {&__pyx_n_s_pgn1, __pyx_k_pgn1, sizeof(__pyx_k_pgn1), 0, 0, 1, 1}, + {&__pyx_n_s_piece, __pyx_k_piece, sizeof(__pyx_k_piece), 0, 0, 1, 1}, + {&__pyx_n_s_pieza, __pyx_k_pieza, sizeof(__pyx_k_pieza), 0, 0, 1, 1}, + {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, + {&__pyx_n_s_posA1, __pyx_k_posA1, sizeof(__pyx_k_posA1), 0, 0, 1, 1}, + {&__pyx_n_s_posFC, __pyx_k_posFC, sizeof(__pyx_k_posFC), 0, 0, 1, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_promotion, __pyx_k_promotion, sizeof(__pyx_k_promotion), 0, 0, 1, 1}, + {&__pyx_n_s_pv, __pyx_k_pv, sizeof(__pyx_k_pv), 0, 0, 1, 1}, + {&__pyx_n_s_pv2xpv, __pyx_k_pv2xpv, sizeof(__pyx_k_pv2xpv), 0, 0, 1, 1}, + {&__pyx_n_s_pv_2, __pyx_k_pv_2, sizeof(__pyx_k_pv_2), 0, 0, 1, 1}, + {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_resp, __pyx_k_resp, sizeof(__pyx_k_resp), 0, 0, 1, 1}, + {&__pyx_n_s_rfind, __pyx_k_rfind, sizeof(__pyx_k_rfind), 0, 0, 1, 1}, + {&__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP, __pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP, sizeof(__pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP), 0, 0, 1, 0}, + {&__pyx_n_s_runFen, __pyx_k_runFen, sizeof(__pyx_k_runFen), 0, 0, 1, 1}, + {&__pyx_n_s_san, __pyx_k_san, sizeof(__pyx_k_san), 0, 0, 1, 1}, + {&__pyx_n_s_san_2, __pyx_k_san_2, sizeof(__pyx_k_san_2), 0, 0, 1, 1}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_setFen, __pyx_k_setFen, sizeof(__pyx_k_setFen), 0, 0, 1, 1}, + {&__pyx_n_s_setFenInicial, __pyx_k_setFenInicial, sizeof(__pyx_k_setFenInicial), 0, 0, 1, 1}, + {&__pyx_n_s_siBlancas, __pyx_k_siBlancas, sizeof(__pyx_k_siBlancas), 0, 0, 1, 1}, + {&__pyx_n_s_siMB, __pyx_k_siMB, sizeof(__pyx_k_siMB), 0, 0, 1, 1}, + {&__pyx_n_s_siW, __pyx_k_siW, sizeof(__pyx_k_siW), 0, 0, 1, 1}, + {&__pyx_n_s_sp1, __pyx_k_sp1, sizeof(__pyx_k_sp1), 0, 0, 1, 1}, + {&__pyx_n_s_sp2, __pyx_k_sp2, sizeof(__pyx_k_sp2), 0, 0, 1, 1}, + {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, + {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1}, + {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, + {&__pyx_n_s_tam, __pyx_k_tam, sizeof(__pyx_k_tam), 0, 0, 1, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_to, __pyx_k_to, sizeof(__pyx_k_to), 0, 0, 1, 1}, + {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, + {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, + {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, + {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, + {&__pyx_n_s_xmin, __pyx_k_xmin, sizeof(__pyx_k_xmin), 0, 0, 1, 1}, + {&__pyx_n_s_xpv, __pyx_k_xpv, sizeof(__pyx_k_xpv), 0, 0, 1, 1}, + {&__pyx_n_s_xpv2lipv, __pyx_k_xpv2lipv, sizeof(__pyx_k_xpv2lipv), 0, 0, 1, 1}, + {&__pyx_n_s_xpv2pgn, __pyx_k_xpv2pgn, sizeof(__pyx_k_xpv2pgn), 0, 0, 1, 1}, + {&__pyx_n_s_xpv2pv, __pyx_k_xpv2pv, sizeof(__pyx_k_xpv2pv), 0, 0, 1, 1}, + {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 292, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 89, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "LCEngine.pyx":431 - * return self._from+self._to+self._promotion.lower() - * - * def jaque(self): # <<<<<<<<<<<<<< - * return self._check + /* "LCEngine2.pyx":98 * + * def move2num(a1h8q): + * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 # <<<<<<<<<<<<<< + * if len(a1h8q)>4: + * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 */ - __pyx_tuple__139 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__139); - __Pyx_GIVEREF(__pyx_tuple__139); - __pyx_codeobj__140 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__139, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_jaque, 431, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(0, 431, __pyx_L1_error) + __pyx_slice__2 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__2); + __Pyx_GIVEREF(__pyx_slice__2); + __pyx_slice__3 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__3); + __Pyx_GIVEREF(__pyx_slice__3); - /* "LCEngine.pyx":434 - * return self._check - * - * def mate(self): # <<<<<<<<<<<<<< - * return self._mate - * + /* "LCEngine2.pyx":119 + * fil, col = posFC(npos) + * liM = [] + * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< + * ft = fil + fi + * ct = col + ci */ - __pyx_tuple__141 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__141); - __Pyx_GIVEREF(__pyx_tuple__141); - __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_mate_2, 434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(0, 434, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__5 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_2); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__6 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__7 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__10 = PyTuple_Pack(2, __pyx_int_neg_2, __pyx_int_1); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_neg_2, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__12 = PyTuple_Pack(8, __pyx_tuple__4, __pyx_tuple__5, __pyx_tuple__6, __pyx_tuple__7, __pyx_tuple__8, __pyx_tuple__9, __pyx_tuple__10, __pyx_tuple__11); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); - /* "LCEngine.pyx":437 - * return self._mate - * - * def captura(self): # <<<<<<<<<<<<<< - * return self._capture - * + /* "LCEngine2.pyx":149 + * for y in lib: + * if x not in no and y not in no: + * nx = no[:] # <<<<<<<<<<<<<< + * nx.append(x) + * nx.append(y) */ - __pyx_tuple__143 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__143); - __Pyx_GIVEREF(__pyx_tuple__143); - __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__143, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_captura, 437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(0, 437, __pyx_L1_error) + __pyx_slice__13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__13)) __PYX_ERR(0, 149, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__13); + __Pyx_GIVEREF(__pyx_slice__13); - /* "LCEngine.pyx":440 - * return self._capture - * - * def pieza(self): # <<<<<<<<<<<<<< - * return self._piece - * + /* "LCEngine2.pyx":172 + * def liNMinimo(x, y, celdas_ocupadas): + * cdef int nv + * ot = celdas_ocupadas[:] # <<<<<<<<<<<<<< + * ot.extend([x, y]) + * nv = 1 */ - __pyx_tuple__145 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__145); - __Pyx_GIVEREF(__pyx_tuple__145); - __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_pieza, 440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(0, 440, __pyx_L1_error) + __pyx_slice__14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__14)) __PYX_ERR(0, 172, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__14); + __Pyx_GIVEREF(__pyx_slice__14); - /* "LCEngine.pyx":443 - * return self._piece - * - * def isCastleK(self): # <<<<<<<<<<<<<< - * return self._castle_K - * + /* "LCEngine2.pyx":203 + * def pv2xpv(pv): + * if pv: + * li = pv.split(" ") # <<<<<<<<<<<<<< + * lix = [] + * for move in li: */ - __pyx_tuple__147 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__147); - __Pyx_GIVEREF(__pyx_tuple__147); - __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isCastleK, 443, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(0, 443, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s__15); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "LCEngine.pyx":446 - * return self._castle_K - * - * def isCastleQ(self): # <<<<<<<<<<<<<< - * return self._castle_Q - * + /* "LCEngine2.pyx":206 + * lix = [] + * for move in li: + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 # <<<<<<<<<<<<<< + * h = chr(a1Pos(move[2:4]) + 58) + * c = move[4:] */ - __pyx_tuple__149 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__149); - __Pyx_GIVEREF(__pyx_tuple__149); - __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isCastleQ, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 446, __pyx_L1_error) + __pyx_slice__17 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__17)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__17); + __Pyx_GIVEREF(__pyx_slice__17); - /* "LCEngine.pyx":449 - * return self._castle_Q - * - * def isEnPassant(self): # <<<<<<<<<<<<<< - * return self._ep - * + /* "LCEngine2.pyx":207 + * for move in li: + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + * h = chr(a1Pos(move[2:4]) + 58) # <<<<<<<<<<<<<< + * c = move[4:] + * if c: */ - __pyx_tuple__151 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__151); - __Pyx_GIVEREF(__pyx_tuple__151); - __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isEnPassant, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 449, __pyx_L1_error) + __pyx_slice__18 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__18)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__18); + __Pyx_GIVEREF(__pyx_slice__18); - /* "LCEngine.pyx":452 - * return self._ep - * - * def getExMoves(): # <<<<<<<<<<<<<< - * nmoves = numMoves() - * + /* "LCEngine2.pyx":208 + * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 + * h = chr(a1Pos(move[2:4]) + 58) + * c = move[4:] # <<<<<<<<<<<<<< + * if c: + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") */ - __pyx_tuple__153 = PyTuple_Pack(5, __pyx_n_s_nmoves, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_mv); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__153); - __Pyx_GIVEREF(__pyx_tuple__153); - __pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getExMoves, 452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 452, __pyx_L1_error) + __pyx_slice__19 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__19)) __PYX_ERR(0, 208, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__19); + __Pyx_GIVEREF(__pyx_slice__19); - /* "LCEngine.pyx":462 - * return li - * - * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" + /* "LCEngine2.pyx":210 + * c = move[4:] + * if c: + * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") # <<<<<<<<<<<<<< + * lix.append(d + h + c) + * return "".join(lix) */ - __pyx_tuple__155 = PyTuple_Pack(5, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num, __pyx_n_s_infoMove); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__155); - __Pyx_GIVEREF(__pyx_tuple__155); - __pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_moveExPV, 462, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) __PYX_ERR(0, 462, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_int_50); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_int_51); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_int_52); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_int_53); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 210, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); - /* "LCEngine.pyx":475 - * return infoMove + /* "LCEngine2.pyx":273 + * siW = not siW * - * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" + * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) # <<<<<<<<<<<<<< + * if numMove == -1: + * break */ - __pyx_tuple__157 = PyTuple_Pack(4, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__157); - __Pyx_GIVEREF(__pyx_tuple__157); - __pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_movePV, 475, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) __PYX_ERR(0, 475, __pyx_L1_error) + __pyx_slice__25 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__25)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__25); + __Pyx_GIVEREF(__pyx_slice__25); + __pyx_slice__26 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__26)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__26); + __Pyx_GIVEREF(__pyx_slice__26); + __pyx_slice__27 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(0, 273, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__27); + __Pyx_GIVEREF(__pyx_slice__27); - /* "LCEngine.pyx":487 - * return True + /* "LCEngine2.pyx":387 * - * def makeMove(move): # <<<<<<<<<<<<<< - * desde = move[:2] + * def makeMove(move): + * desde = move[:2] # <<<<<<<<<<<<<< * hasta = move[2:4] + * coronacion = move[4:] */ - __pyx_tuple__159 = PyTuple_Pack(5, __pyx_n_s_move, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num); if (unlikely(!__pyx_tuple__159)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__159); - __Pyx_GIVEREF(__pyx_tuple__159); - __pyx_codeobj__160 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_makeMove, 487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__160)) __PYX_ERR(0, 487, __pyx_L1_error) - - /* "LCEngine.pyx":498 - * return True - * - * def fen2fenM2(fen): # <<<<<<<<<<<<<< - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) - */ - __pyx_tuple__161 = PyTuple_Pack(3, __pyx_n_s_fen, __pyx_n_s_sp1, __pyx_n_s_sp2); if (unlikely(!__pyx_tuple__161)) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__161); - __Pyx_GIVEREF(__pyx_tuple__161); - __pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__161, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_fen2fenM2, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) __PYX_ERR(0, 498, __pyx_L1_error) - - /* "LCEngine.pyx":503 - * return fen[:sp2] - * - * def setFenInicial(): # <<<<<<<<<<<<<< - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) - */ - __pyx_tuple__163 = PyTuple_Pack(1, __pyx_n_s_inifen); if (unlikely(!__pyx_tuple__163)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__163); - __Pyx_GIVEREF(__pyx_tuple__163); - __pyx_codeobj__164 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_setFenInicial, 503, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__164)) __PYX_ERR(0, 503, __pyx_L1_error) - - /* "LCEngine.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - __pyx_tuple__165 = PyTuple_Pack(2, __pyx_n_s_pv_2, __pyx_n_s_move); if (unlikely(!__pyx_tuple__165)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__165); - __Pyx_GIVEREF(__pyx_tuple__165); - __pyx_codeobj__166 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__165, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_makePV, 507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__166)) __PYX_ERR(0, 507, __pyx_L1_error) - - /* "LCEngine.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - __pyx_tuple__167 = PyTuple_Pack(6, __pyx_n_s_fen, __pyx_n_s_nmoves, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_mv); if (unlikely(!__pyx_tuple__167)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__167); - __Pyx_GIVEREF(__pyx_tuple__167); - __pyx_codeobj__168 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__167, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getCapturesFEN, 515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__168)) __PYX_ERR(0, 515, __pyx_L1_error) + __pyx_slice__31 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__31)) __PYX_ERR(0, 387, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__31); + __Pyx_GIVEREF(__pyx_slice__31); - /* "LCEngine.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) + /* "LCEngine2.pyx":388 + * def makeMove(move): + * desde = move[:2] + * hasta = move[2:4] # <<<<<<<<<<<<<< + * coronacion = move[4:] + * num = searchMove( desde, hasta, coronacion ) */ - __pyx_tuple__169 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_siMB); if (unlikely(!__pyx_tuple__169)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__169); - __Pyx_GIVEREF(__pyx_tuple__169); - __pyx_codeobj__170 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__169, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getCaptures, 526, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__170)) __PYX_ERR(0, 526, __pyx_L1_error) + __pyx_slice__32 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__32)) __PYX_ERR(0, 388, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__32); + __Pyx_GIVEREF(__pyx_slice__32); - /* "LCEngine.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" + /* "LCEngine2.pyx":389 + * desde = move[:2] + * hasta = move[2:4] + * coronacion = move[4:] # <<<<<<<<<<<<<< + * num = searchMove( desde, hasta, coronacion ) + * if num == -1: */ - __pyx_tuple__171 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_li); if (unlikely(!__pyx_tuple__171)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__171); - __Pyx_GIVEREF(__pyx_tuple__171); - __pyx_codeobj__172 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_fenOB, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__172)) __PYX_ERR(0, 531, __pyx_L1_error) + __pyx_slice__33 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__33)) __PYX_ERR(0, 389, __pyx_L1_error) + __Pyx_GOTREF(__pyx_slice__33); + __Pyx_GIVEREF(__pyx_slice__33); - /* "LCEngine.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 + /* "LCEngine2.pyx":398 * + * def fen2fenM2(fen): + * sp1 = fen.rfind(" ") # <<<<<<<<<<<<<< + * sp2 = fen.rfind(" ", 0, sp1) + * return fen[:sp2] */ - __pyx_tuple__173 = PyTuple_Pack(1, __pyx_n_s_fen); if (unlikely(!__pyx_tuple__173)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__173); - __Pyx_GIVEREF(__pyx_tuple__173); - __pyx_codeobj__174 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_fenTerminado, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__174)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_49 = PyInt_FromLong(49); if (unlikely(!__pyx_int_49)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_51 = PyInt_FromLong(51); if (unlikely(!__pyx_int_51)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_52 = PyInt_FromLong(52); if (unlikely(!__pyx_int_52)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_53 = PyInt_FromLong(53); if (unlikely(!__pyx_int_53)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_56 = PyInt_FromLong(56); if (unlikely(!__pyx_int_56)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_58 = PyInt_FromLong(58); if (unlikely(!__pyx_int_58)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_80 = PyInt_FromLong(80); if (unlikely(!__pyx_int_80)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_97 = PyInt_FromLong(97); if (unlikely(!__pyx_int_97)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s__15); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 398, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initLCEngine(void); /*proto*/ -PyMODINIT_FUNC initLCEngine(void) -#else -PyMODINIT_FUNC PyInit_LCEngine(void); /*proto*/ -PyMODINIT_FUNC PyInit_LCEngine(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - int __pyx_t_15; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_LCEngine(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("LCEngine", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_LCEngine) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "LCEngine")) { - if (unlikely(PyDict_SetItemString(modules, "LCEngine", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif + /* "LCEngine2.pyx":409 + * setFenInicial() + * if pv: + * for move in pv.split(" "): # <<<<<<<<<<<<<< + * makeMove(move) + * return getFen() + */ + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s__15); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 409, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); - /* "LCEngine.pyx":41 - * + /* "LCEngine2.pyx":431 * - * class PGNreader: # <<<<<<<<<<<<<< - * def __init__(self, fich, depth): - * self.fich = fich + * def fenOB(fen): + * li = fen.split(" ") # <<<<<<<<<<<<<< + * li[3] = "-" + * li[1] = "w" if li[1] == "b" else "b" */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_PGNreader, __pyx_n_s_PGNreader, (PyObject *) NULL, __pyx_n_s_LCEngine, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s__15); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 431, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); - /* "LCEngine.pyx":42 + /* "LCEngine2.pyx":42 * * class PGNreader: * def __init__(self, fich, depth): # <<<<<<<<<<<<<< * self.fich = fich * self.depth = depth */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_9PGNreader_1__init__, 0, __pyx_n_s_PGNreader___init, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__38 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_fich, __pyx_n_s_depth); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_init, 42, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 42, __pyx_L1_error) - /* "LCEngine.pyx":46 + /* "LCEngine2.pyx":46 * self.depth = depth * * def __enter__(self): # <<<<<<<<<<<<<< * pgn_start(self.fich, self.depth) * return self */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_9PGNreader_3__enter__, 0, __pyx_n_s_PGNreader___enter, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_enter, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_enter, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 46, __pyx_L1_error) - /* "LCEngine.pyx":50 + /* "LCEngine2.pyx":50 * return self * * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< * pgn_stop() * */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_9PGNreader_5__exit__, 0, __pyx_n_s_PGNreader___exit, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_exit, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__42 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_type, __pyx_n_s_value, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_exit, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 50, __pyx_L1_error) - /* "LCEngine.pyx":53 + /* "LCEngine2.pyx":53 * pgn_stop() * * def __iter__(self): # <<<<<<<<<<<<<< * return self * */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_9PGNreader_7__iter__, 0, __pyx_n_s_PGNreader___iter, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_iter, __pyx_t_2) < 0) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__44 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_iter, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 53, __pyx_L1_error) - /* "LCEngine.pyx":56 + /* "LCEngine2.pyx":56 * return self * * def next(self): # <<<<<<<<<<<<<< * n = pgn_read() * if n: */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_9PGNreader_9next, 0, __pyx_n_s_PGNreader_next, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_next, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":41 - * - * - * class PGNreader: # <<<<<<<<<<<<<< - * def __init__(self, fich, depth): - * self.fich = fich - */ - __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_PGNreader, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PGNreader, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__46 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_pgn, __pyx_n_s_pv_2, __pyx_n_s_d, __pyx_n_s_r, __pyx_n_s_fens, __pyx_n_s_x, __pyx_n_s_num); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_next, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 56, __pyx_L1_error) - /* "LCEngine.pyx":73 + /* "LCEngine2.pyx":73 * * * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< * cdef char pv[10]; * resp = pgn2pv(pgn1, pv) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_1lc_pgn2pv, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lc_pgn2pv, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_pgn1, __pyx_n_s_pv_2, __pyx_n_s_resp); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_lc_pgn2pv, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 73, __pyx_L1_error) - /* "LCEngine.pyx":82 + /* "LCEngine2.pyx":82 * * * def posFC(pos): # <<<<<<<<<<<<<< * return pos / 8, pos % 8 * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_3posFC, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_posFC, __pyx_t_1) < 0) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_posFC, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 82, __pyx_L1_error) - /* "LCEngine.pyx":85 + /* "LCEngine2.pyx":85 * return pos / 8, pos % 8 * * def FCpos(f, c): # <<<<<<<<<<<<<< * return f * 8 + c * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_5FCpos, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FCpos, __pyx_t_1) < 0) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__52 = PyTuple_Pack(2, __pyx_n_s_f, __pyx_n_s_c); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_FCpos, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 85, __pyx_L1_error) - /* "LCEngine.pyx":88 + /* "LCEngine2.pyx":88 * return f * 8 + c * * def posA1(pos): # <<<<<<<<<<<<<< * return chr(pos % 8 + 97) + chr(pos / 8 + 49) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_7posA1, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_posA1, __pyx_t_1) < 0) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__54 = PyTuple_Pack(1, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_posA1, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 88, __pyx_L1_error) - /* "LCEngine.pyx":91 + /* "LCEngine2.pyx":91 * return chr(pos % 8 + 97) + chr(pos / 8 + 49) * * def a1Pos(a1): # <<<<<<<<<<<<<< * cdef int f, c * f = ord(a1[1]) - 49 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_9a1Pos, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_a1Pos, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__56 = PyTuple_Pack(3, __pyx_n_s_a1, __pyx_n_s_f, __pyx_n_s_c); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_a1Pos, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 91, __pyx_L1_error) - /* "LCEngine.pyx":97 + /* "LCEngine2.pyx":97 * return f * 8 + c * * def move2num(a1h8q): # <<<<<<<<<<<<<< * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 * if len(a1h8q)>4: */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_11move2num, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_move2num, __pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__58 = PyTuple_Pack(2, __pyx_n_s_a1h8q, __pyx_n_s_num); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_move2num, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 97, __pyx_L1_error) - /* "LCEngine.pyx":103 + /* "LCEngine2.pyx":103 * return num * * def num2move(num): # <<<<<<<<<<<<<< * a1 = posA1(num%64) * num /= 64 */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_13num2move, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_num2move, __pyx_t_1) < 0) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__60 = PyTuple_Pack(4, __pyx_n_s_num, __pyx_n_s_a1, __pyx_n_s_h8, __pyx_n_s_q); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__60); + __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_num2move, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 103, __pyx_L1_error) - /* "LCEngine.pyx":114 + /* "LCEngine2.pyx":114 * return a1 + h8 + q * - * def liK(npos): # <<<<<<<<<<<<<< + * def liN(npos): # <<<<<<<<<<<<<< * cdef int fil, col, ft, ct - * liM = [] + * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_15liK, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liK, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__62 = PyTuple_Pack(9, __pyx_n_s_npos, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_fi, __pyx_n_s_ci, __pyx_n_s_t); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__62); + __Pyx_GIVEREF(__pyx_tuple__62); + __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_liN, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 114, __pyx_L1_error) + + /* "LCEngine2.pyx":130 + * + * + * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< + * if nv > mx: + * return [] + */ + __pyx_tuple__64 = PyTuple_Pack(14, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_no, __pyx_n_s_nv, __pyx_n_s_mx, __pyx_n_s_lia, __pyx_n_s_lib, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_nx, __pyx_n_s_f, __pyx_n_s_xmin, __pyx_n_s_lidef); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__64); + __Pyx_GIVEREF(__pyx_tuple__64); + __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_knightmoves, 130, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 130, __pyx_L1_error) + + /* "LCEngine2.pyx":170 + * return lidef + * + * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< + * cdef int nv + * ot = celdas_ocupadas[:] + */ + __pyx_tuple__66 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_celdas_ocupadas, __pyx_n_s_nv, __pyx_n_s_ot, __pyx_n_s_li); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__66); + __Pyx_GIVEREF(__pyx_tuple__66); + __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_liNMinimo, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 170, __pyx_L1_error) + + /* "LCEngine2.pyx":181 + * return li + * + * def xpv2lipv(xpv): # <<<<<<<<<<<<<< + * li = [] + * siBlancas = True + */ + __pyx_tuple__68 = PyTuple_Pack(7, __pyx_n_s_xpv, __pyx_n_s_li, __pyx_n_s_siBlancas, __pyx_n_s_c, __pyx_n_s_x, __pyx_n_s_move, __pyx_n_s_base); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__68); + __Pyx_GIVEREF(__pyx_tuple__68); + __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_xpv2lipv, 181, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 181, __pyx_L1_error) - /* "LCEngine.pyx":127 - * + /* "LCEngine2.pyx":198 + * return li * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct + * def xpv2pv(xpv): # <<<<<<<<<<<<<< + * return " ".join(xpv2lipv(xpv)) * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_17liBR, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liBR, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__70 = PyTuple_Pack(1, __pyx_n_s_xpv); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__70); + __Pyx_GIVEREF(__pyx_tuple__70); + __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_xpv2pv, 198, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 198, __pyx_L1_error) - /* "LCEngine.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct + /* "LCEngine2.pyx":201 + * return " ".join(xpv2lipv(xpv)) * + * def pv2xpv(pv): # <<<<<<<<<<<<<< + * if pv: + * li = pv.split(" ") */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_19liN, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liN, __pyx_t_1) < 0) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__72 = PyTuple_Pack(7, __pyx_n_s_pv_2, __pyx_n_s_li, __pyx_n_s_lix, __pyx_n_s_move, __pyx_n_s_d, __pyx_n_s_h, __pyx_n_s_c); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__72); + __Pyx_GIVEREF(__pyx_tuple__72); + __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_pv2xpv, 201, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 201, __pyx_L1_error) - /* "LCEngine.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc + /* "LCEngine2.pyx":216 + * return "" * + * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< + * set_level(level) + * x = playFen(fen, depth, ms) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_21liP, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liP, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__74 = PyTuple_Pack(5, __pyx_n_s_fen, __pyx_n_s_depth, __pyx_n_s_ms, __pyx_n_s_level, __pyx_n_s_x); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__74); + __Pyx_GIVEREF(__pyx_tuple__74); + __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_runFen, 216, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 216, __pyx_L1_error) - /* "LCEngine.pyx":188 - * return tuple(liM), tuple(liX) + /* "LCEngine2.pyx":222 + * return x * - * dicK = {} # <<<<<<<<<<<<<< - * for i in range(64): - * dicK[i] = liK(i) + * def setFen(fen): # <<<<<<<<<<<<<< + * fen_board(fen) + * return movegen() */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicK, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__76 = PyTuple_Pack(1, __pyx_n_s_fen); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__76); + __Pyx_GIVEREF(__pyx_tuple__76); + __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_setFen, 222, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 222, __pyx_L1_error) - /* "LCEngine.pyx":189 - * - * dicK = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicK[i] = liK(i) + /* "LCEngine2.pyx":226 + * return movegen() * + * def getFen(): # <<<<<<<<<<<<<< + * cdef char fen[100] + * board_fen(fen) */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 189, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_1) < 0) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__78 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_x); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__78); + __Pyx_GIVEREF(__pyx_tuple__78); + __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_getFen, 226, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 226, __pyx_L1_error) - /* "LCEngine.pyx":190 - * dicK = {} - * for i in range(64): - * dicK[i] = liK(i) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":232 + * return x * - * dicQ = {} + * def getMoves(): # <<<<<<<<<<<<<< + * cdef char pv[10] + * cdef int nmoves, x, nbase */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_liK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_8, __pyx_t_1) < 0)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__80 = PyTuple_Pack(6, __pyx_n_s_pv_2, __pyx_n_s_nmoves, __pyx_n_s_x, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_r); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__80); + __Pyx_GIVEREF(__pyx_tuple__80); + __pyx_codeobj__81 = (PyObject*)__Pyx_PyCode_New(0, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__80, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_getMoves, 232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__81)) __PYX_ERR(0, 232, __pyx_L1_error) - /* "LCEngine.pyx":189 + /* "LCEngine2.pyx":245 + * return li * - * dicK = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicK[i] = liK(i) + * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< + * cdef char san[10] * */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__82 = PyTuple_Pack(5, __pyx_n_s_desdeA1H8, __pyx_n_s_hastaA1H8, __pyx_n_s_coronacion, __pyx_n_s_san_2, __pyx_n_s_num); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__82); + __Pyx_GIVEREF(__pyx_tuple__82); + __pyx_codeobj__83 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__82, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_getPGN, 245, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__83)) __PYX_ERR(0, 245, __pyx_L1_error) - /* "LCEngine.pyx":192 - * dicK[i] = liK(i) + /* "LCEngine2.pyx":258 + * return san * - * dicQ = {} # <<<<<<<<<<<<<< - * for i in range(64): - * li = [] + * def xpv2pgn(xpv): # <<<<<<<<<<<<<< + * cdef char san[10] + * setFenInicial() */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicQ, __pyx_t_2) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__84 = PyTuple_Pack(9, __pyx_n_s_xpv, __pyx_n_s_san_2, __pyx_n_s_siW, __pyx_n_s_num, __pyx_n_s_li, __pyx_n_s_tam, __pyx_n_s_pv_2, __pyx_n_s_x, __pyx_n_s_numMove); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__84); + __Pyx_GIVEREF(__pyx_tuple__84); + __pyx_codeobj__85 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__84, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_xpv2pgn, 258, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__85)) __PYX_ERR(0, 258, __pyx_L1_error) - /* "LCEngine.pyx":193 + /* "LCEngine2.pyx":289 + * return "".join(li) + * + * def isCheck(): # <<<<<<<<<<<<<< + * return inCheck() * - * dicQ = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 193, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_2) < 0) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngine.pyx":194 - * dicQ = {} - * for i in range(64): - * li = [] # <<<<<<<<<<<<<< - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_li, __pyx_t_2) < 0) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_isCheck, 289, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) __PYX_ERR(0, 289, __pyx_L1_error) - /* "LCEngine.pyx":195 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: + /* "LCEngine2.pyx":292 + * return inCheck() + * + * class InfoMove(object): # <<<<<<<<<<<<<< + * def __init__(self, num): + * cdef char pv[10] */ - __pyx_t_2 = __pyx_tuple__90; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - for (;;) { - if (__pyx_t_9 >= 8) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 195, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - if (likely(__pyx_t_8 != Py_None)) { - PyObject* sequence = __pyx_t_8; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 195, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 195, __pyx_L1_error) - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f_i, __pyx_t_5) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_i, __pyx_t_6) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_tuple__87 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__87); + __Pyx_GIVEREF(__pyx_tuple__87); - /* "LCEngine.pyx":196 - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) # <<<<<<<<<<<<<< - * if lin: - * li.append(lin) + /* "LCEngine2.pyx":293 + * + * class InfoMove(object): + * def __init__(self, num): # <<<<<<<<<<<<<< + * cdef char pv[10] + * cdef char info[10] */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_liBR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_f_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_c_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_5, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_5, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_10); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lin, __pyx_t_8) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_tuple__88 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_num, __pyx_n_s_pv_2, __pyx_n_s_info, __pyx_n_s_san_2); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__88); + __Pyx_GIVEREF(__pyx_tuple__88); + __pyx_codeobj__89 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_init, 293, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__89)) __PYX_ERR(0, 293, __pyx_L1_error) - /* "LCEngine.pyx":197 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicQ[i] = tuple(li) + /* "LCEngine2.pyx":318 + * self._capture = "x" in san + * + * def desde(self): # <<<<<<<<<<<<<< + * return self._from + * */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_14) { + __pyx_tuple__90 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 318, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__90); + __Pyx_GIVEREF(__pyx_tuple__90); + __pyx_codeobj__91 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__90, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_desde, 318, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__91)) __PYX_ERR(0, 318, __pyx_L1_error) - /* "LCEngine.pyx":198 - * lin = liBR(i, f_i, c_i) - * if lin: - * li.append(lin) # <<<<<<<<<<<<<< - * dicQ[i] = tuple(li) + /* "LCEngine2.pyx":321 + * return self._from + * + * def hasta(self): # <<<<<<<<<<<<<< + * return self._to * */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_tuple__92 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__92); + __Pyx_GIVEREF(__pyx_tuple__92); + __pyx_codeobj__93 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_hasta, 321, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__93)) __PYX_ERR(0, 321, __pyx_L1_error) - /* "LCEngine.pyx":197 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicQ[i] = tuple(li) + /* "LCEngine2.pyx":324 + * return self._to + * + * def coronacion(self): # <<<<<<<<<<<<<< + * return self._promotion.lower() + * */ - } + __pyx_tuple__94 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__94); + __Pyx_GIVEREF(__pyx_tuple__94); + __pyx_codeobj__95 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_coronacion, 324, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__95)) __PYX_ERR(0, 324, __pyx_L1_error) - /* "LCEngine.pyx":195 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: + /* "LCEngine2.pyx":327 + * return self._promotion.lower() + * + * def movimiento(self): # <<<<<<<<<<<<<< + * return self._from+self._to+self._promotion.lower() + * */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_tuple__96 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__96); + __Pyx_GIVEREF(__pyx_tuple__96); + __pyx_codeobj__97 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_movimiento, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__97)) __PYX_ERR(0, 327, __pyx_L1_error) - /* "LCEngine.pyx":199 - * if lin: - * li.append(lin) - * dicQ[i] = tuple(li) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":330 + * return self._from+self._to+self._promotion.lower() + * + * def jaque(self): # <<<<<<<<<<<<<< + * return self._check * - * dicB = {} */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_tuple__98 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__98); + __Pyx_GIVEREF(__pyx_tuple__98); + __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_jaque, 330, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) __PYX_ERR(0, 330, __pyx_L1_error) - /* "LCEngine.pyx":193 + /* "LCEngine2.pyx":333 + * return self._check + * + * def mate(self): # <<<<<<<<<<<<<< + * return self._mate * - * dicQ = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__100 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__100); + __Pyx_GIVEREF(__pyx_tuple__100); + __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_mate_2, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) __PYX_ERR(0, 333, __pyx_L1_error) - /* "LCEngine.pyx":201 - * dicQ[i] = tuple(li) + /* "LCEngine2.pyx":336 + * return self._mate + * + * def captura(self): # <<<<<<<<<<<<<< + * return self._capture * - * dicB = {} # <<<<<<<<<<<<<< - * for i in range(64): - * li = [] */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicB, __pyx_t_1) < 0) __PYX_ERR(0, 201, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__102 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__102); + __Pyx_GIVEREF(__pyx_tuple__102); + __pyx_codeobj__103 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_captura, 336, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__103)) __PYX_ERR(0, 336, __pyx_L1_error) - /* "LCEngine.pyx":202 + /* "LCEngine2.pyx":339 + * return self._capture + * + * def pieza(self): # <<<<<<<<<<<<<< + * return self._piece * - * dicB = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_6); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 202, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_1) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__104 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__104); + __Pyx_GIVEREF(__pyx_tuple__104); + __pyx_codeobj__105 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_pieza, 339, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__105)) __PYX_ERR(0, 339, __pyx_L1_error) - /* "LCEngine.pyx":203 - * dicB = {} - * for i in range(64): - * li = [] # <<<<<<<<<<<<<< - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) + /* "LCEngine2.pyx":342 + * return self._piece + * + * def isCastleK(self): # <<<<<<<<<<<<<< + * return self._castle_K + * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_li, __pyx_t_1) < 0) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__106 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__106); + __Pyx_GIVEREF(__pyx_tuple__106); + __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_isCastleK, 342, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 342, __pyx_L1_error) - /* "LCEngine.pyx":204 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: + /* "LCEngine2.pyx":345 + * return self._castle_K + * + * def isCastleQ(self): # <<<<<<<<<<<<<< + * return self._castle_Q + * */ - __pyx_t_1 = __pyx_tuple__96; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; - for (;;) { - if (__pyx_t_9 >= 4) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 204, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - if (likely(__pyx_t_8 != Py_None)) { - PyObject* sequence = __pyx_t_8; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 204, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_13); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 204, __pyx_L1_error) - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f_i, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_i, __pyx_t_13) < 0) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_tuple__108 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__108); + __Pyx_GIVEREF(__pyx_tuple__108); + __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_isCastleQ, 345, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 345, __pyx_L1_error) - /* "LCEngine.pyx":205 - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) # <<<<<<<<<<<<<< - * if lin: - * li.append(lin) + /* "LCEngine2.pyx":348 + * return self._castle_Q + * + * def isEnPassant(self): # <<<<<<<<<<<<<< + * return self._ep + * */ - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_liBR); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_f_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_c_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_7}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_7}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_12, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_12, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_12, __pyx_t_7); - __pyx_t_2 = 0; - __pyx_t_10 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lin, __pyx_t_8) < 0) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_tuple__110 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__110); + __Pyx_GIVEREF(__pyx_tuple__110); + __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_isEnPassant, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 348, __pyx_L1_error) - /* "LCEngine.pyx":206 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicB[i] = tuple(li) + /* "LCEngine2.pyx":351 + * return self._ep + * + * def getExMoves(): # <<<<<<<<<<<<<< + * nmoves = numMoves() + * */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_14) { + __pyx_tuple__112 = PyTuple_Pack(5, __pyx_n_s_nmoves, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_mv); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__112); + __Pyx_GIVEREF(__pyx_tuple__112); + __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_getExMoves, 351, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 351, __pyx_L1_error) + + /* "LCEngine2.pyx":361 + * return li + * + * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< + * if not coronacion: + * coronacion = "" + */ + __pyx_tuple__114 = PyTuple_Pack(5, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num, __pyx_n_s_infoMove); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__114); + __Pyx_GIVEREF(__pyx_tuple__114); + __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_moveExPV, 361, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 361, __pyx_L1_error) - /* "LCEngine.pyx":207 - * lin = liBR(i, f_i, c_i) - * if lin: - * li.append(lin) # <<<<<<<<<<<<<< - * dicB[i] = tuple(li) + /* "LCEngine2.pyx":374 + * return infoMove * + * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< + * if not coronacion: + * coronacion = "" */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_13); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_tuple__116 = PyTuple_Pack(4, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__116); + __Pyx_GIVEREF(__pyx_tuple__116); + __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_movePV, 374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 374, __pyx_L1_error) - /* "LCEngine.pyx":206 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicB[i] = tuple(li) + /* "LCEngine2.pyx":386 + * return True + * + * def makeMove(move): # <<<<<<<<<<<<<< + * desde = move[:2] + * hasta = move[2:4] */ - } + __pyx_tuple__118 = PyTuple_Pack(5, __pyx_n_s_move, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__118); + __Pyx_GIVEREF(__pyx_tuple__118); + __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_makeMove, 386, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 386, __pyx_L1_error) - /* "LCEngine.pyx":204 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: + /* "LCEngine2.pyx":397 + * return True + * + * def fen2fenM2(fen): # <<<<<<<<<<<<<< + * sp1 = fen.rfind(" ") + * sp2 = fen.rfind(" ", 0, sp1) */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_tuple__120 = PyTuple_Pack(3, __pyx_n_s_fen, __pyx_n_s_sp1, __pyx_n_s_sp2); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__120); + __Pyx_GIVEREF(__pyx_tuple__120); + __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_fen2fenM2, 397, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 397, __pyx_L1_error) - /* "LCEngine.pyx":208 - * if lin: - * li.append(lin) - * dicB[i] = tuple(li) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":402 + * return fen[:sp2] * - * dicR = {} + * def setFenInicial(): # <<<<<<<<<<<<<< + * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" + * setFen(inifen) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_8, __pyx_t_13) < 0)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_tuple__122 = PyTuple_Pack(1, __pyx_n_s_inifen); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__122); + __Pyx_GIVEREF(__pyx_tuple__122); + __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_setFenInicial, 402, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 402, __pyx_L1_error) + + /* "LCEngine2.pyx":406 + * setFen(inifen) + * + * def makePV(pv): # <<<<<<<<<<<<<< + * setFenInicial() + * if pv: + */ + __pyx_tuple__124 = PyTuple_Pack(2, __pyx_n_s_pv_2, __pyx_n_s_move); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__124); + __Pyx_GIVEREF(__pyx_tuple__124); + __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_makePV, 406, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 406, __pyx_L1_error) + + /* "LCEngine2.pyx":414 + * + * + * def getCapturesFEN(fen): # <<<<<<<<<<<<<< + * setFen(fen) + * nmoves = numMoves() + */ + __pyx_tuple__126 = PyTuple_Pack(6, __pyx_n_s_fen, __pyx_n_s_nmoves, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_mv); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__126); + __Pyx_GIVEREF(__pyx_tuple__126); + __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_getCapturesFEN, 414, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 414, __pyx_L1_error) - /* "LCEngine.pyx":202 + /* "LCEngine2.pyx":425 + * return li * - * dicB = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): + * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< + * if not siMB: + * fen = fenOB(fen) */ - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_tuple__128 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_siMB); if (unlikely(!__pyx_tuple__128)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__128); + __Pyx_GIVEREF(__pyx_tuple__128); + __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_getCaptures, 425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) __PYX_ERR(0, 425, __pyx_L1_error) - /* "LCEngine.pyx":210 - * dicB[i] = tuple(li) + /* "LCEngine2.pyx":430 + * return getCapturesFEN(fen) * - * dicR = {} # <<<<<<<<<<<<<< - * for i in range(64): - * li = [] + * def fenOB(fen): # <<<<<<<<<<<<<< + * li = fen.split(" ") + * li[3] = "-" */ - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicR, __pyx_t_6) < 0) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_tuple__130 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_li); if (unlikely(!__pyx_tuple__130)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__130); + __Pyx_GIVEREF(__pyx_tuple__130); + __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_fenOB, 430, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) __PYX_ERR(0, 430, __pyx_L1_error) - /* "LCEngine.pyx":211 + /* "LCEngine2.pyx":436 + * return " ".join(li) + * + * def fenTerminado(fen): # <<<<<<<<<<<<<< + * return setFen(fen) == 0 * - * dicR = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { - __pyx_t_13 = __pyx_t_6; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_13))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 211, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 211, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_4(__pyx_t_13); - if (unlikely(!__pyx_t_6)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 211, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_6) < 0) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_tuple__132 = PyTuple_Pack(1, __pyx_n_s_fen); if (unlikely(!__pyx_tuple__132)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__132); + __Pyx_GIVEREF(__pyx_tuple__132); + __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_LCEngine2_pyx, __pyx_n_s_fenTerminado, 436, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} - /* "LCEngine.pyx":212 - * dicR = {} - * for i in range(64): - * li = [] # <<<<<<<<<<<<<< - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_li, __pyx_t_6) < 0) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; +static int __Pyx_InitGlobals(void) { + __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type; + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_49 = PyInt_FromLong(49); if (unlikely(!__pyx_int_49)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_51 = PyInt_FromLong(51); if (unlikely(!__pyx_int_51)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_52 = PyInt_FromLong(52); if (unlikely(!__pyx_int_52)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_53 = PyInt_FromLong(53); if (unlikely(!__pyx_int_53)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_58 = PyInt_FromLong(58); if (unlikely(!__pyx_int_58)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_80 = PyInt_FromLong(80); if (unlikely(!__pyx_int_80)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_97 = PyInt_FromLong(97); if (unlikely(!__pyx_int_97)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} - /* "LCEngine.pyx":213 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_t_6 = __pyx_tuple__102; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0; - for (;;) { - if (__pyx_t_9 >= 4) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - if (likely(__pyx_t_8 != Py_None)) { - PyObject* sequence = __pyx_t_8; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 213, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_11); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 213, __pyx_L1_error) - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f_i, __pyx_t_1) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_i, __pyx_t_11) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; +static int __Pyx_modinit_global_init_code(void); /*proto*/ +static int __Pyx_modinit_variable_export_code(void); /*proto*/ +static int __Pyx_modinit_function_export_code(void); /*proto*/ +static int __Pyx_modinit_type_init_code(void); /*proto*/ +static int __Pyx_modinit_type_import_code(void); /*proto*/ +static int __Pyx_modinit_variable_import_code(void); /*proto*/ +static int __Pyx_modinit_function_import_code(void); /*proto*/ - /* "LCEngine.pyx":214 - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) # <<<<<<<<<<<<<< - * if lin: - * li.append(lin) - */ - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_liBR); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_f_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_c_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_1, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_1, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_12, __pyx_t_10); - __pyx_t_1 = 0; - __pyx_t_7 = 0; - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lin, __pyx_t_8) < 0) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "LCEngine.pyx":215 - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicR[i] = tuple(li) - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_14) { +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "LCEngine.pyx":216 - * lin = liBR(i, f_i, c_i) - * if lin: - * li.append(lin) # <<<<<<<<<<<<<< - * dicR[i] = tuple(li) - * - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_11); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "LCEngine.pyx":215 - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicR[i] = tuple(li) - */ - } +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} - /* "LCEngine.pyx":213 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#if PY_MAJOR_VERSION < 3 +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC void +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#else +#ifdef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#endif +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (!(defined(__cplusplus)) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4))) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initLCEngine2(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initLCEngine2(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_LCEngine2(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_LCEngine2(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name) { + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + result = PyDict_SetItemString(moddict, to_name, value); + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__") < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__") < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static int __pyx_pymod_exec_LCEngine2(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m && __pyx_m == __pyx_pyinit_module) return 0; + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_LCEngine2(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("LCEngine2", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_LCEngine2) { + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "LCEngine2")) { + if (unlikely(PyDict_SetItemString(modules, "LCEngine2", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + (void)__Pyx_modinit_type_init_code(); + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif - /* "LCEngine.pyx":217 - * if lin: - * li.append(lin) - * dicR[i] = tuple(li) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":41 * - * dicN = {} - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_t_8, __pyx_t_11) < 0)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngine.pyx":211 * - * dicR = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): + * class PGNreader: # <<<<<<<<<<<<<< + * def __init__(self, fich, depth): + * self.fich = fich */ - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_PGNreader, __pyx_n_s_PGNreader, (PyObject *) NULL, __pyx_n_s_LCEngine2, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); - /* "LCEngine.pyx":219 - * dicR[i] = tuple(li) + /* "LCEngine2.pyx":42 * - * dicN = {} # <<<<<<<<<<<<<< - * for i in range(64): - * dicN[i] = liN(i) + * class PGNreader: + * def __init__(self, fich, depth): # <<<<<<<<<<<<<< + * self.fich = fich + * self.depth = depth */ - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicN, __pyx_t_13) < 0) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_9PGNreader_1__init__, 0, __pyx_n_s_PGNreader___init, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":220 - * - * dicN = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicN[i] = liN(i) + /* "LCEngine2.pyx":46 + * self.depth = depth * + * def __enter__(self): # <<<<<<<<<<<<<< + * pgn_start(self.fich, self.depth) + * return self */ - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) { - __pyx_t_11 = __pyx_t_13; __Pyx_INCREF(__pyx_t_11); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_11))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } - } else { - __pyx_t_13 = __pyx_t_4(__pyx_t_11); - if (unlikely(!__pyx_t_13)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 220, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_13); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_13) < 0) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_9PGNreader_3__enter__, 0, __pyx_n_s_PGNreader___enter, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_enter, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":221 - * dicN = {} - * for i in range(64): - * dicN[i] = liN(i) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":50 + * return self + * + * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< + * pgn_stop() * - * dicPW = {} */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_5) { - __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_13); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; - __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; - __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_8, __pyx_t_10, __pyx_t_13) < 0)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_9PGNreader_5__exit__, 0, __pyx_n_s_PGNreader___exit, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_exit, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":220 + /* "LCEngine2.pyx":53 + * pgn_stop() * - * dicN = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicN[i] = liN(i) + * def __iter__(self): # <<<<<<<<<<<<<< + * return self * */ - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_9PGNreader_7__iter__, 0, __pyx_n_s_PGNreader___iter, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__45)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_iter, __pyx_t_2) < 0) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":223 - * dicN[i] = liN(i) + /* "LCEngine2.pyx":56 + * return self * - * dicPW = {} # <<<<<<<<<<<<<< - * for i in range(8, 56): - * dicPW[i] = liP(i, True) + * def next(self): # <<<<<<<<<<<<<< + * n = pgn_read() + * if n: */ - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicPW, __pyx_t_11) < 0) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_9PGNreader_9next, 0, __pyx_n_s_PGNreader_next, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__47)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_next, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "LCEngine.pyx":224 + /* "LCEngine2.pyx":41 * - * dicPW = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPW[i] = liP(i, True) * + * class PGNreader: # <<<<<<<<<<<<<< + * def __init__(self, fich, depth): + * self.fich = fich */ - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { - __pyx_t_13 = __pyx_t_11; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_13))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_11 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_11); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) - #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_11); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) - #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - #endif - } - } else { - __pyx_t_11 = __pyx_t_4(__pyx_t_13); - if (unlikely(!__pyx_t_11)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 224, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_11); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_11) < 0) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_PGNreader, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PGNreader, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":225 - * dicPW = {} - * for i in range(8, 56): - * dicPW[i] = liP(i, True) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":73 * - * dicPB = {} + * + * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< + * cdef char pv[10]; + * resp = pgn2pv(pgn1, pv) */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_liP); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, Py_True}; - __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, Py_True}; - __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_t_8); - __Pyx_INCREF(Py_True); - __Pyx_GIVEREF(Py_True); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, Py_True); - __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicPW); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_t_5, __pyx_t_11) < 0)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_1lc_pgn2pv, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_lc_pgn2pv, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":224 + /* "LCEngine2.pyx":82 * - * dicPW = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPW[i] = liP(i, True) + * + * def posFC(pos): # <<<<<<<<<<<<<< + * return pos / 8, pos % 8 * */ - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_3posFC, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_posFC, __pyx_t_1) < 0) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":227 - * dicPW[i] = liP(i, True) + /* "LCEngine2.pyx":85 + * return pos / 8, pos % 8 + * + * def FCpos(f, c): # <<<<<<<<<<<<<< + * return f * 8 + c * - * dicPB = {} # <<<<<<<<<<<<<< - * for i in range(8, 56): - * dicPB[i] = liP(i, False) */ - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicPB, __pyx_t_13) < 0) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_5FCpos, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FCpos, __pyx_t_1) < 0) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":228 + /* "LCEngine2.pyx":88 + * return f * 8 + c * - * dicPB = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPB[i] = liP(i, False) + * def posA1(pos): # <<<<<<<<<<<<<< + * return chr(pos % 8 + 97) + chr(pos / 8 + 49) * */ - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__105, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) { - __pyx_t_11 = __pyx_t_13; __Pyx_INCREF(__pyx_t_11); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_11))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 228, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 228, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } - } else { - __pyx_t_13 = __pyx_t_4(__pyx_t_11); - if (unlikely(!__pyx_t_13)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 228, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_13); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_13) < 0) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_7posA1, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_posA1, __pyx_t_1) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":229 - * dicPB = {} - * for i in range(8, 56): - * dicPB[i] = liP(i, False) # <<<<<<<<<<<<<< + /* "LCEngine2.pyx":91 + * return chr(pos % 8 + 97) + chr(pos / 8 + 49) * - * def knightmoves(a, b, no, nv, mx): + * def a1Pos(a1): # <<<<<<<<<<<<<< + * cdef int f, c + * f = ord(a1[1]) - 49 */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_liP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_10, Py_False}; - __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_10, Py_False}; - __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_12, __pyx_t_10); - __Pyx_INCREF(Py_False); - __Pyx_GIVEREF(Py_False); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_12, Py_False); - __pyx_t_10 = 0; - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicPB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_6, __pyx_t_13) < 0)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_9a1Pos, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_a1Pos, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":228 + /* "LCEngine2.pyx":97 + * return f * 8 + c * - * dicPB = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPB[i] = liP(i, False) + * def move2num(a1h8q): # <<<<<<<<<<<<<< + * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 + * if len(a1h8q)>4: + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_11move2num, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_move2num, __pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "LCEngine2.pyx":103 + * return num * + * def num2move(num): # <<<<<<<<<<<<<< + * a1 = posA1(num%64) + * num /= 64 */ - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_13num2move, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_num2move, __pyx_t_1) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "LCEngine2.pyx":114 + * return a1 + h8 + q + * + * def liN(npos): # <<<<<<<<<<<<<< + * cdef int fil, col, ft, ct + * + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_15liN, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_liN, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":231 - * dicPB[i] = liP(i, False) + /* "LCEngine2.pyx":130 + * * * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< * if nv > mx: * return [] */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_23knightmoves, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_knightmoves, __pyx_t_11) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_17knightmoves, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_knightmoves, __pyx_t_1) < 0) __PYX_ERR(0, 130, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":271 + /* "LCEngine2.pyx":170 * return lidef * * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< * cdef int nv * ot = celdas_ocupadas[:] */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_25liNMinimo, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liNMinimo, __pyx_t_11) < 0) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_19liNMinimo, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_liNMinimo, __pyx_t_1) < 0) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":282 + /* "LCEngine2.pyx":181 * return li * * def xpv2lipv(xpv): # <<<<<<<<<<<<<< * li = [] * siBlancas = True */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_27xpv2lipv, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2lipv, __pyx_t_11) < 0) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_21xpv2lipv, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2lipv, __pyx_t_1) < 0) __PYX_ERR(0, 181, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":299 + /* "LCEngine2.pyx":198 * return li * * def xpv2pv(xpv): # <<<<<<<<<<<<<< * return " ".join(xpv2lipv(xpv)) * */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_29xpv2pv, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2pv, __pyx_t_11) < 0) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_23xpv2pv, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2pv, __pyx_t_1) < 0) __PYX_ERR(0, 198, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":302 + /* "LCEngine2.pyx":201 * return " ".join(xpv2lipv(xpv)) * * def pv2xpv(pv): # <<<<<<<<<<<<<< * if pv: * li = pv.split(" ") */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_31pv2xpv, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pv2xpv, __pyx_t_11) < 0) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_25pv2xpv, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pv2xpv, __pyx_t_1) < 0) __PYX_ERR(0, 201, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":317 + /* "LCEngine2.pyx":216 * return "" * * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< * set_level(level) * x = playFen(fen, depth, ms) */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_33runFen, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_runFen, __pyx_t_11) < 0) __PYX_ERR(0, 317, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_27runFen, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_runFen, __pyx_t_1) < 0) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":323 + /* "LCEngine2.pyx":222 * return x * * def setFen(fen): # <<<<<<<<<<<<<< * fen_board(fen) * return movegen() */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_35setFen, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setFen, __pyx_t_11) < 0) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_29setFen, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setFen, __pyx_t_1) < 0) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":327 + /* "LCEngine2.pyx":226 * return movegen() * * def getFen(): # <<<<<<<<<<<<<< * cdef char fen[100] * board_fen(fen) */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_37getFen, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getFen, __pyx_t_11) < 0) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_31getFen, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getFen, __pyx_t_1) < 0) __PYX_ERR(0, 226, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":333 + /* "LCEngine2.pyx":232 * return x * * def getMoves(): # <<<<<<<<<<<<<< * cdef char pv[10] * cdef int nmoves, x, nbase */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_39getMoves, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getMoves, __pyx_t_11) < 0) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_33getMoves, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getMoves, __pyx_t_1) < 0) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":346 + /* "LCEngine2.pyx":245 * return li * * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< * cdef char san[10] * */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_41getPGN, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getPGN, __pyx_t_11) < 0) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_35getPGN, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getPGN, __pyx_t_1) < 0) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":359 + /* "LCEngine2.pyx":258 * return san * * def xpv2pgn(xpv): # <<<<<<<<<<<<<< * cdef char san[10] * setFenInicial() */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_43xpv2pgn, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2pgn, __pyx_t_11) < 0) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_37xpv2pgn, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2pgn, __pyx_t_1) < 0) __PYX_ERR(0, 258, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":390 + /* "LCEngine2.pyx":289 * return "".join(li) * * def isCheck(): # <<<<<<<<<<<<<< * return inCheck() * */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_45isCheck, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_isCheck, __pyx_t_11) < 0) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_39isCheck, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_isCheck, __pyx_t_1) < 0) __PYX_ERR(0, 289, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":393 + /* "LCEngine2.pyx":292 * return inCheck() * * class InfoMove(object): # <<<<<<<<<<<<<< * def __init__(self, num): * cdef char pv[10] */ - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_builtin_object); - __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_11, __pyx_n_s_InfoMove, __pyx_n_s_InfoMove, (PyObject *) NULL, __pyx_n_s_LCEngine, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__87); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__87, __pyx_n_s_InfoMove, __pyx_n_s_InfoMove, (PyObject *) NULL, __pyx_n_s_LCEngine2, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "LCEngine.pyx":394 + /* "LCEngine2.pyx":293 * * class InfoMove(object): * def __init__(self, num): # <<<<<<<<<<<<<< * cdef char pv[10] * cdef char info[10] */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_1__init__, 0, __pyx_n_s_InfoMove___init, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_1__init__, 0, __pyx_n_s_InfoMove___init, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__89)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 293, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":419 + /* "LCEngine2.pyx":318 * self._capture = "x" in san * * def desde(self): # <<<<<<<<<<<<<< * return self._from * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_3desde, 0, __pyx_n_s_InfoMove_desde, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 419, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_desde, __pyx_t_5) < 0) __PYX_ERR(0, 419, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_3desde, 0, __pyx_n_s_InfoMove_desde, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__91)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 318, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_desde, __pyx_t_3) < 0) __PYX_ERR(0, 318, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":422 + /* "LCEngine2.pyx":321 * return self._from * * def hasta(self): # <<<<<<<<<<<<<< * return self._to * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_5hasta, 0, __pyx_n_s_InfoMove_hasta, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_hasta, __pyx_t_5) < 0) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_5hasta, 0, __pyx_n_s_InfoMove_hasta, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__93)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_hasta, __pyx_t_3) < 0) __PYX_ERR(0, 321, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":425 + /* "LCEngine2.pyx":324 * return self._to * * def coronacion(self): # <<<<<<<<<<<<<< * return self._promotion.lower() * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_7coronacion, 0, __pyx_n_s_InfoMove_coronacion, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__136)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_coronacion, __pyx_t_5) < 0) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_7coronacion, 0, __pyx_n_s_InfoMove_coronacion, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__95)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_coronacion, __pyx_t_3) < 0) __PYX_ERR(0, 324, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":428 + /* "LCEngine2.pyx":327 * return self._promotion.lower() * * def movimiento(self): # <<<<<<<<<<<<<< * return self._from+self._to+self._promotion.lower() * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_9movimiento, 0, __pyx_n_s_InfoMove_movimiento, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__138)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_movimiento, __pyx_t_5) < 0) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_9movimiento, 0, __pyx_n_s_InfoMove_movimiento, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__97)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_movimiento, __pyx_t_3) < 0) __PYX_ERR(0, 327, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":431 + /* "LCEngine2.pyx":330 * return self._from+self._to+self._promotion.lower() * * def jaque(self): # <<<<<<<<<<<<<< * return self._check * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_11jaque, 0, __pyx_n_s_InfoMove_jaque, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__140)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_jaque, __pyx_t_5) < 0) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_11jaque, 0, __pyx_n_s_InfoMove_jaque, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_jaque, __pyx_t_3) < 0) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":434 + /* "LCEngine2.pyx":333 * return self._check * * def mate(self): # <<<<<<<<<<<<<< * return self._mate * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_13mate, 0, __pyx_n_s_InfoMove_mate, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__142)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_mate_2, __pyx_t_5) < 0) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_13mate, 0, __pyx_n_s_InfoMove_mate, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__101)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_mate_2, __pyx_t_3) < 0) __PYX_ERR(0, 333, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":437 + /* "LCEngine2.pyx":336 * return self._mate * * def captura(self): # <<<<<<<<<<<<<< * return self._capture * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_15captura, 0, __pyx_n_s_InfoMove_captura, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__144)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_captura, __pyx_t_5) < 0) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_15captura, 0, __pyx_n_s_InfoMove_captura, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__103)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_captura, __pyx_t_3) < 0) __PYX_ERR(0, 336, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":440 + /* "LCEngine2.pyx":339 * return self._capture * * def pieza(self): # <<<<<<<<<<<<<< * return self._piece * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_17pieza, 0, __pyx_n_s_InfoMove_pieza, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_pieza, __pyx_t_5) < 0) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_17pieza, 0, __pyx_n_s_InfoMove_pieza, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__105)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_pieza, __pyx_t_3) < 0) __PYX_ERR(0, 339, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":443 + /* "LCEngine2.pyx":342 * return self._piece * * def isCastleK(self): # <<<<<<<<<<<<<< * return self._castle_K * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_19isCastleK, 0, __pyx_n_s_InfoMove_isCastleK, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_isCastleK, __pyx_t_5) < 0) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_19isCastleK, 0, __pyx_n_s_InfoMove_isCastleK, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__107)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_isCastleK, __pyx_t_3) < 0) __PYX_ERR(0, 342, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":446 + /* "LCEngine2.pyx":345 * return self._castle_K * * def isCastleQ(self): # <<<<<<<<<<<<<< * return self._castle_Q * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_21isCastleQ, 0, __pyx_n_s_InfoMove_isCastleQ, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_isCastleQ, __pyx_t_5) < 0) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_21isCastleQ, 0, __pyx_n_s_InfoMove_isCastleQ, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__109)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_isCastleQ, __pyx_t_3) < 0) __PYX_ERR(0, 345, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":449 + /* "LCEngine2.pyx":348 * return self._castle_Q * * def isEnPassant(self): # <<<<<<<<<<<<<< * return self._ep * */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8LCEngine_8InfoMove_23isEnPassant, 0, __pyx_n_s_InfoMove_isEnPassant, NULL, __pyx_n_s_LCEngine, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_isEnPassant, __pyx_t_5) < 0) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_CyFunction_NewEx(&__pyx_mdef_9LCEngine2_8InfoMove_23isEnPassant, 0, __pyx_n_s_InfoMove_isEnPassant, NULL, __pyx_n_s_LCEngine2, __pyx_d, ((PyObject *)__pyx_codeobj__111)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_isEnPassant, __pyx_t_3) < 0) __PYX_ERR(0, 348, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "LCEngine.pyx":393 + /* "LCEngine2.pyx":292 * return inCheck() * * class InfoMove(object): # <<<<<<<<<<<<<< * def __init__(self, num): * cdef char pv[10] */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_n_s_InfoMove, __pyx_t_11, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_InfoMove, __pyx_t_5) < 0) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_InfoMove, __pyx_tuple__87, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_InfoMove, __pyx_t_3) < 0) __PYX_ERR(0, 292, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":452 + /* "LCEngine2.pyx":351 * return self._ep * * def getExMoves(): # <<<<<<<<<<<<<< * nmoves = numMoves() * */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_47getExMoves, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getExMoves, __pyx_t_11) < 0) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_41getExMoves, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getExMoves, __pyx_t_1) < 0) __PYX_ERR(0, 351, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":462 + /* "LCEngine2.pyx":361 * return li * * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< * if not coronacion: * coronacion = "" */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_49moveExPV, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_moveExPV, __pyx_t_11) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_43moveExPV, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_moveExPV, __pyx_t_1) < 0) __PYX_ERR(0, 361, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":475 + /* "LCEngine2.pyx":374 * return infoMove * * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< * if not coronacion: * coronacion = "" */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_51movePV, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_movePV, __pyx_t_11) < 0) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_45movePV, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_movePV, __pyx_t_1) < 0) __PYX_ERR(0, 374, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":487 + /* "LCEngine2.pyx":386 * return True * * def makeMove(move): # <<<<<<<<<<<<<< * desde = move[:2] * hasta = move[2:4] */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_53makeMove, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_makeMove, __pyx_t_11) < 0) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_47makeMove, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_makeMove, __pyx_t_1) < 0) __PYX_ERR(0, 386, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":498 + /* "LCEngine2.pyx":397 * return True * * def fen2fenM2(fen): # <<<<<<<<<<<<<< * sp1 = fen.rfind(" ") * sp2 = fen.rfind(" ", 0, sp1) */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_55fen2fenM2, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fen2fenM2, __pyx_t_11) < 0) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_49fen2fenM2, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fen2fenM2, __pyx_t_1) < 0) __PYX_ERR(0, 397, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":503 + /* "LCEngine2.pyx":402 * return fen[:sp2] * * def setFenInicial(): # <<<<<<<<<<<<<< * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" * setFen(inifen) */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_57setFenInicial, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setFenInicial, __pyx_t_11) < 0) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_51setFenInicial, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_setFenInicial, __pyx_t_1) < 0) __PYX_ERR(0, 402, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":507 + /* "LCEngine2.pyx":406 * setFen(inifen) * * def makePV(pv): # <<<<<<<<<<<<<< * setFenInicial() * if pv: */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_59makePV, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_makePV, __pyx_t_11) < 0) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_53makePV, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_makePV, __pyx_t_1) < 0) __PYX_ERR(0, 406, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":515 + /* "LCEngine2.pyx":414 * * * def getCapturesFEN(fen): # <<<<<<<<<<<<<< * setFen(fen) * nmoves = numMoves() */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_61getCapturesFEN, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCapturesFEN, __pyx_t_11) < 0) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_55getCapturesFEN, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCapturesFEN, __pyx_t_1) < 0) __PYX_ERR(0, 414, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":526 + /* "LCEngine2.pyx":425 * return li * * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< * if not siMB: * fen = fenOB(fen) */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_63getCaptures, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCaptures, __pyx_t_11) < 0) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_57getCaptures, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCaptures, __pyx_t_1) < 0) __PYX_ERR(0, 425, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":531 + /* "LCEngine2.pyx":430 * return getCapturesFEN(fen) * * def fenOB(fen): # <<<<<<<<<<<<<< * li = fen.split(" ") * li[3] = "-" */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_65fenOB, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fenOB, __pyx_t_11) < 0) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_59fenOB, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fenOB, __pyx_t_1) < 0) __PYX_ERR(0, 430, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":537 + /* "LCEngine2.pyx":436 * return " ".join(li) * * def fenTerminado(fen): # <<<<<<<<<<<<<< * return setFen(fen) == 0 * */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_8LCEngine_67fenTerminado, NULL, __pyx_n_s_LCEngine); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fenTerminado, __pyx_t_11) < 0) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_9LCEngine2_61fenTerminado, NULL, __pyx_n_s_LCEngine2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fenTerminado, __pyx_t_1) < 0) __PYX_ERR(0, 436, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "LCEngine.pyx":1 + /* "LCEngine2.pyx":1 * cimport cython # <<<<<<<<<<<<<< * * */ - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_11) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Wrapped vars code ---*/ @@ -15729,27 +12764,23 @@ PyMODINIT_FUNC PyInit_LCEngine(void) __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { if (__pyx_d) { - __Pyx_AddTraceback("init LCEngine", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init LCEngine2", 0, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init LCEngine"); + PyErr_SetString(PyExc_ImportError, "init LCEngine2"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 return __pyx_m; + #else + return; #endif } @@ -15771,6 +12802,20 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); @@ -15927,23 +12972,42 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs); + } } -#endif // CYTHON_FAST_PYCCALL +#endif /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL @@ -15951,7 +13015,7 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject **fastlocals; Py_ssize_t i; PyObject *result; @@ -16062,8 +13126,8 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_LeaveRecursiveCall(); return result; } -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL +#endif +#endif /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON @@ -16123,11 +13187,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec return __Pyx_PyFunction_FastCall(func, &arg, 1); } #endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else if (likely(PyCFunction_Check(func))) { -#endif if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL @@ -16150,7 +13210,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec #endif /* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON +#if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { @@ -16158,7 +13218,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } #endif #ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { + if (likely(PyCFunction_Check(func) || __Pyx_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif @@ -16171,7 +13231,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #endif /* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE + #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; @@ -16195,7 +13255,7 @@ static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject #endif /* RaiseException */ - #if PY_MAJOR_VERSION < 3 + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare @@ -16310,11 +13370,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "raise: exception class must be a subclass of BaseException"); goto bad; } -#if PY_VERSION_HEX >= 0x03030000 if (cause) { -#else - if (cause && cause != Py_None) { -#endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; @@ -16342,7 +13398,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); @@ -16358,7 +13414,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -16395,6 +13451,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ goto long_long; #endif } + CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16405,6 +13462,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ goto long_long; #endif } + CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16415,6 +13473,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ goto long_long; #endif } + CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16425,6 +13484,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ goto long_long; #endif } + CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16435,6 +13495,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ goto long_long; #endif } + CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16445,6 +13506,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ goto long_long; #endif } + CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2); } } @@ -16466,7 +13528,7 @@ static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_ #endif /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -16504,6 +13566,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED goto long_long; #endif } + CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16514,6 +13577,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED goto long_long; #endif } + CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16524,6 +13588,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED goto long_long; #endif } + CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16534,6 +13599,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED goto long_long; #endif } + CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16544,6 +13610,7 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED goto long_long; #endif } + CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -16554,35 +13621,96 @@ static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED goto long_long; #endif } + CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_add(op1, op2); } } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); + x = a + b; + return PyLong_FromLong(x); +#ifdef HAVE_LONG_LONG + long_long: + llx = lla + llb; + return PyLong_FromLongLong(llx); +#endif + + + } + #endif + if (PyFloat_CheckExact(op1)) { + const long b = intval; + double a = PyFloat_AS_DOUBLE(op1); + double result; + PyFPE_START_PROTECT("add", return NULL) + result = ((double)a) + (double)b; + PyFPE_END_PROTECT(result) + return PyFloat_FromDouble(result); + } + return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); +} +#endif + +/* UnicodeAsUCS4 */ + static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { + Py_ssize_t length; + #if CYTHON_PEP393_ENABLED + length = PyUnicode_GET_LENGTH(x); + if (likely(length == 1)) { + return PyUnicode_READ_CHAR(x, 0); + } + #else + length = PyUnicode_GET_SIZE(x); + if (likely(length == 1)) { + return PyUnicode_AS_UNICODE(x)[0]; + } + #if Py_UNICODE_SIZE == 2 + else if (PyUnicode_GET_SIZE(x) == 2) { + Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0]; + if (high_val >= 0xD800 && high_val <= 0xDBFF) { + Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; + if (low_val >= 0xDC00 && low_val <= 0xDFFF) { + return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); + } + } + } + #endif + #endif + PyErr_Format(PyExc_ValueError, + "only single character unicode strings can be converted to Py_UCS4, " + "got length %" CYTHON_FORMAT_SSIZE_T "d", length); + return (Py_UCS4)-1; +} + +/* object_ord */ + static long __Pyx__PyObject_Ord(PyObject* c) { + Py_ssize_t size; + if (PyBytes_Check(c)) { + size = PyBytes_GET_SIZE(c); + if (likely(size == 1)) { + return (unsigned char) PyBytes_AS_STRING(c)[0]; + } +#if PY_MAJOR_VERSION < 3 + } else if (PyUnicode_Check(c)) { + return (long)__Pyx_PyUnicode_AsPy_UCS4(c); +#endif +#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) + } else if (PyByteArray_Check(c)) { + size = PyByteArray_GET_SIZE(c); + if (likely(size == 1)) { + return (unsigned char) PyByteArray_AS_STRING(c)[0]; + } #endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); + } else { + PyErr_Format(PyExc_TypeError, + "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); + return (long)(Py_UCS4)-1; } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); + PyErr_Format(PyExc_TypeError, + "ord() expected a character, but string of length %zd found", size); + return (long)(Py_UCS4)-1; } -#endif /* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -16593,9 +13721,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_ CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyList_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -16608,9 +13739,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); + Py_ssize_t wrapped_i = i; + if (wraparound & unlikely(i < 0)) { + wrapped_i += PyTuple_GET_SIZE(o); + } + if ((!boundscheck) || likely((0 <= wrapped_i) & (wrapped_i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); Py_INCREF(r); return r; } @@ -16662,74 +13796,23 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -/* UnicodeAsUCS4 */ - static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { - Py_ssize_t length; - #if CYTHON_PEP393_ENABLED - length = PyUnicode_GET_LENGTH(x); - if (likely(length == 1)) { - return PyUnicode_READ_CHAR(x, 0); - } - #else - length = PyUnicode_GET_SIZE(x); - if (likely(length == 1)) { - return PyUnicode_AS_UNICODE(x)[0]; - } - #if Py_UNICODE_SIZE == 2 - else if (PyUnicode_GET_SIZE(x) == 2) { - Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0]; - if (high_val >= 0xD800 && high_val <= 0xDBFF) { - Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; - if (low_val >= 0xDC00 && low_val <= 0xDFFF) { - return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); - } - } - } - #endif - #endif - PyErr_Format(PyExc_ValueError, - "only single character unicode strings can be converted to Py_UCS4, " - "got length %" CYTHON_FORMAT_SSIZE_T "d", length); - return (Py_UCS4)-1; -} - -/* object_ord */ - static long __Pyx__PyObject_Ord(PyObject* c) { - Py_ssize_t size; - if (PyBytes_Check(c)) { - size = PyBytes_GET_SIZE(c); - if (likely(size == 1)) { - return (unsigned char) PyBytes_AS_STRING(c)[0]; - } -#if PY_MAJOR_VERSION < 3 - } else if (PyUnicode_Check(c)) { - return (long)__Pyx_PyUnicode_AsPy_UCS4(c); -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - } else if (PyByteArray_Check(c)) { - size = PyByteArray_GET_SIZE(c); - if (likely(size == 1)) { - return (unsigned char) PyByteArray_AS_STRING(c)[0]; - } -#endif - } else { - PyErr_Format(PyExc_TypeError, - "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); - return (long)(Py_UCS4)-1; - } - PyErr_Format(PyExc_TypeError, - "ord() expected a character, but string of length %zd found", size); - return (long)(Py_UCS4)-1; -} - /* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + if (likely(result)) { + Py_INCREF(result); + } else if (unlikely(PyErr_Occurred())) { + result = NULL; + } else { +#else result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { +#endif #else result = PyObject_GetItem(__pyx_d, name); if (!result) { @@ -16741,7 +13824,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* SliceObject */ - static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { @@ -16837,8 +13920,136 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return NULL; } +/* UnpackUnboundCMethod */ + static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { + PyObject *method; + method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); + if (unlikely(!method)) + return -1; + target->method = method; +#if CYTHON_COMPILING_IN_CPYTHON + #if PY_MAJOR_VERSION >= 3 + if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type))) + #endif + { + PyMethodDescrObject *descr = (PyMethodDescrObject*) method; + target->func = descr->d_method->ml_meth; + target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + } +#endif + return 0; +} + +/* CallUnboundCMethod1 */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) { + if (likely(cfunc->func)) { + int flag = cfunc->flag; + if (flag == METH_O) { + return (*(cfunc->func))(self, arg); + } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) { + if (PY_VERSION_HEX >= 0x030700A0) { + return (*(__Pyx_PyCFunctionFast)cfunc->func)(self, &arg, 1); + } else { + return (*(__Pyx_PyCFunctionFastWithKeywords)cfunc->func)(self, &arg, 1, NULL); + } + } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) { + return (*(__Pyx_PyCFunctionFastWithKeywords)cfunc->func)(self, &arg, 1, NULL); + } + } + return __Pyx__CallUnboundCMethod1(cfunc, self, arg); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(1); + if (unlikely(!args)) goto bad; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(2, self, arg); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + +/* CallUnboundCMethod2 */ + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1 +static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) { + if (likely(cfunc->func)) { + PyObject *args[2] = {arg1, arg2}; + if (cfunc->flag == METH_FASTCALL) { + #if PY_VERSION_HEX >= 0x030700A0 + return (*(__Pyx_PyCFunctionFast)cfunc->func)(self, args, 2); + #else + return (*(__Pyx_PyCFunctionFastWithKeywords)cfunc->func)(self, args, 2, NULL); + #endif + } + #if PY_VERSION_HEX >= 0x030700A0 + if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS)) + return (*(__Pyx_PyCFunctionFastWithKeywords)cfunc->func)(self, args, 2, NULL); + #endif + } + return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2); +} +#endif +static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){ + PyObject *args, *result = NULL; + if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; +#if CYTHON_COMPILING_IN_CPYTHON + if (cfunc->func && (cfunc->flag & METH_VARARGS)) { + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + if (cfunc->flag & METH_KEYWORDS) + result = (*(PyCFunctionWithKeywords)cfunc->func)(self, args, NULL); + else + result = (*cfunc->func)(self, args); + } else { + args = PyTuple_New(3); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 1, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 2, arg2); + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); + } +#else + args = PyTuple_Pack(3, self, arg1, arg2); + if (unlikely(!args)) goto bad; + result = __Pyx_PyObject_Call(cfunc->method, args, NULL); +#endif +bad: + Py_XDECREF(args); + return result; +} + /* dict_getitem_default */ - static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { + static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { PyObject* value; #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY value = PyDict_GetItemWithError(d, key); @@ -16848,6 +14059,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, value = default_value; } Py_INCREF(value); + if ((1)); #else if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { value = PyDict_GetItem(d, key); @@ -16855,36 +14067,37 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, value = default_value; } Py_INCREF(value); - } else { - if (default_value == Py_None) - default_value = NULL; - value = PyObject_CallMethodObjArgs( - d, __pyx_n_s_get, key, default_value, NULL); } #endif + else { + if (default_value == Py_None) + value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key); + else + value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value); + } return value; } /* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* IterFinish */ - static CYTHON_INLINE int __Pyx_IterFinish(void) { + static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = PyThreadState_GET(); + PyThreadState *tstate = __Pyx_PyThreadState_Current; PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; @@ -16914,7 +14127,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* UnpackItemEndCheck */ - static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); @@ -16926,15 +14139,13 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* PyObjectCallMethod1 */ - static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method, *result = NULL; - method = __Pyx_PyObject_GetAttrStr(obj, method_name); - if (unlikely(!method)) goto done; + static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = NULL; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(method))) { PyObject *self = PyMethod_GET_SELF(method); @@ -16962,7 +14173,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, Py_INCREF(arg); PyTuple_SET_ITEM(args, 1, arg); Py_INCREF(function); - Py_DECREF(method); method = NULL; result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); @@ -16971,13 +14181,21 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } #endif result = __Pyx_PyObject_CallOneArg(method, arg); + goto done; done: - Py_XDECREF(method); + return result; +} +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method, *result; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) return NULL; + result = __Pyx__PyObject_CallMethod1(method, arg); + Py_DECREF(method); return result; } /* append */ - static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { if (likely(PyList_CheckExact(L))) { if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; } else { @@ -16990,7 +14208,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, } /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { @@ -17028,6 +14246,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U goto long_long; #endif } + CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -17038,6 +14257,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U goto long_long; #endif } + CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -17048,6 +14268,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U goto long_long; #endif } + CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -17058,6 +14279,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U goto long_long; #endif } + CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -17068,6 +14290,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U goto long_long; #endif } + CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); @@ -17078,6 +14301,7 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U goto long_long; #endif } + CYTHON_FALLTHROUGH; default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); } } @@ -17106,12 +14330,12 @@ static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_U #endif /* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } /* SetItemInt */ - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; r = PyObject_SetItem(o, j, v); @@ -17159,14 +14383,14 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje } /* StringJoin */ - #if !CYTHON_COMPILING_IN_CPYTHON + #if !CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); } #endif /* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -17184,7 +14408,16 @@ static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* value } else if (length == 1) { return (equals == Py_EQ); } else { - int result = memcmp(ps1, ps2, (size_t)length); + int result; +#if CYTHON_USE_UNICODE_INTERNALS + Py_hash_t hash1, hash2; + hash1 = ((PyBytesObject*)s1)->ob_shash; + hash2 = ((PyBytesObject*)s2)->ob_shash; + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + return (equals == Py_NE); + } +#endif + result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { @@ -17204,7 +14437,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* value } /* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else @@ -17244,6 +14477,21 @@ static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* value if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } +#if CYTHON_USE_UNICODE_INTERNALS + { + Py_hash_t hash1, hash2; + #if CYTHON_PEP393_ENABLED + hash1 = ((PyASCIIObject*)s1)->hash; + hash2 = ((PyASCIIObject*)s2)->hash; + #else + hash1 = ((PyUnicodeObject*)s1)->hash; + hash2 = ((PyUnicodeObject*)s2)->hash; + #endif + if (hash1 != hash2 && hash1 != -1 && hash2 != -1) { + goto return_ne; + } + } +#endif kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; @@ -17268,6 +14516,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* value } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(owned_ref); + #endif if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); @@ -17288,7 +14539,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* value } /* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY + #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { if (op1 == op2) { Py_RETURN_TRUE; @@ -17320,31 +14571,37 @@ static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } + CYTHON_FALLTHROUGH; case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } + CYTHON_FALLTHROUGH; case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } + CYTHON_FALLTHROUGH; case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } + CYTHON_FALLTHROUGH; case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } + CYTHON_FALLTHROUGH; case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } + CYTHON_FALLTHROUGH; #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); #else @@ -17373,7 +14630,7 @@ static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED #endif /* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { + static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); @@ -17412,7 +14669,8 @@ static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED } /* CythonFunction */ - static PyObject * + #include +static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { if (unlikely(op->func_doc == NULL)) { @@ -17694,7 +14952,7 @@ static PyGetSetDef __pyx_CyFunction_getsets[] = { {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, + {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} }; static PyObject * @@ -17772,14 +15030,18 @@ __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) } return 0; } -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m) { - PyObject_GC_UnTrack(m); if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } +static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) +{ + PyObject_GC_UnTrack(m); + __Pyx__CyFunction_dealloc(m); +} static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); @@ -17854,10 +15116,16 @@ static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, Py if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 1)) { - PyObject *result, *arg0 = PySequence_ITEM(arg, 0); - if (unlikely(!arg0)) return NULL; + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) Py_DECREF(arg0); + #endif return result; } PyErr_Format(PyExc_TypeError, @@ -17964,7 +15232,7 @@ static PyTypeObject __pyx_CyFunctionType_type = { }; static int __pyx_CyFunction_init(void) { __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__pyx_CyFunctionType == NULL) { + if (unlikely(__pyx_CyFunctionType == NULL)) { return -1; } return 0; @@ -17972,7 +15240,7 @@ static int __pyx_CyFunction_init(void) { static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_Malloc(size); - if (!m->defaults) + if (unlikely(!m->defaults)) return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; @@ -17995,7 +15263,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; @@ -18034,7 +15302,7 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py } /* Py3ClassCreate */ - static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { @@ -18100,8 +15368,48 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return result; } +/* CLineInTraceback */ + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; +#endif + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + use_cline = __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback); + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + } + else if (PyObject_Not(use_cline) != 0) { + c_line = 0; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; +} +#endif + /* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; @@ -18181,7 +15489,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { } /* AddTraceback */ - #include "compile.h" + #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( @@ -18240,18 +15548,22 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); + PyThreadState *tstate = __Pyx_PyThreadState_Current; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); + } + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); } py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); @@ -18262,7 +15574,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) @@ -18284,7 +15596,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -18315,7 +15627,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -18346,7 +15658,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) { const char neg_one = (char) -1, const_zero = (char) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { @@ -18377,7 +15689,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -18566,7 +15878,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, } /* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { + static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 @@ -18754,8 +16066,108 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return (long) -1; } +/* FastTypeChecks */ + #if CYTHON_COMPILING_IN_CPYTHON +static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) { + while (a) { + a = a->tp_base; + if (a == b) + return 1; + } + return b == &PyBaseObject_Type; +} +static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) { + PyObject *mro; + if (a == b) return 1; + mro = a->tp_mro; + if (likely(mro)) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(mro); + for (i = 0; i < n; i++) { + if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) + return 1; + } + return 0; + } + return __Pyx_InBases(a, b); +} +#if PY_MAJOR_VERSION == 2 +static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) { + PyObject *exception, *value, *tb; + int res; + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ErrFetch(&exception, &value, &tb); + res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0; + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + if (!res) { + res = PyObject_IsSubclass(err, exc_type2); + if (unlikely(res == -1)) { + PyErr_WriteUnraisable(err); + res = 0; + } + } + __Pyx_ErrRestore(exception, value, tb); + return res; +} +#else +static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) { + int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0; + if (!res) { + res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2); + } + return res; +} +#endif +static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + assert(PyExceptionClass_Check(exc_type)); + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; ip) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { @@ -18796,6 +16208,8 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, #endif if (!*t->p) return -1; + if (PyObject_Hash(*t->p) == -1) + return -1; ++t; } return 0; @@ -18804,50 +16218,57 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { +static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +#if !CYTHON_PEP393_ENABLED +static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; } } + } #endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +} #else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; +static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) { + if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } + if (likely(PyUnicode_IS_ASCII(o))) { + *length = PyUnicode_GET_LENGTH(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } #else - return PyUnicode_AsUTF8AndSize(o, length); + return PyUnicode_AsUTF8AndSize(o, length); +#endif +} +#endif #endif +static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && #endif + PyUnicode_Check(o)) { + return __Pyx_PyUnicode_AsStringAndSize(o, length); } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) @@ -18871,6 +16292,26 @@ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } +static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) { +#if PY_MAJOR_VERSION >= 3 + if (PyLong_Check(result)) { + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "__int__ returned non-int (type %.200s). " + "The ability to return an instance of a strict subclass of int " + "is deprecated, and may be removed in a future version of Python.", + Py_TYPE(result)->tp_name)) { + Py_DECREF(result); + return NULL; + } + return result; + } +#endif + PyErr_Format(PyExc_TypeError, + "__%.4s__ returned non-%.4s (type %.200s)", + type_name, type_name, Py_TYPE(result)->tp_name); + Py_DECREF(result); + return NULL; +} static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; @@ -18878,9 +16319,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) + if (likely(PyInt_Check(x) || PyLong_Check(x))) #else - if (PyLong_Check(x)) + if (likely(PyLong_Check(x))) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS @@ -18888,32 +16329,30 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; - res = PyNumber_Int(x); + res = m->nb_int(x); } else if (m && m->nb_long) { name = "long"; - res = PyNumber_Long(x); + res = m->nb_long(x); } #else - if (m && m->nb_int) { + if (likely(m && m->nb_int)) { name = "int"; - res = PyNumber_Long(x); + res = m->nb_int(x); } #endif #else - res = PyNumber_Int(x); + if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) { + res = PyNumber_Int(x); + } #endif - if (res) { + if (likely(res)) { #if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { + if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) { #else - if (!PyLong_Check(res)) { + if (unlikely(!PyLong_CheckExact(res))) { #endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; + return __Pyx_PyNumber_IntOrLongWrongResultType(res, name); } } else if (!PyErr_Occurred()) { @@ -18984,6 +16423,9 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { + return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); +} static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } diff --git a/LCEngine/LCEngine2.pyd b/LCEngine/LCEngine2.pyd new file mode 100644 index 0000000..6de7f2f Binary files /dev/null and b/LCEngine/LCEngine2.pyd differ diff --git a/LCEngine/LCEngine.pyx b/LCEngine/LCEngine2.pyx similarity index 81% rename from LCEngine/LCEngine.pyx rename to LCEngine/LCEngine2.pyx index a866bd0..5f78556 100644 --- a/LCEngine/LCEngine.pyx +++ b/LCEngine/LCEngine2.pyx @@ -111,37 +111,6 @@ def num2move(num): q = "" return a1 + h8 + q -def liK(npos): - cdef int fil, col, ft, ct - liM = [] - fil, col = posFC(npos) - for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - ft = fil + fi - ct = col + ci - if ft < 0 or ft > 7 or ct < 0 or ct > 7: - continue - liM.append(FCpos(ft, ct)) - return tuple(liM) - - -def liBR(npos, fi, ci): - cdef int fil, col, ft, ct - - fil, col = posFC(npos) - liM = [] - ft = fil + fi - ct = col + ci - while True: - if ft < 0 or ft > 7 or ct < 0 or ct > 7: - break - - t = FCpos(ft, ct) - liM.append(t) - ft += fi - ct += ci - return tuple(liM) - - def liN(npos): cdef int fil, col, ft, ct @@ -157,76 +126,6 @@ def liN(npos): liM.append(t) return tuple(liM) -def liP(npos, siW): - cdef int fil, col, ft, ct, inc - - fil, col = posFC(npos) - liM = [] - liX = [] - if siW: - filaIni = 1 - salto = +1 - else: - filaIni = 6 - salto = -1 - sig = FCpos(fil + salto, col) - liM.append(sig) - - if fil == filaIni: - sig2 = FCpos(fil + salto * 2, col) - liM.append(sig2) - - for inc in ( +1, -1 ): - ft = fil + salto - ct = col + inc - if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - t = FCpos(ft, ct) - liX.append(t) - - return tuple(liM), tuple(liX) - -dicK = {} -for i in range(64): - dicK[i] = liK(i) - -dicQ = {} -for i in range(64): - li = [] - for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - lin = liBR(i, f_i, c_i) - if lin: - li.append(lin) - dicQ[i] = tuple(li) - -dicB = {} -for i in range(64): - li = [] - for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - lin = liBR(i, f_i, c_i) - if lin: - li.append(lin) - dicB[i] = tuple(li) - -dicR = {} -for i in range(64): - li = [] - for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - lin = liBR(i, f_i, c_i) - if lin: - li.append(lin) - dicR[i] = tuple(li) - -dicN = {} -for i in range(64): - dicN[i] = liN(i) - -dicPW = {} -for i in range(8, 56): - dicPW[i] = liP(i, True) - -dicPB = {} -for i in range(8, 56): - dicPB[i] = liP(i, False) def knightmoves(a, b, no, nv, mx): if nv > mx: diff --git a/LCEngine/LCEngineV1.c b/LCEngine/LCEngineV1.c deleted file mode 100644 index bc65aef..0000000 --- a/LCEngine/LCEngineV1.c +++ /dev/null @@ -1,18992 +0,0 @@ -/* Generated by Cython 0.25.2 */ - -/* BEGIN: Cython Metadata -{ - "distutils": { - "depends": [ - "irina.h" - ], - "libraries": [ - "irina" - ] - }, - "module_name": "LCEngineV1" -} -END: Cython Metadata */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifndef Py_PYTHON_H - #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) - #error Cython requires Python 2.6+ or Python 3.2+. -#else -#define CYTHON_ABI "0_25_2" -#include -#ifndef offsetof - #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) -#endif -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif -#endif -#ifndef DL_IMPORT - #define DL_IMPORT(t) t -#endif -#ifndef DL_EXPORT - #define DL_EXPORT(t) t -#endif -#ifndef HAVE_LONG_LONG - #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) - #define HAVE_LONG_LONG - #endif -#endif -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG -#endif -#ifndef Py_HUGE_VAL - #define Py_HUGE_VAL HUGE_VAL -#endif -#ifdef PYPY_VERSION - #define CYTHON_COMPILING_IN_PYPY 1 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #undef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 0 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #undef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #undef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 1 - #undef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 0 - #undef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 0 - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#elif defined(PYSTON_VERSION) - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 1 - #define CYTHON_COMPILING_IN_CPYTHON 0 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #undef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 0 - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #undef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 0 - #undef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 0 -#else - #define CYTHON_COMPILING_IN_PYPY 0 - #define CYTHON_COMPILING_IN_PYSTON 0 - #define CYTHON_COMPILING_IN_CPYTHON 1 - #ifndef CYTHON_USE_TYPE_SLOTS - #define CYTHON_USE_TYPE_SLOTS 1 - #endif - #if PY_MAJOR_VERSION < 3 - #undef CYTHON_USE_ASYNC_SLOTS - #define CYTHON_USE_ASYNC_SLOTS 0 - #elif !defined(CYTHON_USE_ASYNC_SLOTS) - #define CYTHON_USE_ASYNC_SLOTS 1 - #endif - #if PY_VERSION_HEX < 0x02070000 - #undef CYTHON_USE_PYLONG_INTERNALS - #define CYTHON_USE_PYLONG_INTERNALS 0 - #elif !defined(CYTHON_USE_PYLONG_INTERNALS) - #define CYTHON_USE_PYLONG_INTERNALS 1 - #endif - #ifndef CYTHON_USE_PYLIST_INTERNALS - #define CYTHON_USE_PYLIST_INTERNALS 1 - #endif - #ifndef CYTHON_USE_UNICODE_INTERNALS - #define CYTHON_USE_UNICODE_INTERNALS 1 - #endif - #if PY_VERSION_HEX < 0x030300F0 - #undef CYTHON_USE_UNICODE_WRITER - #define CYTHON_USE_UNICODE_WRITER 0 - #elif !defined(CYTHON_USE_UNICODE_WRITER) - #define CYTHON_USE_UNICODE_WRITER 1 - #endif - #ifndef CYTHON_AVOID_BORROWED_REFS - #define CYTHON_AVOID_BORROWED_REFS 0 - #endif - #ifndef CYTHON_ASSUME_SAFE_MACROS - #define CYTHON_ASSUME_SAFE_MACROS 1 - #endif - #ifndef CYTHON_UNPACK_METHODS - #define CYTHON_UNPACK_METHODS 1 - #endif - #ifndef CYTHON_FAST_THREAD_STATE - #define CYTHON_FAST_THREAD_STATE 1 - #endif - #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 - #endif -#endif -#if !defined(CYTHON_FAST_PYCCALL) -#define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) -#endif -#if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #undef SHIFT - #undef BASE - #undef MASK -#endif -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif -#define __PYX_BUILD_PY_SSIZE_T "n" -#define CYTHON_FORMAT_SSIZE_T "z" -#if PY_MAJOR_VERSION < 3 - #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyClass_Type -#else - #define __Pyx_BUILTIN_MODULE_NAME "builtins" - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) - #define __Pyx_DefaultClassType PyType_Type -#endif -#ifndef Py_TPFLAGS_CHECKTYPES - #define Py_TPFLAGS_CHECKTYPES 0 -#endif -#ifndef Py_TPFLAGS_HAVE_INDEX - #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#ifndef Py_TPFLAGS_HAVE_NEWBUFFER - #define Py_TPFLAGS_HAVE_NEWBUFFER 0 -#endif -#ifndef Py_TPFLAGS_HAVE_FINALIZE - #define Py_TPFLAGS_HAVE_FINALIZE 0 -#endif -#ifndef METH_FASTCALL - #define METH_FASTCALL 0x80 - typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames); -#else - #define __Pyx_PyCFunctionFast _PyCFunctionFast -#endif -#if CYTHON_FAST_PYCCALL -#define __Pyx_PyFastCFunction_Check(func)\ - ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) -#else -#define __Pyx_PyFastCFunction_Check(func) 0 -#endif -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) - #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ - 0 : _PyUnicode_Ready((PyObject *)(op))) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) - #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) - #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) - #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) -#else - #define CYTHON_PEP393_ENABLED 0 - #define PyUnicode_1BYTE_KIND 1 - #define PyUnicode_2BYTE_KIND 2 - #define PyUnicode_4BYTE_KIND 4 - #define __Pyx_PyUnicode_READY(op) (0) - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) - #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) - #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) - #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) - #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) - #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) - #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) - #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) -#endif -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) -#else - #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) - #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ - PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) - #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) - #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) - #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) -#endif -#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) - #define PyObject_Malloc(s) PyMem_Malloc(s) - #define PyObject_Free(p) PyMem_Free(p) - #define PyObject_Realloc(p) PyMem_Realloc(p) -#endif -#if CYTHON_COMPILING_IN_PYSTON - #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) -#else - #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) - #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) -#endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) -#define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) -#else - #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) -#endif -#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) - #define PyObject_ASCII(o) PyObject_Repr(o) -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBaseString_Type PyUnicode_Type - #define PyStringObject PyUnicodeObject - #define PyString_Type PyUnicode_Type - #define PyString_Check PyUnicode_Check - #define PyString_CheckExact PyUnicode_CheckExact -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) - #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) -#else - #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) - #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) -#endif -#ifndef PySet_CheckExact - #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) -#endif -#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) -#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) -#if PY_MAJOR_VERSION >= 3 - #define PyIntObject PyLongObject - #define PyInt_Type PyLong_Type - #define PyInt_Check(op) PyLong_Check(op) - #define PyInt_CheckExact(op) PyLong_CheckExact(op) - #define PyInt_FromString PyLong_FromString - #define PyInt_FromUnicode PyLong_FromUnicode - #define PyInt_FromLong PyLong_FromLong - #define PyInt_FromSize_t PyLong_FromSize_t - #define PyInt_FromSsize_t PyLong_FromSsize_t - #define PyInt_AsLong PyLong_AsLong - #define PyInt_AS_LONG PyLong_AS_LONG - #define PyInt_AsSsize_t PyLong_AsSsize_t - #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask - #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define PyNumber_Int PyNumber_Long -#endif -#if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject -#endif -#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY - #ifndef PyUnicode_InternFromString - #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) - #endif -#endif -#if PY_VERSION_HEX < 0x030200A4 - typedef long Py_hash_t; - #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong -#else - #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t -#endif -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#else - #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) -#endif -#if CYTHON_USE_ASYNC_SLOTS - #if PY_VERSION_HEX >= 0x030500B1 - #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods - #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) - #else - typedef struct { - unaryfunc am_await; - unaryfunc am_aiter; - unaryfunc am_anext; - } __Pyx_PyAsyncMethodsStruct; - #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) - #endif -#else - #define __Pyx_PyType_AsAsync(obj) NULL -#endif -#ifndef CYTHON_RESTRICT - #if defined(__GNUC__) - #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) && _MSC_VER >= 1400 - #define CYTHON_RESTRICT __restrict - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_RESTRICT restrict - #else - #define CYTHON_RESTRICT - #endif -#endif -#ifndef CYTHON_UNUSED -# if defined(__GNUC__) -# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) -# else -# define CYTHON_UNUSED -# endif -#endif -#ifndef CYTHON_MAYBE_UNUSED_VAR -# if defined(__cplusplus) - template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } -# else -# define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) -# endif -#endif -#ifndef CYTHON_NCP_UNUSED -# if CYTHON_COMPILING_IN_CPYTHON -# define CYTHON_NCP_UNUSED -# else -# define CYTHON_NCP_UNUSED CYTHON_UNUSED -# endif -#endif -#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) - -#ifndef CYTHON_INLINE - #if defined(__clang__) - #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #elif defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define CYTHON_INLINE inline - #else - #define CYTHON_INLINE - #endif -#endif - -#if defined(WIN32) || defined(MS_WINDOWS) - #define _USE_MATH_DEFINES -#endif -#include -#ifdef NAN -#define __PYX_NAN() ((float) NAN) -#else -static CYTHON_INLINE float __PYX_NAN() { - float value; - memset(&value, 0xFF, sizeof(value)); - return value; -} -#endif -#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) -#define __Pyx_truncl trunc -#else -#define __Pyx_truncl truncl -#endif - - -#define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - -#ifndef __PYX_EXTERN_C - #ifdef __cplusplus - #define __PYX_EXTERN_C extern "C" - #else - #define __PYX_EXTERN_C extern - #endif -#endif - -#define __PYX_HAVE__LCEngineV1 -#define __PYX_HAVE_API__LCEngineV1 -#include "irina.h" -#ifdef _OPENMP -#include -#endif /* _OPENMP */ - -#ifdef PYREX_WITHOUT_ASSERTIONS -#define CYTHON_WITHOUT_ASSERTIONS -#endif - -typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; - -#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 -#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 -#define __PYX_DEFAULT_STRING_ENCODING "" -#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString -#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#define __Pyx_uchar_cast(c) ((unsigned char)c) -#define __Pyx_long_cast(x) ((long)x) -#define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ - (sizeof(type) < sizeof(Py_ssize_t)) ||\ - (sizeof(type) > sizeof(Py_ssize_t) &&\ - likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX) &&\ - (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ - v == (type)PY_SSIZE_T_MIN))) ||\ - (sizeof(type) == sizeof(Py_ssize_t) &&\ - (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ - v == (type)PY_SSIZE_T_MAX))) ) -#if defined (__cplusplus) && __cplusplus >= 201103L - #include - #define __Pyx_sst_abs(value) std::abs(value) -#elif SIZEOF_INT >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) abs(value) -#elif SIZEOF_LONG >= SIZEOF_SIZE_T - #define __Pyx_sst_abs(value) labs(value) -#elif defined (_MSC_VER) && defined (_M_X64) - #define __Pyx_sst_abs(value) _abs64(value) -#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - #define __Pyx_sst_abs(value) llabs(value) -#elif defined (__GNUC__) - #define __Pyx_sst_abs(value) __builtin_llabs(value) -#else - #define __Pyx_sst_abs(value) ((value<0) ? -value : value) -#endif -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); -#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) -#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); -#if PY_MAJOR_VERSION < 3 - #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize -#else - #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString - #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize -#endif -#define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) -#define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) -#define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) -#define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) -#define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) -#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) -#if PY_MAJOR_VERSION < 3 -static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) -{ - const Py_UNICODE *u_end = u; - while (*u_end++) ; - return (size_t)(u_end - u - 1); -} -#else -#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen -#endif -#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) -#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode -#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode -#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) -#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) -#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -#if CYTHON_ASSUME_SAFE_MACROS -#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -#else -#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) -#endif -#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) -#else -#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) -#endif -#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII -static int __Pyx_sys_getdefaultencoding_not_ascii; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - PyObject* ascii_chars_u = NULL; - PyObject* ascii_chars_b = NULL; - const char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - if (strcmp(default_encoding_c, "ascii") == 0) { - __Pyx_sys_getdefaultencoding_not_ascii = 0; - } else { - char ascii_chars[128]; - int c; - for (c = 0; c < 128; c++) { - ascii_chars[c] = c; - } - __Pyx_sys_getdefaultencoding_not_ascii = 1; - ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); - if (!ascii_chars_u) goto bad; - ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); - if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { - PyErr_Format( - PyExc_ValueError, - "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", - default_encoding_c); - goto bad; - } - Py_DECREF(ascii_chars_u); - Py_DECREF(ascii_chars_b); - } - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - Py_XDECREF(ascii_chars_u); - Py_XDECREF(ascii_chars_b); - return -1; -} -#endif -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) -#else -#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) -#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT -static char* __PYX_DEFAULT_STRING_ENCODING; -static int __Pyx_init_sys_getdefaultencoding_params(void) { - PyObject* sys; - PyObject* default_encoding = NULL; - char* default_encoding_c; - sys = PyImport_ImportModule("sys"); - if (!sys) goto bad; - default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); - Py_DECREF(sys); - if (!default_encoding) goto bad; - default_encoding_c = PyBytes_AsString(default_encoding); - if (!default_encoding_c) goto bad; - __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); - if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; - strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); - Py_DECREF(default_encoding); - return 0; -bad: - Py_XDECREF(default_encoding); - return -1; -} -#endif -#endif - - -/* Test for GCC > 2.95 */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) - #define likely(x) __builtin_expect(!!(x), 1) - #define unlikely(x) __builtin_expect(!!(x), 0) -#else /* !__GNUC__ or GCC < 2.95 */ - #define likely(x) (x) - #define unlikely(x) (x) -#endif /* __GNUC__ */ - -static PyObject *__pyx_m; -static PyObject *__pyx_d; -static PyObject *__pyx_b; -static PyObject *__pyx_empty_tuple; -static PyObject *__pyx_empty_bytes; -static PyObject *__pyx_empty_unicode; -static int __pyx_lineno; -static int __pyx_clineno = 0; -static const char * __pyx_cfilenm= __FILE__; -static const char *__pyx_filename; - - -static const char *__pyx_f[] = { - "LCEngineV1.pyx", -}; - -/*--- Type declarations ---*/ - -/* --- Runtime support code (head) --- */ -/* Refnanny.proto */ -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); - #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; -#ifdef WITH_THREAD - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - if (acquire_gil) {\ - PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - PyGILState_Release(__pyx_gilstate_save);\ - } else {\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ - } -#else - #define __Pyx_RefNannySetupContext(name, acquire_gil)\ - __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) -#endif - #define __Pyx_RefNannyFinishContext()\ - __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) - #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) - #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) -#else - #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name, acquire_gil) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XINCREF(r) Py_XINCREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) - #define __Pyx_XGOTREF(r) - #define __Pyx_XGIVEREF(r) -#endif -#define __Pyx_XDECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_XDECREF(tmp);\ - } while (0) -#define __Pyx_DECREF_SET(r, v) do {\ - PyObject *tmp = (PyObject *) r;\ - r = v; __Pyx_DECREF(tmp);\ - } while (0) -#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) -#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) - -/* PyObjectGetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#else -#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) -#endif - -/* GetBuiltinName.proto */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name); - -/* RaiseArgTupleInvalid.proto */ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); - -/* RaiseDoubleKeywords.proto */ -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); - -/* ParseKeywords.proto */ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ - PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ - const char* function_name); - -/* PyObjectSetAttrStr.proto */ -#if CYTHON_USE_TYPE_SLOTS -#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#else -#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) -#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) -#endif - -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#endif - -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); -#else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) -#endif - -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#else -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_RemainderObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceRemainder(op1, op2) : PyNumber_Remainder(op1, op2)) -#endif - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) -#endif - -/* GetItemInt.proto */ -#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ - __Pyx_GetItemInt_Generic(o, to_py_func(i)))) -#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ - (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - int wraparound, int boundscheck); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, - int is_list, int wraparound, int boundscheck); - -/* UnicodeAsUCS4.proto */ -static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); - -/* object_ord.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyObject_Ord(c)\ - (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c)) -#else -#define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c) -#endif -static long __Pyx__PyObject_Ord(PyObject* c); - -/* GetModuleGlobalName.proto */ -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); - -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* dict_getitem_default.proto */ -static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value); - -/* RaiseTooManyValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); - -/* RaiseNeedMoreValuesToUnpack.proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* UnpackItemEndCheck.proto */ -static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); - -/* RaiseNoneIterError.proto */ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - -/* PySequenceContains.proto */ -static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) { - int result = PySequence_Contains(seq, item); - return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); -} - -/* PyObjectCallMethod1.proto */ -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); - -/* append.proto */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); - -/* ListExtend.proto */ -static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject* none = _PyList_Extend((PyListObject*)L, v); - if (unlikely(!none)) - return -1; - Py_DECREF(none); - return 0; -#else - return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v); -#endif -} - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - -/* None.proto */ -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); - -/* SetItemInt.proto */ -#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ - (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ - __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ - (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) -static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, - int is_list, int wraparound, int boundscheck); - -/* StringJoin.proto */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyString_Join __Pyx_PyBytes_Join -#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) -#else -#define __Pyx_PyString_Join PyUnicode_Join -#define __Pyx_PyBaseString_Join PyUnicode_Join -#endif -#if CYTHON_COMPILING_IN_CPYTHON - #if PY_MAJOR_VERSION < 3 - #define __Pyx_PyBytes_Join _PyString_Join - #else - #define __Pyx_PyBytes_Join _PyBytes_Join - #endif -#else -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); -#endif - -/* IncludeStringH.proto */ -#include - -/* BytesEquals.proto */ -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); - -/* UnicodeEquals.proto */ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); - -/* StrEquals.proto */ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace); -#else -#define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\ - PyObject_RichCompare(op1, op2, Py_EQ) - #endif - -/* FetchCommonType.proto */ -static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); - -/* CythonFunction.proto */ -#define __Pyx_CyFunction_USED 1 -#include -#define __Pyx_CYFUNCTION_STATICMETHOD 0x01 -#define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 -#define __Pyx_CYFUNCTION_CCLASS 0x04 -#define __Pyx_CyFunction_GetClosure(f)\ - (((__pyx_CyFunctionObject *) (f))->func_closure) -#define __Pyx_CyFunction_GetClassObj(f)\ - (((__pyx_CyFunctionObject *) (f))->func_classobj) -#define __Pyx_CyFunction_Defaults(type, f)\ - ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) -#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ - ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) -typedef struct { - PyCFunctionObject func; -#if PY_VERSION_HEX < 0x030500A0 - PyObject *func_weakreflist; -#endif - PyObject *func_dict; - PyObject *func_name; - PyObject *func_qualname; - PyObject *func_doc; - PyObject *func_globals; - PyObject *func_code; - PyObject *func_closure; - PyObject *func_classobj; - void *defaults; - int defaults_pyobjects; - int flags; - PyObject *defaults_tuple; - PyObject *defaults_kwdict; - PyObject *(*defaults_getter)(PyObject *); - PyObject *func_annotations; -} __pyx_CyFunctionObject; -static PyTypeObject *__pyx_CyFunctionType = 0; -#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ - __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) -static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, - int flags, PyObject* qualname, - PyObject *self, - PyObject *module, PyObject *globals, - PyObject* code); -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, - size_t size, - int pyobjects); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, - PyObject *tuple); -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, - PyObject *dict); -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, - PyObject *dict); -static int __pyx_CyFunction_init(void); - -/* CalculateMetaclass.proto */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - -/* Py3ClassCreate.proto */ -static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, - PyObject *mkw, PyObject *modname, PyObject *doc); -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, - PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); - -/* CodeObjectCache.proto */ -typedef struct { - PyCodeObject* code_object; - int code_line; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -/* AddTraceback.proto */ -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value); - -/* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); - -/* CheckBinaryVersion.proto */ -static int __Pyx_check_binary_version(void); - -/* InitStrings.proto */ -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); - - -/* Module declarations from 'cython' */ - -/* Module declarations from 'LCEngineV1' */ -#define __Pyx_MODULE_NAME "LCEngineV1" -int __pyx_module_is_main_LCEngineV1 = 0; - -/* Implementation of 'LCEngineV1' */ -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_object; -static PyObject *__pyx_builtin_StopIteration; -static PyObject *__pyx_builtin_chr; -static const char __pyx_k_[] = ""; -static const char __pyx_k_a[] = "a"; -static const char __pyx_k_b[] = "b"; -static const char __pyx_k_c[] = "c"; -static const char __pyx_k_d[] = "d"; -static const char __pyx_k_f[] = "f"; -static const char __pyx_k_h[] = "h"; -static const char __pyx_k_i[] = "i"; -static const char __pyx_k_n[] = "n"; -static const char __pyx_k_q[] = "q"; -static const char __pyx_k_r[] = "r"; -static const char __pyx_k_t[] = "t"; -static const char __pyx_k_w[] = "w"; -static const char __pyx_k_x[] = "x"; -static const char __pyx_k_y[] = "y"; -static const char __pyx_k_a1[] = "a1"; -static const char __pyx_k_ci[] = "ci"; -static const char __pyx_k_ct[] = "ct"; -static const char __pyx_k_ep[] = "_ep"; -static const char __pyx_k_fi[] = "fi"; -static const char __pyx_k_ft[] = "ft"; -static const char __pyx_k_h8[] = "h8"; -static const char __pyx_k_li[] = "li"; -static const char __pyx_k_ms[] = "ms"; -static const char __pyx_k_mv[] = "mv"; -static const char __pyx_k_mx[] = "mx"; -static const char __pyx_k_no[] = "no"; -static const char __pyx_k_nv[] = "nv"; -static const char __pyx_k_nx[] = "nx"; -static const char __pyx_k_ot[] = "ot"; -static const char __pyx_k_pv[] = "_pv"; -static const char __pyx_k_to[] = "_to"; -static const char __pyx_k__25[] = " "; -static const char __pyx_k__34[] = "."; -static const char __pyx_k__38[] = "\n"; -static const char __pyx_k__39[] = "+"; -static const char __pyx_k__40[] = "#"; -static const char __pyx_k__47[] = "-"; -static const char __pyx_k_c_i[] = "c_i"; -static const char __pyx_k_chr[] = "chr"; -static const char __pyx_k_col[] = "col"; -static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_f_i[] = "f_i"; -static const char __pyx_k_fen[] = "fen"; -static const char __pyx_k_fil[] = "fil"; -static const char __pyx_k_get[] = "get"; -static const char __pyx_k_inc[] = "inc"; -static const char __pyx_k_liK[] = "liK"; -static const char __pyx_k_liM[] = "liM"; -static const char __pyx_k_liN[] = "liN"; -static const char __pyx_k_liP[] = "liP"; -static const char __pyx_k_liX[] = "liX"; -static const char __pyx_k_lia[] = "lia"; -static const char __pyx_k_lib[] = "lib"; -static const char __pyx_k_lin[] = "lin"; -static const char __pyx_k_lix[] = "lix"; -static const char __pyx_k_num[] = "num"; -static const char __pyx_k_pgn[] = "pgn"; -static const char __pyx_k_pos[] = "pos"; -static const char __pyx_k_san[] = "_san"; -static const char __pyx_k_siW[] = "siW"; -static const char __pyx_k_sig[] = "sig"; -static const char __pyx_k_sp1[] = "sp1"; -static const char __pyx_k_sp2[] = "sp2"; -static const char __pyx_k_tam[] = "tam"; -static const char __pyx_k_xpv[] = "xpv"; -static const char __pyx_k_base[] = "base"; -static const char __pyx_k_dicB[] = "dicB"; -static const char __pyx_k_dicK[] = "dicK"; -static const char __pyx_k_dicN[] = "dicN"; -static const char __pyx_k_dicQ[] = "dicQ"; -static const char __pyx_k_dicR[] = "dicR"; -static const char __pyx_k_exit[] = "__exit__"; -static const char __pyx_k_fens[] = "fens"; -static const char __pyx_k_fich[] = "fich"; -static const char __pyx_k_from[] = "_from"; -static const char __pyx_k_info[] = "info"; -static const char __pyx_k_init[] = "__init__"; -static const char __pyx_k_iter[] = "__iter__"; -static const char __pyx_k_join[] = "join"; -static const char __pyx_k_liBR[] = "liBR"; -static const char __pyx_k_main[] = "__main__"; -static const char __pyx_k_mate[] = "_mate"; -static const char __pyx_k_move[] = "move"; -static const char __pyx_k_next[] = "next"; -static const char __pyx_k_npos[] = "npos"; -static const char __pyx_k_pgn1[] = "pgn1"; -static const char __pyx_k_pv_2[] = "pv"; -static const char __pyx_k_resp[] = "resp"; -static const char __pyx_k_self[] = "self"; -static const char __pyx_k_siMB[] = "siMB"; -static const char __pyx_k_sig2[] = "sig2"; -static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_type[] = "type"; -static const char __pyx_k_xmin[] = "xmin"; -static const char __pyx_k_FCpos[] = "FCpos"; -static const char __pyx_k_a1Pos[] = "a1Pos"; -static const char __pyx_k_a1h8q[] = "a1h8q"; -static const char __pyx_k_check[] = "_check"; -static const char __pyx_k_depth[] = "depth"; -static const char __pyx_k_desde[] = "desde"; -static const char __pyx_k_dicPB[] = "dicPB"; -static const char __pyx_k_dicPW[] = "dicPW"; -static const char __pyx_k_enter[] = "__enter__"; -static const char __pyx_k_fenOB[] = "fenOB"; -static const char __pyx_k_hasta[] = "hasta"; -static const char __pyx_k_jaque[] = "jaque"; -static const char __pyx_k_level[] = "level"; -static const char __pyx_k_lidef[] = "lidef"; -static const char __pyx_k_lower[] = "lower"; -static const char __pyx_k_nbase[] = "nbase"; -static const char __pyx_k_piece[] = "_piece"; -static const char __pyx_k_pieza[] = "pieza"; -static const char __pyx_k_posA1[] = "posA1"; -static const char __pyx_k_posFC[] = "posFC"; -static const char __pyx_k_range[] = "range"; -static const char __pyx_k_rfind[] = "rfind"; -static const char __pyx_k_salto[] = "salto"; -static const char __pyx_k_san_2[] = "san"; -static const char __pyx_k_split[] = "split"; -static const char __pyx_k_strip[] = "strip"; -static const char __pyx_k_upper[] = "upper"; -static const char __pyx_k_value[] = "value"; -static const char __pyx_k_append[] = "append"; -static const char __pyx_k_extend[] = "extend"; -static const char __pyx_k_getFen[] = "getFen"; -static const char __pyx_k_getPGN[] = "getPGN"; -static const char __pyx_k_inifen[] = "inifen"; -static const char __pyx_k_insert[] = "insert"; -static const char __pyx_k_makePV[] = "makePV"; -static const char __pyx_k_mate_2[] = "mate"; -static const char __pyx_k_module[] = "__module__"; -static const char __pyx_k_movePV[] = "movePV"; -static const char __pyx_k_nmoves[] = "nmoves"; -static const char __pyx_k_object[] = "object"; -static const char __pyx_k_pv2xpv[] = "pv2xpv"; -static const char __pyx_k_runFen[] = "runFen"; -static const char __pyx_k_setFen[] = "setFen"; -static const char __pyx_k_xpv2pv[] = "xpv2pv"; -static const char __pyx_k_captura[] = "captura"; -static const char __pyx_k_capture[] = "_capture"; -static const char __pyx_k_filaIni[] = "filaIni"; -static const char __pyx_k_isCheck[] = "isCheck"; -static const char __pyx_k_numMove[] = "numMove"; -static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_xpv2pgn[] = "xpv2pgn"; -static const char __pyx_k_InfoMove[] = "InfoMove"; -static const char __pyx_k_castle_K[] = "_castle_K"; -static const char __pyx_k_castle_Q[] = "_castle_Q"; -static const char __pyx_k_getMoves[] = "getMoves"; -static const char __pyx_k_infoMove[] = "infoMove"; -static const char __pyx_k_makeMove[] = "makeMove"; -static const char __pyx_k_move2num[] = "move2num"; -static const char __pyx_k_moveExPV[] = "moveExPV"; -static const char __pyx_k_num2move[] = "num2move"; -static const char __pyx_k_qualname[] = "__qualname__"; -static const char __pyx_k_xpv2lipv[] = "xpv2lipv"; -static const char __pyx_k_PGNreader[] = "PGNreader"; -static const char __pyx_k_desdeA1H8[] = "desdeA1H8"; -static const char __pyx_k_fen2fenM2[] = "fen2fenM2"; -static const char __pyx_k_hastaA1H8[] = "hastaA1H8"; -static const char __pyx_k_isCastleK[] = "isCastleK"; -static const char __pyx_k_isCastleQ[] = "isCastleQ"; -static const char __pyx_k_lc_pgn2pv[] = "lc_pgn2pv"; -static const char __pyx_k_liNMinimo[] = "liNMinimo"; -static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_promotion[] = "_promotion"; -static const char __pyx_k_siBlancas[] = "siBlancas"; -static const char __pyx_k_traceback[] = "traceback"; -static const char __pyx_k_LCEngineV1[] = "LCEngineV1"; -static const char __pyx_k_coronacion[] = "coronacion"; -static const char __pyx_k_getExMoves[] = "getExMoves"; -static const char __pyx_k_movimiento[] = "movimiento"; -static const char __pyx_k_getCaptures[] = "getCaptures"; -static const char __pyx_k_isEnPassant[] = "isEnPassant"; -static const char __pyx_k_knightmoves[] = "knightmoves"; -static const char __pyx_k_fenTerminado[] = "fenTerminado"; -static const char __pyx_k_InfoMove_mate[] = "InfoMove.mate"; -static const char __pyx_k_StopIteration[] = "StopIteration"; -static const char __pyx_k_setFenInicial[] = "setFenInicial"; -static const char __pyx_k_InfoMove_desde[] = "InfoMove.desde"; -static const char __pyx_k_InfoMove_hasta[] = "InfoMove.hasta"; -static const char __pyx_k_InfoMove_jaque[] = "InfoMove.jaque"; -static const char __pyx_k_InfoMove_pieza[] = "InfoMove.pieza"; -static const char __pyx_k_PGNreader_next[] = "PGNreader.next"; -static const char __pyx_k_getCapturesFEN[] = "getCapturesFEN"; -static const char __pyx_k_InfoMove___init[] = "InfoMove.__init__"; -static const char __pyx_k_celdas_ocupadas[] = "celdas_ocupadas"; -static const char __pyx_k_InfoMove_captura[] = "InfoMove.captura"; -static const char __pyx_k_PGNreader___exit[] = "PGNreader.__exit__"; -static const char __pyx_k_PGNreader___init[] = "PGNreader.__init__"; -static const char __pyx_k_PGNreader___iter[] = "PGNreader.__iter__"; -static const char __pyx_k_PGNreader___enter[] = "PGNreader.__enter__"; -static const char __pyx_k_InfoMove_isCastleK[] = "InfoMove.isCastleK"; -static const char __pyx_k_InfoMove_isCastleQ[] = "InfoMove.isCastleQ"; -static const char __pyx_k_InfoMove_coronacion[] = "InfoMove.coronacion"; -static const char __pyx_k_InfoMove_movimiento[] = "InfoMove.movimiento"; -static const char __pyx_k_InfoMove_isEnPassant[] = "InfoMove.isEnPassant"; -static const char __pyx_k_c_correr_lucaschess_pyLC12_LCEng[] = "c:\\correr\\lucaschess\\pyLC12\\LCEngine\\LCEngineV1.pyx"; -static const char __pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP[] = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; -static PyObject *__pyx_kp_s_; -static PyObject *__pyx_n_s_FCpos; -static PyObject *__pyx_n_s_InfoMove; -static PyObject *__pyx_n_s_InfoMove___init; -static PyObject *__pyx_n_s_InfoMove_captura; -static PyObject *__pyx_n_s_InfoMove_coronacion; -static PyObject *__pyx_n_s_InfoMove_desde; -static PyObject *__pyx_n_s_InfoMove_hasta; -static PyObject *__pyx_n_s_InfoMove_isCastleK; -static PyObject *__pyx_n_s_InfoMove_isCastleQ; -static PyObject *__pyx_n_s_InfoMove_isEnPassant; -static PyObject *__pyx_n_s_InfoMove_jaque; -static PyObject *__pyx_n_s_InfoMove_mate; -static PyObject *__pyx_n_s_InfoMove_movimiento; -static PyObject *__pyx_n_s_InfoMove_pieza; -static PyObject *__pyx_n_s_LCEngineV1; -static PyObject *__pyx_n_s_PGNreader; -static PyObject *__pyx_n_s_PGNreader___enter; -static PyObject *__pyx_n_s_PGNreader___exit; -static PyObject *__pyx_n_s_PGNreader___init; -static PyObject *__pyx_n_s_PGNreader___iter; -static PyObject *__pyx_n_s_PGNreader_next; -static PyObject *__pyx_n_s_StopIteration; -static PyObject *__pyx_kp_s__25; -static PyObject *__pyx_kp_s__34; -static PyObject *__pyx_kp_s__38; -static PyObject *__pyx_kp_s__39; -static PyObject *__pyx_kp_s__40; -static PyObject *__pyx_kp_s__47; -static PyObject *__pyx_n_s_a; -static PyObject *__pyx_n_s_a1; -static PyObject *__pyx_n_s_a1Pos; -static PyObject *__pyx_n_s_a1h8q; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_b; -static PyObject *__pyx_n_s_base; -static PyObject *__pyx_n_s_c; -static PyObject *__pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng; -static PyObject *__pyx_n_s_c_i; -static PyObject *__pyx_n_s_captura; -static PyObject *__pyx_n_s_capture; -static PyObject *__pyx_n_s_castle_K; -static PyObject *__pyx_n_s_castle_Q; -static PyObject *__pyx_n_s_celdas_ocupadas; -static PyObject *__pyx_n_s_check; -static PyObject *__pyx_n_s_chr; -static PyObject *__pyx_n_s_ci; -static PyObject *__pyx_n_s_col; -static PyObject *__pyx_n_s_coronacion; -static PyObject *__pyx_n_s_ct; -static PyObject *__pyx_n_s_d; -static PyObject *__pyx_n_s_depth; -static PyObject *__pyx_n_s_desde; -static PyObject *__pyx_n_s_desdeA1H8; -static PyObject *__pyx_n_s_dicB; -static PyObject *__pyx_n_s_dicK; -static PyObject *__pyx_n_s_dicN; -static PyObject *__pyx_n_s_dicPB; -static PyObject *__pyx_n_s_dicPW; -static PyObject *__pyx_n_s_dicQ; -static PyObject *__pyx_n_s_dicR; -static PyObject *__pyx_n_s_doc; -static PyObject *__pyx_n_s_enter; -static PyObject *__pyx_n_s_ep; -static PyObject *__pyx_n_s_exit; -static PyObject *__pyx_n_s_extend; -static PyObject *__pyx_n_s_f; -static PyObject *__pyx_n_s_f_i; -static PyObject *__pyx_n_s_fen; -static PyObject *__pyx_n_s_fen2fenM2; -static PyObject *__pyx_n_s_fenOB; -static PyObject *__pyx_n_s_fenTerminado; -static PyObject *__pyx_n_s_fens; -static PyObject *__pyx_n_s_fi; -static PyObject *__pyx_n_s_fich; -static PyObject *__pyx_n_s_fil; -static PyObject *__pyx_n_s_filaIni; -static PyObject *__pyx_n_s_from; -static PyObject *__pyx_n_s_ft; -static PyObject *__pyx_n_s_get; -static PyObject *__pyx_n_s_getCaptures; -static PyObject *__pyx_n_s_getCapturesFEN; -static PyObject *__pyx_n_s_getExMoves; -static PyObject *__pyx_n_s_getFen; -static PyObject *__pyx_n_s_getMoves; -static PyObject *__pyx_n_s_getPGN; -static PyObject *__pyx_n_s_h; -static PyObject *__pyx_n_s_h8; -static PyObject *__pyx_n_s_hasta; -static PyObject *__pyx_n_s_hastaA1H8; -static PyObject *__pyx_n_s_i; -static PyObject *__pyx_n_s_inc; -static PyObject *__pyx_n_s_info; -static PyObject *__pyx_n_s_infoMove; -static PyObject *__pyx_n_s_inifen; -static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_s_insert; -static PyObject *__pyx_n_s_isCastleK; -static PyObject *__pyx_n_s_isCastleQ; -static PyObject *__pyx_n_s_isCheck; -static PyObject *__pyx_n_s_isEnPassant; -static PyObject *__pyx_n_s_iter; -static PyObject *__pyx_n_s_jaque; -static PyObject *__pyx_n_s_join; -static PyObject *__pyx_n_s_knightmoves; -static PyObject *__pyx_n_s_lc_pgn2pv; -static PyObject *__pyx_n_s_level; -static PyObject *__pyx_n_s_li; -static PyObject *__pyx_n_s_liBR; -static PyObject *__pyx_n_s_liK; -static PyObject *__pyx_n_s_liM; -static PyObject *__pyx_n_s_liN; -static PyObject *__pyx_n_s_liNMinimo; -static PyObject *__pyx_n_s_liP; -static PyObject *__pyx_n_s_liX; -static PyObject *__pyx_n_s_lia; -static PyObject *__pyx_n_s_lib; -static PyObject *__pyx_n_s_lidef; -static PyObject *__pyx_n_s_lin; -static PyObject *__pyx_n_s_lix; -static PyObject *__pyx_n_s_lower; -static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_makeMove; -static PyObject *__pyx_n_s_makePV; -static PyObject *__pyx_n_s_mate; -static PyObject *__pyx_n_s_mate_2; -static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_module; -static PyObject *__pyx_n_s_move; -static PyObject *__pyx_n_s_move2num; -static PyObject *__pyx_n_s_moveExPV; -static PyObject *__pyx_n_s_movePV; -static PyObject *__pyx_n_s_movimiento; -static PyObject *__pyx_n_s_ms; -static PyObject *__pyx_n_s_mv; -static PyObject *__pyx_n_s_mx; -static PyObject *__pyx_n_s_n; -static PyObject *__pyx_n_s_nbase; -static PyObject *__pyx_n_s_next; -static PyObject *__pyx_n_s_nmoves; -static PyObject *__pyx_n_s_no; -static PyObject *__pyx_n_s_npos; -static PyObject *__pyx_n_s_num; -static PyObject *__pyx_n_s_num2move; -static PyObject *__pyx_n_s_numMove; -static PyObject *__pyx_n_s_nv; -static PyObject *__pyx_n_s_nx; -static PyObject *__pyx_n_s_object; -static PyObject *__pyx_n_s_ot; -static PyObject *__pyx_n_s_pgn; -static PyObject *__pyx_n_s_pgn1; -static PyObject *__pyx_n_s_piece; -static PyObject *__pyx_n_s_pieza; -static PyObject *__pyx_n_s_pos; -static PyObject *__pyx_n_s_posA1; -static PyObject *__pyx_n_s_posFC; -static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_promotion; -static PyObject *__pyx_n_s_pv; -static PyObject *__pyx_n_s_pv2xpv; -static PyObject *__pyx_n_s_pv_2; -static PyObject *__pyx_n_s_q; -static PyObject *__pyx_n_s_qualname; -static PyObject *__pyx_n_s_r; -static PyObject *__pyx_n_s_range; -static PyObject *__pyx_n_s_resp; -static PyObject *__pyx_n_s_rfind; -static PyObject *__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP; -static PyObject *__pyx_n_s_runFen; -static PyObject *__pyx_n_s_salto; -static PyObject *__pyx_n_s_san; -static PyObject *__pyx_n_s_san_2; -static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_setFen; -static PyObject *__pyx_n_s_setFenInicial; -static PyObject *__pyx_n_s_siBlancas; -static PyObject *__pyx_n_s_siMB; -static PyObject *__pyx_n_s_siW; -static PyObject *__pyx_n_s_sig; -static PyObject *__pyx_n_s_sig2; -static PyObject *__pyx_n_s_sp1; -static PyObject *__pyx_n_s_sp2; -static PyObject *__pyx_n_s_split; -static PyObject *__pyx_n_s_strip; -static PyObject *__pyx_n_s_t; -static PyObject *__pyx_n_s_tam; -static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_to; -static PyObject *__pyx_n_s_traceback; -static PyObject *__pyx_n_s_type; -static PyObject *__pyx_n_s_upper; -static PyObject *__pyx_n_s_value; -static PyObject *__pyx_n_s_w; -static PyObject *__pyx_n_s_x; -static PyObject *__pyx_n_s_xmin; -static PyObject *__pyx_n_s_xpv; -static PyObject *__pyx_n_s_xpv2lipv; -static PyObject *__pyx_n_s_xpv2pgn; -static PyObject *__pyx_n_s_xpv2pv; -static PyObject *__pyx_n_s_y; -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fich, PyObject *__pyx_v_depth); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_8next(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pgn1); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_2posFC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_c); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_6posA1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_10move2num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1h8q); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_12num2move(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_14liK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_16liBR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_fi, PyObject *__pyx_v_ci); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_18liN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_20liP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_siW); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_22knightmoves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_no, PyObject *__pyx_v_nv, PyObject *__pyx_v_mx); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_24liNMinimo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_celdas_ocupadas); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_26xpv2lipv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_28xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_30pv2xpv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_32runFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_depth, PyObject *__pyx_v_ms, PyObject *__pyx_v_level); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_34setFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_36getFen(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_38getMoves(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_40getPGN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desdeA1H8, PyObject *__pyx_v_hastaA1H8, PyObject *__pyx_v_coronacion); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_42xpv2pgn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_44isCheck(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_num); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_2desde(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_4hasta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_6coronacion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_8movimiento(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_12mate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_14captura(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_46getExMoves(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_48moveExPV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_50movePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_52makeMove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_move); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_56setFenInicial(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_58makePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_60getCapturesFEN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_62getCaptures(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_siMB); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_64fenOB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_pf_10LCEngineV1_66fenTerminado(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen); /* proto */ -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_2; -static PyObject *__pyx_int_3; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_8; -static PyObject *__pyx_int_49; -static PyObject *__pyx_int_50; -static PyObject *__pyx_int_51; -static PyObject *__pyx_int_52; -static PyObject *__pyx_int_53; -static PyObject *__pyx_int_56; -static PyObject *__pyx_int_58; -static PyObject *__pyx_int_64; -static PyObject *__pyx_int_80; -static PyObject *__pyx_int_97; -static PyObject *__pyx_int_neg_1; -static PyObject *__pyx_int_neg_2; -static PyObject *__pyx_slice__2; -static PyObject *__pyx_slice__3; -static PyObject *__pyx_tuple__4; -static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__9; -static PyObject *__pyx_slice__23; -static PyObject *__pyx_slice__24; -static PyObject *__pyx_slice__27; -static PyObject *__pyx_slice__28; -static PyObject *__pyx_slice__29; -static PyObject *__pyx_slice__35; -static PyObject *__pyx_slice__36; -static PyObject *__pyx_slice__37; -static PyObject *__pyx_slice__41; -static PyObject *__pyx_slice__42; -static PyObject *__pyx_slice__43; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__33; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__50; -static PyObject *__pyx_tuple__52; -static PyObject *__pyx_tuple__54; -static PyObject *__pyx_tuple__56; -static PyObject *__pyx_tuple__58; -static PyObject *__pyx_tuple__60; -static PyObject *__pyx_tuple__62; -static PyObject *__pyx_tuple__64; -static PyObject *__pyx_tuple__66; -static PyObject *__pyx_tuple__68; -static PyObject *__pyx_tuple__70; -static PyObject *__pyx_tuple__72; -static PyObject *__pyx_tuple__74; -static PyObject *__pyx_tuple__76; -static PyObject *__pyx_tuple__78; -static PyObject *__pyx_tuple__80; -static PyObject *__pyx_tuple__81; -static PyObject *__pyx_tuple__82; -static PyObject *__pyx_tuple__83; -static PyObject *__pyx_tuple__84; -static PyObject *__pyx_tuple__85; -static PyObject *__pyx_tuple__86; -static PyObject *__pyx_tuple__87; -static PyObject *__pyx_tuple__88; -static PyObject *__pyx_tuple__89; -static PyObject *__pyx_tuple__90; -static PyObject *__pyx_tuple__91; -static PyObject *__pyx_tuple__92; -static PyObject *__pyx_tuple__93; -static PyObject *__pyx_tuple__94; -static PyObject *__pyx_tuple__95; -static PyObject *__pyx_tuple__96; -static PyObject *__pyx_tuple__97; -static PyObject *__pyx_tuple__98; -static PyObject *__pyx_tuple__99; -static PyObject *__pyx_tuple__100; -static PyObject *__pyx_tuple__101; -static PyObject *__pyx_tuple__102; -static PyObject *__pyx_tuple__103; -static PyObject *__pyx_tuple__104; -static PyObject *__pyx_tuple__105; -static PyObject *__pyx_tuple__106; -static PyObject *__pyx_tuple__108; -static PyObject *__pyx_tuple__110; -static PyObject *__pyx_tuple__112; -static PyObject *__pyx_tuple__114; -static PyObject *__pyx_tuple__116; -static PyObject *__pyx_tuple__118; -static PyObject *__pyx_tuple__120; -static PyObject *__pyx_tuple__122; -static PyObject *__pyx_tuple__124; -static PyObject *__pyx_tuple__126; -static PyObject *__pyx_tuple__129; -static PyObject *__pyx_tuple__131; -static PyObject *__pyx_tuple__133; -static PyObject *__pyx_tuple__135; -static PyObject *__pyx_tuple__137; -static PyObject *__pyx_tuple__139; -static PyObject *__pyx_tuple__141; -static PyObject *__pyx_tuple__143; -static PyObject *__pyx_tuple__145; -static PyObject *__pyx_tuple__147; -static PyObject *__pyx_tuple__149; -static PyObject *__pyx_tuple__151; -static PyObject *__pyx_tuple__153; -static PyObject *__pyx_tuple__155; -static PyObject *__pyx_tuple__157; -static PyObject *__pyx_tuple__159; -static PyObject *__pyx_tuple__161; -static PyObject *__pyx_tuple__163; -static PyObject *__pyx_tuple__165; -static PyObject *__pyx_tuple__167; -static PyObject *__pyx_tuple__169; -static PyObject *__pyx_tuple__171; -static PyObject *__pyx_tuple__173; -static PyObject *__pyx_codeobj__49; -static PyObject *__pyx_codeobj__51; -static PyObject *__pyx_codeobj__53; -static PyObject *__pyx_codeobj__55; -static PyObject *__pyx_codeobj__57; -static PyObject *__pyx_codeobj__59; -static PyObject *__pyx_codeobj__61; -static PyObject *__pyx_codeobj__63; -static PyObject *__pyx_codeobj__65; -static PyObject *__pyx_codeobj__67; -static PyObject *__pyx_codeobj__69; -static PyObject *__pyx_codeobj__71; -static PyObject *__pyx_codeobj__73; -static PyObject *__pyx_codeobj__75; -static PyObject *__pyx_codeobj__77; -static PyObject *__pyx_codeobj__79; -static PyObject *__pyx_codeobj__107; -static PyObject *__pyx_codeobj__109; -static PyObject *__pyx_codeobj__111; -static PyObject *__pyx_codeobj__113; -static PyObject *__pyx_codeobj__115; -static PyObject *__pyx_codeobj__117; -static PyObject *__pyx_codeobj__119; -static PyObject *__pyx_codeobj__121; -static PyObject *__pyx_codeobj__123; -static PyObject *__pyx_codeobj__125; -static PyObject *__pyx_codeobj__127; -static PyObject *__pyx_codeobj__128; -static PyObject *__pyx_codeobj__130; -static PyObject *__pyx_codeobj__132; -static PyObject *__pyx_codeobj__134; -static PyObject *__pyx_codeobj__136; -static PyObject *__pyx_codeobj__138; -static PyObject *__pyx_codeobj__140; -static PyObject *__pyx_codeobj__142; -static PyObject *__pyx_codeobj__144; -static PyObject *__pyx_codeobj__146; -static PyObject *__pyx_codeobj__148; -static PyObject *__pyx_codeobj__150; -static PyObject *__pyx_codeobj__152; -static PyObject *__pyx_codeobj__154; -static PyObject *__pyx_codeobj__156; -static PyObject *__pyx_codeobj__158; -static PyObject *__pyx_codeobj__160; -static PyObject *__pyx_codeobj__162; -static PyObject *__pyx_codeobj__164; -static PyObject *__pyx_codeobj__166; -static PyObject *__pyx_codeobj__168; -static PyObject *__pyx_codeobj__170; -static PyObject *__pyx_codeobj__172; -static PyObject *__pyx_codeobj__174; - -/* "LCEngineV1.pyx":42 - * - * class PGNreader: - * def __init__(self, fich, depth): # <<<<<<<<<<<<<< - * self.fich = fich - * self.depth = depth - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_9PGNreader_1__init__ = {"__init__", (PyCFunction)__pyx_pw_10LCEngineV1_9PGNreader_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_fich = 0; - PyObject *__pyx_v_depth = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_fich,&__pyx_n_s_depth,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fich)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 42, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 42, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 42, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_fich = values[1]; - __pyx_v_depth = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 42, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.PGNreader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_9PGNreader___init__(__pyx_self, __pyx_v_self, __pyx_v_fich, __pyx_v_depth); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fich, PyObject *__pyx_v_depth) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__", 0); - - /* "LCEngineV1.pyx":43 - * class PGNreader: - * def __init__(self, fich, depth): - * self.fich = fich # <<<<<<<<<<<<<< - * self.depth = depth - * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_fich, __pyx_v_fich) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - - /* "LCEngineV1.pyx":44 - * def __init__(self, fich, depth): - * self.fich = fich - * self.depth = depth # <<<<<<<<<<<<<< - * - * def __enter__(self): - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_depth, __pyx_v_depth) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - - /* "LCEngineV1.pyx":42 - * - * class PGNreader: - * def __init__(self, fich, depth): # <<<<<<<<<<<<<< - * self.fich = fich - * self.depth = depth - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_AddTraceback("LCEngineV1.PGNreader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":46 - * self.depth = depth - * - * def __enter__(self): # <<<<<<<<<<<<<< - * pgn_start(self.fich, self.depth) - * return self - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_9PGNreader_3__enter__ = {"__enter__", (PyCFunction)__pyx_pw_10LCEngineV1_9PGNreader_3__enter__, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_3__enter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__enter__ (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_9PGNreader_2__enter__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_2__enter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_RefNannySetupContext("__enter__", 0); - - /* "LCEngineV1.pyx":47 - * - * def __enter__(self): - * pgn_start(self.fich, self.depth) # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_fich); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_depth); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - pgn_start(__pyx_t_2, __pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":48 - * def __enter__(self): - * pgn_start(self.fich, self.depth) - * return self # <<<<<<<<<<<<<< - * - * def __exit__(self, type, value, traceback): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self); - __pyx_r = __pyx_v_self; - goto __pyx_L0; - - /* "LCEngineV1.pyx":46 - * self.depth = depth - * - * def __enter__(self): # <<<<<<<<<<<<<< - * pgn_start(self.fich, self.depth) - * return self - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngineV1.PGNreader.__enter__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":50 - * return self - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * pgn_stop() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_9PGNreader_5__exit__ = {"__exit__", (PyCFunction)__pyx_pw_10LCEngineV1_9PGNreader_5__exit__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_5__exit__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - CYTHON_UNUSED PyObject *__pyx_v_self = 0; - CYTHON_UNUSED PyObject *__pyx_v_type = 0; - CYTHON_UNUSED PyObject *__pyx_v_value = 0; - CYTHON_UNUSED PyObject *__pyx_v_traceback = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_type,&__pyx_n_s_value,&__pyx_n_s_traceback,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_type)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 1); __PYX_ERR(0, 50, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 2); __PYX_ERR(0, 50, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_traceback)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, 3); __PYX_ERR(0, 50, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__exit__") < 0)) __PYX_ERR(0, 50, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_self = values[0]; - __pyx_v_type = values[1]; - __pyx_v_value = values[2]; - __pyx_v_traceback = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__exit__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 50, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.PGNreader.__exit__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_9PGNreader_4__exit__(__pyx_self, __pyx_v_self, __pyx_v_type, __pyx_v_value, __pyx_v_traceback); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_4__exit__(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_type, CYTHON_UNUSED PyObject *__pyx_v_value, CYTHON_UNUSED PyObject *__pyx_v_traceback) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__exit__", 0); - - /* "LCEngineV1.pyx":51 - * - * def __exit__(self, type, value, traceback): - * pgn_stop() # <<<<<<<<<<<<<< - * - * def __iter__(self): - */ - pgn_stop(); - - /* "LCEngineV1.pyx":50 - * return self - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * pgn_stop() - * - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":53 - * pgn_stop() - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_7__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_9PGNreader_7__iter__ = {"__iter__", (PyCFunction)__pyx_pw_10LCEngineV1_9PGNreader_7__iter__, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_7__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_9PGNreader_6__iter__(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_6__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__iter__", 0); - - /* "LCEngineV1.pyx":54 - * - * def __iter__(self): - * return self # <<<<<<<<<<<<<< - * - * def next(self): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_self); - __pyx_r = __pyx_v_self; - goto __pyx_L0; - - /* "LCEngineV1.pyx":53 - * pgn_stop() - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":56 - * return self - * - * def next(self): # <<<<<<<<<<<<<< - * n = pgn_read() - * if n: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_9next(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_9PGNreader_9next = {"next", (PyCFunction)__pyx_pw_10LCEngineV1_9PGNreader_9next, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_9PGNreader_9next(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("next (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_9PGNreader_8next(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_9PGNreader_8next(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { - int __pyx_v_n; - char *__pyx_v_pgn; - char *__pyx_v_pv; - PyObject *__pyx_v_d = NULL; - int __pyx_v_r; - PyObject *__pyx_v_fens = NULL; - int __pyx_v_x; - int __pyx_v_num; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - __Pyx_RefNannySetupContext("next", 0); - - /* "LCEngineV1.pyx":57 - * - * def next(self): - * n = pgn_read() # <<<<<<<<<<<<<< - * if n: - * pgn = pgn_game() - */ - __pyx_v_n = pgn_read(); - - /* "LCEngineV1.pyx":58 - * def next(self): - * n = pgn_read() - * if n: # <<<<<<<<<<<<<< - * pgn = pgn_game() - * pv = pgn_pv() - */ - __pyx_t_1 = (__pyx_v_n != 0); - if (__pyx_t_1) { - - /* "LCEngineV1.pyx":59 - * n = pgn_read() - * if n: - * pgn = pgn_game() # <<<<<<<<<<<<<< - * pv = pgn_pv() - * d = {} - */ - __pyx_v_pgn = pgn_game(); - - /* "LCEngineV1.pyx":60 - * if n: - * pgn = pgn_game() - * pv = pgn_pv() # <<<<<<<<<<<<<< - * d = {} - * n = pgn_numlabels() - */ - __pyx_v_pv = pgn_pv(); - - /* "LCEngineV1.pyx":61 - * pgn = pgn_game() - * pv = pgn_pv() - * d = {} # <<<<<<<<<<<<<< - * n = pgn_numlabels() - * r = pgn_raw() - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_v_d = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":62 - * pv = pgn_pv() - * d = {} - * n = pgn_numlabels() # <<<<<<<<<<<<<< - * r = pgn_raw() - * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] - */ - __pyx_v_n = pgn_numlabels(); - - /* "LCEngineV1.pyx":63 - * d = {} - * n = pgn_numlabels() - * r = pgn_raw() # <<<<<<<<<<<<<< - * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] - * if n: - */ - __pyx_v_r = pgn_raw(); - - /* "LCEngineV1.pyx":64 - * n = pgn_numlabels() - * r = pgn_raw() - * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] # <<<<<<<<<<<<<< - * if n: - * for x in range(n): - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = pgn_numfens(); - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_num = __pyx_t_4; - __pyx_t_5 = __Pyx_PyBytes_FromString(pgn_fen(__pyx_v_num)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_v_fens = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":65 - * r = pgn_raw() - * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] - * if n: # <<<<<<<<<<<<<< - * for x in range(n): - * d[pgn_label(x).upper()] = pgn_value(x) - */ - __pyx_t_1 = (__pyx_v_n != 0); - if (__pyx_t_1) { - - /* "LCEngineV1.pyx":66 - * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] - * if n: - * for x in range(n): # <<<<<<<<<<<<<< - * d[pgn_label(x).upper()] = pgn_value(x) - * return pgn, pv, d, r, fens - */ - __pyx_t_3 = __pyx_v_n; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_x = __pyx_t_4; - - /* "LCEngineV1.pyx":67 - * if n: - * for x in range(n): - * d[pgn_label(x).upper()] = pgn_value(x) # <<<<<<<<<<<<<< - * return pgn, pv, d, r, fens - * else: - */ - __pyx_t_2 = __Pyx_PyBytes_FromString(pgn_value(__pyx_v_x)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyBytes_FromString(pgn_label(__pyx_v_x)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_upper); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (__pyx_t_6) { - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else { - __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(PyDict_SetItem(__pyx_v_d, __pyx_t_5, __pyx_t_2) < 0)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - - /* "LCEngineV1.pyx":65 - * r = pgn_raw() - * fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] - * if n: # <<<<<<<<<<<<<< - * for x in range(n): - * d[pgn_label(x).upper()] = pgn_value(x) - */ - } - - /* "LCEngineV1.pyx":68 - * for x in range(n): - * d[pgn_label(x).upper()] = pgn_value(x) - * return pgn, pv, d, r, fens # <<<<<<<<<<<<<< - * else: - * raise StopIteration - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_pgn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_r); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); - __Pyx_INCREF(__pyx_v_d); - __Pyx_GIVEREF(__pyx_v_d); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_d); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_7); - __Pyx_INCREF(__pyx_v_fens); - __Pyx_GIVEREF(__pyx_v_fens); - PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_fens); - __pyx_t_2 = 0; - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":58 - * def next(self): - * n = pgn_read() - * if n: # <<<<<<<<<<<<<< - * pgn = pgn_game() - * pv = pgn_pv() - */ - } - - /* "LCEngineV1.pyx":70 - * return pgn, pv, d, r, fens - * else: - * raise StopIteration # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0); - __PYX_ERR(0, 70, __pyx_L1_error) - } - - /* "LCEngineV1.pyx":56 - * return self - * - * def next(self): # <<<<<<<<<<<<<< - * n = pgn_read() - * if n: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("LCEngineV1.PGNreader.next", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_d); - __Pyx_XDECREF(__pyx_v_fens); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":73 - * - * - * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_1lc_pgn2pv(PyObject *__pyx_self, PyObject *__pyx_v_pgn1); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_1lc_pgn2pv = {"lc_pgn2pv", (PyCFunction)__pyx_pw_10LCEngineV1_1lc_pgn2pv, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_1lc_pgn2pv(PyObject *__pyx_self, PyObject *__pyx_v_pgn1) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("lc_pgn2pv (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_lc_pgn2pv(__pyx_self, ((PyObject *)__pyx_v_pgn1)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_lc_pgn2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pgn1) { - char __pyx_v_pv[10]; - int __pyx_v_resp; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("lc_pgn2pv", 0); - - /* "LCEngineV1.pyx":75 - * def lc_pgn2pv(pgn1): - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) # <<<<<<<<<<<<<< - * if resp == 9999: - * return "" - */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_pgn1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error) - __pyx_v_resp = pgn2pv(__pyx_t_1, __pyx_v_pv); - - /* "LCEngineV1.pyx":76 - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) - * if resp == 9999: # <<<<<<<<<<<<<< - * return "" - * else: - */ - __pyx_t_2 = ((__pyx_v_resp == 0x270F) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":77 - * resp = pgn2pv(pgn1, pv) - * if resp == 9999: - * return "" # <<<<<<<<<<<<<< - * else: - * return pv - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s_); - __pyx_r = __pyx_kp_s_; - goto __pyx_L0; - - /* "LCEngineV1.pyx":76 - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) - * if resp == 9999: # <<<<<<<<<<<<<< - * return "" - * else: - */ - } - - /* "LCEngineV1.pyx":79 - * return "" - * else: - * return pv # <<<<<<<<<<<<<< - * - * - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - } - - /* "LCEngineV1.pyx":73 - * - * - * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngineV1.lc_pgn2pv", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":82 - * - * - * def posFC(pos): # <<<<<<<<<<<<<< - * return pos / 8, pos % 8 - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_3posFC(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_3posFC = {"posFC", (PyCFunction)__pyx_pw_10LCEngineV1_3posFC, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_3posFC(PyObject *__pyx_self, PyObject *__pyx_v_pos) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("posFC (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_2posFC(__pyx_self, ((PyObject *)__pyx_v_pos)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_2posFC(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("posFC", 0); - - /* "LCEngineV1.pyx":83 - * - * def posFC(pos): - * return pos / 8, pos % 8 # <<<<<<<<<<<<<< - * - * def FCpos(f, c): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_pos, __pyx_int_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_RemainderObjC(__pyx_v_pos, __pyx_int_8, 8, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":82 - * - * - * def posFC(pos): # <<<<<<<<<<<<<< - * return pos / 8, pos % 8 - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngineV1.posFC", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":85 - * return pos / 8, pos % 8 - * - * def FCpos(f, c): # <<<<<<<<<<<<<< - * return f * 8 + c - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_5FCpos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_5FCpos = {"FCpos", (PyCFunction)__pyx_pw_10LCEngineV1_5FCpos, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_5FCpos(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_f = 0; - PyObject *__pyx_v_c = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("FCpos (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_f,&__pyx_n_s_c,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_f)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_c)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("FCpos", 1, 2, 2, 1); __PYX_ERR(0, 85, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "FCpos") < 0)) __PYX_ERR(0, 85, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_f = values[0]; - __pyx_v_c = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("FCpos", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 85, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.FCpos", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_4FCpos(__pyx_self, __pyx_v_f, __pyx_v_c); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_4FCpos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_f, PyObject *__pyx_v_c) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("FCpos", 0); - - /* "LCEngineV1.pyx":86 - * - * def FCpos(f, c): - * return f * 8 + c # <<<<<<<<<<<<<< - * - * def posA1(pos): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyNumber_Multiply(__pyx_v_f, __pyx_int_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_c); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":85 - * return pos / 8, pos % 8 - * - * def FCpos(f, c): # <<<<<<<<<<<<<< - * return f * 8 + c - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("LCEngineV1.FCpos", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":88 - * return f * 8 + c - * - * def posA1(pos): # <<<<<<<<<<<<<< - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_7posA1(PyObject *__pyx_self, PyObject *__pyx_v_pos); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_7posA1 = {"posA1", (PyCFunction)__pyx_pw_10LCEngineV1_7posA1, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_7posA1(PyObject *__pyx_self, PyObject *__pyx_v_pos) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("posA1 (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_6posA1(__pyx_self, ((PyObject *)__pyx_v_pos)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_6posA1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pos) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("posA1", 0); - - /* "LCEngineV1.pyx":89 - * - * def posA1(pos): - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) # <<<<<<<<<<<<<< - * - * def a1Pos(a1): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_RemainderObjC(__pyx_v_pos, __pyx_int_8, 8, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_97, 97, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_pos, __pyx_int_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_1, __pyx_int_49, 49, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":88 - * return f * 8 + c - * - * def posA1(pos): # <<<<<<<<<<<<<< - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngineV1.posA1", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":91 - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - * def a1Pos(a1): # <<<<<<<<<<<<<< - * cdef int f, c - * f = ord(a1[1]) - 49 - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_9a1Pos(PyObject *__pyx_self, PyObject *__pyx_v_a1); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_9a1Pos = {"a1Pos", (PyCFunction)__pyx_pw_10LCEngineV1_9a1Pos, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_9a1Pos(PyObject *__pyx_self, PyObject *__pyx_v_a1) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("a1Pos (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8a1Pos(__pyx_self, ((PyObject *)__pyx_v_a1)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8a1Pos(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1) { - int __pyx_v_f; - int __pyx_v_c; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - __Pyx_RefNannySetupContext("a1Pos", 0); - - /* "LCEngineV1.pyx":93 - * def a1Pos(a1): - * cdef int f, c - * f = ord(a1[1]) - 49 # <<<<<<<<<<<<<< - * c = ord(a1[0]) - 97 - * return f * 8 + c - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_2 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_f = (__pyx_t_2 - 49); - - /* "LCEngineV1.pyx":94 - * cdef int f, c - * f = ord(a1[1]) - 49 - * c = ord(a1[0]) - 97 # <<<<<<<<<<<<<< - * return f * 8 + c - * - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_a1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_2 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 94, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_c = (__pyx_t_2 - 97); - - /* "LCEngineV1.pyx":95 - * f = ord(a1[1]) - 49 - * c = ord(a1[0]) - 97 - * return f * 8 + c # <<<<<<<<<<<<<< - * - * def move2num(a1h8q): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_long(((__pyx_v_f * 8) + __pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 95, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":91 - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - * def a1Pos(a1): # <<<<<<<<<<<<<< - * cdef int f, c - * f = ord(a1[1]) - 49 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.a1Pos", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":97 - * return f * 8 + c - * - * def move2num(a1h8q): # <<<<<<<<<<<<<< - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_11move2num(PyObject *__pyx_self, PyObject *__pyx_v_a1h8q); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_11move2num = {"move2num", (PyCFunction)__pyx_pw_10LCEngineV1_11move2num, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_11move2num(PyObject *__pyx_self, PyObject *__pyx_v_a1h8q) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("move2num (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_10move2num(__pyx_self, ((PyObject *)__pyx_v_a1h8q)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_10move2num(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a1h8q) { - PyObject *__pyx_v_num = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - __Pyx_RefNannySetupContext("move2num", 0); - - /* "LCEngineV1.pyx":98 - * - * def move2num(a1h8q): - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 # <<<<<<<<<<<<<< - * if len(a1h8q)>4: - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_a1h8q, 0, 2, NULL, NULL, &__pyx_slice__2, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_a1h8q, 2, 4, NULL, NULL, &__pyx_slice__3, 1, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_t_2, __pyx_int_64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_num = __pyx_t_2; - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":99 - * def move2num(a1h8q): - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: # <<<<<<<<<<<<<< - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - * return num - */ - __pyx_t_7 = PyObject_Length(__pyx_v_a1h8q); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 99, __pyx_L1_error) - __pyx_t_8 = ((__pyx_t_7 > 4) != 0); - if (__pyx_t_8) { - - /* "LCEngineV1.pyx":100 - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 # <<<<<<<<<<<<<< - * return num - * - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_q, __pyx_int_1) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_r, __pyx_int_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_b, __pyx_int_3) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_n, __pyx_int_4) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_a1h8q, 4, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_t_2, __pyx_t_5, __pyx_int_0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_t_1, __pyx_int_64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_num, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_5); - __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":99 - * def move2num(a1h8q): - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: # <<<<<<<<<<<<<< - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - * return num - */ - } - - /* "LCEngineV1.pyx":101 - * if len(a1h8q)>4: - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - * return num # <<<<<<<<<<<<<< - * - * def num2move(num): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_num); - __pyx_r = __pyx_v_num; - goto __pyx_L0; - - /* "LCEngineV1.pyx":97 - * return f * 8 + c - * - * def move2num(a1h8q): # <<<<<<<<<<<<<< - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("LCEngineV1.move2num", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_num); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":103 - * return num - * - * def num2move(num): # <<<<<<<<<<<<<< - * a1 = posA1(num%64) - * num /= 64 - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_13num2move(PyObject *__pyx_self, PyObject *__pyx_v_num); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_13num2move = {"num2move", (PyCFunction)__pyx_pw_10LCEngineV1_13num2move, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_13num2move(PyObject *__pyx_self, PyObject *__pyx_v_num) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("num2move (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_12num2move(__pyx_self, ((PyObject *)__pyx_v_num)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_12num2move(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num) { - PyObject *__pyx_v_a1 = NULL; - PyObject *__pyx_v_h8 = NULL; - PyObject *__pyx_v_q = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - __Pyx_RefNannySetupContext("num2move", 0); - __Pyx_INCREF(__pyx_v_num); - - /* "LCEngineV1.pyx":104 - * - * def num2move(num): - * a1 = posA1(num%64) # <<<<<<<<<<<<<< - * num /= 64 - * h8 = posA1(num%64) - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posA1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_RemainderObjC(__pyx_v_num, __pyx_int_64, 64, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_a1 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":105 - * def num2move(num): - * a1 = posA1(num%64) - * num /= 64 # <<<<<<<<<<<<<< - * h8 = posA1(num%64) - * num /= 64 - */ - __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_num, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":106 - * a1 = posA1(num%64) - * num /= 64 - * h8 = posA1(num%64) # <<<<<<<<<<<<<< - * num /= 64 - * if num: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posA1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_RemainderObjC(__pyx_v_num, __pyx_int_64, 64, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_h8 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":107 - * num /= 64 - * h8 = posA1(num%64) - * num /= 64 # <<<<<<<<<<<<<< - * if num: - * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) - */ - __pyx_t_1 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_num, __pyx_int_64); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":108 - * h8 = posA1(num%64) - * num /= 64 - * if num: # <<<<<<<<<<<<<< - * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) - * else: - */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_num); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 108, __pyx_L1_error) - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":109 - * num /= 64 - * if num: - * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) # <<<<<<<<<<<<<< - * else: - * q = "" - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, __pyx_n_s_q) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, __pyx_n_s_r) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, __pyx_n_s_b) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, __pyx_n_s_n) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_t_1, __pyx_v_num, Py_None); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_q = __pyx_t_2; - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":108 - * h8 = posA1(num%64) - * num /= 64 - * if num: # <<<<<<<<<<<<<< - * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) - * else: - */ - goto __pyx_L3; - } - - /* "LCEngineV1.pyx":111 - * q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) - * else: - * q = "" # <<<<<<<<<<<<<< - * return a1 + h8 + q - * - */ - /*else*/ { - __Pyx_INCREF(__pyx_kp_s_); - __pyx_v_q = __pyx_kp_s_; - } - __pyx_L3:; - - /* "LCEngineV1.pyx":112 - * else: - * q = "" - * return a1 + h8 + q # <<<<<<<<<<<<<< - * - * def liK(npos): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyNumber_Add(__pyx_v_a1, __pyx_v_h8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_v_q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":103 - * return num - * - * def num2move(num): # <<<<<<<<<<<<<< - * a1 = posA1(num%64) - * num /= 64 - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("LCEngineV1.num2move", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_a1); - __Pyx_XDECREF(__pyx_v_h8); - __Pyx_XDECREF(__pyx_v_q); - __Pyx_XDECREF(__pyx_v_num); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":114 - * return a1 + h8 + q - * - * def liK(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * liM = [] - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_15liK(PyObject *__pyx_self, PyObject *__pyx_v_npos); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_15liK = {"liK", (PyCFunction)__pyx_pw_10LCEngineV1_15liK, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_15liK(PyObject *__pyx_self, PyObject *__pyx_v_npos) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liK (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_14liK(__pyx_self, ((PyObject *)__pyx_v_npos)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_14liK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_fi = NULL; - PyObject *__pyx_v_ci = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - __Pyx_RefNannySetupContext("liK", 0); - - /* "LCEngineV1.pyx":116 - * def liK(npos): - * cdef int fil, col, ft, ct - * liM = [] # <<<<<<<<<<<<<< - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 116, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":117 - * cdef int fil, col, ft, ct - * liM = [] - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - * ft = fil + fi - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 117, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 117, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; - - /* "LCEngineV1.pyx":118 - * liM = [] - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_t_1 = __pyx_tuple__12; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; - for (;;) { - if (__pyx_t_8 >= 8) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 118, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - if (likely(__pyx_t_4 != Py_None)) { - PyObject* sequence = __pyx_t_4; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 118, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 118, __pyx_L1_error) - } - __Pyx_XDECREF_SET(__pyx_v_fi, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_ci, __pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":119 - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - * ft = fil + fi # <<<<<<<<<<<<<< - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_fi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngineV1.pyx":120 - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - * ft = fil + fi - * ct = col + ci # <<<<<<<<<<<<<< - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_ci); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ct = __pyx_t_7; - - /* "LCEngineV1.pyx":121 - * ft = fil + fi - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * continue - * liM.append(FCpos(ft, ct)) - */ - __pyx_t_10 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ct > 7) != 0); - __pyx_t_9 = __pyx_t_10; - __pyx_L8_bool_binop_done:; - if (__pyx_t_9) { - - /* "LCEngineV1.pyx":122 - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue # <<<<<<<<<<<<<< - * liM.append(FCpos(ft, ct)) - * return tuple(liM) - */ - goto __pyx_L5_continue; - - /* "LCEngineV1.pyx":121 - * ft = fil + fi - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * continue - * liM.append(FCpos(ft, ct)) - */ - } - - /* "LCEngineV1.pyx":123 - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue - * liM.append(FCpos(ft, ct)) # <<<<<<<<<<<<<< - * return tuple(liM) - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_11); - __pyx_t_2 = 0; - __pyx_t_11 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_t_4); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":118 - * liM = [] - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_L5_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":124 - * continue - * liM.append(FCpos(ft, ct)) - * return tuple(liM) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":114 - * return a1 + h8 + q - * - * def liK(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * liM = [] - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("LCEngineV1.liK", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_fi); - __Pyx_XDECREF(__pyx_v_ci); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":127 - * - * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_17liBR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_17liBR = {"liBR", (PyCFunction)__pyx_pw_10LCEngineV1_17liBR, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_17liBR(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_npos = 0; - PyObject *__pyx_v_fi = 0; - PyObject *__pyx_v_ci = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liBR (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npos,&__pyx_n_s_fi,&__pyx_n_s_ci,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npos)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fi)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liBR", 1, 3, 3, 1); __PYX_ERR(0, 127, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ci)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liBR", 1, 3, 3, 2); __PYX_ERR(0, 127, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liBR") < 0)) __PYX_ERR(0, 127, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_npos = values[0]; - __pyx_v_fi = values[1]; - __pyx_v_ci = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("liBR", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.liBR", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_16liBR(__pyx_self, __pyx_v_npos, __pyx_v_fi, __pyx_v_ci); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_16liBR(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_fi, PyObject *__pyx_v_ci) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - __Pyx_RefNannySetupContext("liBR", 0); - - /* "LCEngineV1.pyx":130 - * cdef int fil, col, ft, ct - * - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * liM = [] - * ft = fil + fi - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 130, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 130, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 130, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; - - /* "LCEngineV1.pyx":131 - * - * fil, col = posFC(npos) - * liM = [] # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":132 - * fil, col = posFC(npos) - * liM = [] - * ft = fil + fi # <<<<<<<<<<<<<< - * ct = col + ci - * while True: - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_v_fi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngineV1.pyx":133 - * liM = [] - * ft = fil + fi - * ct = col + ci # <<<<<<<<<<<<<< - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_v_ci); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_ct = __pyx_t_7; - - /* "LCEngineV1.pyx":134 - * ft = fil + fi - * ct = col + ci - * while True: # <<<<<<<<<<<<<< - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * break - */ - while (1) { - - /* "LCEngineV1.pyx":135 - * ct = col + ci - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * break - * - */ - __pyx_t_9 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_9) { - } else { - __pyx_t_8 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = ((__pyx_v_ct > 7) != 0); - __pyx_t_8 = __pyx_t_9; - __pyx_L8_bool_binop_done:; - if (__pyx_t_8) { - - /* "LCEngineV1.pyx":136 - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * break # <<<<<<<<<<<<<< - * - * t = FCpos(ft, ct) - */ - goto __pyx_L6_break; - - /* "LCEngineV1.pyx":135 - * ct = col + ci - * while True: - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * break - * - */ - } - - /* "LCEngineV1.pyx":138 - * break - * - * t = FCpos(ft, ct) # <<<<<<<<<<<<<< - * liM.append(t) - * ft += fi - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_7, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":139 - * - * t = FCpos(ft, ct) - * liM.append(t) # <<<<<<<<<<<<<< - * ft += fi - * ct += ci - */ - __pyx_t_12 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_t); if (unlikely(__pyx_t_12 == -1)) __PYX_ERR(0, 139, __pyx_L1_error) - - /* "LCEngineV1.pyx":140 - * t = FCpos(ft, ct) - * liM.append(t) - * ft += fi # <<<<<<<<<<<<<< - * ct += ci - * return tuple(liM) - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_v_fi); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngineV1.pyx":141 - * liM.append(t) - * ft += fi - * ct += ci # <<<<<<<<<<<<<< - * return tuple(liM) - * - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_v_ci); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_ct = __pyx_t_7; - } - __pyx_L6_break:; - - /* "LCEngineV1.pyx":142 - * ft += fi - * ct += ci - * return tuple(liM) # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":127 - * - * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_AddTraceback("LCEngineV1.liBR", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_19liN(PyObject *__pyx_self, PyObject *__pyx_v_npos); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_19liN = {"liN", (PyCFunction)__pyx_pw_10LCEngineV1_19liN, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_19liN(PyObject *__pyx_self, PyObject *__pyx_v_npos) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liN (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_18liN(__pyx_self, ((PyObject *)__pyx_v_npos)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_18liN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_fi = NULL; - PyObject *__pyx_v_ci = NULL; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - __Pyx_RefNannySetupContext("liN", 0); - - /* "LCEngineV1.pyx":148 - * cdef int fil, col, ft, ct - * - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 148, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 148, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 148, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; - - /* "LCEngineV1.pyx":149 - * - * fil, col = posFC(npos) - * liM = [] # <<<<<<<<<<<<<< - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - * ft = fil + fi - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":150 - * fil, col = posFC(npos) - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_t_1 = __pyx_tuple__21; __Pyx_INCREF(__pyx_t_1); __pyx_t_8 = 0; - for (;;) { - if (__pyx_t_8 >= 8) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_8); __Pyx_INCREF(__pyx_t_4); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - if (likely(__pyx_t_4 != Py_None)) { - PyObject* sequence = __pyx_t_4; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 150, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 150, __pyx_L1_error) - } - __Pyx_XDECREF_SET(__pyx_v_fi, __pyx_t_2); - __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_ci, __pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":151 - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - * ft = fil + fi # <<<<<<<<<<<<<< - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_v_fi); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngineV1.pyx":152 - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - * ft = fil + fi - * ct = col + ci # <<<<<<<<<<<<<< - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue - */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_ci); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 152, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ct = __pyx_t_7; - - /* "LCEngineV1.pyx":153 - * ft = fil + fi - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * continue - * - */ - __pyx_t_10 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_10) { - } else { - __pyx_t_9 = __pyx_t_10; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_10 = ((__pyx_v_ct > 7) != 0); - __pyx_t_9 = __pyx_t_10; - __pyx_L8_bool_binop_done:; - if (__pyx_t_9) { - - /* "LCEngineV1.pyx":154 - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: - * continue # <<<<<<<<<<<<<< - * - * t = FCpos(ft, ct) - */ - goto __pyx_L5_continue; - - /* "LCEngineV1.pyx":153 - * ft = fil + fi - * ct = col + ci - * if ft < 0 or ft > 7 or ct < 0 or ct > 7: # <<<<<<<<<<<<<< - * continue - * - */ - } - - /* "LCEngineV1.pyx":156 - * continue - * - * t = FCpos(ft, ct) # <<<<<<<<<<<<<< - * liM.append(t) - * return tuple(liM) - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_12)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_12); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_12, __pyx_t_2, __pyx_t_11}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_12) { - __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_7, __pyx_t_11); - __pyx_t_2 = 0; - __pyx_t_11 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":157 - * - * t = FCpos(ft, ct) - * liM.append(t) # <<<<<<<<<<<<<< - * return tuple(liM) - * - */ - __pyx_t_14 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_t); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 157, __pyx_L1_error) - - /* "LCEngineV1.pyx":150 - * fil, col = posFC(npos) - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_L5_continue:; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":158 - * t = FCpos(ft, ct) - * liM.append(t) - * return tuple(liM) # <<<<<<<<<<<<<< - * - * def liP(npos, siW): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_AddTraceback("LCEngineV1.liN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_fi); - __Pyx_XDECREF(__pyx_v_ci); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_21liP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_21liP = {"liP", (PyCFunction)__pyx_pw_10LCEngineV1_21liP, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_21liP(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_npos = 0; - PyObject *__pyx_v_siW = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liP (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_npos,&__pyx_n_s_siW,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_npos)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_siW)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liP", 1, 2, 2, 1); __PYX_ERR(0, 160, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liP") < 0)) __PYX_ERR(0, 160, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_npos = values[0]; - __pyx_v_siW = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("liP", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 160, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.liP", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_20liP(__pyx_self, __pyx_v_npos, __pyx_v_siW); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_20liP(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_npos, PyObject *__pyx_v_siW) { - int __pyx_v_fil; - int __pyx_v_col; - int __pyx_v_ft; - int __pyx_v_ct; - int __pyx_v_inc; - PyObject *__pyx_v_liM = NULL; - PyObject *__pyx_v_liX = NULL; - long __pyx_v_filaIni; - PyObject *__pyx_v_salto = NULL; - PyObject *__pyx_v_sig = NULL; - PyObject *__pyx_v_sig2 = NULL; - PyObject *__pyx_v_t = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - int __pyx_t_13; - PyObject *__pyx_t_14 = NULL; - __Pyx_RefNannySetupContext("liP", 0); - - /* "LCEngineV1.pyx":163 - * cdef int fil, col, ft, ct, inc - * - * fil, col = posFC(npos) # <<<<<<<<<<<<<< - * liM = [] - * liX = [] - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_posFC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_npos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_npos}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_npos); - __Pyx_GIVEREF(__pyx_v_npos); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_npos); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { - PyObject* sequence = __pyx_t_1; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 163, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); - } else { - __pyx_t_2 = PyList_GET_ITEM(sequence, 0); - __pyx_t_4 = PyList_GET_ITEM(sequence, 1); - } - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - Py_ssize_t index = -1; - __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; - index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_2); - index = 1; __pyx_t_4 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_3), 2) < 0) __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_t_5 = NULL; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L4_unpacking_done; - __pyx_L3_unpacking_failed:; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = NULL; - if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 163, __pyx_L1_error) - __pyx_L4_unpacking_done:; - } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_fil = __pyx_t_6; - __pyx_v_col = __pyx_t_7; - - /* "LCEngineV1.pyx":164 - * - * fil, col = posFC(npos) - * liM = [] # <<<<<<<<<<<<<< - * liX = [] - * if siW: - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liM = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":165 - * fil, col = posFC(npos) - * liM = [] - * liX = [] # <<<<<<<<<<<<<< - * if siW: - * filaIni = 1 - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_liX = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":166 - * liM = [] - * liX = [] - * if siW: # <<<<<<<<<<<<<< - * filaIni = 1 - * salto = +1 - */ - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_siW); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) - if (__pyx_t_8) { - - /* "LCEngineV1.pyx":167 - * liX = [] - * if siW: - * filaIni = 1 # <<<<<<<<<<<<<< - * salto = +1 - * else: - */ - __pyx_v_filaIni = 1; - - /* "LCEngineV1.pyx":168 - * if siW: - * filaIni = 1 - * salto = +1 # <<<<<<<<<<<<<< - * else: - * filaIni = 6 - */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_salto = __pyx_int_1; - - /* "LCEngineV1.pyx":166 - * liM = [] - * liX = [] - * if siW: # <<<<<<<<<<<<<< - * filaIni = 1 - * salto = +1 - */ - goto __pyx_L5; - } - - /* "LCEngineV1.pyx":170 - * salto = +1 - * else: - * filaIni = 6 # <<<<<<<<<<<<<< - * salto = -1 - * sig = FCpos(fil + salto, col) - */ - /*else*/ { - __pyx_v_filaIni = 6; - - /* "LCEngineV1.pyx":171 - * else: - * filaIni = 6 - * salto = -1 # <<<<<<<<<<<<<< - * sig = FCpos(fil + salto, col) - * liM.append(sig) - */ - __Pyx_INCREF(__pyx_int_neg_1); - __pyx_v_salto = __pyx_int_neg_1; - } - __pyx_L5:; - - /* "LCEngineV1.pyx":172 - * filaIni = 6 - * salto = -1 - * sig = FCpos(fil + salto, col) # <<<<<<<<<<<<<< - * liM.append(sig) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_salto); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (__pyx_t_9) { - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_2); - __pyx_t_3 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_sig = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":173 - * salto = -1 - * sig = FCpos(fil + salto, col) - * liM.append(sig) # <<<<<<<<<<<<<< - * - * if fil == filaIni: - */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_sig); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 173, __pyx_L1_error) - - /* "LCEngineV1.pyx":175 - * liM.append(sig) - * - * if fil == filaIni: # <<<<<<<<<<<<<< - * sig2 = FCpos(fil + salto * 2, col) - * liM.append(sig2) - */ - __pyx_t_8 = ((__pyx_v_fil == __pyx_v_filaIni) != 0); - if (__pyx_t_8) { - - /* "LCEngineV1.pyx":176 - * - * if fil == filaIni: - * sig2 = FCpos(fil + salto * 2, col) # <<<<<<<<<<<<<< - * liM.append(sig2) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = PyNumber_Multiply(__pyx_v_salto, __pyx_int_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_10, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_3, __pyx_t_2}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_2); - __pyx_t_3 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_sig2 = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":177 - * if fil == filaIni: - * sig2 = FCpos(fil + salto * 2, col) - * liM.append(sig2) # <<<<<<<<<<<<<< - * - * for inc in ( +1, -1 ): - */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_liM, __pyx_v_sig2); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 177, __pyx_L1_error) - - /* "LCEngineV1.pyx":175 - * liM.append(sig) - * - * if fil == filaIni: # <<<<<<<<<<<<<< - * sig2 = FCpos(fil + salto * 2, col) - * liM.append(sig2) - */ - } - - /* "LCEngineV1.pyx":179 - * liM.append(sig2) - * - * for inc in ( +1, -1 ): # <<<<<<<<<<<<<< - * ft = fil + salto - * ct = col + inc - */ - __pyx_t_1 = __pyx_tuple__22; __Pyx_INCREF(__pyx_t_1); __pyx_t_12 = 0; - for (;;) { - if (__pyx_t_12 >= 2) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_12); __Pyx_INCREF(__pyx_t_4); __pyx_t_12++; if (unlikely(0 < 0)) __PYX_ERR(0, 179, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_12); __pyx_t_12++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_inc = __pyx_t_7; - - /* "LCEngineV1.pyx":180 - * - * for inc in ( +1, -1 ): - * ft = fil + salto # <<<<<<<<<<<<<< - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - */ - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_fil); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyNumber_Add(__pyx_t_4, __pyx_v_salto); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_9); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_v_ft = __pyx_t_7; - - /* "LCEngineV1.pyx":181 - * for inc in ( +1, -1 ): - * ft = fil + salto - * ct = col + inc # <<<<<<<<<<<<<< - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - * t = FCpos(ft, ct) - */ - __pyx_v_ct = (__pyx_v_col + __pyx_v_inc); - - /* "LCEngineV1.pyx":182 - * ft = fil + salto - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): # <<<<<<<<<<<<<< - * t = FCpos(ft, ct) - * liX.append(t) - */ - __pyx_t_13 = ((__pyx_v_ft < 0) != 0); - if (!__pyx_t_13) { - } else { - __pyx_t_8 = __pyx_t_13; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_13 = ((__pyx_v_ft > 7) != 0); - if (!__pyx_t_13) { - } else { - __pyx_t_8 = __pyx_t_13; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_13 = ((__pyx_v_ct < 0) != 0); - if (!__pyx_t_13) { - } else { - __pyx_t_8 = __pyx_t_13; - goto __pyx_L10_bool_binop_done; - } - __pyx_t_13 = ((__pyx_v_ct > 7) != 0); - __pyx_t_8 = __pyx_t_13; - __pyx_L10_bool_binop_done:; - __pyx_t_13 = ((!__pyx_t_8) != 0); - if (__pyx_t_13) { - - /* "LCEngineV1.pyx":183 - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - * t = FCpos(ft, ct) # <<<<<<<<<<<<<< - * liX.append(t) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_FCpos); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_ft); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_ct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_10 = NULL; - __pyx_t_7 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - __pyx_t_7 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_2, __pyx_t_3}; - __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_14 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); - if (__pyx_t_10) { - __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); __pyx_t_10 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_7, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_7, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_14, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 183, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_9); - __pyx_t_9 = 0; - - /* "LCEngineV1.pyx":184 - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - * t = FCpos(ft, ct) - * liX.append(t) # <<<<<<<<<<<<<< - * - * return tuple(liM), tuple(liX) - */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_liX, __pyx_v_t); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 184, __pyx_L1_error) - - /* "LCEngineV1.pyx":182 - * ft = fil + salto - * ct = col + inc - * if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): # <<<<<<<<<<<<<< - * t = FCpos(ft, ct) - * liX.append(t) - */ - } - - /* "LCEngineV1.pyx":179 - * liM.append(sig2) - * - * for inc in ( +1, -1 ): # <<<<<<<<<<<<<< - * ft = fil + salto - * ct = col + inc - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":186 - * liX.append(t) - * - * return tuple(liM), tuple(liX) # <<<<<<<<<<<<<< - * - * dicK = {} - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_AsTuple(__pyx_v_liM); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyList_AsTuple(__pyx_v_liX); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); - __pyx_t_1 = 0; - __pyx_t_9 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_AddTraceback("LCEngineV1.liP", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_liM); - __Pyx_XDECREF(__pyx_v_liX); - __Pyx_XDECREF(__pyx_v_salto); - __Pyx_XDECREF(__pyx_v_sig); - __Pyx_XDECREF(__pyx_v_sig2); - __Pyx_XDECREF(__pyx_v_t); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":231 - * dicPB[i] = liP(i, False) - * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_23knightmoves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_23knightmoves = {"knightmoves", (PyCFunction)__pyx_pw_10LCEngineV1_23knightmoves, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_23knightmoves(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_a = 0; - PyObject *__pyx_v_b = 0; - PyObject *__pyx_v_no = 0; - PyObject *__pyx_v_nv = 0; - PyObject *__pyx_v_mx = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("knightmoves (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_a,&__pyx_n_s_b,&__pyx_n_s_no,&__pyx_n_s_nv,&__pyx_n_s_mx,0}; - PyObject* values[5] = {0,0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_a)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 1); __PYX_ERR(0, 231, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_no)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 2); __PYX_ERR(0, 231, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_nv)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 3); __PYX_ERR(0, 231, __pyx_L3_error) - } - case 4: - if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_mx)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, 4); __PYX_ERR(0, 231, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "knightmoves") < 0)) __PYX_ERR(0, 231, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - } - __pyx_v_a = values[0]; - __pyx_v_b = values[1]; - __pyx_v_no = values[2]; - __pyx_v_nv = values[3]; - __pyx_v_mx = values[4]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("knightmoves", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 231, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.knightmoves", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_22knightmoves(__pyx_self, __pyx_v_a, __pyx_v_b, __pyx_v_no, __pyx_v_nv, __pyx_v_mx); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_22knightmoves(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_no, PyObject *__pyx_v_nv, PyObject *__pyx_v_mx) { - PyObject *__pyx_v_lia = NULL; - PyObject *__pyx_v_lib = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_y = NULL; - PyObject *__pyx_v_nx = NULL; - PyObject *__pyx_v_f = NULL; - Py_ssize_t __pyx_v_xmin; - PyObject *__pyx_v_lidef = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - PyObject *(*__pyx_t_8)(PyObject *); - int __pyx_t_9; - int __pyx_t_10; - Py_ssize_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - PyObject *__pyx_t_13 = NULL; - PyObject *__pyx_t_14 = NULL; - int __pyx_t_15; - PyObject *__pyx_t_16 = NULL; - __Pyx_RefNannySetupContext("knightmoves", 0); - - /* "LCEngineV1.pyx":232 - * - * def knightmoves(a, b, no, nv, mx): - * if nv > mx: # <<<<<<<<<<<<<< - * return [] - * lia = liN(a) - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_nv, __pyx_v_mx, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":233 - * def knightmoves(a, b, no, nv, mx): - * if nv > mx: - * return [] # <<<<<<<<<<<<<< - * lia = liN(a) - * if b in lia: - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":232 - * - * def knightmoves(a, b, no, nv, mx): - * if nv > mx: # <<<<<<<<<<<<<< - * return [] - * lia = liN(a) - */ - } - - /* "LCEngineV1.pyx":234 - * if nv > mx: - * return [] - * lia = liN(a) # <<<<<<<<<<<<<< - * if b in lia: - * return [[a, b]] - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_a); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_a}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_v_a}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_a); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_lia = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":235 - * return [] - * lia = liN(a) - * if b in lia: # <<<<<<<<<<<<<< - * return [[a, b]] - * lib = liN(b) - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_b, __pyx_v_lia, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 235, __pyx_L1_error) - __pyx_t_6 = (__pyx_t_2 != 0); - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":236 - * lia = liN(a) - * if b in lia: - * return [[a, b]] # <<<<<<<<<<<<<< - * lib = liN(b) - * li = [] - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_b); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 236, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":235 - * return [] - * lia = liN(a) - * if b in lia: # <<<<<<<<<<<<<< - * return [[a, b]] - * lib = liN(b) - */ - } - - /* "LCEngineV1.pyx":237 - * if b in lia: - * return [[a, b]] - * lib = liN(b) # <<<<<<<<<<<<<< - * li = [] - * for x in lia: - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_b); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_b}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_b}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_b); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 237, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_lib = __pyx_t_3; - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":238 - * return [[a, b]] - * lib = liN(b) - * li = [] # <<<<<<<<<<<<<< - * for x in lia: - * if x not in no and x in lib: - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_li = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":239 - * lib = liN(b) - * li = [] - * for x in lia: # <<<<<<<<<<<<<< - * if x not in no and x in lib: - * li.append([a, x, b]) - */ - if (likely(PyList_CheckExact(__pyx_v_lia)) || PyTuple_CheckExact(__pyx_v_lia)) { - __pyx_t_3 = __pyx_v_lia; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lia); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 239, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 239, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 239, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 239, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":240 - * li = [] - * for x in lia: - * if x not in no and x in lib: # <<<<<<<<<<<<<< - * li.append([a, x, b]) - * if li: - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) - __pyx_t_9 = (__pyx_t_2 != 0); - if (__pyx_t_9) { - } else { - __pyx_t_6 = __pyx_t_9; - goto __pyx_L8_bool_binop_done; - } - __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_lib, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_9 != 0); - __pyx_t_6 = __pyx_t_2; - __pyx_L8_bool_binop_done:; - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":241 - * for x in lia: - * if x not in no and x in lib: - * li.append([a, x, b]) # <<<<<<<<<<<<<< - * if li: - * return li - */ - __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_v_x); - __Pyx_INCREF(__pyx_v_b); - __Pyx_GIVEREF(__pyx_v_b); - PyList_SET_ITEM(__pyx_t_1, 2, __pyx_v_b); - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":240 - * li = [] - * for x in lia: - * if x not in no and x in lib: # <<<<<<<<<<<<<< - * li.append([a, x, b]) - * if li: - */ - } - - /* "LCEngineV1.pyx":239 - * lib = liN(b) - * li = [] - * for x in lia: # <<<<<<<<<<<<<< - * if x not in no and x in lib: - * li.append([a, x, b]) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":242 - * if x not in no and x in lib: - * li.append([a, x, b]) - * if li: # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_6 = (__pyx_v_li != Py_None) && (PyList_GET_SIZE(__pyx_v_li) != 0); - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":243 - * li.append([a, x, b]) - * if li: - * return li # <<<<<<<<<<<<<< - * - * li = [] - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":242 - * if x not in no and x in lib: - * li.append([a, x, b]) - * if li: # <<<<<<<<<<<<<< - * return li - * - */ - } - - /* "LCEngineV1.pyx":245 - * return li - * - * li = [] # <<<<<<<<<<<<<< - * - * for x in lia: - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_li, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":247 - * li = [] - * - * for x in lia: # <<<<<<<<<<<<<< - * for y in lib: - * if x not in no and y not in no: - */ - if (likely(PyList_CheckExact(__pyx_v_lia)) || PyTuple_CheckExact(__pyx_v_lia)) { - __pyx_t_3 = __pyx_v_lia; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - __pyx_t_8 = NULL; - } else { - __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_lia); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 247, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_8)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 247, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_8(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 247, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":248 - * - * for x in lia: - * for y in lib: # <<<<<<<<<<<<<< - * if x not in no and y not in no: - * nx = no[:] - */ - if (likely(PyList_CheckExact(__pyx_v_lib)) || PyTuple_CheckExact(__pyx_v_lib)) { - __pyx_t_1 = __pyx_v_lib; __Pyx_INCREF(__pyx_t_1); __pyx_t_11 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_11 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_lib); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 248, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_11); __Pyx_INCREF(__pyx_t_4); __pyx_t_11++; if (unlikely(0 < 0)) __PYX_ERR(0, 248, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_11); __pyx_t_11++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_12(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 248, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_y, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":249 - * for x in lia: - * for y in lib: - * if x not in no and y not in no: # <<<<<<<<<<<<<< - * nx = no[:] - * nx.append(x) - */ - __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_v_x, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 249, __pyx_L1_error) - __pyx_t_9 = (__pyx_t_2 != 0); - if (__pyx_t_9) { - } else { - __pyx_t_6 = __pyx_t_9; - goto __pyx_L16_bool_binop_done; - } - __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_v_y, __pyx_v_no, Py_NE)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 249, __pyx_L1_error) - __pyx_t_2 = (__pyx_t_9 != 0); - __pyx_t_6 = __pyx_t_2; - __pyx_L16_bool_binop_done:; - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":250 - * for y in lib: - * if x not in no and y not in no: - * nx = no[:] # <<<<<<<<<<<<<< - * nx.append(x) - * nx.append(y) - */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_no, 0, 0, NULL, NULL, &__pyx_slice__23, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":251 - * if x not in no and y not in no: - * nx = no[:] - * nx.append(x) # <<<<<<<<<<<<<< - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) - */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_nx, __pyx_v_x); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 251, __pyx_L1_error) - - /* "LCEngineV1.pyx":252 - * nx = no[:] - * nx.append(x) - * nx.append(y) # <<<<<<<<<<<<<< - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: - */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_nx, __pyx_v_y); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 252, __pyx_L1_error) - - /* "LCEngineV1.pyx":253 - * nx.append(x) - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) # <<<<<<<<<<<<<< - * if f: - * li.extend(f) - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_13 = __Pyx_PyInt_AddObjC(__pyx_v_nv, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = NULL; - __pyx_t_15 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_14)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_14); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_15 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_v_x, __pyx_v_y, __pyx_v_nx, __pyx_t_13, __pyx_v_mx}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 5+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_v_x, __pyx_v_y, __pyx_v_nx, __pyx_t_13, __pyx_v_mx}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_15, 5+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } else - #endif - { - __pyx_t_16 = PyTuple_New(5+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_14) { - __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_14); __pyx_t_14 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_y); - __Pyx_INCREF(__pyx_v_nx); - __Pyx_GIVEREF(__pyx_v_nx); - PyTuple_SET_ITEM(__pyx_t_16, 2+__pyx_t_15, __pyx_v_nx); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_16, 3+__pyx_t_15, __pyx_t_13); - __Pyx_INCREF(__pyx_v_mx); - __Pyx_GIVEREF(__pyx_v_mx); - PyTuple_SET_ITEM(__pyx_t_16, 4+__pyx_t_15, __pyx_v_mx); - __pyx_t_13 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 253, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":254 - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: # <<<<<<<<<<<<<< - * li.extend(f) - * if not li: - */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_f); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 254, __pyx_L1_error) - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":255 - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: - * li.extend(f) # <<<<<<<<<<<<<< - * if not li: - * return li - */ - __pyx_t_10 = __Pyx_PyList_Extend(__pyx_v_li, __pyx_v_f); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 255, __pyx_L1_error) - - /* "LCEngineV1.pyx":254 - * nx.append(y) - * f = knightmoves(x, y, nx, nv + 1, mx) - * if f: # <<<<<<<<<<<<<< - * li.extend(f) - * if not li: - */ - } - - /* "LCEngineV1.pyx":249 - * for x in lia: - * for y in lib: - * if x not in no and y not in no: # <<<<<<<<<<<<<< - * nx = no[:] - * nx.append(x) - */ - } - - /* "LCEngineV1.pyx":248 - * - * for x in lia: - * for y in lib: # <<<<<<<<<<<<<< - * if x not in no and y not in no: - * nx = no[:] - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":247 - * li = [] - * - * for x in lia: # <<<<<<<<<<<<<< - * for y in lib: - * if x not in no and y not in no: - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":256 - * if f: - * li.extend(f) - * if not li: # <<<<<<<<<<<<<< - * return li - * xmin = 9999 - */ - __pyx_t_6 = (__pyx_v_li != Py_None) && (PyList_GET_SIZE(__pyx_v_li) != 0); - __pyx_t_2 = ((!__pyx_t_6) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":257 - * li.extend(f) - * if not li: - * return li # <<<<<<<<<<<<<< - * xmin = 9999 - * for x in li: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":256 - * if f: - * li.extend(f) - * if not li: # <<<<<<<<<<<<<< - * return li - * xmin = 9999 - */ - } - - /* "LCEngineV1.pyx":258 - * if not li: - * return li - * xmin = 9999 # <<<<<<<<<<<<<< - * for x in li: - * nx = len(x) - */ - __pyx_v_xmin = 0x270F; - - /* "LCEngineV1.pyx":259 - * return li - * xmin = 9999 - * for x in li: # <<<<<<<<<<<<<< - * nx = len(x) - * if nx < xmin: - */ - __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - for (;;) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_1); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 259, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":260 - * xmin = 9999 - * for x in li: - * nx = len(x) # <<<<<<<<<<<<<< - * if nx < xmin: - * xmin = nx - */ - __pyx_t_11 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 260, __pyx_L1_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XDECREF_SET(__pyx_v_nx, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":261 - * for x in li: - * nx = len(x) - * if nx < xmin: # <<<<<<<<<<<<<< - * xmin = nx - * lidef = [] - */ - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_xmin); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_RichCompare(__pyx_v_nx, __pyx_t_1, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 261, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":262 - * nx = len(x) - * if nx < xmin: - * xmin = nx # <<<<<<<<<<<<<< - * lidef = [] - * for x in li: - */ - __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_nx); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 262, __pyx_L1_error) - __pyx_v_xmin = __pyx_t_11; - - /* "LCEngineV1.pyx":261 - * for x in li: - * nx = len(x) - * if nx < xmin: # <<<<<<<<<<<<<< - * xmin = nx - * lidef = [] - */ - } - - /* "LCEngineV1.pyx":259 - * return li - * xmin = 9999 - * for x in li: # <<<<<<<<<<<<<< - * nx = len(x) - * if nx < xmin: - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":263 - * if nx < xmin: - * xmin = nx - * lidef = [] # <<<<<<<<<<<<<< - * for x in li: - * if len(x) == xmin: - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_lidef = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":264 - * xmin = nx - * lidef = [] - * for x in li: # <<<<<<<<<<<<<< - * if len(x) == xmin: - * x.insert(0, a) - */ - __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; - for (;;) { - if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_4); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 264, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":265 - * lidef = [] - * for x in li: - * if len(x) == xmin: # <<<<<<<<<<<<<< - * x.insert(0, a) - * x.append(b) - */ - __pyx_t_11 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 265, __pyx_L1_error) - __pyx_t_2 = ((__pyx_t_11 == __pyx_v_xmin) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":266 - * for x in li: - * if len(x) == xmin: - * x.insert(0, a) # <<<<<<<<<<<<<< - * x.append(b) - * lidef.append(x) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s_insert); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = NULL; - __pyx_t_15 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_15 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_int_0, __pyx_v_a}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_int_0, __pyx_v_a}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_15, 2+__pyx_t_15); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else - #endif - { - __pyx_t_16 = PyTuple_New(2+__pyx_t_15); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_16); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_16, 0+__pyx_t_15, __pyx_int_0); - __Pyx_INCREF(__pyx_v_a); - __Pyx_GIVEREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_16, 1+__pyx_t_15, __pyx_v_a); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_16, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 266, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":267 - * if len(x) == xmin: - * x.insert(0, a) - * x.append(b) # <<<<<<<<<<<<<< - * lidef.append(x) - * return lidef - */ - __pyx_t_10 = __Pyx_PyObject_Append(__pyx_v_x, __pyx_v_b); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 267, __pyx_L1_error) - - /* "LCEngineV1.pyx":268 - * x.insert(0, a) - * x.append(b) - * lidef.append(x) # <<<<<<<<<<<<<< - * return lidef - * - */ - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lidef, __pyx_v_x); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 268, __pyx_L1_error) - - /* "LCEngineV1.pyx":265 - * lidef = [] - * for x in li: - * if len(x) == xmin: # <<<<<<<<<<<<<< - * x.insert(0, a) - * x.append(b) - */ - } - - /* "LCEngineV1.pyx":264 - * xmin = nx - * lidef = [] - * for x in li: # <<<<<<<<<<<<<< - * if len(x) == xmin: - * x.insert(0, a) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":269 - * x.append(b) - * lidef.append(x) - * return lidef # <<<<<<<<<<<<<< - * - * def liNMinimo(x, y, celdas_ocupadas): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_lidef); - __pyx_r = __pyx_v_lidef; - goto __pyx_L0; - - /* "LCEngineV1.pyx":231 - * dicPB[i] = liP(i, False) - * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_14); - __Pyx_XDECREF(__pyx_t_16); - __Pyx_AddTraceback("LCEngineV1.knightmoves", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_lia); - __Pyx_XDECREF(__pyx_v_lib); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_y); - __Pyx_XDECREF(__pyx_v_nx); - __Pyx_XDECREF(__pyx_v_f); - __Pyx_XDECREF(__pyx_v_lidef); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":271 - * return lidef - * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_25liNMinimo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_25liNMinimo = {"liNMinimo", (PyCFunction)__pyx_pw_10LCEngineV1_25liNMinimo, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_25liNMinimo(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_x = 0; - PyObject *__pyx_v_y = 0; - PyObject *__pyx_v_celdas_ocupadas = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("liNMinimo (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_x,&__pyx_n_s_y,&__pyx_n_s_celdas_ocupadas,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_x)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_y)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, 1); __PYX_ERR(0, 271, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_celdas_ocupadas)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, 2); __PYX_ERR(0, 271, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "liNMinimo") < 0)) __PYX_ERR(0, 271, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_x = values[0]; - __pyx_v_y = values[1]; - __pyx_v_celdas_ocupadas = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("liNMinimo", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 271, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.liNMinimo", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_24liNMinimo(__pyx_self, __pyx_v_x, __pyx_v_y, __pyx_v_celdas_ocupadas); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_24liNMinimo(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_celdas_ocupadas) { - int __pyx_v_nv; - PyObject *__pyx_v_ot = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - __Pyx_RefNannySetupContext("liNMinimo", 0); - - /* "LCEngineV1.pyx":273 - * def liNMinimo(x, y, celdas_ocupadas): - * cdef int nv - * ot = celdas_ocupadas[:] # <<<<<<<<<<<<<< - * ot.extend([x, y]) - * nv = 1 - */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_celdas_ocupadas, 0, 0, NULL, NULL, &__pyx_slice__24, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_ot = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":274 - * cdef int nv - * ot = celdas_ocupadas[:] - * ot.extend([x, y]) # <<<<<<<<<<<<<< - * nv = 1 - * li = knightmoves(x, y, ot, 0, nv) - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ot, __pyx_n_s_extend); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyList_SET_ITEM(__pyx_t_3, 1, __pyx_v_y); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_4) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 274, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":275 - * ot = celdas_ocupadas[:] - * ot.extend([x, y]) - * nv = 1 # <<<<<<<<<<<<<< - * li = knightmoves(x, y, ot, 0, nv) - * while len(li) == 0: - */ - __pyx_v_nv = 1; - - /* "LCEngineV1.pyx":276 - * ot.extend([x, y]) - * nv = 1 - * li = knightmoves(x, y, ot, 0, nv) # <<<<<<<<<<<<<< - * while len(li) == 0: - * nv += 1 - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_nv); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_3, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_5}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } else - #endif - { - __pyx_t_4 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_y); - __Pyx_INCREF(__pyx_v_ot); - __Pyx_GIVEREF(__pyx_v_ot); - PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_6, __pyx_v_ot); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_6, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_6, __pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 276, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_li = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":277 - * nv = 1 - * li = knightmoves(x, y, ot, 0, nv) - * while len(li) == 0: # <<<<<<<<<<<<<< - * nv += 1 - * li = knightmoves(x, y, ot, 0, nv) - */ - while (1) { - __pyx_t_7 = PyObject_Length(__pyx_v_li); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 277, __pyx_L1_error) - __pyx_t_8 = ((__pyx_t_7 == 0) != 0); - if (!__pyx_t_8) break; - - /* "LCEngineV1.pyx":278 - * li = knightmoves(x, y, ot, 0, nv) - * while len(li) == 0: - * nv += 1 # <<<<<<<<<<<<<< - * li = knightmoves(x, y, ot, 0, nv) - * return li - */ - __pyx_v_nv = (__pyx_v_nv + 1); - - /* "LCEngineV1.pyx":279 - * while len(li) == 0: - * nv += 1 - * li = knightmoves(x, y, ot, 0, nv) # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_knightmoves); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_nv); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_v_x, __pyx_v_y, __pyx_v_ot, __pyx_int_0, __pyx_t_4}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 5+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } else - #endif - { - __pyx_t_3 = PyTuple_New(5+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_INCREF(__pyx_v_x); - __Pyx_GIVEREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_x); - __Pyx_INCREF(__pyx_v_y); - __Pyx_GIVEREF(__pyx_v_y); - PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_y); - __Pyx_INCREF(__pyx_v_ot); - __Pyx_GIVEREF(__pyx_v_ot); - PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_ot); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_3, 3+__pyx_t_6, __pyx_int_0); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_3, 4+__pyx_t_6, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 279, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF_SET(__pyx_v_li, __pyx_t_1); - __pyx_t_1 = 0; - } - - /* "LCEngineV1.pyx":280 - * nv += 1 - * li = knightmoves(x, y, ot, 0, nv) - * return li # <<<<<<<<<<<<<< - * - * def xpv2lipv(xpv): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":271 - * return lidef - * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("LCEngineV1.liNMinimo", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_ot); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":282 - * return li - * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_27xpv2lipv(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_27xpv2lipv = {"xpv2lipv", (PyCFunction)__pyx_pw_10LCEngineV1_27xpv2lipv, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_27xpv2lipv(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("xpv2lipv (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_26xpv2lipv(__pyx_self, ((PyObject *)__pyx_v_xpv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_26xpv2lipv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - PyObject *__pyx_v_li = NULL; - int __pyx_v_siBlancas; - PyObject *__pyx_v_c = NULL; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_move = NULL; - PyObject *__pyx_v_base = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - long __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - __Pyx_RefNannySetupContext("xpv2lipv", 0); - - /* "LCEngineV1.pyx":283 - * - * def xpv2lipv(xpv): - * li = [] # <<<<<<<<<<<<<< - * siBlancas = True - * for c in xpv: - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":284 - * def xpv2lipv(xpv): - * li = [] - * siBlancas = True # <<<<<<<<<<<<<< - * for c in xpv: - * x = ord(c) - */ - __pyx_v_siBlancas = 1; - - /* "LCEngineV1.pyx":285 - * li = [] - * siBlancas = True - * for c in xpv: # <<<<<<<<<<<<<< - * x = ord(c) - * if x >= 58: - */ - if (likely(PyList_CheckExact(__pyx_v_xpv)) || PyTuple_CheckExact(__pyx_v_xpv)) { - __pyx_t_1 = __pyx_v_xpv; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 285, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 285, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 285, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":286 - * siBlancas = True - * for c in xpv: - * x = ord(c) # <<<<<<<<<<<<<< - * if x >= 58: - * move = posA1(x - 58) - */ - __pyx_t_5 = __Pyx_PyObject_Ord(__pyx_v_c); if (unlikely(__pyx_t_5 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 286, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 286, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":287 - * for c in xpv: - * x = ord(c) - * if x >= 58: # <<<<<<<<<<<<<< - * move = posA1(x - 58) - * if siBlancas: - */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_x, __pyx_int_58, Py_GE); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 287, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 287, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":288 - * x = ord(c) - * if x >= 58: - * move = posA1(x - 58) # <<<<<<<<<<<<<< - * if siBlancas: - * base = move - */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_posA1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_SubtractObjC(__pyx_v_x, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_9) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_4); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 288, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":289 - * if x >= 58: - * move = posA1(x - 58) - * if siBlancas: # <<<<<<<<<<<<<< - * base = move - * else: - */ - __pyx_t_6 = (__pyx_v_siBlancas != 0); - if (__pyx_t_6) { - - /* "LCEngineV1.pyx":290 - * move = posA1(x - 58) - * if siBlancas: - * base = move # <<<<<<<<<<<<<< - * else: - * li.append(base + move) - */ - __Pyx_INCREF(__pyx_v_move); - __Pyx_XDECREF_SET(__pyx_v_base, __pyx_v_move); - - /* "LCEngineV1.pyx":289 - * if x >= 58: - * move = posA1(x - 58) - * if siBlancas: # <<<<<<<<<<<<<< - * base = move - * else: - */ - goto __pyx_L6; - } - - /* "LCEngineV1.pyx":292 - * base = move - * else: - * li.append(base + move) # <<<<<<<<<<<<<< - * siBlancas = not siBlancas - * else: - */ - /*else*/ { - if (unlikely(!__pyx_v_base)) { __Pyx_RaiseUnboundLocalError("base"); __PYX_ERR(0, 292, __pyx_L1_error) } - __pyx_t_4 = PyNumber_Add(__pyx_v_base, __pyx_v_move); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_4); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 292, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_L6:; - - /* "LCEngineV1.pyx":293 - * else: - * li.append(base + move) - * siBlancas = not siBlancas # <<<<<<<<<<<<<< - * else: - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") - */ - __pyx_v_siBlancas = (!(__pyx_v_siBlancas != 0)); - - /* "LCEngineV1.pyx":287 - * for c in xpv: - * x = ord(c) - * if x >= 58: # <<<<<<<<<<<<<< - * move = posA1(x - 58) - * if siBlancas: - */ - goto __pyx_L5; - } - - /* "LCEngineV1.pyx":295 - * siBlancas = not siBlancas - * else: - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") # <<<<<<<<<<<<<< - * li[-1] += c - * return li - */ - /*else*/ { - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_4, __pyx_int_50, __pyx_n_s_q) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_int_51, __pyx_n_s_r) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_int_52, __pyx_n_s_b) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_4, __pyx_int_53, __pyx_n_s_n) < 0) __PYX_ERR(0, 295, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyDict_GetItemDefault(__pyx_t_4, __pyx_v_x, __pyx_kp_s_); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 295, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_7); - __pyx_t_7 = 0; - - /* "LCEngineV1.pyx":296 - * else: - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") - * li[-1] += c # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_12 = -1L; - __pyx_t_7 = __Pyx_GetItemInt_List(__pyx_v_li, __pyx_t_12, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_7, __pyx_v_c); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(__Pyx_SetItemInt(__pyx_v_li, __pyx_t_12, __pyx_t_4, Py_ssize_t, 1, PyInt_FromSsize_t, 1, 1, 1) < 0)) __PYX_ERR(0, 296, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - __pyx_L5:; - - /* "LCEngineV1.pyx":285 - * li = [] - * siBlancas = True - * for c in xpv: # <<<<<<<<<<<<<< - * x = ord(c) - * if x >= 58: - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":297 - * c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") - * li[-1] += c - * return li # <<<<<<<<<<<<<< - * - * def xpv2pv(xpv): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":282 - * return li - * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("LCEngineV1.xpv2lipv", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_c); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_move); - __Pyx_XDECREF(__pyx_v_base); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":299 - * return li - * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_29xpv2pv(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_29xpv2pv = {"xpv2pv", (PyCFunction)__pyx_pw_10LCEngineV1_29xpv2pv, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_29xpv2pv(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("xpv2pv (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_28xpv2pv(__pyx_self, ((PyObject *)__pyx_v_xpv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_28xpv2pv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("xpv2pv", 0); - - /* "LCEngineV1.pyx":300 - * - * def xpv2pv(xpv): - * return " ".join(xpv2lipv(xpv)) # <<<<<<<<<<<<<< - * - * def pv2xpv(pv): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_xpv2lipv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_xpv); - __Pyx_GIVEREF(__pyx_v_xpv); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_xpv); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__25, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":299 - * return li - * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.xpv2pv", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":302 - * return " ".join(xpv2lipv(xpv)) - * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_31pv2xpv(PyObject *__pyx_self, PyObject *__pyx_v_pv); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_31pv2xpv = {"pv2xpv", (PyCFunction)__pyx_pw_10LCEngineV1_31pv2xpv, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_31pv2xpv(PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pv2xpv (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_30pv2xpv(__pyx_self, ((PyObject *)__pyx_v_pv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_30pv2xpv(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_lix = NULL; - PyObject *__pyx_v_move = NULL; - PyObject *__pyx_v_d = NULL; - PyObject *__pyx_v_h = NULL; - PyObject *__pyx_v_c = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; - __Pyx_RefNannySetupContext("pv2xpv", 0); - - /* "LCEngineV1.pyx":303 - * - * def pv2xpv(pv): - * if pv: # <<<<<<<<<<<<<< - * li = pv.split(" ") - * lix = [] - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pv); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 303, __pyx_L1_error) - if (__pyx_t_1) { - - /* "LCEngineV1.pyx":304 - * def pv2xpv(pv): - * if pv: - * li = pv.split(" ") # <<<<<<<<<<<<<< - * lix = [] - * for move in li: - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_pv, __pyx_n_s_split); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_li = __pyx_t_3; - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":305 - * if pv: - * li = pv.split(" ") - * lix = [] # <<<<<<<<<<<<<< - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_v_lix = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":306 - * li = pv.split(" ") - * lix = [] - * for move in li: # <<<<<<<<<<<<<< - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - */ - if (likely(PyList_CheckExact(__pyx_v_li)) || PyTuple_CheckExact(__pyx_v_li)) { - __pyx_t_3 = __pyx_v_li; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_li); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 306, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 306, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 306, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 306, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":307 - * lix = [] - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 # <<<<<<<<<<<<<< - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetSlice(__pyx_v_move, 0, 2, NULL, NULL, &__pyx_slice__27, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - if (!__pyx_t_8) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[2] = {__pyx_t_8, __pyx_t_7}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_7); - __pyx_t_7 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF_SET(__pyx_v_d, __pyx_t_6); - __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":308 - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) # <<<<<<<<<<<<<< - * c = move[4:] - * if c: - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_a1Pos); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = __Pyx_PyObject_GetSlice(__pyx_v_move, 2, 4, NULL, NULL, &__pyx_slice__28, 1, 1, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_7) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_9}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_AddObjC(__pyx_t_6, __pyx_int_58, 58, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_h, __pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":309 - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] # <<<<<<<<<<<<<< - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - */ - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_move, 4, 0, NULL, NULL, &__pyx_slice__29, 1, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":310 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] - * if c: # <<<<<<<<<<<<<< - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_c); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 310, __pyx_L1_error) - if (__pyx_t_1) { - - /* "LCEngineV1.pyx":311 - * c = move[4:] - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") # <<<<<<<<<<<<<< - * lix.append(d + h + c) - * return "".join(lix) - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_q, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_r, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_b, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_chr, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_n, __pyx_t_6) < 0) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (__pyx_t_9) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } else { - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 311, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_PyDict_GetItemDefault(__pyx_t_2, __pyx_t_6, __pyx_kp_s_); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF_SET(__pyx_v_c, __pyx_t_8); - __pyx_t_8 = 0; - - /* "LCEngineV1.pyx":310 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] - * if c: # <<<<<<<<<<<<<< - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) - */ - } - - /* "LCEngineV1.pyx":312 - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) # <<<<<<<<<<<<<< - * return "".join(lix) - * else: - */ - __pyx_t_8 = PyNumber_Add(__pyx_v_d, __pyx_v_h); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyNumber_Add(__pyx_t_8, __pyx_v_c); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_lix, __pyx_t_6); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 312, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":306 - * li = pv.split(" ") - * lix = [] - * for move in li: # <<<<<<<<<<<<<< - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":313 - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - * lix.append(d + h + c) - * return "".join(lix) # <<<<<<<<<<<<<< - * else: - * return "" - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_v_lix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 313, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":303 - * - * def pv2xpv(pv): - * if pv: # <<<<<<<<<<<<<< - * li = pv.split(" ") - * lix = [] - */ - } - - /* "LCEngineV1.pyx":315 - * return "".join(lix) - * else: - * return "" # <<<<<<<<<<<<<< - * - * def runFen( fen, depth, ms, level ): - */ - /*else*/ { - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_kp_s_); - __pyx_r = __pyx_kp_s_; - goto __pyx_L0; - } - - /* "LCEngineV1.pyx":302 - * return " ".join(xpv2lipv(xpv)) - * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("LCEngineV1.pv2xpv", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_lix); - __Pyx_XDECREF(__pyx_v_move); - __Pyx_XDECREF(__pyx_v_d); - __Pyx_XDECREF(__pyx_v_h); - __Pyx_XDECREF(__pyx_v_c); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":317 - * return "" - * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_33runFen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_33runFen = {"runFen", (PyCFunction)__pyx_pw_10LCEngineV1_33runFen, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_33runFen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fen = 0; - PyObject *__pyx_v_depth = 0; - PyObject *__pyx_v_ms = 0; - PyObject *__pyx_v_level = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("runFen (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fen,&__pyx_n_s_depth,&__pyx_n_s_ms,&__pyx_n_s_level,0}; - PyObject* values[4] = {0,0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fen)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_depth)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 1); __PYX_ERR(0, 317, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ms)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 2); __PYX_ERR(0, 317, __pyx_L3_error) - } - case 3: - if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_level)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, 3); __PYX_ERR(0, 317, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "runFen") < 0)) __PYX_ERR(0, 317, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - } - __pyx_v_fen = values[0]; - __pyx_v_depth = values[1]; - __pyx_v_ms = values[2]; - __pyx_v_level = values[3]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("runFen", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 317, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.runFen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_32runFen(__pyx_self, __pyx_v_fen, __pyx_v_depth, __pyx_v_ms, __pyx_v_level); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_32runFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_depth, PyObject *__pyx_v_ms, PyObject *__pyx_v_level) { - char *__pyx_v_x; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - char *__pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("runFen", 0); - - /* "LCEngineV1.pyx":318 - * - * def runFen( fen, depth, ms, level ): - * set_level(level) # <<<<<<<<<<<<<< - * x = playFen(fen, depth, ms) - * set_level(0) - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_level); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 318, __pyx_L1_error) - set_level(__pyx_t_1); - - /* "LCEngineV1.pyx":319 - * def runFen( fen, depth, ms, level ): - * set_level(level) - * x = playFen(fen, depth, ms) # <<<<<<<<<<<<<< - * set_level(0) - * return x - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_fen); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_depth); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_ms); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 319, __pyx_L1_error) - __pyx_v_x = playFen(__pyx_t_2, __pyx_t_1, __pyx_t_3); - - /* "LCEngineV1.pyx":320 - * set_level(level) - * x = playFen(fen, depth, ms) - * set_level(0) # <<<<<<<<<<<<<< - * return x - * - */ - set_level(0); - - /* "LCEngineV1.pyx":321 - * x = playFen(fen, depth, ms) - * set_level(0) - * return x # <<<<<<<<<<<<<< - * - * def setFen(fen): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_x); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 321, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":317 - * return "" - * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.runFen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":323 - * return x - * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_35setFen(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_35setFen = {"setFen", (PyCFunction)__pyx_pw_10LCEngineV1_35setFen, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_35setFen(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("setFen (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_34setFen(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_34setFen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - char *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - __Pyx_RefNannySetupContext("setFen", 0); - - /* "LCEngineV1.pyx":324 - * - * def setFen(fen): - * fen_board(fen) # <<<<<<<<<<<<<< - * return movegen() - * - */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_fen); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 324, __pyx_L1_error) - fen_board(__pyx_t_1); - - /* "LCEngineV1.pyx":325 - * def setFen(fen): - * fen_board(fen) - * return movegen() # <<<<<<<<<<<<<< - * - * def getFen(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int(movegen()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 325, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":323 - * return x - * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("LCEngineV1.setFen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":327 - * return movegen() - * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_37getFen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_37getFen = {"getFen", (PyCFunction)__pyx_pw_10LCEngineV1_37getFen, METH_NOARGS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_37getFen(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getFen (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_36getFen(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_36getFen(CYTHON_UNUSED PyObject *__pyx_self) { - char __pyx_v_fen[0x64]; - char *__pyx_v_x; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("getFen", 0); - - /* "LCEngineV1.pyx":329 - * def getFen(): - * cdef char fen[100] - * board_fen(fen) # <<<<<<<<<<<<<< - * x = fen - * return x - */ - board_fen(__pyx_v_fen); - - /* "LCEngineV1.pyx":330 - * cdef char fen[100] - * board_fen(fen) - * x = fen # <<<<<<<<<<<<<< - * return x - * - */ - __pyx_v_x = __pyx_v_fen; - - /* "LCEngineV1.pyx":331 - * board_fen(fen) - * x = fen - * return x # <<<<<<<<<<<<<< - * - * def getMoves(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 331, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":327 - * return movegen() - * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.getFen", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":333 - * return x - * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_39getMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_39getMoves = {"getMoves", (PyCFunction)__pyx_pw_10LCEngineV1_39getMoves, METH_NOARGS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_39getMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getMoves (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_38getMoves(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_38getMoves(CYTHON_UNUSED PyObject *__pyx_self) { - char __pyx_v_pv[10]; - int __pyx_v_nmoves; - int __pyx_v_x; - int __pyx_v_nbase; - PyObject *__pyx_v_li = NULL; - char *__pyx_v_r; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - int __pyx_t_4; - __Pyx_RefNannySetupContext("getMoves", 0); - - /* "LCEngineV1.pyx":336 - * cdef char pv[10] - * cdef int nmoves, x, nbase - * nmoves = numMoves() # <<<<<<<<<<<<<< - * - * nbase = numBaseMove() - */ - __pyx_v_nmoves = numMoves(); - - /* "LCEngineV1.pyx":338 - * nmoves = numMoves() - * - * nbase = numBaseMove() # <<<<<<<<<<<<<< - * li = [] - * for x in range(nmoves): - */ - __pyx_v_nbase = numBaseMove(); - - /* "LCEngineV1.pyx":339 - * - * nbase = numBaseMove() - * li = [] # <<<<<<<<<<<<<< - * for x in range(nmoves): - * getMove(x+nbase, pv) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 339, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":340 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * getMove(x+nbase, pv) - * r = pv - */ - __pyx_t_2 = __pyx_v_nmoves; - for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { - __pyx_v_x = __pyx_t_3; - - /* "LCEngineV1.pyx":341 - * li = [] - * for x in range(nmoves): - * getMove(x+nbase, pv) # <<<<<<<<<<<<<< - * r = pv - * li.append(r) - */ - getMove((__pyx_v_x + __pyx_v_nbase), __pyx_v_pv); - - /* "LCEngineV1.pyx":342 - * for x in range(nmoves): - * getMove(x+nbase, pv) - * r = pv # <<<<<<<<<<<<<< - * li.append(r) - * return li - */ - __pyx_v_r = __pyx_v_pv; - - /* "LCEngineV1.pyx":343 - * getMove(x+nbase, pv) - * r = pv - * li.append(r) # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_li, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 343, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - - /* "LCEngineV1.pyx":344 - * r = pv - * li.append(r) - * return li # <<<<<<<<<<<<<< - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":333 - * return x - * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.getMoves", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":346 - * return li - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< - * cdef char san[10] - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_41getPGN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_41getPGN = {"getPGN", (PyCFunction)__pyx_pw_10LCEngineV1_41getPGN, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_41getPGN(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_desdeA1H8 = 0; - PyObject *__pyx_v_hastaA1H8 = 0; - PyObject *__pyx_v_coronacion = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getPGN (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_desdeA1H8,&__pyx_n_s_hastaA1H8,&__pyx_n_s_coronacion,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_desdeA1H8)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hastaA1H8)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, 1); __PYX_ERR(0, 346, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, 2); __PYX_ERR(0, 346, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getPGN") < 0)) __PYX_ERR(0, 346, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_desdeA1H8 = values[0]; - __pyx_v_hastaA1H8 = values[1]; - __pyx_v_coronacion = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getPGN", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 346, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.getPGN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_40getPGN(__pyx_self, __pyx_v_desdeA1H8, __pyx_v_hastaA1H8, __pyx_v_coronacion); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_40getPGN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desdeA1H8, PyObject *__pyx_v_hastaA1H8, PyObject *__pyx_v_coronacion) { - char __pyx_v_san[10]; - int __pyx_v_num; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - char *__pyx_t_3; - char *__pyx_t_4; - char *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("getPGN", 0); - __Pyx_INCREF(__pyx_v_coronacion); - - /* "LCEngineV1.pyx":349 - * cdef char san[10] - * - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 349, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":350 - * - * if not coronacion: - * coronacion = "" # <<<<<<<<<<<<<< - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - */ - __Pyx_INCREF(__pyx_kp_s_); - __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); - - /* "LCEngineV1.pyx":349 - * cdef char san[10] - * - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * - */ - } - - /* "LCEngineV1.pyx":352 - * coronacion = "" - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) # <<<<<<<<<<<<<< - * if num == -1: - * return None - */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_desdeA1H8); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_hastaA1H8); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 352, __pyx_L1_error) - __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); - - /* "LCEngineV1.pyx":353 - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_2 = ((__pyx_v_num == -1L) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":354 - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - * if num == -1: - * return None # <<<<<<<<<<<<<< - * - * toSan(num, san) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - /* "LCEngineV1.pyx":353 - * - * num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return None - * - */ - } - - /* "LCEngineV1.pyx":356 - * return None - * - * toSan(num, san) # <<<<<<<<<<<<<< - * return san - * - */ - toSan(__pyx_v_num, __pyx_v_san); - - /* "LCEngineV1.pyx":357 - * - * toSan(num, san) - * return san # <<<<<<<<<<<<<< - * - * def xpv2pgn(xpv): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 357, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_r = __pyx_t_6; - __pyx_t_6 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":346 - * return li - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< - * cdef char san[10] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("LCEngineV1.getPGN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_coronacion); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":359 - * return san - * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_43xpv2pgn(PyObject *__pyx_self, PyObject *__pyx_v_xpv); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_43xpv2pgn = {"xpv2pgn", (PyCFunction)__pyx_pw_10LCEngineV1_43xpv2pgn, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_43xpv2pgn(PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("xpv2pgn (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_42xpv2pgn(__pyx_self, ((PyObject *)__pyx_v_xpv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_42xpv2pgn(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_xpv) { - char __pyx_v_san[10]; - int __pyx_v_siW; - PyObject *__pyx_v_num = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_tam = NULL; - PyObject *__pyx_v_pv = NULL; - PyObject *__pyx_v_x = NULL; - int __pyx_v_numMove; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - char *__pyx_t_10; - char *__pyx_t_11; - char *__pyx_t_12; - __Pyx_RefNannySetupContext("xpv2pgn", 0); - - /* "LCEngineV1.pyx":361 - * def xpv2pgn(xpv): - * cdef char san[10] - * setFenInicial() # <<<<<<<<<<<<<< - * siW = True - * num = 1 - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFenInicial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 361, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":362 - * cdef char san[10] - * setFenInicial() - * siW = True # <<<<<<<<<<<<<< - * num = 1 - * li = [] - */ - __pyx_v_siW = 1; - - /* "LCEngineV1.pyx":363 - * setFenInicial() - * siW = True - * num = 1 # <<<<<<<<<<<<<< - * li = [] - * tam = 0 - */ - __Pyx_INCREF(__pyx_int_1); - __pyx_v_num = __pyx_int_1; - - /* "LCEngineV1.pyx":364 - * siW = True - * num = 1 - * li = [] # <<<<<<<<<<<<<< - * tam = 0 - * for pv in xpv2lipv(xpv): - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 364, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":365 - * num = 1 - * li = [] - * tam = 0 # <<<<<<<<<<<<<< - * for pv in xpv2lipv(xpv): - * if siW: - */ - __Pyx_INCREF(__pyx_int_0); - __pyx_v_tam = __pyx_int_0; - - /* "LCEngineV1.pyx":366 - * li = [] - * tam = 0 - * for pv in xpv2lipv(xpv): # <<<<<<<<<<<<<< - * if siW: - * x = str(num)+"." - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_xpv2lipv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_xpv); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_xpv}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_xpv); - __Pyx_GIVEREF(__pyx_v_xpv); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_xpv); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 366, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 366, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 366, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 366, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_pv, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":367 - * tam = 0 - * for pv in xpv2lipv(xpv): - * if siW: # <<<<<<<<<<<<<< - * x = str(num)+"." - * tam += len(x) - */ - __pyx_t_7 = (__pyx_v_siW != 0); - if (__pyx_t_7) { - - /* "LCEngineV1.pyx":368 - * for pv in xpv2lipv(xpv): - * if siW: - * x = str(num)+"." # <<<<<<<<<<<<<< - * tam += len(x) - * li.append(x) - */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_num); - __Pyx_GIVEREF(__pyx_v_num); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_num); - __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__34); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 368, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":369 - * if siW: - * x = str(num)+"." - * tam += len(x) # <<<<<<<<<<<<<< - * li.append(x) - * num += 1 - */ - __pyx_t_8 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 369, __pyx_L1_error) - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_tam, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 369, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":370 - * x = str(num)+"." - * tam += len(x) - * li.append(x) # <<<<<<<<<<<<<< - * num += 1 - * siW = not siW - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_x); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 370, __pyx_L1_error) - - /* "LCEngineV1.pyx":371 - * tam += len(x) - * li.append(x) - * num += 1 # <<<<<<<<<<<<<< - * siW = not siW - * - */ - __pyx_t_4 = __Pyx_PyInt_AddObjC(__pyx_v_num, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 371, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF_SET(__pyx_v_num, __pyx_t_4); - __pyx_t_4 = 0; - - /* "LCEngineV1.pyx":367 - * tam = 0 - * for pv in xpv2lipv(xpv): - * if siW: # <<<<<<<<<<<<<< - * x = str(num)+"." - * tam += len(x) - */ - } - - /* "LCEngineV1.pyx":372 - * li.append(x) - * num += 1 - * siW = not siW # <<<<<<<<<<<<<< - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - */ - __pyx_v_siW = (!(__pyx_v_siW != 0)); - - /* "LCEngineV1.pyx":374 - * siW = not siW - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) # <<<<<<<<<<<<<< - * if numMove == -1: - * break - */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 0, 2, NULL, NULL, &__pyx_slice__35, 0, 1, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_t_4); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 2, 4, NULL, NULL, &__pyx_slice__36, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_pv, 4, 0, NULL, NULL, &__pyx_slice__37, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 374, __pyx_L1_error) - __pyx_v_numMove = searchMove(__pyx_t_10, __pyx_t_11, __pyx_t_12); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":375 - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - * if numMove == -1: # <<<<<<<<<<<<<< - * break - * toSan(numMove, san) - */ - __pyx_t_7 = ((__pyx_v_numMove == -1L) != 0); - if (__pyx_t_7) { - - /* "LCEngineV1.pyx":376 - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - * if numMove == -1: - * break # <<<<<<<<<<<<<< - * toSan(numMove, san) - * x = str(san) - */ - goto __pyx_L4_break; - - /* "LCEngineV1.pyx":375 - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - * if numMove == -1: # <<<<<<<<<<<<<< - * break - * toSan(numMove, san) - */ - } - - /* "LCEngineV1.pyx":377 - * if numMove == -1: - * break - * toSan(numMove, san) # <<<<<<<<<<<<<< - * x = str(san) - * li.append(x) - */ - toSan(__pyx_v_numMove, __pyx_v_san); - - /* "LCEngineV1.pyx":378 - * break - * toSan(numMove, san) - * x = str(san) # <<<<<<<<<<<<<< - * li.append(x) - * tam += len(x) - */ - __pyx_t_3 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 378, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":379 - * toSan(numMove, san) - * x = str(san) - * li.append(x) # <<<<<<<<<<<<<< - * tam += len(x) - * if tam >= 80: - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_x); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 379, __pyx_L1_error) - - /* "LCEngineV1.pyx":380 - * x = str(san) - * li.append(x) - * tam += len(x) # <<<<<<<<<<<<<< - * if tam >= 80: - * li.append("\n") - */ - __pyx_t_8 = PyObject_Length(__pyx_v_x); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 380, __pyx_L1_error) - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_tam, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":381 - * li.append(x) - * tam += len(x) - * if tam >= 80: # <<<<<<<<<<<<<< - * li.append("\n") - * tam = 0 - */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_tam, __pyx_int_80, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 381, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_7) { - - /* "LCEngineV1.pyx":382 - * tam += len(x) - * if tam >= 80: - * li.append("\n") # <<<<<<<<<<<<<< - * tam = 0 - * else: - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_kp_s__38); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 382, __pyx_L1_error) - - /* "LCEngineV1.pyx":383 - * if tam >= 80: - * li.append("\n") - * tam = 0 # <<<<<<<<<<<<<< - * else: - * li.append(" ") - */ - __Pyx_INCREF(__pyx_int_0); - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_int_0); - - /* "LCEngineV1.pyx":381 - * li.append(x) - * tam += len(x) - * if tam >= 80: # <<<<<<<<<<<<<< - * li.append("\n") - * tam = 0 - */ - goto __pyx_L7; - } - - /* "LCEngineV1.pyx":385 - * tam = 0 - * else: - * li.append(" ") # <<<<<<<<<<<<<< - * tam += 1 - * make_nummove(numMove) - */ - /*else*/ { - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_kp_s__25); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 385, __pyx_L1_error) - - /* "LCEngineV1.pyx":386 - * else: - * li.append(" ") - * tam += 1 # <<<<<<<<<<<<<< - * make_nummove(numMove) - * return "".join(li) - */ - __pyx_t_1 = __Pyx_PyInt_AddObjC(__pyx_v_tam, __pyx_int_1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 386, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF_SET(__pyx_v_tam, __pyx_t_1); - __pyx_t_1 = 0; - } - __pyx_L7:; - - /* "LCEngineV1.pyx":387 - * li.append(" ") - * tam += 1 - * make_nummove(numMove) # <<<<<<<<<<<<<< - * return "".join(li) - * - */ - make_nummove(__pyx_v_numMove); - - /* "LCEngineV1.pyx":366 - * li = [] - * tam = 0 - * for pv in xpv2lipv(xpv): # <<<<<<<<<<<<<< - * if siW: - * x = str(num)+"." - */ - } - __pyx_L4_break:; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":388 - * tam += 1 - * make_nummove(numMove) - * return "".join(li) # <<<<<<<<<<<<<< - * - * def isCheck(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s_, __pyx_v_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 388, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":359 - * return san - * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.xpv2pgn", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_num); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_tam); - __Pyx_XDECREF(__pyx_v_pv); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":390 - * return "".join(li) - * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_45isCheck(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_45isCheck = {"isCheck", (PyCFunction)__pyx_pw_10LCEngineV1_45isCheck, METH_NOARGS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_45isCheck(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isCheck (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_44isCheck(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_44isCheck(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("isCheck", 0); - - /* "LCEngineV1.pyx":391 - * - * def isCheck(): - * return inCheck() # <<<<<<<<<<<<<< - * - * class InfoMove(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_char(inCheck()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":390 - * return "".join(li) - * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.isCheck", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":394 - * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_1__init__ = {"__init__", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_num = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_num,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 394, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 394, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_num = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 394, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.InfoMove.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove___init__(__pyx_self, __pyx_v_self, __pyx_v_num); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_num) { - char __pyx_v_pv[10]; - char __pyx_v_info[10]; - char __pyx_v_san[10]; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "LCEngineV1.pyx":399 - * cdef char san[10] - * - * getMove(num, pv) # <<<<<<<<<<<<<< - * getMoveEx(num, info) - * toSan(num, san) - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 399, __pyx_L1_error) - getMove(__pyx_t_1, __pyx_v_pv); - - /* "LCEngineV1.pyx":400 - * - * getMove(num, pv) - * getMoveEx(num, info) # <<<<<<<<<<<<<< - * toSan(num, san) - * - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 400, __pyx_L1_error) - getMoveEx(__pyx_t_1, __pyx_v_info); - - /* "LCEngineV1.pyx":401 - * getMove(num, pv) - * getMoveEx(num, info) - * toSan(num, san) # <<<<<<<<<<<<<< - * - * # info = P a1 h8 q [K|Q|] - */ - __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_num); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 401, __pyx_L1_error) - toSan(__pyx_t_1, __pyx_v_san); - - /* "LCEngineV1.pyx":405 - * # info = P a1 h8 q [K|Q|] - * - * self._castle_K = info[6] == "K" # <<<<<<<<<<<<<< - * self._castle_Q = info[6] == "Q" - * self._ep = info[7]=="E" - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[6]) == 'K')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_castle_K, __pyx_t_2) < 0) __PYX_ERR(0, 405, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":406 - * - * self._castle_K = info[6] == "K" - * self._castle_Q = info[6] == "Q" # <<<<<<<<<<<<<< - * self._ep = info[7]=="E" - * self._pv = pv - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[6]) == 'Q')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 406, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_castle_Q, __pyx_t_2) < 0) __PYX_ERR(0, 406, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":407 - * self._castle_K = info[6] == "K" - * self._castle_Q = info[6] == "Q" - * self._ep = info[7]=="E" # <<<<<<<<<<<<<< - * self._pv = pv - * self._san = san - */ - __pyx_t_2 = __Pyx_PyBool_FromLong(((__pyx_v_info[7]) == 'E')); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_ep, __pyx_t_2) < 0) __PYX_ERR(0, 407, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":408 - * self._castle_Q = info[6] == "Q" - * self._ep = info[7]=="E" - * self._pv = pv # <<<<<<<<<<<<<< - * self._san = san - * - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_pv); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pv, __pyx_t_2) < 0) __PYX_ERR(0, 408, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":409 - * self._ep = info[7]=="E" - * self._pv = pv - * self._san = san # <<<<<<<<<<<<<< - * - * self._piece = info[0:1] - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_san, __pyx_t_2) < 0) __PYX_ERR(0, 409, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":411 - * self._san = san - * - * self._piece = info[0:1] # <<<<<<<<<<<<<< - * self._from = info[1:3] - * self._to = info[3:5] - */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 0, 1 - 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_piece, __pyx_t_2) < 0) __PYX_ERR(0, 411, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":412 - * - * self._piece = info[0:1] - * self._from = info[1:3] # <<<<<<<<<<<<<< - * self._to = info[3:5] - * self._promotion = info[5:6].strip() - */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 1, 3 - 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_from, __pyx_t_2) < 0) __PYX_ERR(0, 412, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":413 - * self._piece = info[0:1] - * self._from = info[1:3] - * self._to = info[3:5] # <<<<<<<<<<<<<< - * self._promotion = info[5:6].strip() - * self._check = "+" in san - */ - __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 3, 5 - 3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_to, __pyx_t_2) < 0) __PYX_ERR(0, 413, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":414 - * self._from = info[1:3] - * self._to = info[3:5] - * self._promotion = info[5:6].strip() # <<<<<<<<<<<<<< - * self._check = "+" in san - * self._mate = "#" in san - */ - __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_info) + 5, 6 - 5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_strip); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_3) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_promotion, __pyx_t_2) < 0) __PYX_ERR(0, 414, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":415 - * self._to = info[3:5] - * self._promotion = info[5:6].strip() - * self._check = "+" in san # <<<<<<<<<<<<<< - * self._mate = "#" in san - * self._capture = "x" in san - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__39, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_check, __pyx_t_2) < 0) __PYX_ERR(0, 415, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":416 - * self._promotion = info[5:6].strip() - * self._check = "+" in san - * self._mate = "#" in san # <<<<<<<<<<<<<< - * self._capture = "x" in san - * - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_kp_s__40, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_mate, __pyx_t_2) < 0) __PYX_ERR(0, 416, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":417 - * self._check = "+" in san - * self._mate = "#" in san - * self._capture = "x" in san # <<<<<<<<<<<<<< - * - * def desde(self): - */ - __pyx_t_2 = __Pyx_PyObject_FromString(__pyx_v_san); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_x, __pyx_t_2, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_capture, __pyx_t_2) < 0) __PYX_ERR(0, 417, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":394 - * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.InfoMove.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":419 - * self._capture = "x" in san - * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_3desde(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_3desde = {"desde", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_3desde, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_3desde(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("desde (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_2desde(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_2desde(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("desde", 0); - - /* "LCEngineV1.pyx":420 - * - * def desde(self): - * return self._from # <<<<<<<<<<<<<< - * - * def hasta(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_from); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 420, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":419 - * self._capture = "x" in san - * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.desde", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":422 - * return self._from - * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_5hasta(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_5hasta = {"hasta", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_5hasta, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_5hasta(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("hasta (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_4hasta(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_4hasta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("hasta", 0); - - /* "LCEngineV1.pyx":423 - * - * def hasta(self): - * return self._to # <<<<<<<<<<<<<< - * - * def coronacion(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 423, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":422 - * return self._from - * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.hasta", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":425 - * return self._to - * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_7coronacion(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_7coronacion = {"coronacion", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_7coronacion, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_7coronacion(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("coronacion (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_6coronacion(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_6coronacion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - __Pyx_RefNannySetupContext("coronacion", 0); - - /* "LCEngineV1.pyx":426 - * - * def coronacion(self): - * return self._promotion.lower() # <<<<<<<<<<<<<< - * - * def movimiento(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_promotion); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_lower); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (__pyx_t_2) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 426, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":425 - * return self._to - * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("LCEngineV1.InfoMove.coronacion", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":428 - * return self._promotion.lower() - * - * def movimiento(self): # <<<<<<<<<<<<<< - * return self._from+self._to+self._promotion.lower() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_9movimiento(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_9movimiento = {"movimiento", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_9movimiento, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_9movimiento(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("movimiento (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_8movimiento(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_8movimiento(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("movimiento", 0); - - /* "LCEngineV1.pyx":429 - * - * def movimiento(self): - * return self._from+self._to+self._promotion.lower() # <<<<<<<<<<<<<< - * - * def jaque(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_from); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_to); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_promotion); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_lower); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_1)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_1) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 429, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":428 - * return self._promotion.lower() - * - * def movimiento(self): # <<<<<<<<<<<<<< - * return self._from+self._to+self._promotion.lower() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.InfoMove.movimiento", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":431 - * return self._from+self._to+self._promotion.lower() - * - * def jaque(self): # <<<<<<<<<<<<<< - * return self._check - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_11jaque(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_11jaque = {"jaque", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_11jaque, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_11jaque(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("jaque (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_10jaque(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_10jaque(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("jaque", 0); - - /* "LCEngineV1.pyx":432 - * - * def jaque(self): - * return self._check # <<<<<<<<<<<<<< - * - * def mate(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_check); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 432, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":431 - * return self._from+self._to+self._promotion.lower() - * - * def jaque(self): # <<<<<<<<<<<<<< - * return self._check - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.jaque", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":434 - * return self._check - * - * def mate(self): # <<<<<<<<<<<<<< - * return self._mate - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_13mate(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_13mate = {"mate", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_13mate, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_13mate(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("mate (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_12mate(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_12mate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("mate", 0); - - /* "LCEngineV1.pyx":435 - * - * def mate(self): - * return self._mate # <<<<<<<<<<<<<< - * - * def captura(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_mate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 435, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":434 - * return self._check - * - * def mate(self): # <<<<<<<<<<<<<< - * return self._mate - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.mate", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":437 - * return self._mate - * - * def captura(self): # <<<<<<<<<<<<<< - * return self._capture - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_15captura(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_15captura = {"captura", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_15captura, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_15captura(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("captura (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_14captura(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_14captura(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("captura", 0); - - /* "LCEngineV1.pyx":438 - * - * def captura(self): - * return self._capture # <<<<<<<<<<<<<< - * - * def pieza(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_capture); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 438, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":437 - * return self._mate - * - * def captura(self): # <<<<<<<<<<<<<< - * return self._capture - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.captura", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":440 - * return self._capture - * - * def pieza(self): # <<<<<<<<<<<<<< - * return self._piece - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_17pieza(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_17pieza = {"pieza", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_17pieza, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_17pieza(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("pieza (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_16pieza(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_16pieza(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("pieza", 0); - - /* "LCEngineV1.pyx":441 - * - * def pieza(self): - * return self._piece # <<<<<<<<<<<<<< - * - * def isCastleK(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_piece); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 441, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":440 - * return self._capture - * - * def pieza(self): # <<<<<<<<<<<<<< - * return self._piece - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.pieza", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":443 - * return self._piece - * - * def isCastleK(self): # <<<<<<<<<<<<<< - * return self._castle_K - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_19isCastleK(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_19isCastleK = {"isCastleK", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_19isCastleK, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_19isCastleK(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isCastleK (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_18isCastleK(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_18isCastleK(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("isCastleK", 0); - - /* "LCEngineV1.pyx":444 - * - * def isCastleK(self): - * return self._castle_K # <<<<<<<<<<<<<< - * - * def isCastleQ(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_castle_K); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 444, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":443 - * return self._piece - * - * def isCastleK(self): # <<<<<<<<<<<<<< - * return self._castle_K - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.isCastleK", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":446 - * return self._castle_K - * - * def isCastleQ(self): # <<<<<<<<<<<<<< - * return self._castle_Q - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_21isCastleQ(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_21isCastleQ = {"isCastleQ", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_21isCastleQ, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_21isCastleQ(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isCastleQ (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_20isCastleQ(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_20isCastleQ(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("isCastleQ", 0); - - /* "LCEngineV1.pyx":447 - * - * def isCastleQ(self): - * return self._castle_Q # <<<<<<<<<<<<<< - * - * def isEnPassant(self): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_castle_Q); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 447, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":446 - * return self._castle_K - * - * def isCastleQ(self): # <<<<<<<<<<<<<< - * return self._castle_Q - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.isCastleQ", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":449 - * return self._castle_Q - * - * def isEnPassant(self): # <<<<<<<<<<<<<< - * return self._ep - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_23isEnPassant(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_8InfoMove_23isEnPassant = {"isEnPassant", (PyCFunction)__pyx_pw_10LCEngineV1_8InfoMove_23isEnPassant, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_8InfoMove_23isEnPassant(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("isEnPassant (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_8InfoMove_22isEnPassant(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_8InfoMove_22isEnPassant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("isEnPassant", 0); - - /* "LCEngineV1.pyx":450 - * - * def isEnPassant(self): - * return self._ep # <<<<<<<<<<<<<< - * - * def getExMoves(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_ep); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 450, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":449 - * return self._castle_Q - * - * def isEnPassant(self): # <<<<<<<<<<<<<< - * return self._ep - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.InfoMove.isEnPassant", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":452 - * return self._ep - * - * def getExMoves(): # <<<<<<<<<<<<<< - * nmoves = numMoves() - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_47getExMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_47getExMoves = {"getExMoves", (PyCFunction)__pyx_pw_10LCEngineV1_47getExMoves, METH_NOARGS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_47getExMoves(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getExMoves (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_46getExMoves(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_46getExMoves(CYTHON_UNUSED PyObject *__pyx_self) { - int __pyx_v_nmoves; - PyObject *__pyx_v_nbase = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_mv = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - __Pyx_RefNannySetupContext("getExMoves", 0); - - /* "LCEngineV1.pyx":453 - * - * def getExMoves(): - * nmoves = numMoves() # <<<<<<<<<<<<<< - * - * nbase = numBaseMove() - */ - __pyx_v_nmoves = numMoves(); - - /* "LCEngineV1.pyx":455 - * nmoves = numMoves() - * - * nbase = numBaseMove() # <<<<<<<<<<<<<< - * li = [] - * for x in range(nmoves): - */ - __pyx_t_1 = __Pyx_PyInt_From_int(numBaseMove()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 455, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_nbase = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":456 - * - * nbase = numBaseMove() - * li = [] # <<<<<<<<<<<<<< - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 456, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":457 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * mv = InfoMove(x + nbase) - * li.append(mv) - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmoves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 457, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 457, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 457, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 457, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":458 - * li = [] - * for x in range(nmoves): - * mv = InfoMove(x + nbase) # <<<<<<<<<<<<<< - * li.append(mv) - * return li - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyNumber_Add(__pyx_v_x, __pyx_v_nbase); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 458, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_mv, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":459 - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - * li.append(mv) # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_mv); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 459, __pyx_L1_error) - - /* "LCEngineV1.pyx":457 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * mv = InfoMove(x + nbase) - * li.append(mv) - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":460 - * mv = InfoMove(x + nbase) - * li.append(mv) - * return li # <<<<<<<<<<<<<< - * - * def moveExPV(desde, hasta, coronacion): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":452 - * return self._ep - * - * def getExMoves(): # <<<<<<<<<<<<<< - * nmoves = numMoves() - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("LCEngineV1.getExMoves", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_nbase); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_mv); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":462 - * return li - * - * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_49moveExPV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_49moveExPV = {"moveExPV", (PyCFunction)__pyx_pw_10LCEngineV1_49moveExPV, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_49moveExPV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_desde = 0; - PyObject *__pyx_v_hasta = 0; - PyObject *__pyx_v_coronacion = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("moveExPV (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_desde,&__pyx_n_s_hasta,&__pyx_n_s_coronacion,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_desde)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hasta)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, 1); __PYX_ERR(0, 462, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, 2); __PYX_ERR(0, 462, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "moveExPV") < 0)) __PYX_ERR(0, 462, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_desde = values[0]; - __pyx_v_hasta = values[1]; - __pyx_v_coronacion = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("moveExPV", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 462, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.moveExPV", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_48moveExPV(__pyx_self, __pyx_v_desde, __pyx_v_hasta, __pyx_v_coronacion); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_48moveExPV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion) { - int __pyx_v_num; - PyObject *__pyx_v_infoMove = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - char *__pyx_t_3; - char *__pyx_t_4; - char *__pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - __Pyx_RefNannySetupContext("moveExPV", 0); - __Pyx_INCREF(__pyx_v_coronacion); - - /* "LCEngineV1.pyx":463 - * - * def moveExPV(desde, hasta, coronacion): - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 463, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":464 - * def moveExPV(desde, hasta, coronacion): - * if not coronacion: - * coronacion = "" # <<<<<<<<<<<<<< - * - * num = searchMove( desde, hasta, coronacion ) - */ - __Pyx_INCREF(__pyx_kp_s_); - __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); - - /* "LCEngineV1.pyx":463 - * - * def moveExPV(desde, hasta, coronacion): - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * - */ - } - - /* "LCEngineV1.pyx":466 - * coronacion = "" - * - * num = searchMove( desde, hasta, coronacion ) # <<<<<<<<<<<<<< - * if num == -1: - * return None - */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_desde); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_hasta); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 466, __pyx_L1_error) - __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); - - /* "LCEngineV1.pyx":467 - * - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return None - * - */ - __pyx_t_2 = ((__pyx_v_num == -1L) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":468 - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: - * return None # <<<<<<<<<<<<<< - * - * infoMove = InfoMove(num) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - - /* "LCEngineV1.pyx":467 - * - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return None - * - */ - } - - /* "LCEngineV1.pyx":470 - * return None - * - * infoMove = InfoMove(num) # <<<<<<<<<<<<<< - * make_nummove(num) - * - */ - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_num); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - } - } - if (!__pyx_t_9) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_6); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_t_8}; - __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 470, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_infoMove = __pyx_t_6; - __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":471 - * - * infoMove = InfoMove(num) - * make_nummove(num) # <<<<<<<<<<<<<< - * - * return infoMove - */ - make_nummove(__pyx_v_num); - - /* "LCEngineV1.pyx":473 - * make_nummove(num) - * - * return infoMove # <<<<<<<<<<<<<< - * - * def movePV(desde, hasta, coronacion): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_infoMove); - __pyx_r = __pyx_v_infoMove; - goto __pyx_L0; - - /* "LCEngineV1.pyx":462 - * return li - * - * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("LCEngineV1.moveExPV", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_infoMove); - __Pyx_XDECREF(__pyx_v_coronacion); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":475 - * return infoMove - * - * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_51movePV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_51movePV = {"movePV", (PyCFunction)__pyx_pw_10LCEngineV1_51movePV, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_51movePV(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_desde = 0; - PyObject *__pyx_v_hasta = 0; - PyObject *__pyx_v_coronacion = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("movePV (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_desde,&__pyx_n_s_hasta,&__pyx_n_s_coronacion,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_desde)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hasta)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, 1); __PYX_ERR(0, 475, __pyx_L3_error) - } - case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_coronacion)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, 2); __PYX_ERR(0, 475, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "movePV") < 0)) __PYX_ERR(0, 475, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_desde = values[0]; - __pyx_v_hasta = values[1]; - __pyx_v_coronacion = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("movePV", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 475, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.movePV", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_50movePV(__pyx_self, __pyx_v_desde, __pyx_v_hasta, __pyx_v_coronacion); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_50movePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_desde, PyObject *__pyx_v_hasta, PyObject *__pyx_v_coronacion) { - int __pyx_v_num; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - char *__pyx_t_3; - char *__pyx_t_4; - char *__pyx_t_5; - __Pyx_RefNannySetupContext("movePV", 0); - __Pyx_INCREF(__pyx_v_coronacion); - - /* "LCEngineV1.pyx":476 - * - * def movePV(desde, hasta, coronacion): - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_coronacion); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 476, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":477 - * def movePV(desde, hasta, coronacion): - * if not coronacion: - * coronacion = "" # <<<<<<<<<<<<<< - * - * num = searchMove( desde, hasta, coronacion ) - */ - __Pyx_INCREF(__pyx_kp_s_); - __Pyx_DECREF_SET(__pyx_v_coronacion, __pyx_kp_s_); - - /* "LCEngineV1.pyx":476 - * - * def movePV(desde, hasta, coronacion): - * if not coronacion: # <<<<<<<<<<<<<< - * coronacion = "" - * - */ - } - - /* "LCEngineV1.pyx":479 - * coronacion = "" - * - * num = searchMove( desde, hasta, coronacion ) # <<<<<<<<<<<<<< - * if num == -1: - * return False - */ - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_desde); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_hasta); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) __PYX_ERR(0, 479, __pyx_L1_error) - __pyx_v_num = searchMove(__pyx_t_3, __pyx_t_4, __pyx_t_5); - - /* "LCEngineV1.pyx":480 - * - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_2 = ((__pyx_v_num == -1L) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":481 - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: - * return False # <<<<<<<<<<<<<< - * - * make_nummove(num) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - - /* "LCEngineV1.pyx":480 - * - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return False - * - */ - } - - /* "LCEngineV1.pyx":483 - * return False - * - * make_nummove(num) # <<<<<<<<<<<<<< - * - * return True - */ - make_nummove(__pyx_v_num); - - /* "LCEngineV1.pyx":485 - * make_nummove(num) - * - * return True # <<<<<<<<<<<<<< - * - * def makeMove(move): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - - /* "LCEngineV1.pyx":475 - * return infoMove - * - * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_AddTraceback("LCEngineV1.movePV", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_coronacion); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":487 - * return True - * - * def makeMove(move): # <<<<<<<<<<<<<< - * desde = move[:2] - * hasta = move[2:4] - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_53makeMove(PyObject *__pyx_self, PyObject *__pyx_v_move); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_53makeMove = {"makeMove", (PyCFunction)__pyx_pw_10LCEngineV1_53makeMove, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_53makeMove(PyObject *__pyx_self, PyObject *__pyx_v_move) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("makeMove (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_52makeMove(__pyx_self, ((PyObject *)__pyx_v_move)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_52makeMove(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_move) { - PyObject *__pyx_v_desde = NULL; - PyObject *__pyx_v_hasta = NULL; - PyObject *__pyx_v_coronacion = NULL; - int __pyx_v_num; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - char *__pyx_t_2; - char *__pyx_t_3; - char *__pyx_t_4; - int __pyx_t_5; - __Pyx_RefNannySetupContext("makeMove", 0); - - /* "LCEngineV1.pyx":488 - * - * def makeMove(move): - * desde = move[:2] # <<<<<<<<<<<<<< - * hasta = move[2:4] - * coronacion = move[4:] - */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 0, 2, NULL, NULL, &__pyx_slice__41, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_desde = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":489 - * def makeMove(move): - * desde = move[:2] - * hasta = move[2:4] # <<<<<<<<<<<<<< - * coronacion = move[4:] - * num = searchMove( desde, hasta, coronacion ) - */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 2, 4, NULL, NULL, &__pyx_slice__42, 1, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_hasta = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":490 - * desde = move[:2] - * hasta = move[2:4] - * coronacion = move[4:] # <<<<<<<<<<<<<< - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: - */ - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_v_move, 4, 0, NULL, NULL, &__pyx_slice__43, 1, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_coronacion = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":491 - * hasta = move[2:4] - * coronacion = move[4:] - * num = searchMove( desde, hasta, coronacion ) # <<<<<<<<<<<<<< - * if num == -1: - * return False - */ - __pyx_t_2 = __Pyx_PyObject_AsString(__pyx_v_desde); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_hasta); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_coronacion); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 491, __pyx_L1_error) - __pyx_v_num = searchMove(__pyx_t_2, __pyx_t_3, __pyx_t_4); - - /* "LCEngineV1.pyx":492 - * coronacion = move[4:] - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return False - * - */ - __pyx_t_5 = ((__pyx_v_num == -1L) != 0); - if (__pyx_t_5) { - - /* "LCEngineV1.pyx":493 - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: - * return False # <<<<<<<<<<<<<< - * - * make_nummove(num) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_False); - __pyx_r = Py_False; - goto __pyx_L0; - - /* "LCEngineV1.pyx":492 - * coronacion = move[4:] - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: # <<<<<<<<<<<<<< - * return False - * - */ - } - - /* "LCEngineV1.pyx":495 - * return False - * - * make_nummove(num) # <<<<<<<<<<<<<< - * return True - * - */ - make_nummove(__pyx_v_num); - - /* "LCEngineV1.pyx":496 - * - * make_nummove(num) - * return True # <<<<<<<<<<<<<< - * - * def fen2fenM2(fen): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_True); - __pyx_r = Py_True; - goto __pyx_L0; - - /* "LCEngineV1.pyx":487 - * return True - * - * def makeMove(move): # <<<<<<<<<<<<<< - * desde = move[:2] - * hasta = move[2:4] - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("LCEngineV1.makeMove", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_desde); - __Pyx_XDECREF(__pyx_v_hasta); - __Pyx_XDECREF(__pyx_v_coronacion); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":498 - * return True - * - * def fen2fenM2(fen): # <<<<<<<<<<<<<< - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_55fen2fenM2(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_55fen2fenM2 = {"fen2fenM2", (PyCFunction)__pyx_pw_10LCEngineV1_55fen2fenM2, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_55fen2fenM2(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fen2fenM2 (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_54fen2fenM2(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_54fen2fenM2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_v_sp1 = NULL; - PyObject *__pyx_v_sp2 = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_RefNannySetupContext("fen2fenM2", 0); - - /* "LCEngineV1.pyx":499 - * - * def fen2fenM2(fen): - * sp1 = fen.rfind(" ") # <<<<<<<<<<<<<< - * sp2 = fen.rfind(" ", 0, sp1) - * return fen[:sp2] - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__44, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sp1 = __pyx_t_2; - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":500 - * def fen2fenM2(fen): - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) # <<<<<<<<<<<<<< - * return fen[:sp2] - * - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_rfind); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - __pyx_t_4 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s__25, __pyx_int_0, __pyx_v_sp1}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { - PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s__25, __pyx_int_0, __pyx_v_sp1}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 3+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_5 = PyTuple_New(3+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_3) { - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; - } - __Pyx_INCREF(__pyx_kp_s__25); - __Pyx_GIVEREF(__pyx_kp_s__25); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s__25); - __Pyx_INCREF(__pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_0); - __Pyx_INCREF(__pyx_v_sp1); - __Pyx_GIVEREF(__pyx_v_sp1); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_sp1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 500, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_sp2 = __pyx_t_2; - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":501 - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) - * return fen[:sp2] # <<<<<<<<<<<<<< - * - * def setFenInicial(): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetSlice(__pyx_v_fen, 0, 0, NULL, &__pyx_v_sp2, NULL, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 501, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":498 - * return True - * - * def fen2fenM2(fen): # <<<<<<<<<<<<<< - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("LCEngineV1.fen2fenM2", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_sp1); - __Pyx_XDECREF(__pyx_v_sp2); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":503 - * return fen[:sp2] - * - * def setFenInicial(): # <<<<<<<<<<<<<< - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_57setFenInicial(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_57setFenInicial = {"setFenInicial", (PyCFunction)__pyx_pw_10LCEngineV1_57setFenInicial, METH_NOARGS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_57setFenInicial(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("setFenInicial (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_56setFenInicial(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_56setFenInicial(CYTHON_UNUSED PyObject *__pyx_self) { - PyObject *__pyx_v_inifen = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("setFenInicial", 0); - - /* "LCEngineV1.pyx":504 - * - * def setFenInicial(): - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" # <<<<<<<<<<<<<< - * setFen(inifen) - * - */ - __Pyx_INCREF(__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP); - __pyx_v_inifen = __pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP; - - /* "LCEngineV1.pyx":505 - * def setFenInicial(): - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) # <<<<<<<<<<<<<< - * - * def makePV(pv): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_inifen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inifen}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_inifen}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_inifen); - __Pyx_GIVEREF(__pyx_v_inifen); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_inifen); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 505, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":503 - * return fen[:sp2] - * - * def setFenInicial(): # <<<<<<<<<<<<<< - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.setFenInicial", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_inifen); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_59makePV(PyObject *__pyx_self, PyObject *__pyx_v_pv); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_59makePV = {"makePV", (PyCFunction)__pyx_pw_10LCEngineV1_59makePV, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_59makePV(PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("makePV (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_58makePV(__pyx_self, ((PyObject *)__pyx_v_pv)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_58makePV(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pv) { - PyObject *__pyx_v_move = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - __Pyx_RefNannySetupContext("makePV", 0); - - /* "LCEngineV1.pyx":508 - * - * def makePV(pv): - * setFenInicial() # <<<<<<<<<<<<<< - * if pv: - * for move in pv.split(" "): - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFenInicial); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 508, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":509 - * def makePV(pv): - * setFenInicial() - * if pv: # <<<<<<<<<<<<<< - * for move in pv.split(" "): - * makeMove(move) - */ - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_pv); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 509, __pyx_L1_error) - if (__pyx_t_4) { - - /* "LCEngineV1.pyx":510 - * setFenInicial() - * if pv: - * for move in pv.split(" "): # <<<<<<<<<<<<<< - * makeMove(move) - * return getFen() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_pv, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__45, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 510, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 510, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_2); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 510, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_6(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 510, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_move, __pyx_t_2); - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":511 - * if pv: - * for move in pv.split(" "): - * makeMove(move) # <<<<<<<<<<<<<< - * return getFen() - * - */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_makeMove); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - if (!__pyx_t_7) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_move); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_move}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_v_move}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_INCREF(__pyx_v_move); - __Pyx_GIVEREF(__pyx_v_move); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_move); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 511, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":510 - * setFenInicial() - * if pv: - * for move in pv.split(" "): # <<<<<<<<<<<<<< - * makeMove(move) - * return getFen() - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":509 - * def makePV(pv): - * setFenInicial() - * if pv: # <<<<<<<<<<<<<< - * for move in pv.split(" "): - * makeMove(move) - */ - } - - /* "LCEngineV1.pyx":512 - * for move in pv.split(" "): - * makeMove(move) - * return getFen() # <<<<<<<<<<<<<< - * - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_getFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 512, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("LCEngineV1.makePV", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_move); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_61getCapturesFEN(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_61getCapturesFEN = {"getCapturesFEN", (PyCFunction)__pyx_pw_10LCEngineV1_61getCapturesFEN, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_61getCapturesFEN(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getCapturesFEN (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_60getCapturesFEN(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_60getCapturesFEN(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - int __pyx_v_nmoves; - PyObject *__pyx_v_nbase = NULL; - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_v_x = NULL; - PyObject *__pyx_v_mv = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - PyObject *(*__pyx_t_6)(PyObject *); - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - int __pyx_t_10; - __Pyx_RefNannySetupContext("getCapturesFEN", 0); - - /* "LCEngineV1.pyx":516 - * - * def getCapturesFEN(fen): - * setFen(fen) # <<<<<<<<<<<<<< - * nmoves = numMoves() - * nbase = numBaseMove() - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fen); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 516, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":517 - * def getCapturesFEN(fen): - * setFen(fen) - * nmoves = numMoves() # <<<<<<<<<<<<<< - * nbase = numBaseMove() - * li = [] - */ - __pyx_v_nmoves = numMoves(); - - /* "LCEngineV1.pyx":518 - * setFen(fen) - * nmoves = numMoves() - * nbase = numBaseMove() # <<<<<<<<<<<<<< - * li = [] - * for x in range(nmoves): - */ - __pyx_t_1 = __Pyx_PyInt_From_int(numBaseMove()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_nbase = __pyx_t_1; - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":519 - * nmoves = numMoves() - * nbase = numBaseMove() - * li = [] # <<<<<<<<<<<<<< - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 519, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_li = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":520 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * mv = InfoMove(x + nbase) - * if mv.captura(): - */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_nmoves); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_5 = 0; - __pyx_t_6 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 520, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_6)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 520, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 520, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_6(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 520, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_x, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":521 - * li = [] - * for x in range(nmoves): - * mv = InfoMove(x + nbase) # <<<<<<<<<<<<<< - * if mv.captura(): - * li.append(mv) - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_InfoMove); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Add(__pyx_v_x, __pyx_v_nbase); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_3}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 521, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_mv, __pyx_t_1); - __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":522 - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - * if mv.captura(): # <<<<<<<<<<<<<< - * li.append(mv) - * return li - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_mv, __pyx_n_s_captura); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 522, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (__pyx_t_8) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 522, __pyx_L1_error) - } - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 522, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_9) { - - /* "LCEngineV1.pyx":523 - * mv = InfoMove(x + nbase) - * if mv.captura(): - * li.append(mv) # <<<<<<<<<<<<<< - * return li - * - */ - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_li, __pyx_v_mv); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 523, __pyx_L1_error) - - /* "LCEngineV1.pyx":522 - * for x in range(nmoves): - * mv = InfoMove(x + nbase) - * if mv.captura(): # <<<<<<<<<<<<<< - * li.append(mv) - * return li - */ - } - - /* "LCEngineV1.pyx":520 - * nbase = numBaseMove() - * li = [] - * for x in range(nmoves): # <<<<<<<<<<<<<< - * mv = InfoMove(x + nbase) - * if mv.captura(): - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":524 - * if mv.captura(): - * li.append(mv) - * return li # <<<<<<<<<<<<<< - * - * def getCaptures(fen, siMB): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_li); - __pyx_r = __pyx_v_li; - goto __pyx_L0; - - /* "LCEngineV1.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("LCEngineV1.getCapturesFEN", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_nbase); - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XDECREF(__pyx_v_x); - __Pyx_XDECREF(__pyx_v_mv); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_63getCaptures(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_63getCaptures = {"getCaptures", (PyCFunction)__pyx_pw_10LCEngineV1_63getCaptures, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_10LCEngineV1_63getCaptures(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_fen = 0; - PyObject *__pyx_v_siMB = 0; - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("getCaptures (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_fen,&__pyx_n_s_siMB,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_fen)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_siMB)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("getCaptures", 1, 2, 2, 1); __PYX_ERR(0, 526, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "getCaptures") < 0)) __PYX_ERR(0, 526, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_fen = values[0]; - __pyx_v_siMB = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("getCaptures", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 526, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("LCEngineV1.getCaptures", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_10LCEngineV1_62getCaptures(__pyx_self, __pyx_v_fen, __pyx_v_siMB); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_62getCaptures(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen, PyObject *__pyx_v_siMB) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - __Pyx_RefNannySetupContext("getCaptures", 0); - __Pyx_INCREF(__pyx_v_fen); - - /* "LCEngineV1.pyx":527 - * - * def getCaptures(fen, siMB): - * if not siMB: # <<<<<<<<<<<<<< - * fen = fenOB(fen) - * return getCapturesFEN(fen) - */ - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_siMB); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 527, __pyx_L1_error) - __pyx_t_2 = ((!__pyx_t_1) != 0); - if (__pyx_t_2) { - - /* "LCEngineV1.pyx":528 - * def getCaptures(fen, siMB): - * if not siMB: - * fen = fenOB(fen) # <<<<<<<<<<<<<< - * return getCapturesFEN(fen) - * - */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_fenOB); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_5) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_fen); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_fen, __pyx_t_3); - __pyx_t_3 = 0; - - /* "LCEngineV1.pyx":527 - * - * def getCaptures(fen, siMB): - * if not siMB: # <<<<<<<<<<<<<< - * fen = fenOB(fen) - * return getCapturesFEN(fen) - */ - } - - /* "LCEngineV1.pyx":529 - * if not siMB: - * fen = fenOB(fen) - * return getCapturesFEN(fen) # <<<<<<<<<<<<<< - * - * def fenOB(fen): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_getCapturesFEN); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - if (!__pyx_t_6) { - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_fen); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { - PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_v_fen}; - __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_3); - } else - #endif - { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_fen); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("LCEngineV1.getCaptures", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_fen); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_65fenOB(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_65fenOB = {"fenOB", (PyCFunction)__pyx_pw_10LCEngineV1_65fenOB, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_65fenOB(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fenOB (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_64fenOB(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_64fenOB(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_v_li = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - __Pyx_RefNannySetupContext("fenOB", 0); - - /* "LCEngineV1.pyx":532 - * - * def fenOB(fen): - * li = fen.split(" ") # <<<<<<<<<<<<<< - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_fen, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__46, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_li = __pyx_t_2; - __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":533 - * def fenOB(fen): - * li = fen.split(" ") - * li[3] = "-" # <<<<<<<<<<<<<< - * li[1] = "w" if li[1] == "b" else "b" - * return " ".join(li) - */ - if (unlikely(__Pyx_SetItemInt(__pyx_v_li, 3, __pyx_kp_s__47, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 533, __pyx_L1_error) - - /* "LCEngineV1.pyx":534 - * li = fen.split(" ") - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" # <<<<<<<<<<<<<< - * return " ".join(li) - * - */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_li, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_b, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_3) { - __Pyx_INCREF(__pyx_n_s_w); - __pyx_t_2 = __pyx_n_s_w; - } else { - __Pyx_INCREF(__pyx_n_s_b); - __pyx_t_2 = __pyx_n_s_b; - } - if (unlikely(__Pyx_SetItemInt(__pyx_v_li, 1, __pyx_t_2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1) < 0)) __PYX_ERR(0, 534, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":535 - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" - * return " ".join(li) # <<<<<<<<<<<<<< - * - * def fenTerminado(fen): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__25, __pyx_v_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 535, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("LCEngineV1.fenOB", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_li); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "LCEngineV1.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_10LCEngineV1_67fenTerminado(PyObject *__pyx_self, PyObject *__pyx_v_fen); /*proto*/ -static PyMethodDef __pyx_mdef_10LCEngineV1_67fenTerminado = {"fenTerminado", (PyCFunction)__pyx_pw_10LCEngineV1_67fenTerminado, METH_O, 0}; -static PyObject *__pyx_pw_10LCEngineV1_67fenTerminado(PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("fenTerminado (wrapper)", 0); - __pyx_r = __pyx_pf_10LCEngineV1_66fenTerminado(__pyx_self, ((PyObject *)__pyx_v_fen)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_10LCEngineV1_66fenTerminado(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fen) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("fenTerminado", 0); - - /* "LCEngineV1.pyx":538 - * - * def fenTerminado(fen): - * return setFen(fen) == 0 # <<<<<<<<<<<<<< - * - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_setFen); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - } - } - if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_fen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { - PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_fen}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; - __Pyx_INCREF(__pyx_v_fen); - __Pyx_GIVEREF(__pyx_v_fen); - PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_fen); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_EqObjC(__pyx_t_1, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "LCEngineV1.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("LCEngineV1.fenTerminado", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -static struct PyModuleDef __pyx_moduledef = { - #if PY_VERSION_HEX < 0x03020000 - { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, - #else - PyModuleDef_HEAD_INIT, - #endif - "LCEngineV1", - 0, /* m_doc */ - -1, /* m_size */ - __pyx_methods /* m_methods */, - NULL, /* m_reload */ - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, - {&__pyx_n_s_FCpos, __pyx_k_FCpos, sizeof(__pyx_k_FCpos), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove, __pyx_k_InfoMove, sizeof(__pyx_k_InfoMove), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove___init, __pyx_k_InfoMove___init, sizeof(__pyx_k_InfoMove___init), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_captura, __pyx_k_InfoMove_captura, sizeof(__pyx_k_InfoMove_captura), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_coronacion, __pyx_k_InfoMove_coronacion, sizeof(__pyx_k_InfoMove_coronacion), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_desde, __pyx_k_InfoMove_desde, sizeof(__pyx_k_InfoMove_desde), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_hasta, __pyx_k_InfoMove_hasta, sizeof(__pyx_k_InfoMove_hasta), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_isCastleK, __pyx_k_InfoMove_isCastleK, sizeof(__pyx_k_InfoMove_isCastleK), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_isCastleQ, __pyx_k_InfoMove_isCastleQ, sizeof(__pyx_k_InfoMove_isCastleQ), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_isEnPassant, __pyx_k_InfoMove_isEnPassant, sizeof(__pyx_k_InfoMove_isEnPassant), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_jaque, __pyx_k_InfoMove_jaque, sizeof(__pyx_k_InfoMove_jaque), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_mate, __pyx_k_InfoMove_mate, sizeof(__pyx_k_InfoMove_mate), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_movimiento, __pyx_k_InfoMove_movimiento, sizeof(__pyx_k_InfoMove_movimiento), 0, 0, 1, 1}, - {&__pyx_n_s_InfoMove_pieza, __pyx_k_InfoMove_pieza, sizeof(__pyx_k_InfoMove_pieza), 0, 0, 1, 1}, - {&__pyx_n_s_LCEngineV1, __pyx_k_LCEngineV1, sizeof(__pyx_k_LCEngineV1), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader, __pyx_k_PGNreader, sizeof(__pyx_k_PGNreader), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___enter, __pyx_k_PGNreader___enter, sizeof(__pyx_k_PGNreader___enter), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___exit, __pyx_k_PGNreader___exit, sizeof(__pyx_k_PGNreader___exit), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___init, __pyx_k_PGNreader___init, sizeof(__pyx_k_PGNreader___init), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader___iter, __pyx_k_PGNreader___iter, sizeof(__pyx_k_PGNreader___iter), 0, 0, 1, 1}, - {&__pyx_n_s_PGNreader_next, __pyx_k_PGNreader_next, sizeof(__pyx_k_PGNreader_next), 0, 0, 1, 1}, - {&__pyx_n_s_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 0, 0, 1, 1}, - {&__pyx_kp_s__25, __pyx_k__25, sizeof(__pyx_k__25), 0, 0, 1, 0}, - {&__pyx_kp_s__34, __pyx_k__34, sizeof(__pyx_k__34), 0, 0, 1, 0}, - {&__pyx_kp_s__38, __pyx_k__38, sizeof(__pyx_k__38), 0, 0, 1, 0}, - {&__pyx_kp_s__39, __pyx_k__39, sizeof(__pyx_k__39), 0, 0, 1, 0}, - {&__pyx_kp_s__40, __pyx_k__40, sizeof(__pyx_k__40), 0, 0, 1, 0}, - {&__pyx_kp_s__47, __pyx_k__47, sizeof(__pyx_k__47), 0, 0, 1, 0}, - {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1}, - {&__pyx_n_s_a1, __pyx_k_a1, sizeof(__pyx_k_a1), 0, 0, 1, 1}, - {&__pyx_n_s_a1Pos, __pyx_k_a1Pos, sizeof(__pyx_k_a1Pos), 0, 0, 1, 1}, - {&__pyx_n_s_a1h8q, __pyx_k_a1h8q, sizeof(__pyx_k_a1h8q), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1}, - {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, - {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, - {&__pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_k_c_correr_lucaschess_pyLC12_LCEng, sizeof(__pyx_k_c_correr_lucaschess_pyLC12_LCEng), 0, 0, 1, 0}, - {&__pyx_n_s_c_i, __pyx_k_c_i, sizeof(__pyx_k_c_i), 0, 0, 1, 1}, - {&__pyx_n_s_captura, __pyx_k_captura, sizeof(__pyx_k_captura), 0, 0, 1, 1}, - {&__pyx_n_s_capture, __pyx_k_capture, sizeof(__pyx_k_capture), 0, 0, 1, 1}, - {&__pyx_n_s_castle_K, __pyx_k_castle_K, sizeof(__pyx_k_castle_K), 0, 0, 1, 1}, - {&__pyx_n_s_castle_Q, __pyx_k_castle_Q, sizeof(__pyx_k_castle_Q), 0, 0, 1, 1}, - {&__pyx_n_s_celdas_ocupadas, __pyx_k_celdas_ocupadas, sizeof(__pyx_k_celdas_ocupadas), 0, 0, 1, 1}, - {&__pyx_n_s_check, __pyx_k_check, sizeof(__pyx_k_check), 0, 0, 1, 1}, - {&__pyx_n_s_chr, __pyx_k_chr, sizeof(__pyx_k_chr), 0, 0, 1, 1}, - {&__pyx_n_s_ci, __pyx_k_ci, sizeof(__pyx_k_ci), 0, 0, 1, 1}, - {&__pyx_n_s_col, __pyx_k_col, sizeof(__pyx_k_col), 0, 0, 1, 1}, - {&__pyx_n_s_coronacion, __pyx_k_coronacion, sizeof(__pyx_k_coronacion), 0, 0, 1, 1}, - {&__pyx_n_s_ct, __pyx_k_ct, sizeof(__pyx_k_ct), 0, 0, 1, 1}, - {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, - {&__pyx_n_s_depth, __pyx_k_depth, sizeof(__pyx_k_depth), 0, 0, 1, 1}, - {&__pyx_n_s_desde, __pyx_k_desde, sizeof(__pyx_k_desde), 0, 0, 1, 1}, - {&__pyx_n_s_desdeA1H8, __pyx_k_desdeA1H8, sizeof(__pyx_k_desdeA1H8), 0, 0, 1, 1}, - {&__pyx_n_s_dicB, __pyx_k_dicB, sizeof(__pyx_k_dicB), 0, 0, 1, 1}, - {&__pyx_n_s_dicK, __pyx_k_dicK, sizeof(__pyx_k_dicK), 0, 0, 1, 1}, - {&__pyx_n_s_dicN, __pyx_k_dicN, sizeof(__pyx_k_dicN), 0, 0, 1, 1}, - {&__pyx_n_s_dicPB, __pyx_k_dicPB, sizeof(__pyx_k_dicPB), 0, 0, 1, 1}, - {&__pyx_n_s_dicPW, __pyx_k_dicPW, sizeof(__pyx_k_dicPW), 0, 0, 1, 1}, - {&__pyx_n_s_dicQ, __pyx_k_dicQ, sizeof(__pyx_k_dicQ), 0, 0, 1, 1}, - {&__pyx_n_s_dicR, __pyx_k_dicR, sizeof(__pyx_k_dicR), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, - {&__pyx_n_s_ep, __pyx_k_ep, sizeof(__pyx_k_ep), 0, 0, 1, 1}, - {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, - {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1}, - {&__pyx_n_s_f, __pyx_k_f, sizeof(__pyx_k_f), 0, 0, 1, 1}, - {&__pyx_n_s_f_i, __pyx_k_f_i, sizeof(__pyx_k_f_i), 0, 0, 1, 1}, - {&__pyx_n_s_fen, __pyx_k_fen, sizeof(__pyx_k_fen), 0, 0, 1, 1}, - {&__pyx_n_s_fen2fenM2, __pyx_k_fen2fenM2, sizeof(__pyx_k_fen2fenM2), 0, 0, 1, 1}, - {&__pyx_n_s_fenOB, __pyx_k_fenOB, sizeof(__pyx_k_fenOB), 0, 0, 1, 1}, - {&__pyx_n_s_fenTerminado, __pyx_k_fenTerminado, sizeof(__pyx_k_fenTerminado), 0, 0, 1, 1}, - {&__pyx_n_s_fens, __pyx_k_fens, sizeof(__pyx_k_fens), 0, 0, 1, 1}, - {&__pyx_n_s_fi, __pyx_k_fi, sizeof(__pyx_k_fi), 0, 0, 1, 1}, - {&__pyx_n_s_fich, __pyx_k_fich, sizeof(__pyx_k_fich), 0, 0, 1, 1}, - {&__pyx_n_s_fil, __pyx_k_fil, sizeof(__pyx_k_fil), 0, 0, 1, 1}, - {&__pyx_n_s_filaIni, __pyx_k_filaIni, sizeof(__pyx_k_filaIni), 0, 0, 1, 1}, - {&__pyx_n_s_from, __pyx_k_from, sizeof(__pyx_k_from), 0, 0, 1, 1}, - {&__pyx_n_s_ft, __pyx_k_ft, sizeof(__pyx_k_ft), 0, 0, 1, 1}, - {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1}, - {&__pyx_n_s_getCaptures, __pyx_k_getCaptures, sizeof(__pyx_k_getCaptures), 0, 0, 1, 1}, - {&__pyx_n_s_getCapturesFEN, __pyx_k_getCapturesFEN, sizeof(__pyx_k_getCapturesFEN), 0, 0, 1, 1}, - {&__pyx_n_s_getExMoves, __pyx_k_getExMoves, sizeof(__pyx_k_getExMoves), 0, 0, 1, 1}, - {&__pyx_n_s_getFen, __pyx_k_getFen, sizeof(__pyx_k_getFen), 0, 0, 1, 1}, - {&__pyx_n_s_getMoves, __pyx_k_getMoves, sizeof(__pyx_k_getMoves), 0, 0, 1, 1}, - {&__pyx_n_s_getPGN, __pyx_k_getPGN, sizeof(__pyx_k_getPGN), 0, 0, 1, 1}, - {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1}, - {&__pyx_n_s_h8, __pyx_k_h8, sizeof(__pyx_k_h8), 0, 0, 1, 1}, - {&__pyx_n_s_hasta, __pyx_k_hasta, sizeof(__pyx_k_hasta), 0, 0, 1, 1}, - {&__pyx_n_s_hastaA1H8, __pyx_k_hastaA1H8, sizeof(__pyx_k_hastaA1H8), 0, 0, 1, 1}, - {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, - {&__pyx_n_s_inc, __pyx_k_inc, sizeof(__pyx_k_inc), 0, 0, 1, 1}, - {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1}, - {&__pyx_n_s_infoMove, __pyx_k_infoMove, sizeof(__pyx_k_infoMove), 0, 0, 1, 1}, - {&__pyx_n_s_inifen, __pyx_k_inifen, sizeof(__pyx_k_inifen), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_insert, __pyx_k_insert, sizeof(__pyx_k_insert), 0, 0, 1, 1}, - {&__pyx_n_s_isCastleK, __pyx_k_isCastleK, sizeof(__pyx_k_isCastleK), 0, 0, 1, 1}, - {&__pyx_n_s_isCastleQ, __pyx_k_isCastleQ, sizeof(__pyx_k_isCastleQ), 0, 0, 1, 1}, - {&__pyx_n_s_isCheck, __pyx_k_isCheck, sizeof(__pyx_k_isCheck), 0, 0, 1, 1}, - {&__pyx_n_s_isEnPassant, __pyx_k_isEnPassant, sizeof(__pyx_k_isEnPassant), 0, 0, 1, 1}, - {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, - {&__pyx_n_s_jaque, __pyx_k_jaque, sizeof(__pyx_k_jaque), 0, 0, 1, 1}, - {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, - {&__pyx_n_s_knightmoves, __pyx_k_knightmoves, sizeof(__pyx_k_knightmoves), 0, 0, 1, 1}, - {&__pyx_n_s_lc_pgn2pv, __pyx_k_lc_pgn2pv, sizeof(__pyx_k_lc_pgn2pv), 0, 0, 1, 1}, - {&__pyx_n_s_level, __pyx_k_level, sizeof(__pyx_k_level), 0, 0, 1, 1}, - {&__pyx_n_s_li, __pyx_k_li, sizeof(__pyx_k_li), 0, 0, 1, 1}, - {&__pyx_n_s_liBR, __pyx_k_liBR, sizeof(__pyx_k_liBR), 0, 0, 1, 1}, - {&__pyx_n_s_liK, __pyx_k_liK, sizeof(__pyx_k_liK), 0, 0, 1, 1}, - {&__pyx_n_s_liM, __pyx_k_liM, sizeof(__pyx_k_liM), 0, 0, 1, 1}, - {&__pyx_n_s_liN, __pyx_k_liN, sizeof(__pyx_k_liN), 0, 0, 1, 1}, - {&__pyx_n_s_liNMinimo, __pyx_k_liNMinimo, sizeof(__pyx_k_liNMinimo), 0, 0, 1, 1}, - {&__pyx_n_s_liP, __pyx_k_liP, sizeof(__pyx_k_liP), 0, 0, 1, 1}, - {&__pyx_n_s_liX, __pyx_k_liX, sizeof(__pyx_k_liX), 0, 0, 1, 1}, - {&__pyx_n_s_lia, __pyx_k_lia, sizeof(__pyx_k_lia), 0, 0, 1, 1}, - {&__pyx_n_s_lib, __pyx_k_lib, sizeof(__pyx_k_lib), 0, 0, 1, 1}, - {&__pyx_n_s_lidef, __pyx_k_lidef, sizeof(__pyx_k_lidef), 0, 0, 1, 1}, - {&__pyx_n_s_lin, __pyx_k_lin, sizeof(__pyx_k_lin), 0, 0, 1, 1}, - {&__pyx_n_s_lix, __pyx_k_lix, sizeof(__pyx_k_lix), 0, 0, 1, 1}, - {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_makeMove, __pyx_k_makeMove, sizeof(__pyx_k_makeMove), 0, 0, 1, 1}, - {&__pyx_n_s_makePV, __pyx_k_makePV, sizeof(__pyx_k_makePV), 0, 0, 1, 1}, - {&__pyx_n_s_mate, __pyx_k_mate, sizeof(__pyx_k_mate), 0, 0, 1, 1}, - {&__pyx_n_s_mate_2, __pyx_k_mate_2, sizeof(__pyx_k_mate_2), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_move, __pyx_k_move, sizeof(__pyx_k_move), 0, 0, 1, 1}, - {&__pyx_n_s_move2num, __pyx_k_move2num, sizeof(__pyx_k_move2num), 0, 0, 1, 1}, - {&__pyx_n_s_moveExPV, __pyx_k_moveExPV, sizeof(__pyx_k_moveExPV), 0, 0, 1, 1}, - {&__pyx_n_s_movePV, __pyx_k_movePV, sizeof(__pyx_k_movePV), 0, 0, 1, 1}, - {&__pyx_n_s_movimiento, __pyx_k_movimiento, sizeof(__pyx_k_movimiento), 0, 0, 1, 1}, - {&__pyx_n_s_ms, __pyx_k_ms, sizeof(__pyx_k_ms), 0, 0, 1, 1}, - {&__pyx_n_s_mv, __pyx_k_mv, sizeof(__pyx_k_mv), 0, 0, 1, 1}, - {&__pyx_n_s_mx, __pyx_k_mx, sizeof(__pyx_k_mx), 0, 0, 1, 1}, - {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, - {&__pyx_n_s_nbase, __pyx_k_nbase, sizeof(__pyx_k_nbase), 0, 0, 1, 1}, - {&__pyx_n_s_next, __pyx_k_next, sizeof(__pyx_k_next), 0, 0, 1, 1}, - {&__pyx_n_s_nmoves, __pyx_k_nmoves, sizeof(__pyx_k_nmoves), 0, 0, 1, 1}, - {&__pyx_n_s_no, __pyx_k_no, sizeof(__pyx_k_no), 0, 0, 1, 1}, - {&__pyx_n_s_npos, __pyx_k_npos, sizeof(__pyx_k_npos), 0, 0, 1, 1}, - {&__pyx_n_s_num, __pyx_k_num, sizeof(__pyx_k_num), 0, 0, 1, 1}, - {&__pyx_n_s_num2move, __pyx_k_num2move, sizeof(__pyx_k_num2move), 0, 0, 1, 1}, - {&__pyx_n_s_numMove, __pyx_k_numMove, sizeof(__pyx_k_numMove), 0, 0, 1, 1}, - {&__pyx_n_s_nv, __pyx_k_nv, sizeof(__pyx_k_nv), 0, 0, 1, 1}, - {&__pyx_n_s_nx, __pyx_k_nx, sizeof(__pyx_k_nx), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_ot, __pyx_k_ot, sizeof(__pyx_k_ot), 0, 0, 1, 1}, - {&__pyx_n_s_pgn, __pyx_k_pgn, sizeof(__pyx_k_pgn), 0, 0, 1, 1}, - {&__pyx_n_s_pgn1, __pyx_k_pgn1, sizeof(__pyx_k_pgn1), 0, 0, 1, 1}, - {&__pyx_n_s_piece, __pyx_k_piece, sizeof(__pyx_k_piece), 0, 0, 1, 1}, - {&__pyx_n_s_pieza, __pyx_k_pieza, sizeof(__pyx_k_pieza), 0, 0, 1, 1}, - {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, - {&__pyx_n_s_posA1, __pyx_k_posA1, sizeof(__pyx_k_posA1), 0, 0, 1, 1}, - {&__pyx_n_s_posFC, __pyx_k_posFC, sizeof(__pyx_k_posFC), 0, 0, 1, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_promotion, __pyx_k_promotion, sizeof(__pyx_k_promotion), 0, 0, 1, 1}, - {&__pyx_n_s_pv, __pyx_k_pv, sizeof(__pyx_k_pv), 0, 0, 1, 1}, - {&__pyx_n_s_pv2xpv, __pyx_k_pv2xpv, sizeof(__pyx_k_pv2xpv), 0, 0, 1, 1}, - {&__pyx_n_s_pv_2, __pyx_k_pv_2, sizeof(__pyx_k_pv_2), 0, 0, 1, 1}, - {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_resp, __pyx_k_resp, sizeof(__pyx_k_resp), 0, 0, 1, 1}, - {&__pyx_n_s_rfind, __pyx_k_rfind, sizeof(__pyx_k_rfind), 0, 0, 1, 1}, - {&__pyx_kp_s_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP, __pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP, sizeof(__pyx_k_rnbqkbnr_pppppppp_8_8_8_8_PPPPPP), 0, 0, 1, 0}, - {&__pyx_n_s_runFen, __pyx_k_runFen, sizeof(__pyx_k_runFen), 0, 0, 1, 1}, - {&__pyx_n_s_salto, __pyx_k_salto, sizeof(__pyx_k_salto), 0, 0, 1, 1}, - {&__pyx_n_s_san, __pyx_k_san, sizeof(__pyx_k_san), 0, 0, 1, 1}, - {&__pyx_n_s_san_2, __pyx_k_san_2, sizeof(__pyx_k_san_2), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_setFen, __pyx_k_setFen, sizeof(__pyx_k_setFen), 0, 0, 1, 1}, - {&__pyx_n_s_setFenInicial, __pyx_k_setFenInicial, sizeof(__pyx_k_setFenInicial), 0, 0, 1, 1}, - {&__pyx_n_s_siBlancas, __pyx_k_siBlancas, sizeof(__pyx_k_siBlancas), 0, 0, 1, 1}, - {&__pyx_n_s_siMB, __pyx_k_siMB, sizeof(__pyx_k_siMB), 0, 0, 1, 1}, - {&__pyx_n_s_siW, __pyx_k_siW, sizeof(__pyx_k_siW), 0, 0, 1, 1}, - {&__pyx_n_s_sig, __pyx_k_sig, sizeof(__pyx_k_sig), 0, 0, 1, 1}, - {&__pyx_n_s_sig2, __pyx_k_sig2, sizeof(__pyx_k_sig2), 0, 0, 1, 1}, - {&__pyx_n_s_sp1, __pyx_k_sp1, sizeof(__pyx_k_sp1), 0, 0, 1, 1}, - {&__pyx_n_s_sp2, __pyx_k_sp2, sizeof(__pyx_k_sp2), 0, 0, 1, 1}, - {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, - {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1}, - {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, - {&__pyx_n_s_tam, __pyx_k_tam, sizeof(__pyx_k_tam), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_to, __pyx_k_to, sizeof(__pyx_k_to), 0, 0, 1, 1}, - {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, - {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1}, - {&__pyx_n_s_upper, __pyx_k_upper, sizeof(__pyx_k_upper), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, - {&__pyx_n_s_x, __pyx_k_x, sizeof(__pyx_k_x), 0, 0, 1, 1}, - {&__pyx_n_s_xmin, __pyx_k_xmin, sizeof(__pyx_k_xmin), 0, 0, 1, 1}, - {&__pyx_n_s_xpv, __pyx_k_xpv, sizeof(__pyx_k_xpv), 0, 0, 1, 1}, - {&__pyx_n_s_xpv2lipv, __pyx_k_xpv2lipv, sizeof(__pyx_k_xpv2lipv), 0, 0, 1, 1}, - {&__pyx_n_s_xpv2pgn, __pyx_k_xpv2pgn, sizeof(__pyx_k_xpv2pgn), 0, 0, 1, 1}, - {&__pyx_n_s_xpv2pv, __pyx_k_xpv2pv, sizeof(__pyx_k_xpv2pv), 0, 0, 1, 1}, - {&__pyx_n_s_y, __pyx_k_y, sizeof(__pyx_k_y), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 189, __pyx_L1_error) - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 393, __pyx_L1_error) - __pyx_builtin_StopIteration = __Pyx_GetBuiltinName(__pyx_n_s_StopIteration); if (!__pyx_builtin_StopIteration) __PYX_ERR(0, 70, __pyx_L1_error) - __pyx_builtin_chr = __Pyx_GetBuiltinName(__pyx_n_s_chr); if (!__pyx_builtin_chr) __PYX_ERR(0, 89, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static int __Pyx_InitCachedConstants(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - - /* "LCEngineV1.pyx":98 - * - * def move2num(a1h8q): - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 # <<<<<<<<<<<<<< - * if len(a1h8q)>4: - * num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - */ - __pyx_slice__2 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__2)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); - __pyx_slice__3 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__3); - __Pyx_GIVEREF(__pyx_slice__3); - - /* "LCEngineV1.pyx":118 - * liM = [] - * fil, col = posFC(npos) - * for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_tuple__4 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); - __pyx_tuple__5 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_tuple__6 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_tuple__7 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_tuple__8 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_tuple__9 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_tuple__11 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_tuple__12 = PyTuple_Pack(8, __pyx_tuple__4, __pyx_tuple__5, __pyx_tuple__6, __pyx_tuple__7, __pyx_tuple__8, __pyx_tuple__9, __pyx_tuple__10, __pyx_tuple__11); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "LCEngineV1.pyx":150 - * fil, col = posFC(npos) - * liM = [] - * for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): # <<<<<<<<<<<<<< - * ft = fil + fi - * ct = col + ci - */ - __pyx_tuple__13 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_2); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_tuple__14 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_2); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_2); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_tuple__16 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_2); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_1); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_tuple__18 = PyTuple_Pack(2, __pyx_int_2, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_tuple__19 = PyTuple_Pack(2, __pyx_int_neg_2, __pyx_int_1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_tuple__20 = PyTuple_Pack(2, __pyx_int_neg_2, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_tuple__21 = PyTuple_Pack(8, __pyx_tuple__13, __pyx_tuple__14, __pyx_tuple__15, __pyx_tuple__16, __pyx_tuple__17, __pyx_tuple__18, __pyx_tuple__19, __pyx_tuple__20); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - - /* "LCEngineV1.pyx":179 - * liM.append(sig2) - * - * for inc in ( +1, -1 ): # <<<<<<<<<<<<<< - * ft = fil + salto - * ct = col + inc - */ - __pyx_tuple__22 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 179, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - - /* "LCEngineV1.pyx":250 - * for y in lib: - * if x not in no and y not in no: - * nx = no[:] # <<<<<<<<<<<<<< - * nx.append(x) - * nx.append(y) - */ - __pyx_slice__23 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__23)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__23); - __Pyx_GIVEREF(__pyx_slice__23); - - /* "LCEngineV1.pyx":273 - * def liNMinimo(x, y, celdas_ocupadas): - * cdef int nv - * ot = celdas_ocupadas[:] # <<<<<<<<<<<<<< - * ot.extend([x, y]) - * nv = 1 - */ - __pyx_slice__24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(0, 273, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__24); - __Pyx_GIVEREF(__pyx_slice__24); - - /* "LCEngineV1.pyx":304 - * def pv2xpv(pv): - * if pv: - * li = pv.split(" ") # <<<<<<<<<<<<<< - * lix = [] - * for move in li: - */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 304, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - - /* "LCEngineV1.pyx":307 - * lix = [] - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 # <<<<<<<<<<<<<< - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] - */ - __pyx_slice__27 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__27)) __PYX_ERR(0, 307, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__27); - __Pyx_GIVEREF(__pyx_slice__27); - - /* "LCEngineV1.pyx":308 - * for move in li: - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) # <<<<<<<<<<<<<< - * c = move[4:] - * if c: - */ - __pyx_slice__28 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__28)) __PYX_ERR(0, 308, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__28); - __Pyx_GIVEREF(__pyx_slice__28); - - /* "LCEngineV1.pyx":309 - * d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - * h = chr(a1Pos(move[2:4]) + 58) - * c = move[4:] # <<<<<<<<<<<<<< - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - */ - __pyx_slice__29 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__29)) __PYX_ERR(0, 309, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__29); - __Pyx_GIVEREF(__pyx_slice__29); - - /* "LCEngineV1.pyx":311 - * c = move[4:] - * if c: - * c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") # <<<<<<<<<<<<<< - * lix.append(d + h + c) - * return "".join(lix) - */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_int_50); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_int_51); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_int_52); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_int_53); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 311, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - - /* "LCEngineV1.pyx":374 - * siW = not siW - * - * numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) # <<<<<<<<<<<<<< - * if numMove == -1: - * break - */ - __pyx_slice__35 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__35)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__35); - __Pyx_GIVEREF(__pyx_slice__35); - __pyx_slice__36 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__36)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__36); - __Pyx_GIVEREF(__pyx_slice__36); - __pyx_slice__37 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__37)) __PYX_ERR(0, 374, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__37); - __Pyx_GIVEREF(__pyx_slice__37); - - /* "LCEngineV1.pyx":488 - * - * def makeMove(move): - * desde = move[:2] # <<<<<<<<<<<<<< - * hasta = move[2:4] - * coronacion = move[4:] - */ - __pyx_slice__41 = PySlice_New(Py_None, __pyx_int_2, Py_None); if (unlikely(!__pyx_slice__41)) __PYX_ERR(0, 488, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__41); - __Pyx_GIVEREF(__pyx_slice__41); - - /* "LCEngineV1.pyx":489 - * def makeMove(move): - * desde = move[:2] - * hasta = move[2:4] # <<<<<<<<<<<<<< - * coronacion = move[4:] - * num = searchMove( desde, hasta, coronacion ) - */ - __pyx_slice__42 = PySlice_New(__pyx_int_2, __pyx_int_4, Py_None); if (unlikely(!__pyx_slice__42)) __PYX_ERR(0, 489, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__42); - __Pyx_GIVEREF(__pyx_slice__42); - - /* "LCEngineV1.pyx":490 - * desde = move[:2] - * hasta = move[2:4] - * coronacion = move[4:] # <<<<<<<<<<<<<< - * num = searchMove( desde, hasta, coronacion ) - * if num == -1: - */ - __pyx_slice__43 = PySlice_New(__pyx_int_4, Py_None, Py_None); if (unlikely(!__pyx_slice__43)) __PYX_ERR(0, 490, __pyx_L1_error) - __Pyx_GOTREF(__pyx_slice__43); - __Pyx_GIVEREF(__pyx_slice__43); - - /* "LCEngineV1.pyx":499 - * - * def fen2fenM2(fen): - * sp1 = fen.rfind(" ") # <<<<<<<<<<<<<< - * sp2 = fen.rfind(" ", 0, sp1) - * return fen[:sp2] - */ - __pyx_tuple__44 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 499, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - - /* "LCEngineV1.pyx":510 - * setFenInicial() - * if pv: - * for move in pv.split(" "): # <<<<<<<<<<<<<< - * makeMove(move) - * return getFen() - */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 510, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - - /* "LCEngineV1.pyx":532 - * - * def fenOB(fen): - * li = fen.split(" ") # <<<<<<<<<<<<<< - * li[3] = "-" - * li[1] = "w" if li[1] == "b" else "b" - */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_kp_s__25); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 532, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - - /* "LCEngineV1.pyx":42 - * - * class PGNreader: - * def __init__(self, fich, depth): # <<<<<<<<<<<<<< - * self.fich = fich - * self.depth = depth - */ - __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_fich, __pyx_n_s_depth); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_init, 42, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 42, __pyx_L1_error) - - /* "LCEngineV1.pyx":46 - * self.depth = depth - * - * def __enter__(self): # <<<<<<<<<<<<<< - * pgn_start(self.fich, self.depth) - * return self - */ - __pyx_tuple__50 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_enter, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 46, __pyx_L1_error) - - /* "LCEngineV1.pyx":50 - * return self - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * pgn_stop() - * - */ - __pyx_tuple__52 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_type, __pyx_n_s_value, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_exit, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 50, __pyx_L1_error) - - /* "LCEngineV1.pyx":53 - * pgn_stop() - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_tuple__54 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_iter, 53, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 53, __pyx_L1_error) - - /* "LCEngineV1.pyx":56 - * return self - * - * def next(self): # <<<<<<<<<<<<<< - * n = pgn_read() - * if n: - */ - __pyx_tuple__56 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_pgn, __pyx_n_s_pv_2, __pyx_n_s_d, __pyx_n_s_r, __pyx_n_s_fens, __pyx_n_s_x, __pyx_n_s_num); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_next, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 56, __pyx_L1_error) - - /* "LCEngineV1.pyx":73 - * - * - * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) - */ - __pyx_tuple__58 = PyTuple_Pack(3, __pyx_n_s_pgn1, __pyx_n_s_pv_2, __pyx_n_s_resp); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); - __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_lc_pgn2pv, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 73, __pyx_L1_error) - - /* "LCEngineV1.pyx":82 - * - * - * def posFC(pos): # <<<<<<<<<<<<<< - * return pos / 8, pos % 8 - * - */ - __pyx_tuple__60 = PyTuple_Pack(1, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_posFC, 82, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 82, __pyx_L1_error) - - /* "LCEngineV1.pyx":85 - * return pos / 8, pos % 8 - * - * def FCpos(f, c): # <<<<<<<<<<<<<< - * return f * 8 + c - * - */ - __pyx_tuple__62 = PyTuple_Pack(2, __pyx_n_s_f, __pyx_n_s_c); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_FCpos, 85, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 85, __pyx_L1_error) - - /* "LCEngineV1.pyx":88 - * return f * 8 + c - * - * def posA1(pos): # <<<<<<<<<<<<<< - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - */ - __pyx_tuple__64 = PyTuple_Pack(1, __pyx_n_s_pos); if (unlikely(!__pyx_tuple__64)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__64); - __Pyx_GIVEREF(__pyx_tuple__64); - __pyx_codeobj__65 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__64, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_posA1, 88, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__65)) __PYX_ERR(0, 88, __pyx_L1_error) - - /* "LCEngineV1.pyx":91 - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - * def a1Pos(a1): # <<<<<<<<<<<<<< - * cdef int f, c - * f = ord(a1[1]) - 49 - */ - __pyx_tuple__66 = PyTuple_Pack(3, __pyx_n_s_a1, __pyx_n_s_f, __pyx_n_s_c); if (unlikely(!__pyx_tuple__66)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__66); - __Pyx_GIVEREF(__pyx_tuple__66); - __pyx_codeobj__67 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__66, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_a1Pos, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__67)) __PYX_ERR(0, 91, __pyx_L1_error) - - /* "LCEngineV1.pyx":97 - * return f * 8 + c - * - * def move2num(a1h8q): # <<<<<<<<<<<<<< - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: - */ - __pyx_tuple__68 = PyTuple_Pack(2, __pyx_n_s_a1h8q, __pyx_n_s_num); if (unlikely(!__pyx_tuple__68)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__68); - __Pyx_GIVEREF(__pyx_tuple__68); - __pyx_codeobj__69 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__68, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_move2num, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__69)) __PYX_ERR(0, 97, __pyx_L1_error) - - /* "LCEngineV1.pyx":103 - * return num - * - * def num2move(num): # <<<<<<<<<<<<<< - * a1 = posA1(num%64) - * num /= 64 - */ - __pyx_tuple__70 = PyTuple_Pack(4, __pyx_n_s_num, __pyx_n_s_a1, __pyx_n_s_h8, __pyx_n_s_q); if (unlikely(!__pyx_tuple__70)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__70); - __Pyx_GIVEREF(__pyx_tuple__70); - __pyx_codeobj__71 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__70, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_num2move, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__71)) __PYX_ERR(0, 103, __pyx_L1_error) - - /* "LCEngineV1.pyx":114 - * return a1 + h8 + q - * - * def liK(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * liM = [] - */ - __pyx_tuple__72 = PyTuple_Pack(8, __pyx_n_s_npos, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_fi, __pyx_n_s_ci); if (unlikely(!__pyx_tuple__72)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__72); - __Pyx_GIVEREF(__pyx_tuple__72); - __pyx_codeobj__73 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__72, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liK, 114, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__73)) __PYX_ERR(0, 114, __pyx_L1_error) - - /* "LCEngineV1.pyx":127 - * - * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - __pyx_tuple__74 = PyTuple_Pack(9, __pyx_n_s_npos, __pyx_n_s_fi, __pyx_n_s_ci, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_t); if (unlikely(!__pyx_tuple__74)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__74); - __Pyx_GIVEREF(__pyx_tuple__74); - __pyx_codeobj__75 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__74, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liBR, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__75)) __PYX_ERR(0, 127, __pyx_L1_error) - - /* "LCEngineV1.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - __pyx_tuple__76 = PyTuple_Pack(9, __pyx_n_s_npos, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_liM, __pyx_n_s_fi, __pyx_n_s_ci, __pyx_n_s_t); if (unlikely(!__pyx_tuple__76)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__76); - __Pyx_GIVEREF(__pyx_tuple__76); - __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liN, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) __PYX_ERR(0, 145, __pyx_L1_error) - - /* "LCEngineV1.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc - * - */ - __pyx_tuple__78 = PyTuple_Pack(14, __pyx_n_s_npos, __pyx_n_s_siW, __pyx_n_s_fil, __pyx_n_s_col, __pyx_n_s_ft, __pyx_n_s_ct, __pyx_n_s_inc, __pyx_n_s_liM, __pyx_n_s_liX, __pyx_n_s_filaIni, __pyx_n_s_salto, __pyx_n_s_sig, __pyx_n_s_sig2, __pyx_n_s_t); if (unlikely(!__pyx_tuple__78)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__78); - __Pyx_GIVEREF(__pyx_tuple__78); - __pyx_codeobj__79 = (PyObject*)__Pyx_PyCode_New(2, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__78, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liP, 160, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__79)) __PYX_ERR(0, 160, __pyx_L1_error) - - /* "LCEngineV1.pyx":189 - * - * dicK = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicK[i] = liK(i) - * - */ - __pyx_tuple__80 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__80)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__80); - __Pyx_GIVEREF(__pyx_tuple__80); - - /* "LCEngineV1.pyx":193 - * - * dicQ = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - __pyx_tuple__81 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__81)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__81); - __Pyx_GIVEREF(__pyx_tuple__81); - - /* "LCEngineV1.pyx":195 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_tuple__82 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__82)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__82); - __Pyx_GIVEREF(__pyx_tuple__82); - __pyx_tuple__83 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__83)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__83); - __Pyx_GIVEREF(__pyx_tuple__83); - __pyx_tuple__84 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__84)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__84); - __Pyx_GIVEREF(__pyx_tuple__84); - __pyx_tuple__85 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__85)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__85); - __Pyx_GIVEREF(__pyx_tuple__85); - __pyx_tuple__86 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__86)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__86); - __Pyx_GIVEREF(__pyx_tuple__86); - __pyx_tuple__87 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__87)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__87); - __Pyx_GIVEREF(__pyx_tuple__87); - __pyx_tuple__88 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__88)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__88); - __Pyx_GIVEREF(__pyx_tuple__88); - __pyx_tuple__89 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__89)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__89); - __Pyx_GIVEREF(__pyx_tuple__89); - __pyx_tuple__90 = PyTuple_Pack(8, __pyx_tuple__82, __pyx_tuple__83, __pyx_tuple__84, __pyx_tuple__85, __pyx_tuple__86, __pyx_tuple__87, __pyx_tuple__88, __pyx_tuple__89); if (unlikely(!__pyx_tuple__90)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__90); - __Pyx_GIVEREF(__pyx_tuple__90); - - /* "LCEngineV1.pyx":202 - * - * dicB = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - */ - __pyx_tuple__91 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__91)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__91); - __Pyx_GIVEREF(__pyx_tuple__91); - - /* "LCEngineV1.pyx":204 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_tuple__92 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__92)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__92); - __Pyx_GIVEREF(__pyx_tuple__92); - __pyx_tuple__93 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__93)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__93); - __Pyx_GIVEREF(__pyx_tuple__93); - __pyx_tuple__94 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_1); if (unlikely(!__pyx_tuple__94)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__94); - __Pyx_GIVEREF(__pyx_tuple__94); - __pyx_tuple__95 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__95)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__95); - __Pyx_GIVEREF(__pyx_tuple__95); - __pyx_tuple__96 = PyTuple_Pack(4, __pyx_tuple__92, __pyx_tuple__93, __pyx_tuple__94, __pyx_tuple__95); if (unlikely(!__pyx_tuple__96)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__96); - __Pyx_GIVEREF(__pyx_tuple__96); - - /* "LCEngineV1.pyx":211 - * - * dicR = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - __pyx_tuple__97 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__97)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__97); - __Pyx_GIVEREF(__pyx_tuple__97); - - /* "LCEngineV1.pyx":213 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_tuple__98 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_0); if (unlikely(!__pyx_tuple__98)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__98); - __Pyx_GIVEREF(__pyx_tuple__98); - __pyx_tuple__99 = PyTuple_Pack(2, __pyx_int_neg_1, __pyx_int_0); if (unlikely(!__pyx_tuple__99)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__99); - __Pyx_GIVEREF(__pyx_tuple__99); - __pyx_tuple__100 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_1); if (unlikely(!__pyx_tuple__100)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__100); - __Pyx_GIVEREF(__pyx_tuple__100); - __pyx_tuple__101 = PyTuple_Pack(2, __pyx_int_0, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__101)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__101); - __Pyx_GIVEREF(__pyx_tuple__101); - __pyx_tuple__102 = PyTuple_Pack(4, __pyx_tuple__98, __pyx_tuple__99, __pyx_tuple__100, __pyx_tuple__101); if (unlikely(!__pyx_tuple__102)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__102); - __Pyx_GIVEREF(__pyx_tuple__102); - - /* "LCEngineV1.pyx":220 - * - * dicN = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicN[i] = liN(i) - * - */ - __pyx_tuple__103 = PyTuple_Pack(1, __pyx_int_64); if (unlikely(!__pyx_tuple__103)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__103); - __Pyx_GIVEREF(__pyx_tuple__103); - - /* "LCEngineV1.pyx":224 - * - * dicPW = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPW[i] = liP(i, True) - * - */ - __pyx_tuple__104 = PyTuple_Pack(2, __pyx_int_8, __pyx_int_56); if (unlikely(!__pyx_tuple__104)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__104); - __Pyx_GIVEREF(__pyx_tuple__104); - - /* "LCEngineV1.pyx":228 - * - * dicPB = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPB[i] = liP(i, False) - * - */ - __pyx_tuple__105 = PyTuple_Pack(2, __pyx_int_8, __pyx_int_56); if (unlikely(!__pyx_tuple__105)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__105); - __Pyx_GIVEREF(__pyx_tuple__105); - - /* "LCEngineV1.pyx":231 - * dicPB[i] = liP(i, False) - * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] - */ - __pyx_tuple__106 = PyTuple_Pack(14, __pyx_n_s_a, __pyx_n_s_b, __pyx_n_s_no, __pyx_n_s_nv, __pyx_n_s_mx, __pyx_n_s_lia, __pyx_n_s_lib, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_nx, __pyx_n_s_f, __pyx_n_s_xmin, __pyx_n_s_lidef); if (unlikely(!__pyx_tuple__106)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__106); - __Pyx_GIVEREF(__pyx_tuple__106); - __pyx_codeobj__107 = (PyObject*)__Pyx_PyCode_New(5, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_knightmoves, 231, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__107)) __PYX_ERR(0, 231, __pyx_L1_error) - - /* "LCEngineV1.pyx":271 - * return lidef - * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] - */ - __pyx_tuple__108 = PyTuple_Pack(6, __pyx_n_s_x, __pyx_n_s_y, __pyx_n_s_celdas_ocupadas, __pyx_n_s_nv, __pyx_n_s_ot, __pyx_n_s_li); if (unlikely(!__pyx_tuple__108)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__108); - __Pyx_GIVEREF(__pyx_tuple__108); - __pyx_codeobj__109 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__108, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_liNMinimo, 271, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__109)) __PYX_ERR(0, 271, __pyx_L1_error) - - /* "LCEngineV1.pyx":282 - * return li - * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True - */ - __pyx_tuple__110 = PyTuple_Pack(7, __pyx_n_s_xpv, __pyx_n_s_li, __pyx_n_s_siBlancas, __pyx_n_s_c, __pyx_n_s_x, __pyx_n_s_move, __pyx_n_s_base); if (unlikely(!__pyx_tuple__110)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__110); - __Pyx_GIVEREF(__pyx_tuple__110); - __pyx_codeobj__111 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__110, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_xpv2lipv, 282, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__111)) __PYX_ERR(0, 282, __pyx_L1_error) - - /* "LCEngineV1.pyx":299 - * return li - * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) - * - */ - __pyx_tuple__112 = PyTuple_Pack(1, __pyx_n_s_xpv); if (unlikely(!__pyx_tuple__112)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__112); - __Pyx_GIVEREF(__pyx_tuple__112); - __pyx_codeobj__113 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__112, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_xpv2pv, 299, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__113)) __PYX_ERR(0, 299, __pyx_L1_error) - - /* "LCEngineV1.pyx":302 - * return " ".join(xpv2lipv(xpv)) - * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") - */ - __pyx_tuple__114 = PyTuple_Pack(7, __pyx_n_s_pv_2, __pyx_n_s_li, __pyx_n_s_lix, __pyx_n_s_move, __pyx_n_s_d, __pyx_n_s_h, __pyx_n_s_c); if (unlikely(!__pyx_tuple__114)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__114); - __Pyx_GIVEREF(__pyx_tuple__114); - __pyx_codeobj__115 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__114, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_pv2xpv, 302, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__115)) __PYX_ERR(0, 302, __pyx_L1_error) - - /* "LCEngineV1.pyx":317 - * return "" - * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) - */ - __pyx_tuple__116 = PyTuple_Pack(5, __pyx_n_s_fen, __pyx_n_s_depth, __pyx_n_s_ms, __pyx_n_s_level, __pyx_n_s_x); if (unlikely(!__pyx_tuple__116)) __PYX_ERR(0, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__116); - __Pyx_GIVEREF(__pyx_tuple__116); - __pyx_codeobj__117 = (PyObject*)__Pyx_PyCode_New(4, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__116, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_runFen, 317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__117)) __PYX_ERR(0, 317, __pyx_L1_error) - - /* "LCEngineV1.pyx":323 - * return x - * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() - */ - __pyx_tuple__118 = PyTuple_Pack(1, __pyx_n_s_fen); if (unlikely(!__pyx_tuple__118)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__118); - __Pyx_GIVEREF(__pyx_tuple__118); - __pyx_codeobj__119 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__118, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_setFen, 323, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__119)) __PYX_ERR(0, 323, __pyx_L1_error) - - /* "LCEngineV1.pyx":327 - * return movegen() - * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) - */ - __pyx_tuple__120 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_x); if (unlikely(!__pyx_tuple__120)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__120); - __Pyx_GIVEREF(__pyx_tuple__120); - __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(0, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getFen, 327, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) __PYX_ERR(0, 327, __pyx_L1_error) - - /* "LCEngineV1.pyx":333 - * return x - * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase - */ - __pyx_tuple__122 = PyTuple_Pack(6, __pyx_n_s_pv_2, __pyx_n_s_nmoves, __pyx_n_s_x, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_r); if (unlikely(!__pyx_tuple__122)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__122); - __Pyx_GIVEREF(__pyx_tuple__122); - __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(0, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getMoves, 333, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) __PYX_ERR(0, 333, __pyx_L1_error) - - /* "LCEngineV1.pyx":346 - * return li - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< - * cdef char san[10] - * - */ - __pyx_tuple__124 = PyTuple_Pack(5, __pyx_n_s_desdeA1H8, __pyx_n_s_hastaA1H8, __pyx_n_s_coronacion, __pyx_n_s_san_2, __pyx_n_s_num); if (unlikely(!__pyx_tuple__124)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__124); - __Pyx_GIVEREF(__pyx_tuple__124); - __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getPGN, 346, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) __PYX_ERR(0, 346, __pyx_L1_error) - - /* "LCEngineV1.pyx":359 - * return san - * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() - */ - __pyx_tuple__126 = PyTuple_Pack(9, __pyx_n_s_xpv, __pyx_n_s_san_2, __pyx_n_s_siW, __pyx_n_s_num, __pyx_n_s_li, __pyx_n_s_tam, __pyx_n_s_pv_2, __pyx_n_s_x, __pyx_n_s_numMove); if (unlikely(!__pyx_tuple__126)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__126); - __Pyx_GIVEREF(__pyx_tuple__126); - __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_xpv2pgn, 359, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) __PYX_ERR(0, 359, __pyx_L1_error) - - /* "LCEngineV1.pyx":390 - * return "".join(li) - * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() - * - */ - __pyx_codeobj__128 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isCheck, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__128)) __PYX_ERR(0, 390, __pyx_L1_error) - - /* "LCEngineV1.pyx":394 - * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] - */ - __pyx_tuple__129 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_num, __pyx_n_s_pv_2, __pyx_n_s_info, __pyx_n_s_san_2); if (unlikely(!__pyx_tuple__129)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__129); - __Pyx_GIVEREF(__pyx_tuple__129); - __pyx_codeobj__130 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__129, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_init, 394, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__130)) __PYX_ERR(0, 394, __pyx_L1_error) - - /* "LCEngineV1.pyx":419 - * self._capture = "x" in san - * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from - * - */ - __pyx_tuple__131 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__131)) __PYX_ERR(0, 419, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__131); - __Pyx_GIVEREF(__pyx_tuple__131); - __pyx_codeobj__132 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__131, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_desde, 419, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__132)) __PYX_ERR(0, 419, __pyx_L1_error) - - /* "LCEngineV1.pyx":422 - * return self._from - * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to - * - */ - __pyx_tuple__133 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__133)) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__133); - __Pyx_GIVEREF(__pyx_tuple__133); - __pyx_codeobj__134 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__133, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_hasta, 422, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__134)) __PYX_ERR(0, 422, __pyx_L1_error) - - /* "LCEngineV1.pyx":425 - * return self._to - * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() - * - */ - __pyx_tuple__135 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__135)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__135); - __Pyx_GIVEREF(__pyx_tuple__135); - __pyx_codeobj__136 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__135, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_coronacion, 425, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__136)) __PYX_ERR(0, 425, __pyx_L1_error) - - /* "LCEngineV1.pyx":428 - * return self._promotion.lower() - * - * def movimiento(self): # <<<<<<<<<<<<<< - * return self._from+self._to+self._promotion.lower() - * - */ - __pyx_tuple__137 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__137)) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__137); - __Pyx_GIVEREF(__pyx_tuple__137); - __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_movimiento, 428, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) __PYX_ERR(0, 428, __pyx_L1_error) - - /* "LCEngineV1.pyx":431 - * return self._from+self._to+self._promotion.lower() - * - * def jaque(self): # <<<<<<<<<<<<<< - * return self._check - * - */ - __pyx_tuple__139 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__139)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__139); - __Pyx_GIVEREF(__pyx_tuple__139); - __pyx_codeobj__140 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__139, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_jaque, 431, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__140)) __PYX_ERR(0, 431, __pyx_L1_error) - - /* "LCEngineV1.pyx":434 - * return self._check - * - * def mate(self): # <<<<<<<<<<<<<< - * return self._mate - * - */ - __pyx_tuple__141 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__141)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__141); - __Pyx_GIVEREF(__pyx_tuple__141); - __pyx_codeobj__142 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__141, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_mate_2, 434, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__142)) __PYX_ERR(0, 434, __pyx_L1_error) - - /* "LCEngineV1.pyx":437 - * return self._mate - * - * def captura(self): # <<<<<<<<<<<<<< - * return self._capture - * - */ - __pyx_tuple__143 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__143)) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__143); - __Pyx_GIVEREF(__pyx_tuple__143); - __pyx_codeobj__144 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__143, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_captura, 437, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__144)) __PYX_ERR(0, 437, __pyx_L1_error) - - /* "LCEngineV1.pyx":440 - * return self._capture - * - * def pieza(self): # <<<<<<<<<<<<<< - * return self._piece - * - */ - __pyx_tuple__145 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__145)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__145); - __Pyx_GIVEREF(__pyx_tuple__145); - __pyx_codeobj__146 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__145, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_pieza, 440, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__146)) __PYX_ERR(0, 440, __pyx_L1_error) - - /* "LCEngineV1.pyx":443 - * return self._piece - * - * def isCastleK(self): # <<<<<<<<<<<<<< - * return self._castle_K - * - */ - __pyx_tuple__147 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__147)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__147); - __Pyx_GIVEREF(__pyx_tuple__147); - __pyx_codeobj__148 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__147, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isCastleK, 443, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__148)) __PYX_ERR(0, 443, __pyx_L1_error) - - /* "LCEngineV1.pyx":446 - * return self._castle_K - * - * def isCastleQ(self): # <<<<<<<<<<<<<< - * return self._castle_Q - * - */ - __pyx_tuple__149 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__149)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__149); - __Pyx_GIVEREF(__pyx_tuple__149); - __pyx_codeobj__150 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__149, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isCastleQ, 446, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__150)) __PYX_ERR(0, 446, __pyx_L1_error) - - /* "LCEngineV1.pyx":449 - * return self._castle_Q - * - * def isEnPassant(self): # <<<<<<<<<<<<<< - * return self._ep - * - */ - __pyx_tuple__151 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__151)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__151); - __Pyx_GIVEREF(__pyx_tuple__151); - __pyx_codeobj__152 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__151, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_isEnPassant, 449, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__152)) __PYX_ERR(0, 449, __pyx_L1_error) - - /* "LCEngineV1.pyx":452 - * return self._ep - * - * def getExMoves(): # <<<<<<<<<<<<<< - * nmoves = numMoves() - * - */ - __pyx_tuple__153 = PyTuple_Pack(5, __pyx_n_s_nmoves, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_mv); if (unlikely(!__pyx_tuple__153)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__153); - __Pyx_GIVEREF(__pyx_tuple__153); - __pyx_codeobj__154 = (PyObject*)__Pyx_PyCode_New(0, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__153, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getExMoves, 452, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__154)) __PYX_ERR(0, 452, __pyx_L1_error) - - /* "LCEngineV1.pyx":462 - * return li - * - * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - __pyx_tuple__155 = PyTuple_Pack(5, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num, __pyx_n_s_infoMove); if (unlikely(!__pyx_tuple__155)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__155); - __Pyx_GIVEREF(__pyx_tuple__155); - __pyx_codeobj__156 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__155, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_moveExPV, 462, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__156)) __PYX_ERR(0, 462, __pyx_L1_error) - - /* "LCEngineV1.pyx":475 - * return infoMove - * - * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - __pyx_tuple__157 = PyTuple_Pack(4, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num); if (unlikely(!__pyx_tuple__157)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__157); - __Pyx_GIVEREF(__pyx_tuple__157); - __pyx_codeobj__158 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__157, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_movePV, 475, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__158)) __PYX_ERR(0, 475, __pyx_L1_error) - - /* "LCEngineV1.pyx":487 - * return True - * - * def makeMove(move): # <<<<<<<<<<<<<< - * desde = move[:2] - * hasta = move[2:4] - */ - __pyx_tuple__159 = PyTuple_Pack(5, __pyx_n_s_move, __pyx_n_s_desde, __pyx_n_s_hasta, __pyx_n_s_coronacion, __pyx_n_s_num); if (unlikely(!__pyx_tuple__159)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__159); - __Pyx_GIVEREF(__pyx_tuple__159); - __pyx_codeobj__160 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__159, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_makeMove, 487, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__160)) __PYX_ERR(0, 487, __pyx_L1_error) - - /* "LCEngineV1.pyx":498 - * return True - * - * def fen2fenM2(fen): # <<<<<<<<<<<<<< - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) - */ - __pyx_tuple__161 = PyTuple_Pack(3, __pyx_n_s_fen, __pyx_n_s_sp1, __pyx_n_s_sp2); if (unlikely(!__pyx_tuple__161)) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__161); - __Pyx_GIVEREF(__pyx_tuple__161); - __pyx_codeobj__162 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__161, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_fen2fenM2, 498, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__162)) __PYX_ERR(0, 498, __pyx_L1_error) - - /* "LCEngineV1.pyx":503 - * return fen[:sp2] - * - * def setFenInicial(): # <<<<<<<<<<<<<< - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) - */ - __pyx_tuple__163 = PyTuple_Pack(1, __pyx_n_s_inifen); if (unlikely(!__pyx_tuple__163)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__163); - __Pyx_GIVEREF(__pyx_tuple__163); - __pyx_codeobj__164 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__163, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_setFenInicial, 503, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__164)) __PYX_ERR(0, 503, __pyx_L1_error) - - /* "LCEngineV1.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - __pyx_tuple__165 = PyTuple_Pack(2, __pyx_n_s_pv_2, __pyx_n_s_move); if (unlikely(!__pyx_tuple__165)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__165); - __Pyx_GIVEREF(__pyx_tuple__165); - __pyx_codeobj__166 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__165, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_makePV, 507, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__166)) __PYX_ERR(0, 507, __pyx_L1_error) - - /* "LCEngineV1.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - __pyx_tuple__167 = PyTuple_Pack(6, __pyx_n_s_fen, __pyx_n_s_nmoves, __pyx_n_s_nbase, __pyx_n_s_li, __pyx_n_s_x, __pyx_n_s_mv); if (unlikely(!__pyx_tuple__167)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__167); - __Pyx_GIVEREF(__pyx_tuple__167); - __pyx_codeobj__168 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__167, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getCapturesFEN, 515, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__168)) __PYX_ERR(0, 515, __pyx_L1_error) - - /* "LCEngineV1.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) - */ - __pyx_tuple__169 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_siMB); if (unlikely(!__pyx_tuple__169)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__169); - __Pyx_GIVEREF(__pyx_tuple__169); - __pyx_codeobj__170 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__169, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_getCaptures, 526, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__170)) __PYX_ERR(0, 526, __pyx_L1_error) - - /* "LCEngineV1.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" - */ - __pyx_tuple__171 = PyTuple_Pack(2, __pyx_n_s_fen, __pyx_n_s_li); if (unlikely(!__pyx_tuple__171)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__171); - __Pyx_GIVEREF(__pyx_tuple__171); - __pyx_codeobj__172 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__171, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_fenOB, 531, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__172)) __PYX_ERR(0, 531, __pyx_L1_error) - - /* "LCEngineV1.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 - * - */ - __pyx_tuple__173 = PyTuple_Pack(1, __pyx_n_s_fen); if (unlikely(!__pyx_tuple__173)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__173); - __Pyx_GIVEREF(__pyx_tuple__173); - __pyx_codeobj__174 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__173, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_c_correr_lucaschess_pyLC12_LCEng, __pyx_n_s_fenTerminado, 537, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__174)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} - -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_49 = PyInt_FromLong(49); if (unlikely(!__pyx_int_49)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_51 = PyInt_FromLong(51); if (unlikely(!__pyx_int_51)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_52 = PyInt_FromLong(52); if (unlikely(!__pyx_int_52)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_53 = PyInt_FromLong(53); if (unlikely(!__pyx_int_53)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_56 = PyInt_FromLong(56); if (unlikely(!__pyx_int_56)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_58 = PyInt_FromLong(58); if (unlikely(!__pyx_int_58)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_64 = PyInt_FromLong(64); if (unlikely(!__pyx_int_64)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_80 = PyInt_FromLong(80); if (unlikely(!__pyx_int_80)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_97 = PyInt_FromLong(97); if (unlikely(!__pyx_int_97)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initLCEngineV1(void); /*proto*/ -PyMODINIT_FUNC initLCEngineV1(void) -#else -PyMODINIT_FUNC PyInit_LCEngineV1(void); /*proto*/ -PyMODINIT_FUNC PyInit_LCEngineV1(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - int __pyx_t_15; - __Pyx_RefNannyDeclarations - #if CYTHON_REFNANNY - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); - } - #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_LCEngineV1(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("LCEngineV1", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - #if CYTHON_COMPILING_IN_PYPY - Py_INCREF(__pyx_b); - #endif - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_LCEngineV1) { - if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - } - #if PY_MAJOR_VERSION >= 3 - { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "LCEngineV1")) { - if (unlikely(PyDict_SetItemString(modules, "LCEngineV1", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) - } - } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global init code ---*/ - /*--- Variable export code ---*/ - /*--- Function export code ---*/ - /*--- Type init code ---*/ - /*--- Type import code ---*/ - /*--- Variable import code ---*/ - /*--- Function import code ---*/ - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - - /* "LCEngineV1.pyx":41 - * - * - * class PGNreader: # <<<<<<<<<<<<<< - * def __init__(self, fich, depth): - * self.fich = fich - */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_PGNreader, __pyx_n_s_PGNreader, (PyObject *) NULL, __pyx_n_s_LCEngineV1, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - - /* "LCEngineV1.pyx":42 - * - * class PGNreader: - * def __init__(self, fich, depth): # <<<<<<<<<<<<<< - * self.fich = fich - * self.depth = depth - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_9PGNreader_1__init__, 0, __pyx_n_s_PGNreader___init, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__49)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":46 - * self.depth = depth - * - * def __enter__(self): # <<<<<<<<<<<<<< - * pgn_start(self.fich, self.depth) - * return self - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_9PGNreader_3__enter__, 0, __pyx_n_s_PGNreader___enter, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__51)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_enter, __pyx_t_2) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":50 - * return self - * - * def __exit__(self, type, value, traceback): # <<<<<<<<<<<<<< - * pgn_stop() - * - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_9PGNreader_5__exit__, 0, __pyx_n_s_PGNreader___exit, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__53)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_exit, __pyx_t_2) < 0) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":53 - * pgn_stop() - * - * def __iter__(self): # <<<<<<<<<<<<<< - * return self - * - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_9PGNreader_7__iter__, 0, __pyx_n_s_PGNreader___iter, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__55)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_iter, __pyx_t_2) < 0) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":56 - * return self - * - * def next(self): # <<<<<<<<<<<<<< - * n = pgn_read() - * if n: - */ - __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_9PGNreader_9next, 0, __pyx_n_s_PGNreader_next, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__57)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_next, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":41 - * - * - * class PGNreader: # <<<<<<<<<<<<<< - * def __init__(self, fich, depth): - * self.fich = fich - */ - __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_PGNreader, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PGNreader, __pyx_t_2) < 0) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":73 - * - * - * def lc_pgn2pv(pgn1): # <<<<<<<<<<<<<< - * cdef char pv[10]; - * resp = pgn2pv(pgn1, pv) - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_1lc_pgn2pv, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lc_pgn2pv, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":82 - * - * - * def posFC(pos): # <<<<<<<<<<<<<< - * return pos / 8, pos % 8 - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_3posFC, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_posFC, __pyx_t_1) < 0) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":85 - * return pos / 8, pos % 8 - * - * def FCpos(f, c): # <<<<<<<<<<<<<< - * return f * 8 + c - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_5FCpos, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FCpos, __pyx_t_1) < 0) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":88 - * return f * 8 + c - * - * def posA1(pos): # <<<<<<<<<<<<<< - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_7posA1, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_posA1, __pyx_t_1) < 0) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":91 - * return chr(pos % 8 + 97) + chr(pos / 8 + 49) - * - * def a1Pos(a1): # <<<<<<<<<<<<<< - * cdef int f, c - * f = ord(a1[1]) - 49 - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_9a1Pos, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_a1Pos, __pyx_t_1) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":97 - * return f * 8 + c - * - * def move2num(a1h8q): # <<<<<<<<<<<<<< - * num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - * if len(a1h8q)>4: - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_11move2num, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_move2num, __pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":103 - * return num - * - * def num2move(num): # <<<<<<<<<<<<<< - * a1 = posA1(num%64) - * num /= 64 - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_13num2move, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_num2move, __pyx_t_1) < 0) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":114 - * return a1 + h8 + q - * - * def liK(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * liM = [] - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_15liK, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liK, __pyx_t_1) < 0) __PYX_ERR(0, 114, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":127 - * - * - * def liBR(npos, fi, ci): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_17liBR, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liBR, __pyx_t_1) < 0) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":145 - * - * - * def liN(npos): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_19liN, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liN, __pyx_t_1) < 0) __PYX_ERR(0, 145, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":160 - * return tuple(liM) - * - * def liP(npos, siW): # <<<<<<<<<<<<<< - * cdef int fil, col, ft, ct, inc - * - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_21liP, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liP, __pyx_t_1) < 0) __PYX_ERR(0, 160, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":188 - * return tuple(liM), tuple(liX) - * - * dicK = {} # <<<<<<<<<<<<<< - * for i in range(64): - * dicK[i] = liK(i) - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicK, __pyx_t_1) < 0) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":189 - * - * dicK = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicK[i] = liK(i) - * - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__80, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 189, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 189, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_1) < 0) __PYX_ERR(0, 189, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":190 - * dicK = {} - * for i in range(64): - * dicK[i] = liK(i) # <<<<<<<<<<<<<< - * - * dicQ = {} - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_liK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_7) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicK); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_8, __pyx_t_1) < 0)) __PYX_ERR(0, 190, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":189 - * - * dicK = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicK[i] = liK(i) - * - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":192 - * dicK[i] = liK(i) - * - * dicQ = {} # <<<<<<<<<<<<<< - * for i in range(64): - * li = [] - */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicQ, __pyx_t_2) < 0) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":193 - * - * dicQ = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__81, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 193, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 193, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_2) < 0) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":194 - * dicQ = {} - * for i in range(64): - * li = [] # <<<<<<<<<<<<<< - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_li, __pyx_t_2) < 0) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":195 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_t_2 = __pyx_tuple__90; __Pyx_INCREF(__pyx_t_2); __pyx_t_9 = 0; - for (;;) { - if (__pyx_t_9 >= 8) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 195, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_2, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - if (likely(__pyx_t_8 != Py_None)) { - PyObject* sequence = __pyx_t_8; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 195, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - #else - __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 195, __pyx_L1_error) - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f_i, __pyx_t_5) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_i, __pyx_t_6) < 0) __PYX_ERR(0, 195, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":196 - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) # <<<<<<<<<<<<<< - * if lin: - * li.append(lin) - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_liBR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_f_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_c_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_11)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_11); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_5, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { - PyObject *__pyx_temp[4] = {__pyx_t_11, __pyx_t_5, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_13 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (__pyx_t_11) { - __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL; - } - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_12, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_12, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_12, __pyx_t_10); - __pyx_t_5 = 0; - __pyx_t_7 = 0; - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lin, __pyx_t_8) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "LCEngineV1.pyx":197 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicQ[i] = tuple(li) - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 197, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_14) { - - /* "LCEngineV1.pyx":198 - * lin = liBR(i, f_i, c_i) - * if lin: - * li.append(lin) # <<<<<<<<<<<<<< - * dicQ[i] = tuple(li) - * - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_6); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 198, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":197 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicQ[i] = tuple(li) - */ - } - - /* "LCEngineV1.pyx":195 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "LCEngineV1.pyx":199 - * if lin: - * li.append(lin) - * dicQ[i] = tuple(li) # <<<<<<<<<<<<<< - * - * dicB = {} - */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PySequence_Tuple(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicQ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_t_8, __pyx_t_6) < 0)) __PYX_ERR(0, 199, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":193 - * - * dicQ = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":201 - * dicQ[i] = tuple(li) - * - * dicB = {} # <<<<<<<<<<<<<< - * for i in range(64): - * li = [] - */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicB, __pyx_t_1) < 0) __PYX_ERR(0, 201, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":202 - * - * dicB = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__91, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 202, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_6, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_6); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 202, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_1) < 0) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":203 - * dicB = {} - * for i in range(64): - * li = [] # <<<<<<<<<<<<<< - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_li, __pyx_t_1) < 0) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":204 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_t_1 = __pyx_tuple__96; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; - for (;;) { - if (__pyx_t_9 >= 4) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 204, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - if (likely(__pyx_t_8 != Py_None)) { - PyObject* sequence = __pyx_t_8; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 204, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(__pyx_t_13); - #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 204, __pyx_L1_error) - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f_i, __pyx_t_2) < 0) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_i, __pyx_t_13) < 0) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":205 - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) # <<<<<<<<<<<<<< - * if lin: - * li.append(lin) - */ - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_liBR); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_f_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_c_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_13); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_13, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_7}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[4] = {__pyx_t_5, __pyx_t_2, __pyx_t_10, __pyx_t_7}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } else - #endif - { - __pyx_t_11 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (__pyx_t_5) { - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5); __pyx_t_5 = NULL; - } - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_12, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_12, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_12, __pyx_t_7); - __pyx_t_2 = 0; - __pyx_t_10 = 0; - __pyx_t_7 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lin, __pyx_t_8) < 0) __PYX_ERR(0, 205, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "LCEngineV1.pyx":206 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicB[i] = tuple(li) - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 206, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_14) { - - /* "LCEngineV1.pyx":207 - * lin = liBR(i, f_i, c_i) - * if lin: - * li.append(lin) # <<<<<<<<<<<<<< - * dicB[i] = tuple(li) - * - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_13); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 207, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":206 - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicB[i] = tuple(li) - */ - } - - /* "LCEngineV1.pyx":204 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "LCEngineV1.pyx":208 - * if lin: - * li.append(lin) - * dicB[i] = tuple(li) # <<<<<<<<<<<<<< - * - * dicR = {} - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicB); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_t_8, __pyx_t_13) < 0)) __PYX_ERR(0, 208, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":202 - * - * dicB = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - */ - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":210 - * dicB[i] = tuple(li) - * - * dicR = {} # <<<<<<<<<<<<<< - * for i in range(64): - * li = [] - */ - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicR, __pyx_t_6) < 0) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":211 - * - * dicR = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__97, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { - __pyx_t_13 = __pyx_t_6; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_13))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 211, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_6); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 211, __pyx_L1_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_4(__pyx_t_13); - if (unlikely(!__pyx_t_6)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 211, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_6) < 0) __PYX_ERR(0, 211, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":212 - * dicR = {} - * for i in range(64): - * li = [] # <<<<<<<<<<<<<< - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_li, __pyx_t_6) < 0) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":213 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - __pyx_t_6 = __pyx_tuple__102; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0; - for (;;) { - if (__pyx_t_9 >= 4) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) - #else - __pyx_t_8 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - #endif - if (likely(__pyx_t_8 != Py_None)) { - PyObject* sequence = __pyx_t_8; - #if !CYTHON_COMPILING_IN_PYPY - Py_ssize_t size = Py_SIZE(sequence); - #else - Py_ssize_t size = PySequence_Size(sequence); - #endif - if (unlikely(size != 2)) { - if (size > 2) __Pyx_RaiseTooManyValuesError(2); - else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 213, __pyx_L1_error) - } - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_11 = PyTuple_GET_ITEM(sequence, 1); - __Pyx_INCREF(__pyx_t_1); - __Pyx_INCREF(__pyx_t_11); - #else - __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - #endif - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else { - __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(0, 213, __pyx_L1_error) - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_f_i, __pyx_t_1) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_c_i, __pyx_t_11) < 0) __PYX_ERR(0, 213, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":214 - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) # <<<<<<<<<<<<<< - * if lin: - * li.append(lin) - */ - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_liBR); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_f_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_c_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_11); - if (likely(__pyx_t_2)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); - __Pyx_INCREF(__pyx_t_2); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_11, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_1, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { - PyObject *__pyx_temp[4] = {__pyx_t_2, __pyx_t_1, __pyx_t_7, __pyx_t_10}; - __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_12, 3+__pyx_t_12); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(3+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_2) { - __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; - } - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_12, __pyx_t_10); - __pyx_t_1 = 0; - __pyx_t_7 = 0; - __pyx_t_10 = 0; - __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_5, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_lin, __pyx_t_8) < 0) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "LCEngineV1.pyx":215 - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicR[i] = tuple(li) - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 215, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__pyx_t_14) { - - /* "LCEngineV1.pyx":216 - * lin = liBR(i, f_i, c_i) - * if lin: - * li.append(lin) # <<<<<<<<<<<<<< - * dicR[i] = tuple(li) - * - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_lin); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_15 = __Pyx_PyObject_Append(__pyx_t_8, __pyx_t_11); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 216, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":215 - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - * lin = liBR(i, f_i, c_i) - * if lin: # <<<<<<<<<<<<<< - * li.append(lin) - * dicR[i] = tuple(li) - */ - } - - /* "LCEngineV1.pyx":213 - * for i in range(64): - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): # <<<<<<<<<<<<<< - * lin = liBR(i, f_i, c_i) - * if lin: - */ - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "LCEngineV1.pyx":217 - * if lin: - * li.append(lin) - * dicR[i] = tuple(li) # <<<<<<<<<<<<<< - * - * dicN = {} - */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_li); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_11 = PySequence_Tuple(__pyx_t_6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicR); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - if (unlikely(PyObject_SetItem(__pyx_t_6, __pyx_t_8, __pyx_t_11) < 0)) __PYX_ERR(0, 217, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":211 - * - * dicR = {} - * for i in range(64): # <<<<<<<<<<<<<< - * li = [] - * for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - */ - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":219 - * dicR[i] = tuple(li) - * - * dicN = {} # <<<<<<<<<<<<<< - * for i in range(64): - * dicN[i] = liN(i) - */ - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicN, __pyx_t_13) < 0) __PYX_ERR(0, 219, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":220 - * - * dicN = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicN[i] = liN(i) - * - */ - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__103, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) { - __pyx_t_11 = __pyx_t_13; __Pyx_INCREF(__pyx_t_11); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_11))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } - } else { - __pyx_t_13 = __pyx_t_4(__pyx_t_11); - if (unlikely(!__pyx_t_13)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 220, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_13); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_13) < 0) __PYX_ERR(0, 220, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":221 - * dicN = {} - * for i in range(64): - * dicN[i] = liN(i) # <<<<<<<<<<<<<< - * - * dicPW = {} - */ - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_liN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_8, function); - } - } - if (!__pyx_t_5) { - __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_13); - } else { - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; - __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) { - PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; - __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __pyx_t_5 = NULL; - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_10, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } - } - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicN); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_8, __pyx_t_10, __pyx_t_13) < 0)) __PYX_ERR(0, 221, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":220 - * - * dicN = {} - * for i in range(64): # <<<<<<<<<<<<<< - * dicN[i] = liN(i) - * - */ - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":223 - * dicN[i] = liN(i) - * - * dicPW = {} # <<<<<<<<<<<<<< - * for i in range(8, 56): - * dicPW[i] = liP(i, True) - */ - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicPW, __pyx_t_11) < 0) __PYX_ERR(0, 223, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":224 - * - * dicPW = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPW[i] = liP(i, True) - * - */ - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__104, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (likely(PyList_CheckExact(__pyx_t_11)) || PyTuple_CheckExact(__pyx_t_11)) { - __pyx_t_13 = __pyx_t_11; __Pyx_INCREF(__pyx_t_13); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_13 = PyObject_GetIter(__pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_4 = Py_TYPE(__pyx_t_13)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_13))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_11 = PyList_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_11); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) - #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_13)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_11 = PyTuple_GET_ITEM(__pyx_t_13, __pyx_t_3); __Pyx_INCREF(__pyx_t_11); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) - #else - __pyx_t_11 = PySequence_ITEM(__pyx_t_13, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - #endif - } - } else { - __pyx_t_11 = __pyx_t_4(__pyx_t_13); - if (unlikely(!__pyx_t_11)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 224, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_11); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_11) < 0) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":225 - * dicPW = {} - * for i in range(8, 56): - * dicPW[i] = liP(i, True) # <<<<<<<<<<<<<< - * - * dicPB = {} - */ - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_liP); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, Py_True}; - __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { - PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_8, Py_True}; - __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (__pyx_t_6) { - __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; - } - __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_12, __pyx_t_8); - __Pyx_INCREF(Py_True); - __Pyx_GIVEREF(Py_True); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_12, Py_True); - __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicPW); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(PyObject_SetItem(__pyx_t_10, __pyx_t_5, __pyx_t_11) < 0)) __PYX_ERR(0, 225, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":224 - * - * dicPW = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPW[i] = liP(i, True) - * - */ - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":227 - * dicPW[i] = liP(i, True) - * - * dicPB = {} # <<<<<<<<<<<<<< - * for i in range(8, 56): - * dicPB[i] = liP(i, False) - */ - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_dicPB, __pyx_t_13) < 0) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":228 - * - * dicPB = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPB[i] = liP(i, False) - * - */ - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_tuple__105, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - if (likely(PyList_CheckExact(__pyx_t_13)) || PyTuple_CheckExact(__pyx_t_13)) { - __pyx_t_11 = __pyx_t_13; __Pyx_INCREF(__pyx_t_11); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_11 = PyObject_GetIter(__pyx_t_13); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_4 = Py_TYPE(__pyx_t_11)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 228, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_11))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyList_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 228, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_11)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_13 = PyTuple_GET_ITEM(__pyx_t_11, __pyx_t_3); __Pyx_INCREF(__pyx_t_13); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 228, __pyx_L1_error) - #else - __pyx_t_13 = PySequence_ITEM(__pyx_t_11, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - #endif - } - } else { - __pyx_t_13 = __pyx_t_4(__pyx_t_11); - if (unlikely(!__pyx_t_13)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 228, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_13); - } - if (PyDict_SetItem(__pyx_d, __pyx_n_s_i, __pyx_t_13) < 0) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":229 - * dicPB = {} - * for i in range(8, 56): - * dicPB[i] = liP(i, False) # <<<<<<<<<<<<<< - * - * def knightmoves(a, b, no, nv, mx): - */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_liP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = NULL; - __pyx_t_12 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_12 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_10, Py_False}; - __pyx_t_13 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_10, Py_False}; - __pyx_t_13 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_12, 2+__pyx_t_12); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - } else - #endif - { - __pyx_t_6 = PyTuple_New(2+__pyx_t_12); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__pyx_t_8) { - __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL; - } - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_12, __pyx_t_10); - __Pyx_INCREF(Py_False); - __Pyx_GIVEREF(Py_False); - PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_12, Py_False); - __pyx_t_10 = 0; - __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_dicPB); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_6, __pyx_t_13) < 0)) __PYX_ERR(0, 229, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - - /* "LCEngineV1.pyx":228 - * - * dicPB = {} - * for i in range(8, 56): # <<<<<<<<<<<<<< - * dicPB[i] = liP(i, False) - * - */ - } - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":231 - * dicPB[i] = liP(i, False) - * - * def knightmoves(a, b, no, nv, mx): # <<<<<<<<<<<<<< - * if nv > mx: - * return [] - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_23knightmoves, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_knightmoves, __pyx_t_11) < 0) __PYX_ERR(0, 231, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":271 - * return lidef - * - * def liNMinimo(x, y, celdas_ocupadas): # <<<<<<<<<<<<<< - * cdef int nv - * ot = celdas_ocupadas[:] - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_25liNMinimo, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_liNMinimo, __pyx_t_11) < 0) __PYX_ERR(0, 271, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":282 - * return li - * - * def xpv2lipv(xpv): # <<<<<<<<<<<<<< - * li = [] - * siBlancas = True - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_27xpv2lipv, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2lipv, __pyx_t_11) < 0) __PYX_ERR(0, 282, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":299 - * return li - * - * def xpv2pv(xpv): # <<<<<<<<<<<<<< - * return " ".join(xpv2lipv(xpv)) - * - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_29xpv2pv, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2pv, __pyx_t_11) < 0) __PYX_ERR(0, 299, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":302 - * return " ".join(xpv2lipv(xpv)) - * - * def pv2xpv(pv): # <<<<<<<<<<<<<< - * if pv: - * li = pv.split(" ") - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_31pv2xpv, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_pv2xpv, __pyx_t_11) < 0) __PYX_ERR(0, 302, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":317 - * return "" - * - * def runFen( fen, depth, ms, level ): # <<<<<<<<<<<<<< - * set_level(level) - * x = playFen(fen, depth, ms) - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_33runFen, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 317, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_runFen, __pyx_t_11) < 0) __PYX_ERR(0, 317, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":323 - * return x - * - * def setFen(fen): # <<<<<<<<<<<<<< - * fen_board(fen) - * return movegen() - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_35setFen, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setFen, __pyx_t_11) < 0) __PYX_ERR(0, 323, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":327 - * return movegen() - * - * def getFen(): # <<<<<<<<<<<<<< - * cdef char fen[100] - * board_fen(fen) - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_37getFen, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getFen, __pyx_t_11) < 0) __PYX_ERR(0, 327, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":333 - * return x - * - * def getMoves(): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef int nmoves, x, nbase - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_39getMoves, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getMoves, __pyx_t_11) < 0) __PYX_ERR(0, 333, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":346 - * return li - * - * def getPGN(desdeA1H8, hastaA1H8, coronacion): # <<<<<<<<<<<<<< - * cdef char san[10] - * - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_41getPGN, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getPGN, __pyx_t_11) < 0) __PYX_ERR(0, 346, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":359 - * return san - * - * def xpv2pgn(xpv): # <<<<<<<<<<<<<< - * cdef char san[10] - * setFenInicial() - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_43xpv2pgn, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_xpv2pgn, __pyx_t_11) < 0) __PYX_ERR(0, 359, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":390 - * return "".join(li) - * - * def isCheck(): # <<<<<<<<<<<<<< - * return inCheck() - * - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_45isCheck, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_isCheck, __pyx_t_11) < 0) __PYX_ERR(0, 390, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":393 - * return inCheck() - * - * class InfoMove(object): # <<<<<<<<<<<<<< - * def __init__(self, num): - * cdef char pv[10] - */ - __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - __Pyx_INCREF(__pyx_builtin_object); - __Pyx_GIVEREF(__pyx_builtin_object); - PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_builtin_object); - __pyx_t_13 = __Pyx_CalculateMetaclass(NULL, __pyx_t_11); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_13, __pyx_t_11, __pyx_n_s_InfoMove, __pyx_n_s_InfoMove, (PyObject *) NULL, __pyx_n_s_LCEngineV1, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "LCEngineV1.pyx":394 - * - * class InfoMove(object): - * def __init__(self, num): # <<<<<<<<<<<<<< - * cdef char pv[10] - * cdef char info[10] - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_1__init__, 0, __pyx_n_s_InfoMove___init, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__130)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_init, __pyx_t_5) < 0) __PYX_ERR(0, 394, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":419 - * self._capture = "x" in san - * - * def desde(self): # <<<<<<<<<<<<<< - * return self._from - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_3desde, 0, __pyx_n_s_InfoMove_desde, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__132)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 419, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_desde, __pyx_t_5) < 0) __PYX_ERR(0, 419, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":422 - * return self._from - * - * def hasta(self): # <<<<<<<<<<<<<< - * return self._to - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_5hasta, 0, __pyx_n_s_InfoMove_hasta, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__134)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_hasta, __pyx_t_5) < 0) __PYX_ERR(0, 422, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":425 - * return self._to - * - * def coronacion(self): # <<<<<<<<<<<<<< - * return self._promotion.lower() - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_7coronacion, 0, __pyx_n_s_InfoMove_coronacion, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__136)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_coronacion, __pyx_t_5) < 0) __PYX_ERR(0, 425, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":428 - * return self._promotion.lower() - * - * def movimiento(self): # <<<<<<<<<<<<<< - * return self._from+self._to+self._promotion.lower() - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_9movimiento, 0, __pyx_n_s_InfoMove_movimiento, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__138)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_movimiento, __pyx_t_5) < 0) __PYX_ERR(0, 428, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":431 - * return self._from+self._to+self._promotion.lower() - * - * def jaque(self): # <<<<<<<<<<<<<< - * return self._check - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_11jaque, 0, __pyx_n_s_InfoMove_jaque, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__140)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_jaque, __pyx_t_5) < 0) __PYX_ERR(0, 431, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":434 - * return self._check - * - * def mate(self): # <<<<<<<<<<<<<< - * return self._mate - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_13mate, 0, __pyx_n_s_InfoMove_mate, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__142)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_mate_2, __pyx_t_5) < 0) __PYX_ERR(0, 434, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":437 - * return self._mate - * - * def captura(self): # <<<<<<<<<<<<<< - * return self._capture - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_15captura, 0, __pyx_n_s_InfoMove_captura, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__144)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_captura, __pyx_t_5) < 0) __PYX_ERR(0, 437, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":440 - * return self._capture - * - * def pieza(self): # <<<<<<<<<<<<<< - * return self._piece - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_17pieza, 0, __pyx_n_s_InfoMove_pieza, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__146)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_pieza, __pyx_t_5) < 0) __PYX_ERR(0, 440, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":443 - * return self._piece - * - * def isCastleK(self): # <<<<<<<<<<<<<< - * return self._castle_K - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_19isCastleK, 0, __pyx_n_s_InfoMove_isCastleK, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__148)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_isCastleK, __pyx_t_5) < 0) __PYX_ERR(0, 443, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":446 - * return self._castle_K - * - * def isCastleQ(self): # <<<<<<<<<<<<<< - * return self._castle_Q - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_21isCastleQ, 0, __pyx_n_s_InfoMove_isCastleQ, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__150)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_isCastleQ, __pyx_t_5) < 0) __PYX_ERR(0, 446, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":449 - * return self._castle_Q - * - * def isEnPassant(self): # <<<<<<<<<<<<<< - * return self._ep - * - */ - __pyx_t_5 = __Pyx_CyFunction_NewEx(&__pyx_mdef_10LCEngineV1_8InfoMove_23isEnPassant, 0, __pyx_n_s_InfoMove_isEnPassant, NULL, __pyx_n_s_LCEngineV1, __pyx_d, ((PyObject *)__pyx_codeobj__152)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_6, __pyx_n_s_isEnPassant, __pyx_t_5) < 0) __PYX_ERR(0, 449, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "LCEngineV1.pyx":393 - * return inCheck() - * - * class InfoMove(object): # <<<<<<<<<<<<<< - * def __init__(self, num): - * cdef char pv[10] - */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_13, __pyx_n_s_InfoMove, __pyx_t_11, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_InfoMove, __pyx_t_5) < 0) __PYX_ERR(0, 393, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":452 - * return self._ep - * - * def getExMoves(): # <<<<<<<<<<<<<< - * nmoves = numMoves() - * - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_47getExMoves, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getExMoves, __pyx_t_11) < 0) __PYX_ERR(0, 452, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":462 - * return li - * - * def moveExPV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_49moveExPV, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_moveExPV, __pyx_t_11) < 0) __PYX_ERR(0, 462, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":475 - * return infoMove - * - * def movePV(desde, hasta, coronacion): # <<<<<<<<<<<<<< - * if not coronacion: - * coronacion = "" - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_51movePV, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_movePV, __pyx_t_11) < 0) __PYX_ERR(0, 475, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":487 - * return True - * - * def makeMove(move): # <<<<<<<<<<<<<< - * desde = move[:2] - * hasta = move[2:4] - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_53makeMove, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_makeMove, __pyx_t_11) < 0) __PYX_ERR(0, 487, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":498 - * return True - * - * def fen2fenM2(fen): # <<<<<<<<<<<<<< - * sp1 = fen.rfind(" ") - * sp2 = fen.rfind(" ", 0, sp1) - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_55fen2fenM2, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fen2fenM2, __pyx_t_11) < 0) __PYX_ERR(0, 498, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":503 - * return fen[:sp2] - * - * def setFenInicial(): # <<<<<<<<<<<<<< - * inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - * setFen(inifen) - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_57setFenInicial, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_setFenInicial, __pyx_t_11) < 0) __PYX_ERR(0, 503, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":507 - * setFen(inifen) - * - * def makePV(pv): # <<<<<<<<<<<<<< - * setFenInicial() - * if pv: - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_59makePV, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_makePV, __pyx_t_11) < 0) __PYX_ERR(0, 507, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":515 - * - * - * def getCapturesFEN(fen): # <<<<<<<<<<<<<< - * setFen(fen) - * nmoves = numMoves() - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_61getCapturesFEN, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCapturesFEN, __pyx_t_11) < 0) __PYX_ERR(0, 515, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":526 - * return li - * - * def getCaptures(fen, siMB): # <<<<<<<<<<<<<< - * if not siMB: - * fen = fenOB(fen) - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_63getCaptures, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_getCaptures, __pyx_t_11) < 0) __PYX_ERR(0, 526, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":531 - * return getCapturesFEN(fen) - * - * def fenOB(fen): # <<<<<<<<<<<<<< - * li = fen.split(" ") - * li[3] = "-" - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_65fenOB, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fenOB, __pyx_t_11) < 0) __PYX_ERR(0, 531, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":537 - * return " ".join(li) - * - * def fenTerminado(fen): # <<<<<<<<<<<<<< - * return setFen(fen) == 0 - * - */ - __pyx_t_11 = PyCFunction_NewEx(&__pyx_mdef_10LCEngineV1_67fenTerminado, NULL, __pyx_n_s_LCEngineV1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fenTerminado, __pyx_t_11) < 0) __PYX_ERR(0, 537, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /* "LCEngineV1.pyx":1 - * cimport cython # <<<<<<<<<<<<<< - * - * - */ - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_11) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - - /*--- Wrapped vars code ---*/ - - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_13); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init LCEngineV1", __pyx_clineno, __pyx_lineno, __pyx_filename); - } - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init LCEngineV1"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} - -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif - -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif - } - return result; -} - -/* RaiseArgTupleInvalid */ -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } - } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif -bad: - return -1; -} - -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); -} -#endif // CYTHON_FAST_PYCCALL - -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -#include "frameobject.h" -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - fastlocals = f->f_localsplus; - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; - } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } - } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif // CPython < 3.6 -#endif // CYTHON_FAST_PYCALL - -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCallNoArg */ - #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, NULL, 0); - } -#endif -#ifdef __Pyx_CyFunction_USED - if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { -#else - if (likely(PyCFunction_Check(func))) { -#endif - if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { - return __Pyx_PyObject_CallMethO(func, NULL); - } - } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); -} -#endif - -/* PyErrFetchRestore */ - #if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } -#if PY_VERSION_HEX >= 0x03030000 - if (cause) { -#else - if (cause && cause != Py_None) { -#endif - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_RemainderObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = a % b; - x += ((x != 0) & ((x ^ b) < 0)) * b; - return PyInt_FromLong(x); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - default: return PyLong_Type.tp_as_number->nb_remainder(op1, op2); - } - } - x = a % b; - x += ((x != 0) & ((x ^ b) < 0)) * b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla % llb; - llx += ((llx != 0) & ((llx ^ llb) < 0)) * llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - return (inplace ? PyNumber_InPlaceRemainder : PyNumber_Remainder)(op1, op2); -} -#endif - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a + b); - if (likely((x^a) >= 0 || (x^b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - default: return PyLong_Type.tp_as_number->nb_add(op1, op2); - } - } - x = a + b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla + llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("add", return NULL) - result = ((double)a) + (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); -} -#endif - -/* GetItemInt */ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { - PyObject *r; - if (!j) return NULL; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* UnicodeAsUCS4 */ - static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { - Py_ssize_t length; - #if CYTHON_PEP393_ENABLED - length = PyUnicode_GET_LENGTH(x); - if (likely(length == 1)) { - return PyUnicode_READ_CHAR(x, 0); - } - #else - length = PyUnicode_GET_SIZE(x); - if (likely(length == 1)) { - return PyUnicode_AS_UNICODE(x)[0]; - } - #if Py_UNICODE_SIZE == 2 - else if (PyUnicode_GET_SIZE(x) == 2) { - Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0]; - if (high_val >= 0xD800 && high_val <= 0xDBFF) { - Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; - if (low_val >= 0xDC00 && low_val <= 0xDFFF) { - return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); - } - } - } - #endif - #endif - PyErr_Format(PyExc_ValueError, - "only single character unicode strings can be converted to Py_UCS4, " - "got length %" CYTHON_FORMAT_SSIZE_T "d", length); - return (Py_UCS4)-1; -} - -/* object_ord */ - static long __Pyx__PyObject_Ord(PyObject* c) { - Py_ssize_t size; - if (PyBytes_Check(c)) { - size = PyBytes_GET_SIZE(c); - if (likely(size == 1)) { - return (unsigned char) PyBytes_AS_STRING(c)[0]; - } -#if PY_MAJOR_VERSION < 3 - } else if (PyUnicode_Check(c)) { - return (long)__Pyx_PyUnicode_AsPy_UCS4(c); -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - } else if (PyByteArray_Check(c)) { - size = PyByteArray_GET_SIZE(c); - if (likely(size == 1)) { - return (unsigned char) PyByteArray_AS_STRING(c)[0]; - } -#endif - } else { - PyErr_Format(PyExc_TypeError, - "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); - return (long)(Py_UCS4)-1; - } - PyErr_Format(PyExc_TypeError, - "ord() expected a character, but string of length %zd found", size); - return (long)(Py_UCS4)-1; -} - -/* GetModuleGlobalName */ - static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS - result = PyDict_GetItem(__pyx_d, name); - if (likely(result)) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - -/* SliceObject */ - static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); - } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); -#else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; - } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); -bad: - return NULL; -} - -/* dict_getitem_default */ - static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) { - PyObject* value; -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (unlikely(PyErr_Occurred())) - return NULL; - value = default_value; - } - Py_INCREF(value); -#else - if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) { - value = PyDict_GetItem(d, key); - if (unlikely(!value)) { - value = default_value; - } - Py_INCREF(value); - } else { - if (default_value == Py_None) - default_value = NULL; - value = PyObject_CallMethodObjArgs( - d, __pyx_n_s_get, key, default_value, NULL); - } -#endif - return value; -} - -/* RaiseTooManyValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); -} - -/* RaiseNeedMoreValuesToUnpack */ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", - index, (index == 1) ? "" : "s"); -} - -/* IterFinish */ - static CYTHON_INLINE int __Pyx_IterFinish(void) { -#if CYTHON_FAST_THREAD_STATE - PyThreadState *tstate = PyThreadState_GET(); - PyObject* exc_type = tstate->curexc_type; - if (unlikely(exc_type)) { - if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { - PyObject *exc_value, *exc_tb; - exc_value = tstate->curexc_value; - exc_tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; - Py_DECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(exc_tb); - return 0; - } else { - return -1; - } - } - return 0; -#else - if (unlikely(PyErr_Occurred())) { - if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { - PyErr_Clear(); - return 0; - } else { - return -1; - } - } - return 0; -#endif -} - -/* UnpackItemEndCheck */ - static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { - if (unlikely(retval)) { - Py_DECREF(retval); - __Pyx_RaiseTooManyValuesError(expected); - return -1; - } else { - return __Pyx_IterFinish(); - } - return 0; -} - -/* RaiseNoneIterError */ - static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -/* PyObjectCallMethod1 */ - static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method, *result = NULL; - method = __Pyx_PyObject_GetAttrStr(obj, method_name); - if (unlikely(!method)) goto done; -#if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(method))) { - PyObject *self = PyMethod_GET_SELF(method); - if (likely(self)) { - PyObject *args; - PyObject *function = PyMethod_GET_FUNCTION(method); - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {self, arg}; - result = __Pyx_PyFunction_FastCall(function, args, 2); - goto done; - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {self, arg}; - result = __Pyx_PyCFunction_FastCall(function, args, 2); - goto done; - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(self); - PyTuple_SET_ITEM(args, 0, self); - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 1, arg); - Py_INCREF(function); - Py_DECREF(method); method = NULL; - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); - return result; - } - } -#endif - result = __Pyx_PyObject_CallOneArg(method, arg); -done: - Py_XDECREF(method); - return result; -} - -/* append */ - static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); - } - return 0; -} - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; -#ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; -#endif - } - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - double result; - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - -/* None */ - static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - -/* SetItemInt */ - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { - int r; - if (!j) return -1; - r = PyObject_SetItem(o, j, v); - Py_DECREF(j); - return r; -} -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, - CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); - if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { - PyObject* old = PyList_GET_ITEM(o, n); - Py_INCREF(v); - PyList_SET_ITEM(o, n, v); - Py_DECREF(old); - return 1; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_ass_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - } - return m->sq_ass_item(o, i, v); - } - } -#else -#if CYTHON_COMPILING_IN_PYPY - if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { -#else - if (is_list || PySequence_Check(o)) { -#endif - return PySequence_SetItem(o, i, v); - } -#endif - return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); -} - -/* StringJoin */ - #if !CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { - return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); -} -#endif - -/* BytesEquals */ - static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - const char *ps1, *ps2; - Py_ssize_t length = PyBytes_GET_SIZE(s1); - if (length != PyBytes_GET_SIZE(s2)) - return (equals == Py_NE); - ps1 = PyBytes_AS_STRING(s1); - ps2 = PyBytes_AS_STRING(s2); - if (ps1[0] != ps2[0]) { - return (equals == Py_NE); - } else if (length == 1) { - return (equals == Py_EQ); - } else { - int result = memcmp(ps1, ps2, (size_t)length); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -#endif -} - -/* UnicodeEquals */ - static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { -#if CYTHON_COMPILING_IN_PYPY - return PyObject_RichCompareBool(s1, s2, equals); -#else -#if PY_MAJOR_VERSION < 3 - PyObject* owned_ref = NULL; -#endif - int s1_is_unicode, s2_is_unicode; - if (s1 == s2) { - goto return_eq; - } - s1_is_unicode = PyUnicode_CheckExact(s1); - s2_is_unicode = PyUnicode_CheckExact(s2); -#if PY_MAJOR_VERSION < 3 - if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { - owned_ref = PyUnicode_FromObject(s2); - if (unlikely(!owned_ref)) - return -1; - s2 = owned_ref; - s2_is_unicode = 1; - } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { - owned_ref = PyUnicode_FromObject(s1); - if (unlikely(!owned_ref)) - return -1; - s1 = owned_ref; - s1_is_unicode = 1; - } else if (((!s2_is_unicode) & (!s1_is_unicode))) { - return __Pyx_PyBytes_Equals(s1, s2, equals); - } -#endif - if (s1_is_unicode & s2_is_unicode) { - Py_ssize_t length; - int kind; - void *data1, *data2; - if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) - return -1; - length = __Pyx_PyUnicode_GET_LENGTH(s1); - if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { - goto return_ne; - } - kind = __Pyx_PyUnicode_KIND(s1); - if (kind != __Pyx_PyUnicode_KIND(s2)) { - goto return_ne; - } - data1 = __Pyx_PyUnicode_DATA(s1); - data2 = __Pyx_PyUnicode_DATA(s2); - if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { - goto return_ne; - } else if (length == 1) { - goto return_eq; - } else { - int result = memcmp(data1, data2, (size_t)(length * kind)); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & s2_is_unicode) { - goto return_ne; - } else if ((s2 == Py_None) & s1_is_unicode) { - goto return_ne; - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -return_eq: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_EQ); -return_ne: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(owned_ref); - #endif - return (equals == Py_NE); -#endif -} - -/* PyIntBinop */ - #if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a; - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - } - #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15 - default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ); - #else - default: Py_RETURN_FALSE; - #endif - } - } - if (a == b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; - double a = PyFloat_AS_DOUBLE(op1); - if ((double)a == (double)b) { - Py_RETURN_TRUE; - } else { - Py_RETURN_FALSE; - } - } - return PyObject_RichCompare(op1, op2, Py_EQ); -} -#endif - -/* FetchCommonType */ - static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { - PyObject* fake_module; - PyTypeObject* cached_type = NULL; - fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); - if (!fake_module) return NULL; - Py_INCREF(fake_module); - cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); - if (cached_type) { - if (!PyType_Check((PyObject*)cached_type)) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s is not a type object", - type->tp_name); - goto bad; - } - if (cached_type->tp_basicsize != type->tp_basicsize) { - PyErr_Format(PyExc_TypeError, - "Shared Cython type %.200s has the wrong size, try recompiling", - type->tp_name); - goto bad; - } - } else { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; - PyErr_Clear(); - if (PyType_Ready(type) < 0) goto bad; - if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) - goto bad; - Py_INCREF(type); - cached_type = type; - } -done: - Py_DECREF(fake_module); - return cached_type; -bad: - Py_XDECREF(cached_type); - cached_type = NULL; - goto done; -} - -/* CythonFunction */ - static PyObject * -__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) -{ - if (unlikely(op->func_doc == NULL)) { - if (op->func.m_ml->ml_doc) { -#if PY_MAJOR_VERSION >= 3 - op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); -#else - op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); -#endif - if (unlikely(op->func_doc == NULL)) - return NULL; - } else { - Py_INCREF(Py_None); - return Py_None; - } - } - Py_INCREF(op->func_doc); - return op->func_doc; -} -static int -__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp = op->func_doc; - if (value == NULL) { - value = Py_None; - } - Py_INCREF(value); - op->func_doc = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_name == NULL)) { -#if PY_MAJOR_VERSION >= 3 - op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); -#else - op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); -#endif - if (unlikely(op->func_name == NULL)) - return NULL; - } - Py_INCREF(op->func_name); - return op->func_name; -} -static int -__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_qualname); - return op->func_qualname; -} -static int -__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; -#if PY_MAJOR_VERSION >= 3 - if (unlikely(value == NULL || !PyUnicode_Check(value))) { -#else - if (unlikely(value == NULL || !PyString_Check(value))) { -#endif - PyErr_SetString(PyExc_TypeError, - "__qualname__ must be set to a string object"); - return -1; - } - tmp = op->func_qualname; - Py_INCREF(value); - op->func_qualname = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) -{ - PyObject *self; - self = m->func_closure; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} -static PyObject * -__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) -{ - if (unlikely(op->func_dict == NULL)) { - op->func_dict = PyDict_New(); - if (unlikely(op->func_dict == NULL)) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} -static int -__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - if (unlikely(value == NULL)) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - if (unlikely(!PyDict_Check(value))) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) -{ - Py_INCREF(op->func_globals); - return op->func_globals; -} -static PyObject * -__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) -{ - Py_INCREF(Py_None); - return Py_None; -} -static PyObject * -__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) -{ - PyObject* result = (op->func_code) ? op->func_code : Py_None; - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { - int result = 0; - PyObject *res = op->defaults_getter((PyObject *) op); - if (unlikely(!res)) - return -1; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - op->defaults_tuple = PyTuple_GET_ITEM(res, 0); - Py_INCREF(op->defaults_tuple); - op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); - Py_INCREF(op->defaults_kwdict); - #else - op->defaults_tuple = PySequence_ITEM(res, 0); - if (unlikely(!op->defaults_tuple)) result = -1; - else { - op->defaults_kwdict = PySequence_ITEM(res, 1); - if (unlikely(!op->defaults_kwdict)) result = -1; - } - #endif - Py_DECREF(res); - return result; -} -static int -__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_tuple; - op->defaults_tuple = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_tuple; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_tuple; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value) { - value = Py_None; - } else if (value != Py_None && !PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__kwdefaults__ must be set to a dict object"); - return -1; - } - Py_INCREF(value); - tmp = op->defaults_kwdict; - op->defaults_kwdict = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { - PyObject* result = op->defaults_kwdict; - if (unlikely(!result)) { - if (op->defaults_getter) { - if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; - result = op->defaults_kwdict; - } else { - result = Py_None; - } - } - Py_INCREF(result); - return result; -} -static int -__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { - PyObject* tmp; - if (!value || value == Py_None) { - value = NULL; - } else if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__annotations__ must be set to a dict object"); - return -1; - } - Py_XINCREF(value); - tmp = op->func_annotations; - op->func_annotations = value; - Py_XDECREF(tmp); - return 0; -} -static PyObject * -__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { - PyObject* result = op->func_annotations; - if (unlikely(!result)) { - result = PyDict_New(); - if (unlikely(!result)) return NULL; - op->func_annotations = result; - } - Py_INCREF(result); - return result; -} -static PyGetSetDef __pyx_CyFunction_getsets[] = { - {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, - {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, - {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, - {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, - {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, - {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, - {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, - {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, - {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, - {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, - {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, - {0, 0, 0, 0, 0} -}; -static PyMemberDef __pyx_CyFunction_members[] = { - {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, - {0, 0, 0, 0, 0} -}; -static PyObject * -__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); -#else - return PyString_FromString(m->func.m_ml->ml_name); -#endif -} -static PyMethodDef __pyx_CyFunction_methods[] = { - {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, - {0, 0, 0, 0} -}; -#if PY_VERSION_HEX < 0x030500A0 -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) -#else -#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) -#endif -static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); - if (op == NULL) - return NULL; - op->flags = flags; - __Pyx_CyFunction_weakreflist(op) = NULL; - op->func.m_ml = ml; - op->func.m_self = (PyObject *) op; - Py_XINCREF(closure); - op->func_closure = closure; - Py_XINCREF(module); - op->func.m_module = module; - op->func_dict = NULL; - op->func_name = NULL; - Py_INCREF(qualname); - op->func_qualname = qualname; - op->func_doc = NULL; - op->func_classobj = NULL; - op->func_globals = globals; - Py_INCREF(op->func_globals); - Py_XINCREF(code); - op->func_code = code; - op->defaults_pyobjects = 0; - op->defaults = NULL; - op->defaults_tuple = NULL; - op->defaults_kwdict = NULL; - op->defaults_getter = NULL; - op->func_annotations = NULL; - PyObject_GC_Track(op); - return (PyObject *) op; -} -static int -__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) -{ - Py_CLEAR(m->func_closure); - Py_CLEAR(m->func.m_module); - Py_CLEAR(m->func_dict); - Py_CLEAR(m->func_name); - Py_CLEAR(m->func_qualname); - Py_CLEAR(m->func_doc); - Py_CLEAR(m->func_globals); - Py_CLEAR(m->func_code); - Py_CLEAR(m->func_classobj); - Py_CLEAR(m->defaults_tuple); - Py_CLEAR(m->defaults_kwdict); - Py_CLEAR(m->func_annotations); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_XDECREF(pydefaults[i]); - PyObject_Free(m->defaults); - m->defaults = NULL; - } - return 0; -} -static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) -{ - PyObject_GC_UnTrack(m); - if (__Pyx_CyFunction_weakreflist(m) != NULL) - PyObject_ClearWeakRefs((PyObject *) m); - __Pyx_CyFunction_clear(m); - PyObject_GC_Del(m); -} -static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->func_closure); - Py_VISIT(m->func.m_module); - Py_VISIT(m->func_dict); - Py_VISIT(m->func_name); - Py_VISIT(m->func_qualname); - Py_VISIT(m->func_doc); - Py_VISIT(m->func_globals); - Py_VISIT(m->func_code); - Py_VISIT(m->func_classobj); - Py_VISIT(m->defaults_tuple); - Py_VISIT(m->defaults_kwdict); - if (m->defaults) { - PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); - int i; - for (i = 0; i < m->defaults_pyobjects; i++) - Py_VISIT(pydefaults[i]); - } - return 0; -} -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; - } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); - } - if (obj == Py_None) - obj = NULL; - return __Pyx_PyMethod_New(func, obj, type); -} -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); -#endif -} -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0 = PySequence_ITEM(arg, 0); - if (unlikely(!arg0)) return NULL; - result = (*meth)(self, arg0); - Py_DECREF(arg0); - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); - } - return result; -} -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, -#if PY_MAJOR_VERSION < 3 - 0, -#else - 0, -#endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), -#endif - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, -#endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (__pyx_CyFunctionType == NULL) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (!m->defaults) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; -#endif - if (!metaclass) { - metaclass = tmptype; - continue; - } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; -#else - metaclass = &PyType_Type; -#endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; -} - -/* Py3ClassCreate */ - static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, - PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { - PyObject *ns; - if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); - if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; - } - ns = PyObject_Call(prep, pargs, mkw); - Py_DECREF(prep); - Py_DECREF(pargs); - } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - PyErr_Clear(); - ns = PyDict_New(); - } - } else { - ns = PyDict_New(); - } - if (unlikely(!ns)) - return NULL; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; - if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; - return ns; -bad: - Py_DECREF(ns); - return NULL; -} -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, - PyObject *dict, PyObject *mkw, - int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; - PyObject *owned_metaclass = NULL; - if (allow_py2_metaclass) { - owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); - if (owned_metaclass) { - metaclass = owned_metaclass; - } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { - PyErr_Clear(); - } else { - return NULL; - } - } - if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { - metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); - Py_XDECREF(owned_metaclass); - if (unlikely(!metaclass)) - return NULL; - owned_metaclass = metaclass; - } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; - } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); - } - Py_XDECREF(owned_metaclass); - return result; -} - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_char(char value) { - const char neg_one = (char) -1, const_zero = (char) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(char) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(char) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(char) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(char), - little, !is_unsigned); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) -1, const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (int) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (int) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) - case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); - } - } - break; - } -#endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - int val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (int) -1; - } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) -1, const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (long) val; - } - } else -#endif - if (likely(PyLong_Check(x))) { - if (is_unsigned) { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { - return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { - return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { - return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); - } - } - break; - } -#endif -#if CYTHON_COMPILING_IN_CPYTHON - if (unlikely(Py_SIZE(x) < 0)) { - goto raise_neg_overflow; - } -#else - { - int result = PyObject_RichCompareBool(x, Py_False, Py_LT); - if (unlikely(result < 0)) - return (long) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) -#endif - } - } else { -#if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)x)->ob_digit; - switch (Py_SIZE(x)) { - case 0: return (long) 0; - case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) - case -2: - if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(long) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(long) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(long) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); - } - } - break; - } -#endif - if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) -#endif - } - } - { -#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); -#else - long val; - PyObject *v = __Pyx_PyNumber_IntOrLong(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } -#endif - return (long) -1; - } - } else { - long val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (long) -1; - val = __Pyx_PyInt_As_long(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to long"); - return (long) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; -} - -/* CheckBinaryVersion */ - static int __Pyx_check_binary_version(void) { - char ctversion[4], rtversion[4]; - PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); - PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); - if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { - char message[200]; - PyOS_snprintf(message, sizeof(message), - "compiletime version %s of module '%.100s' " - "does not match runtime version %s", - ctversion, __Pyx_MODULE_NAME, rtversion); - return PyErr_WarnEx(NULL, message, 1); - } - return 0; -} - -/* InitStrings */ - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { - while (t->p) { - #if PY_MAJOR_VERSION < 3 - if (t->is_unicode) { - *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); - } else if (t->intern) { - *t->p = PyString_InternFromString(t->s); - } else { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); - } - #else - if (t->is_unicode | t->is_str) { - if (t->intern) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->encoding) { - *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); - } else { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); - } - } else { - *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); - } - #endif - if (!*t->p) - return -1; - ++t; - } - return 0; -} - -static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { - return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { - Py_ssize_t ignore; - return __Pyx_PyObject_AsStringAndSize(o, &ignore); -} -static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { -#if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if ( -#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - __Pyx_sys_getdefaultencoding_not_ascii && -#endif - PyUnicode_Check(o)) { -#if PY_VERSION_HEX < 0x03030000 - char* defenc_c; - PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); - if (!defenc) return NULL; - defenc_c = PyBytes_AS_STRING(defenc); -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - { - char* end = defenc_c + PyBytes_GET_SIZE(defenc); - char* c; - for (c = defenc_c; c < end; c++) { - if ((unsigned char) (*c) >= 128) { - PyUnicode_AsASCIIString(o); - return NULL; - } - } - } -#endif - *length = PyBytes_GET_SIZE(defenc); - return defenc_c; -#else - if (__Pyx_PyUnicode_READY(o) == -1) return NULL; -#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII - if (PyUnicode_IS_ASCII(o)) { - *length = PyUnicode_GET_LENGTH(o); - return PyUnicode_AsUTF8(o); - } else { - PyUnicode_AsASCIIString(o); - return NULL; - } -#else - return PyUnicode_AsUTF8AndSize(o, length); -#endif -#endif - } else -#endif -#if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) - if (PyByteArray_Check(o)) { - *length = PyByteArray_GET_SIZE(o); - return PyByteArray_AS_STRING(o); - } else -#endif - { - char* result; - int r = PyBytes_AsStringAndSize(o, &result, length); - if (unlikely(r < 0)) { - return NULL; - } else { - return result; - } - } -} -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - int is_true = x == Py_True; - if (is_true | (x == Py_False) | (x == Py_None)) return is_true; - else return PyObject_IsTrue(x); -} -static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { -#if CYTHON_USE_TYPE_SLOTS - PyNumberMethods *m; -#endif - const char *name = NULL; - PyObject *res = NULL; -#if PY_MAJOR_VERSION < 3 - if (PyInt_Check(x) || PyLong_Check(x)) -#else - if (PyLong_Check(x)) -#endif - return __Pyx_NewRef(x); -#if CYTHON_USE_TYPE_SLOTS - m = Py_TYPE(x)->tp_as_number; - #if PY_MAJOR_VERSION < 3 - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Int(x); - } - else if (m && m->nb_long) { - name = "long"; - res = PyNumber_Long(x); - } - #else - if (m && m->nb_int) { - name = "int"; - res = PyNumber_Long(x); - } - #endif -#else - res = PyNumber_Int(x); -#endif - if (res) { -#if PY_MAJOR_VERSION < 3 - if (!PyInt_Check(res) && !PyLong_Check(res)) { -#else - if (!PyLong_Check(res)) { -#endif - PyErr_Format(PyExc_TypeError, - "__%.4s__ returned non-%.4s (type %.200s)", - name, name, Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - } - else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - } - return res; -} -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject *x; -#if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(b))) { - if (sizeof(Py_ssize_t) >= sizeof(long)) - return PyInt_AS_LONG(b); - else - return PyInt_AsSsize_t(x); - } -#endif - if (likely(PyLong_CheckExact(b))) { - #if CYTHON_USE_PYLONG_INTERNALS - const digit* digits = ((PyLongObject*)b)->ob_digit; - const Py_ssize_t size = Py_SIZE(b); - if (likely(__Pyx_sst_abs(size) <= 1)) { - ival = likely(size) ? digits[0] : 0; - if (size == -1) ival = -ival; - return ival; - } else { - switch (size) { - case 2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -2: - if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -3: - if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case 4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - case -4: - if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { - return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); - } - break; - } - } - #endif - return PyLong_AsSsize_t(b); - } - x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { - return PyInt_FromSize_t(ival); -} - - -#endif /* Py_PYTHON_H */ diff --git a/LCEngine/LCEngineV1.pyd b/LCEngine/LCEngineV1.pyd deleted file mode 100644 index 89a8a82..0000000 Binary files a/LCEngine/LCEngineV1.pyd and /dev/null differ diff --git a/LCEngine/LCEngineV1.pyx b/LCEngine/LCEngineV1.pyx deleted file mode 100644 index a866bd0..0000000 --- a/LCEngine/LCEngineV1.pyx +++ /dev/null @@ -1,539 +0,0 @@ -cimport cython - - -cdef extern from "irina.h": - ctypedef struct Move: - pass - - void init_board() - void fen_board(char *fen) - char *board_fen(char *fen) - - int movegen() - int pgn2pv(char *pgn, char *pv) - int make_nummove(int num) - char * playFen(char *fen, int depth, int time) - int numMoves( ) - void getMove( int num, char * pv ) - char *board_fen(char *fen) - int numBaseMove( ) - int searchMove( char *desde, char *hasta, char * promotion ) - void getMoveEx( int num, char * info ) - char * toSan(int num, char *sanMove) - char inCheck() - void set_level(int lv) - - void pgn_start(char * fich, int depth) - void pgn_stop() - int pgn_read( ) - char * pgn_game() - char * pgn_pv() - int pgn_numlabels() - char * pgn_label(int num) - char * pgn_value(int num) - int pgn_raw() - int pgn_numfens() - char * pgn_fen(int num) - - - - -class PGNreader: - def __init__(self, fich, depth): - self.fich = fich - self.depth = depth - - def __enter__(self): - pgn_start(self.fich, self.depth) - return self - - def __exit__(self, type, value, traceback): - pgn_stop() - - def __iter__(self): - return self - - def next(self): - n = pgn_read() - if n: - pgn = pgn_game() - pv = pgn_pv() - d = {} - n = pgn_numlabels() - r = pgn_raw() - fens = [ pgn_fen(num) for num in range(pgn_numfens()) ] - if n: - for x in range(n): - d[pgn_label(x).upper()] = pgn_value(x) - return pgn, pv, d, r, fens - else: - raise StopIteration - - -def lc_pgn2pv(pgn1): - cdef char pv[10]; - resp = pgn2pv(pgn1, pv) - if resp == 9999: - return "" - else: - return pv - - -def posFC(pos): - return pos / 8, pos % 8 - -def FCpos(f, c): - return f * 8 + c - -def posA1(pos): - return chr(pos % 8 + 97) + chr(pos / 8 + 49) - -def a1Pos(a1): - cdef int f, c - f = ord(a1[1]) - 49 - c = ord(a1[0]) - 97 - return f * 8 + c - -def move2num(a1h8q): - num = a1Pos(a1h8q[:2]) + a1Pos(a1h8q[2:4])*64 - if len(a1h8q)>4: - num += ({"q":1, "r":2, "b":3, "n":4}.get(a1h8q[4], 0))*64*64 - return num - -def num2move(num): - a1 = posA1(num%64) - num /= 64 - h8 = posA1(num%64) - num /= 64 - if num: - q = {1:"q", 2:"r", 3:"b", 4:"n"}.get(num) - else: - q = "" - return a1 + h8 + q - -def liK(npos): - cdef int fil, col, ft, ct - liM = [] - fil, col = posFC(npos) - for fi, ci in ( (+1, +1), (+1, -1), (-1, +1), (-1, -1), (+1, 0), (-1, 0), (0, +1), (0, -1) ): - ft = fil + fi - ct = col + ci - if ft < 0 or ft > 7 or ct < 0 or ct > 7: - continue - liM.append(FCpos(ft, ct)) - return tuple(liM) - - -def liBR(npos, fi, ci): - cdef int fil, col, ft, ct - - fil, col = posFC(npos) - liM = [] - ft = fil + fi - ct = col + ci - while True: - if ft < 0 or ft > 7 or ct < 0 or ct > 7: - break - - t = FCpos(ft, ct) - liM.append(t) - ft += fi - ct += ci - return tuple(liM) - - -def liN(npos): - cdef int fil, col, ft, ct - - fil, col = posFC(npos) - liM = [] - for fi, ci in ( (+1, +2), (+1, -2), (-1, +2), (-1, -2), (+2, +1), (+2, -1), (-2, +1), (-2, -1) ): - ft = fil + fi - ct = col + ci - if ft < 0 or ft > 7 or ct < 0 or ct > 7: - continue - - t = FCpos(ft, ct) - liM.append(t) - return tuple(liM) - -def liP(npos, siW): - cdef int fil, col, ft, ct, inc - - fil, col = posFC(npos) - liM = [] - liX = [] - if siW: - filaIni = 1 - salto = +1 - else: - filaIni = 6 - salto = -1 - sig = FCpos(fil + salto, col) - liM.append(sig) - - if fil == filaIni: - sig2 = FCpos(fil + salto * 2, col) - liM.append(sig2) - - for inc in ( +1, -1 ): - ft = fil + salto - ct = col + inc - if not (ft < 0 or ft > 7 or ct < 0 or ct > 7): - t = FCpos(ft, ct) - liX.append(t) - - return tuple(liM), tuple(liX) - -dicK = {} -for i in range(64): - dicK[i] = liK(i) - -dicQ = {} -for i in range(64): - li = [] - for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1), (1, 0), (-1, 0), (0, 1), (0, -1) ): - lin = liBR(i, f_i, c_i) - if lin: - li.append(lin) - dicQ[i] = tuple(li) - -dicB = {} -for i in range(64): - li = [] - for f_i, c_i in ( (1, 1), (1, -1), (-1, 1), (-1, -1) ): - lin = liBR(i, f_i, c_i) - if lin: - li.append(lin) - dicB[i] = tuple(li) - -dicR = {} -for i in range(64): - li = [] - for f_i, c_i in ( (1, 0), (-1, 0), (0, 1), (0, -1) ): - lin = liBR(i, f_i, c_i) - if lin: - li.append(lin) - dicR[i] = tuple(li) - -dicN = {} -for i in range(64): - dicN[i] = liN(i) - -dicPW = {} -for i in range(8, 56): - dicPW[i] = liP(i, True) - -dicPB = {} -for i in range(8, 56): - dicPB[i] = liP(i, False) - -def knightmoves(a, b, no, nv, mx): - if nv > mx: - return [] - lia = liN(a) - if b in lia: - return [[a, b]] - lib = liN(b) - li = [] - for x in lia: - if x not in no and x in lib: - li.append([a, x, b]) - if li: - return li - - li = [] - - for x in lia: - for y in lib: - if x not in no and y not in no: - nx = no[:] - nx.append(x) - nx.append(y) - f = knightmoves(x, y, nx, nv + 1, mx) - if f: - li.extend(f) - if not li: - return li - xmin = 9999 - for x in li: - nx = len(x) - if nx < xmin: - xmin = nx - lidef = [] - for x in li: - if len(x) == xmin: - x.insert(0, a) - x.append(b) - lidef.append(x) - return lidef - -def liNMinimo(x, y, celdas_ocupadas): - cdef int nv - ot = celdas_ocupadas[:] - ot.extend([x, y]) - nv = 1 - li = knightmoves(x, y, ot, 0, nv) - while len(li) == 0: - nv += 1 - li = knightmoves(x, y, ot, 0, nv) - return li - -def xpv2lipv(xpv): - li = [] - siBlancas = True - for c in xpv: - x = ord(c) - if x >= 58: - move = posA1(x - 58) - if siBlancas: - base = move - else: - li.append(base + move) - siBlancas = not siBlancas - else: - c = {50: "q", 51: "r", 52: "b", 53: "n"}.get(x, "") - li[-1] += c - return li - -def xpv2pv(xpv): - return " ".join(xpv2lipv(xpv)) - -def pv2xpv(pv): - if pv: - li = pv.split(" ") - lix = [] - for move in li: - d = chr(a1Pos(move[:2]) + 58) # 58 is an arbitrary number, to remain in range 58..122 - h = chr(a1Pos(move[2:4]) + 58) - c = move[4:] - if c: - c = {"q": chr(50), "r": chr(51), "b": chr(52), "n": chr(53)}.get(c.lower(), "") - lix.append(d + h + c) - return "".join(lix) - else: - return "" - -def runFen( fen, depth, ms, level ): - set_level(level) - x = playFen(fen, depth, ms) - set_level(0) - return x - -def setFen(fen): - fen_board(fen) - return movegen() - -def getFen(): - cdef char fen[100] - board_fen(fen) - x = fen - return x - -def getMoves(): - cdef char pv[10] - cdef int nmoves, x, nbase - nmoves = numMoves() - - nbase = numBaseMove() - li = [] - for x in range(nmoves): - getMove(x+nbase, pv) - r = pv - li.append(r) - return li - -def getPGN(desdeA1H8, hastaA1H8, coronacion): - cdef char san[10] - - if not coronacion: - coronacion = "" - - num = searchMove( desdeA1H8, hastaA1H8, coronacion ) - if num == -1: - return None - - toSan(num, san) - return san - -def xpv2pgn(xpv): - cdef char san[10] - setFenInicial() - siW = True - num = 1 - li = [] - tam = 0 - for pv in xpv2lipv(xpv): - if siW: - x = str(num)+"." - tam += len(x) - li.append(x) - num += 1 - siW = not siW - - numMove = searchMove( pv[:2], pv[2:4], pv[4:] ) - if numMove == -1: - break - toSan(numMove, san) - x = str(san) - li.append(x) - tam += len(x) - if tam >= 80: - li.append("\n") - tam = 0 - else: - li.append(" ") - tam += 1 - make_nummove(numMove) - return "".join(li) - -def isCheck(): - return inCheck() - -class InfoMove(object): - def __init__(self, num): - cdef char pv[10] - cdef char info[10] - cdef char san[10] - - getMove(num, pv) - getMoveEx(num, info) - toSan(num, san) - - # info = P a1 h8 q [K|Q|] - - self._castle_K = info[6] == "K" - self._castle_Q = info[6] == "Q" - self._ep = info[7]=="E" - self._pv = pv - self._san = san - - self._piece = info[0:1] - self._from = info[1:3] - self._to = info[3:5] - self._promotion = info[5:6].strip() - self._check = "+" in san - self._mate = "#" in san - self._capture = "x" in san - - def desde(self): - return self._from - - def hasta(self): - return self._to - - def coronacion(self): - return self._promotion.lower() - - def movimiento(self): - return self._from+self._to+self._promotion.lower() - - def jaque(self): - return self._check - - def mate(self): - return self._mate - - def captura(self): - return self._capture - - def pieza(self): - return self._piece - - def isCastleK(self): - return self._castle_K - - def isCastleQ(self): - return self._castle_Q - - def isEnPassant(self): - return self._ep - -def getExMoves(): - nmoves = numMoves() - - nbase = numBaseMove() - li = [] - for x in range(nmoves): - mv = InfoMove(x + nbase) - li.append(mv) - return li - -def moveExPV(desde, hasta, coronacion): - if not coronacion: - coronacion = "" - - num = searchMove( desde, hasta, coronacion ) - if num == -1: - return None - - infoMove = InfoMove(num) - make_nummove(num) - - return infoMove - -def movePV(desde, hasta, coronacion): - if not coronacion: - coronacion = "" - - num = searchMove( desde, hasta, coronacion ) - if num == -1: - return False - - make_nummove(num) - - return True - -def makeMove(move): - desde = move[:2] - hasta = move[2:4] - coronacion = move[4:] - num = searchMove( desde, hasta, coronacion ) - if num == -1: - return False - - make_nummove(num) - return True - -def fen2fenM2(fen): - sp1 = fen.rfind(" ") - sp2 = fen.rfind(" ", 0, sp1) - return fen[:sp2] - -def setFenInicial(): - inifen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" - setFen(inifen) - -def makePV(pv): - setFenInicial() - if pv: - for move in pv.split(" "): - makeMove(move) - return getFen() - - -def getCapturesFEN(fen): - setFen(fen) - nmoves = numMoves() - nbase = numBaseMove() - li = [] - for x in range(nmoves): - mv = InfoMove(x + nbase) - if mv.captura(): - li.append(mv) - return li - -def getCaptures(fen, siMB): - if not siMB: - fen = fenOB(fen) - return getCapturesFEN(fen) - -def fenOB(fen): - li = fen.split(" ") - li[3] = "-" - li[1] = "w" if li[1] == "b" else "b" - return " ".join(li) - -def fenTerminado(fen): - return setFen(fen) == 0 - diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngine.exp b/LCEngine/build/temp.win32-2.7/Release/LCEngine.exp deleted file mode 100644 index a034fea..0000000 Binary files a/LCEngine/build/temp.win32-2.7/Release/LCEngine.exp and /dev/null differ diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngine.lib b/LCEngine/build/temp.win32-2.7/Release/LCEngine.lib deleted file mode 100644 index 1e1cab3..0000000 Binary files a/LCEngine/build/temp.win32-2.7/Release/LCEngine.lib and /dev/null differ diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngine.obj b/LCEngine/build/temp.win32-2.7/Release/LCEngine.obj deleted file mode 100644 index 971449d..0000000 Binary files a/LCEngine/build/temp.win32-2.7/Release/LCEngine.obj and /dev/null differ diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngine.pyd.manifest b/LCEngine/build/temp.win32-2.7/Release/LCEngine.pyd.manifest deleted file mode 100644 index 7256947..0000000 --- a/LCEngine/build/temp.win32-2.7/Release/LCEngine.pyd.manifest +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.exp b/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.exp deleted file mode 100644 index d3b6e1c..0000000 Binary files a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.exp and /dev/null differ diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.lib b/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.lib deleted file mode 100644 index 51b8fd1..0000000 Binary files a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.lib and /dev/null differ diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.obj b/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.obj deleted file mode 100644 index a1ea4b9..0000000 Binary files a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.obj and /dev/null differ diff --git a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.pyd.manifest b/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.pyd.manifest deleted file mode 100644 index 7256947..0000000 --- a/LCEngine/build/temp.win32-2.7/Release/LCEngineV1.pyd.manifest +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/LCEngine/irina/Makefile b/LCEngine/irina/Makefile index 25f3dd4..4d0490d 100644 --- a/LCEngine/irina/Makefile +++ b/LCEngine/irina/Makefile @@ -1,6 +1,6 @@ LINK_TARGET = ../libirina.a -OBJS = loop.o board.o data.o util.o movegen.o makemove.o test.o eval.o search.o hash.o lc.o pgn.o +OBJS = board.o data.o eval.o hash.o loop.o makemove.o movegen.o movegen_piece_to.o search.o test.o util.o pgn.o REBUILDABLES = $(OBJS) $(LINK_TARGET) @@ -16,7 +16,7 @@ $(LINK_TARGET) : $(OBJS) %.o : %.c - #~ gcc -Wall -O3 -o $@ -c $< -DNDEBUG + gcc -Wall -O3 -o $@ -c $< -DNDEBUG #~ mas rapida y menor tam = -O1 #~ profile mas -pg - clang -Wall -O2 -o $@ -c $< + #~ clang -Wall -O2 -o $@ -c $< diff --git a/LCEngine/irina/pgn.c b/LCEngine/irina/pgn.c index 54de560..7e0edf3 100644 --- a/LCEngine/irina/pgn.c +++ b/LCEngine/irina/pgn.c @@ -11,6 +11,7 @@ FILE * fpgn; char * pgn; char * w_pgn; +char * line; int max_pgn; char * pos_body; @@ -24,6 +25,7 @@ int raw; char * fens[256]; int pos_fens; int max_depth; +int max_line; /*d = {"B":"WHITE_BISHOP", "P":"WHITE_PAWN", "Q":"WHITE_QUEEN", "R":"WHITE_ROOK", "N":"WHITE_KNIGHT", "K":"WHITE_KING"} @@ -66,8 +68,10 @@ void pgn_start(char * fich, int depth) fpgn = fopen(fich, "rb"); max_pgn = 64*1024; + max_line = 64*1024; pgn = (char *)malloc(max_pgn); pv = (char *)malloc(5*1024); + line = (char *)malloc(max_line); for( i=0; i < 256; i++) { labels[i] = (char *) malloc(256); @@ -90,6 +94,7 @@ void pgn_stop( void ) fclose(fpgn); free(pgn); free(pv); + free(line); for( i=0; i < 256; i++) { free(labels[i]); @@ -108,7 +113,34 @@ bool empty_line() return true; } -void mas_pgn(void) +bool test_label() +{ + char * c; + char * end; + int n; + size_t size; + + if(w_pgn[0] != '[') return false; + size = strlen(w_pgn); + + end = w_pgn + size - 1; + while (end >= w_pgn && isspace(*end)) + end--; + if( end[0] != ']') return false; + + c = w_pgn; + n = 0; + while( *c ) { + if( *c == '\\') c++; + else { + if( *c == '"') n++; + } + c++; + } + return n == 2; +} + +void test_size_pgn(void) { int tam_line, dif; tam_line = strlen(w_pgn); @@ -126,7 +158,7 @@ void mas_label(void) { char *c, *lk, *lv; - if( pos_label > 255 ) return; + if( pos_label > 255 || !test_label()) return; lk = labels[pos_label]; lv = values[pos_label]; @@ -171,6 +203,7 @@ void mas_label(void) int pgn_read( void ) { + long int max_tam; w_pgn = pgn; fen[0] = 0; pos_label = 0; @@ -179,13 +212,14 @@ int pgn_read( void ) /* leemos primer label*/ do { - if(!fgets(w_pgn, 1024, fpgn)) return false; + max_tam = max_pgn - (w_pgn-pgn); + if(!fgets(w_pgn, max_tam, fpgn)) return false; // printf("PL:[%s]", w_pgn); if(w_pgn[0] == '[' ) { mas_label(); - mas_pgn(); + test_size_pgn(); break; } } @@ -194,30 +228,32 @@ int pgn_read( void ) /* leemos resto labels */ do { - if(!fgets(w_pgn, 1024, fpgn)) return false; /*EOF*/ + max_tam = max_pgn - (w_pgn-pgn); + if(!fgets(w_pgn, max_tam, fpgn)) return false; /*EOF*/ if(w_pgn[0] != '[') break; // printf("+L:[%s]", w_pgn); mas_label(); - mas_pgn(); + test_size_pgn(); } while(1); // printf("PR:[%s]", w_pgn); pos_body = w_pgn; - mas_pgn(); + test_size_pgn(); /* leemos hasta linea en blanco */ do { - if(!fgets(w_pgn, 1024, fpgn)) break; /*EOF*/ - if(w_pgn[0] == '[') { + max_tam = max_pgn - (w_pgn-pgn); + if(!fgets(w_pgn, max_tam, fpgn)) break; /*EOF*/ + if(w_pgn[0] == '[' && test_label()) { fseek( fpgn, -strlen(w_pgn)-1, SEEK_CUR ); // printf("FR:[%s,%d]", w_pgn, -strlen(w_pgn)-1); w_pgn[0] = '\0'; break; } // printf("+R:[%s]", w_pgn); - mas_pgn(); + test_size_pgn(); } while(1); diff --git a/LCEngine/libirina.so b/LCEngine/libirina.so deleted file mode 100644 index f36c527..0000000 Binary files a/LCEngine/libirina.so and /dev/null differ diff --git a/LCEngine/setup.py b/LCEngine/setup.py index c3d1158..0e7c75f 100644 --- a/LCEngine/setup.py +++ b/LCEngine/setup.py @@ -4,5 +4,5 @@ from Cython.Build import cythonize setup( - ext_modules = cythonize([Extension("LCEngineV1", ["LCEngineV1.pyx"], libraries=["irina"])]) + ext_modules = cythonize([Extension("LCEngine2", ["LCEngine2.pyx"], libraries=["irina"])]) ) diff --git a/LCEngine/xcython_VC.bat b/LCEngine/xcython_VC.bat index 59477e4..256a6c8 100644 --- a/LCEngine/xcython_VC.bat +++ b/LCEngine/xcython_VC.bat @@ -14,5 +14,5 @@ set LIBPATH=%VCINSTALLDIR%\Lib;%WindowsSdkDir%\Lib;%LIBPATH% python setup.py build_ext --inplace -copy LCEngineV1.pyd ..\Engines\Windows\_tools +copy LCEngine2.pyd ..\Engines\Windows\_tools diff --git a/Linux/xlinux_install.sh b/Linux/xlinux_install.sh index 5e5ae86..a0660ce 100644 --- a/Linux/xlinux_install.sh +++ b/Linux/xlinux_install.sh @@ -9,22 +9,22 @@ sudo apt-get install python-pyaudio # added install of setuptools, is required for psutils, python-chess and PhotoHash pip install setuptools pip install psutil -pip install pygal pip install chardet pip install python-chess pip install Pillow pip install PhotoHash pip install Cython +pip install scandir # !! modify path to your installation directory of lucaschess!! -cd /usr/share/lucaschess +cd .. # give read rights to group and others sudo chmod -R 755 * # give execution right to all executable files, especially chess engines sudo chmod -R +x * # give all rights to ./UsrData in order for all users to share settings -sudo chmod 777 UsrData +# sudo chmod 777 UsrData # build Irina engine etc, refresh existing libirina.so and LCEngine.so cd LCEngine/irina diff --git a/Locale/ar/LC_MESSAGES/lucaschess.mo b/Locale/ar/LC_MESSAGES/lucaschess.mo index 01f2295..6510767 100644 Binary files a/Locale/ar/LC_MESSAGES/lucaschess.mo and b/Locale/ar/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/az/LC_MESSAGES/lucaschess.mo b/Locale/az/LC_MESSAGES/lucaschess.mo index 5843fd0..ee8206b 100644 Binary files a/Locale/az/LC_MESSAGES/lucaschess.mo and b/Locale/az/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/br/LC_MESSAGES/lucaschess.mo b/Locale/br/LC_MESSAGES/lucaschess.mo index e363c44..fea8c3e 100644 Binary files a/Locale/br/LC_MESSAGES/lucaschess.mo and b/Locale/br/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/es/LC_MESSAGES/lucaschess.mo b/Locale/es/LC_MESSAGES/lucaschess.mo index e8e27c0..e80363b 100644 Binary files a/Locale/es/LC_MESSAGES/lucaschess.mo and b/Locale/es/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/fr/LC_MESSAGES/lucaschess.mo b/Locale/fr/LC_MESSAGES/lucaschess.mo index 65d8280..dc97b43 100644 Binary files a/Locale/fr/LC_MESSAGES/lucaschess.mo and b/Locale/fr/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/gr/LC_MESSAGES/lucaschess.mo b/Locale/gr/LC_MESSAGES/lucaschess.mo index d6305fb..7c766d5 100644 Binary files a/Locale/gr/LC_MESSAGES/lucaschess.mo and b/Locale/gr/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/it/LC_MESSAGES/lucaschess.mo b/Locale/it/LC_MESSAGES/lucaschess.mo index bbb5062..4452946 100644 Binary files a/Locale/it/LC_MESSAGES/lucaschess.mo and b/Locale/it/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/nl/LC_MESSAGES/lucaschess.mo b/Locale/nl/LC_MESSAGES/lucaschess.mo index 02991db..874f441 100644 Binary files a/Locale/nl/LC_MESSAGES/lucaschess.mo and b/Locale/nl/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/pl/LC_MESSAGES/lucaschess.mo b/Locale/pl/LC_MESSAGES/lucaschess.mo index c99ff4b..e25b499 100644 Binary files a/Locale/pl/LC_MESSAGES/lucaschess.mo and b/Locale/pl/LC_MESSAGES/lucaschess.mo differ diff --git a/Locale/ro/LC_MESSAGES/lucaschess.mo b/Locale/ro/LC_MESSAGES/lucaschess.mo index 6f3eba5..c608002 100644 Binary files a/Locale/ro/LC_MESSAGES/lucaschess.mo and b/Locale/ro/LC_MESSAGES/lucaschess.mo differ diff --git a/Lucas.py b/Lucas.py index aeda793..669c454 100644 --- a/Lucas.py +++ b/Lucas.py @@ -11,22 +11,6 @@ - - - - - - - - - - - - - - - - import os import sip diff --git a/WGM/_listaGM.txt b/WGM/_listaGM.txt deleted file mode 100644 index ac14951..0000000 --- a/WGM/_listaGM.txt +++ /dev/null @@ -1,134 +0,0 @@ -Abdumalik·Abdumalik, Zhansaya·31163·127 -Alexandrova·Alexandrova, Olga·75215·316 -Arabidze·Arabidze, Meri·64862·259 -Arakhamia-grant·Arakhamia-Grant, Ketevan·201230·831 -Atalik·Atalik, Ekaterina·104307·433 -Aulia·Aulia, Medina Warda·2246·9 -Batchimeg·Batchimeg, Tuvshintugs·26515·102 -Batsiashvili·Batsiashvili, Nino·91350·357 -Berend·Berend, Elvira·44956·196 -Bivol·Bivol, Alina·48689·193 -Bodnaruk·Bodnaruk, Anastasia·125509·501 -Bojkovic·Bojkovic, Natasa·129364·561 -Brunello·Brunello, Marina·58149·234 -Bulmaga·Bulmaga, Irina·104350·414 -Charochkina·Charochkina, Daria·80257·331 -Cmilyte·Cmilyte, Viktorija·168427·703 -Cori t.·Cori T., Deysi·2334·10 -Cramling·Cramling, Pia·348439·1494 -Danielian·Danielian, Elina·161951·665 -Daulyte·Daulyte, Deimante·85135·362 -Derakhshani·Derakhshani, Dorsa·27356·115 -Ding·Ding, Yixin·53607·227 -Dzagnidze·Dzagnidze, Nana·199071·797 -Galliamova·Galliamova, Alisa·129826·535 -Gaponenko·Gaponenko, Inna·201891·857 -Gara·Gara, Anita·111775·470 -Garcia martin·Garcia Martin, Marta·5083·18 -Girya·Girya, Olga·143976·558 -Goryachkina·Goryachkina, Aleksandra·108947·418 -Gritsayeva·Gritsayeva, Oksana·31720·123 -Guichard·Guichard, Pauline·44511·180 -Gunina·Gunina, Valentina·193573·761 -Guo·Guo, Qi·56141·227 -Guramishvili·Guramishvili, Sopiko·92386·390 -Guseva·Guseva, Marina·123381·496 -Haast·Haast, Anne·49212·201 -Harika·Harika, Dronavalli·217104·894 -Hoang·Hoang, Thanh Trang·194465·836 -Hoangthi·Hoang, Thi Bao Tram·74777·308 -Hoolt·Hoolt, Sarah·51162·212 -Hou·Hou, Yifan·227872·928 -Houska·Houska, Jovanka·149409·623 -Huang·Huang, Qian·122268·488 -Hunt·Hunt, Harriet V·91912·393 -Javakhishvili·Javakhishvili, Lela·137463·583 -Ju·Ju, Wenjun·166084·683 -Kachiani-gersinska·Kachiani-Gersinska, Ketino·111622·477 -Karavade·Karavade, Eesha·122846·511 -Kashlinskaya·Kashlinskaya, Alina·102845·426 -Khademalsharieh·Khademalsharieh, Sarasadat·42734·175 -Khotenashvili·Khotenashvili, Bela·115204·450 -Khukhashvili·Khukhashvili, Sopiko·68277·276 -Khurtsidze·Khurtsidze, Nino·161355·676 -Koneru·Koneru, Humpy·195728·811 -Kosintseva·Kosintseva, Tatiana·325461·1282 -Kosteniuk·Kosteniuk, Alexandra·249522·1021 -Kovalevskaya·Kovalevskaya, Ekaterina·198217·817 -Kovanova·Kovanova, Baira·83103·357 -Krush·Krush, Irina·217335·927 -Kulon·Kulon, Klaudia·74791·312 -L'ami·L'Ami, Alina·98622·421 -Lagno·Lagno, Kateryna·174509·740 -Lei·Lei, Tingjie·49280·196 -Li·Li, Ruofan·49087·205 -Lomineishvili·Lomineishvili, Maia·106308·424 -Lujan·Lujan, Carolina·72259·307 -Majdan-gajewska·Majdan-Gajewska, Joanna·68859·290 -Mammadzada·Mammadzada, Gunay·21003·82 -Matnadze·Matnadze, Ana·117353·484 -Matveeva·Matveeva, Svetlana·124286·533 -Melia·Melia, Salome·114161·462 -Michna·Michna, Marta·101948·431 -Milliet·Milliet, Sophie·136220·589 -Mkrtchian·Mkrtchian, Lilit·132653·538 -Moser·Moser, Eva·134115·570 -Munguntuul·Munguntuul, Batkhuyag·108234·444 -Muzychuk·Muzychuk, Mariya·353776·1440 -Nechaeva·Nechaeva, Marina·5599·23 -Nemcova·Nemcova, Katerina·72769·306 -Ni·Ni, Shiqun·24602·105 -Nomin-erdene·Nomin-Erdene, Davaademberel·22674·97 -Ordaz valdes·Ordaz Valdes, Lisandra Teresa·28950·119 -Osmanodja·Osmanodja, Filiz·31112·125 -Ovod·Ovod, Evgenija·114276·474 -Padmini·Padmini, Rout·104703·411 -Paehtz·Paehtz, Elisabeth·248205·1069 -Paikidze·Paikidze, Nazi·70065·290 -Papp·Papp, Petra·55384·240 -Peng·Peng, Zhaoqin·170947·711 -Peptan·Peptan, Corina-Isabela·153799·630 -Pogonina·Pogonina, Natalija·173559·689 -Polgarj·Polgar, Judit·151508·674 -Polgars·Polgar, Sofia·91098·425 -Polgarz·Polgar, Zsuzsa·120588·568 -Pustovoitova·Pustovoitova, Daria·54723·226 -Rajlich·Rajlich, Iweta·202947·827 -Ryjanova·Ryjanova, Julia·19593·86 -Saduakassova·Saduakassova, Dinara·57542·238 -Savina·Savina, Anastasia·85224·355 -Schleining·Schleining, Zoya·46609·188 -Sebag·Sebag, Marie·146382·607 -Shen·Shen, Yang·105937·433 -Shuvalova·Shuvalova, Polina·10820·41 -Shvayger·Shvayger, Yuliya·25797·103 -Skripchenko·Skripchenko, Almira·176443·762 -Socko·Socko, Monika·248803·995 -Soumya·Soumya, Swaminathan·72972·304 -Stefanova·Stefanova, Antoaneta·301392·1288 -Stockova·Stockova, Zuzana·61993·270 -Sukandar·Sukandar, Irine Kharisma·85724·343 -Szczepkowska-horowska·Szczepkowska-Horowska, Karina·108516·427 -Tan·Tan, Zhongyi·95344·409 -Tania·Tania, Sachdev·141472·590 -Tsolakidou·Tsolakidou, Stavroula·18997·74 -Turova·Turova, Irina·81903·362 -Ushenina·Ushenina, Anna·146356·591 -Vasilevich·Vasilevich, Tatjana·102402·442 -Vega gutierrez·Vega Gutierrez, Sabrina·89840·378 -Velikic·Velikic, Adela·25701·105 -Videnova·Videnova, Iva·112202·438 -Vijayalakshmi·Vijayalakshmi, Subbaraman·113270·428 -Vo·Vo, Thi Kim Phung·28010·97 -Wang·Wang, Jue·63992·249 -Yildiz·Yildiz, Betul Cemre·88823·372 -Zaiatz·Zaiatz, Elena·89452·373 -Zatonskih·Zatonskih, Anna·116147·475 -Zawadzka·Zawadzka, Jolanta·164125·670 -Zhai·Zhai, Mo·36781·146 -Zhang·Zhang, Xiaowen·65418·281 -Zhao·Zhao, Xue·226236·885 -Zhu·Zhu, Chen·155686·617 -Zhukova·Zhukova, Natalia·176917·772 -Ziaziulkina·Ziaziulkina, Nastassia·57466·240 -Zimina·Zimina, Olga·82087·329 diff --git a/bug.log b/bug.log index 1bece4c..b11ecf5 100644 --- a/bug.log +++ b/bug.log @@ -1 +1 @@ -Version 11.11 +Version 11.12a