Exemplo n.º 1
0
    def read_line_fich(self, line):
        li = line.strip().split("|")
        self.fen, self.label, pgn_moves = li[0], li[1], li[2]

        p = Game.fen_partida(self.fen, pgn_moves)
        self.pv = p.pv()
        self.limoves = self.pv.split(" ")

        nmoves = len(self.limoves)
        self.num_moves = int(len(self.limoves) / 2)
        if nmoves % 2 == 1:
            self.num_moves += 1
        return self
Exemplo n.º 2
0
    def inicio(self, route):
        GestorRoutes.inicio(self, route)

        tactica = self.route.get_tactic()

        self.partida_objetivo = Game.fen_partida(tactica.fen, tactica.pgn)

        self.is_rival_thinking = False

        cp = Position.Position()
        cp.read_fen(tactica.fen)

        self.fen = tactica.fen

        is_white = cp.is_white

        self.game.set_position(cp)
        self.game.pending_opening = False

        self.human_is_playing = False
        self.state = ST_PLAYING

        self.is_human_side_white = is_white
        self.is_engine_side_white = not is_white

        self.main_window.ponActivarTutor(False)

        self.ayudas_iniciales = 0

        li_options = [TB_CLOSE, TB_HELP]
        self.main_window.pon_toolbar(li_options)

        self.main_window.activaJuego(True, False, siAyudas=False)
        self.main_window.quitaAyudas(True)
        self.set_dispatcher(self.mueve_humano)
        self.setposition(self.game.last_position)
        self.mostrarIndicador(True)
        self.ponPiezasAbajo(is_white)
        # self.ponRotulo1("<b>%s</b>" % tactica.label)
        self.ponRotulo2(route.mens_tactic(False))
        self.pgnRefresh(True)
        QTUtil.refresh_gui()

        self.dgt_setposition()

        self.siguiente_jugada()