Ejemplo n.º 1
0
 def entrenaMaquina(self, dic):
     self.manager = ManagerPlayAgainstEngine.ManagerPlayAgainstEngine(self)
     side = dic["SIDE"]
     if side == "R":
         side = "B" if random.randint(1, 2) == 1 else "N"
     dic["ISWHITE"] = side == "B"
     self.manager.start(dic)
Ejemplo n.º 2
0
 def juegaExterno(self, fich_tmp):
     dic_sended = Util.restore_pickle(fich_tmp)
     dic = WPlayAgainstEngine.play_position(self, _("Play a position"), dic_sended["ISWHITE"])
     if dic is None:
         self.run_action(TB_QUIT)
     else:
         side = dic["SIDE"]
         if side == "R":
             side = "B" if random.randint(1, 2) == 1 else "N"
         dic["ISWHITE"] = side == "B"
         self.manager = ManagerPlayAgainstEngine.ManagerPlayAgainstEngine(self)
         self.manager.play_position(dic, dic_sended["GAME"])
Ejemplo n.º 3
0
    def Adjournments(self):
        menu = QTVarios.LCMenu(self.main_window)
        li_Adjournments = Adjournments.Adjournments().list_menu()
        for key, label, tp in li_Adjournments:
            menu.opcion((True, key, tp), label, Iconos.PuntoMagenta())
            menu.addSeparator()
        menu.addSeparator()
        mr = menu.submenu(_("Remove"), Iconos.Borrar())
        for key, label, tp in li_Adjournments:
            mr.opcion((False, key, tp), label, Iconos.Delete())

        resp = menu.lanza()
        if resp:
            si_run, key, tp = resp
            if si_run:
                dic = Adjournments.Adjournments().get(key)

                Adjournments.Adjournments().remove(key)
                if tp == GT_AGAINST_ENGINE:
                    self.manager = ManagerPlayAgainstEngine.ManagerPlayAgainstEngine(
                        self)
                elif tp == GT_ALBUM:
                    self.manager = ManagerAlbum.ManagerAlbum(self)
                elif tp == GT_AGAINST_CHILD_ENGINE:
                    self.manager = ManagerPerson.ManagerPerson(self)
                elif tp == GT_MICELO:
                    self.manager = ManagerMicElo.ManagerMicElo(self)
                elif tp == GT_COMPETITION_WITH_TUTOR:
                    self.manager = ManagerCompeticion.ManagerCompeticion(self)
                elif tp == GT_ELO:
                    self.manager = ManagerElo.ManagerElo(self)
                elif tp == GT_AGAINST_GM:
                    self.manager = ManagerGM.ManagerGM(self)
                elif tp in (GT_FIDE, GT_FICS, GT_LICHESS):
                    self.manager = ManagerFideFics.ManagerFideFics(self)
                    self.manager.selecciona(tp)
                else:
                    return
                self.manager.run_adjourn(dic)
                return

            else:
                Adjournments.Adjournments().remove(key)

            self.test_opcion_Adjournments()
            self.main_window.pon_toolbar(self.li_opciones_inicio, atajos=True)