コード例 #1
0
ファイル: WDB_Summary.py プロジェクト: xaizek/lucaschessR
    def grid_boton_derecho(self, grid, fila, columna, modificadores):
        if self.siFilaTotales(fila):
            return
        alm = self.liMoves[fila]["rec"]
        if not alm or len(alm.LIALMS) < 2:
            return

        menu = QTVarios.LCMenu(self)
        rondo = QTVarios.rondoPuntos()
        for ralm in alm.LIALMS:
            menu.opcion(ralm, Game.pv_pgn(None, ralm.PV), rondo.otro())
            menu.separador()
        resp = menu.lanza()
        if resp:
            self.actualizaPV(resp.PV)
コード例 #2
0
ファイル: GestorRoutes.py プロジェクト: xaizek/lucaschessR
    def mueve_humano(self, from_sq, to_sq, promotion=None):
        jgSel = self.checkmueve_humano(from_sq, to_sq, promotion)
        if not jgSel:
            return False

        if self.is_guided:
            pvSel = jgSel.movimiento().lower()
            pvObj = self.liPV[self.posPV]
            li = pvObj.split("-")
            if li[0] != pvSel:
                if pvSel in li:
                    pgn = Game.pv_pgn(jgSel.position_before.fen(), pvObj)
                    self.show_mens(
                        _("You have selected one correct move, but the line use %s"
                          ) % pgn)
                    self.ponFlechaSC(pvObj[:2], pvObj[2:4])
                    self.ayuda(False)
                else:
                    self.show_error(_("Wrong move"))
                    self.warnings += 1
                    self.ponWarnings()
                self.sigueHumano()
                return False
            self.posPV += 1
        else:
            fen = self.game.last_position.fen()
            pv = jgSel.movimiento().lower()
            b_wdl = self.t4.wdl(fen)
            m_wdl = self.t4.wdl_move(fen, pv)

            if b_wdl != m_wdl:
                self.show_error(_("Wrong move"))
                self.warnings += 1
                self.ponWarnings()
                self.setposition(self.game.last_position)
                self.sigueHumano()
                return False

        self.move_the_pieces(jgSel.liMovs)

        self.add_move(jgSel, True)
        self.error = ""

        self.siguiente_jugada()
        return True
コード例 #3
0
ファイル: Routes.py プロジェクト: xaizek/lucaschessR
    def next_task(self):
        state, task = self.get_task()
        if state == PLAYING:
            opening, win = task
            pgn = Game.pv_pgn(None, opening.pv)

            litxt = [_("To play a complete game.")]
            if opening.label:
                litxt.append(_("With the opening: %s.") % _F(opening.label))
                litxt.append(pgn)
            if win:
                litxt.append(_("You must win to pass this step."))
            else:
                litxt.append(_("You don't need to win to pass this step."))
            return "<br>".join(litxt), "#597272"
        elif state == ENDING:
            return _("You must solve an endgame puzzle"), "Brown"
        else:
            return _("You must solve tactics puzzles to advance."), "#807C6E"