コード例 #1
0
ファイル: game.py プロジェクト: jpghacct/pyduel_engine
    def create(self):
        """ sets up game"""

        # choose number of players 1-6 start with even numbers only
        # num_players = utils.choose_number_of_players()
        # num_squads = utils.choose_number_of_squads()
        # player_squad = {}
        # for x in range(0, num_squads + 1):
        #     player = utils.choose_player(num_players + 1)
        #     squad = utils.choose_players_squads()
        #     if Player(player) in player_squad:
        #         player_squad[Player(player)].append(Main(squad))
        #     else:
        #         player_squad[Player(player)] = [Main(squad)]
        # print(player_squad)

        #board_type = utils.choose_game_board()

        # skipping the setup menus
        squads = [s_utils.setup_squad(1, Main.dooku, SqState.dark),
                  s_utils.setup_squad(2, Main.mace, SqState.light)]
        board_type = BoardType.ruins
        self.engine = Engine({'squads': squads, 'board_type': board_type})
        self.engine.num_players = 2
        self.engine.initial_placement()
        print(self.engine)
コード例 #2
0
ファイル: test_engine.py プロジェクト: jpghacct/pyduel_engine
 def setUp(self):
     self.board = Board({})
     self.squads = [s_utils.setup_squad(1, Main.mace, SqState.light),
                    s_utils.setup_squad(2, Main.dooku, SqState.dark)]
     # s_utils.setup_squad(3, Main.mace, Square.light),
     # s_utils.setup_squad(4, Main.dooku, Square.dark)]
     self.engine = Engine({'board': self.board, 'squads': self.squads,
                           'active_char': self.squads[0].chars['main']})
     self.engine.move_char(self.squads[0].chars['main'], Pos(3, 3))
コード例 #3
0
ファイル: text_game.py プロジェクト: jpghacct/pyduel_engine
    def create(self):
        """ sets up game"""
        logging.info('Creating engine')

        # choose number of players 1-6 start with even numbers only
        # pick sides

        # pick squads
        # player_squad = {}
        # for x in range(0, num_squads + 1):
        #     player = utils.choose_player(num_players + 1)
        #     squad = utils.choose_players_squads()
        #     if Player(player) in player_squad:
        #         player_squad[Player(player)].append(Main(squad))
        #     else:
        #         player_squad[Player(player)] = [Main(squad)]
        # print(player_squad)

        # pick number of players
        # num_players = utils.choose_number_of_players()
        num_players = 2

        # pick number of squads
        # self.engine = utils.choose_number_of_squads()
        num_squads = 2

        # skipping the setup menus
        squads = [s_utils.setup_squad(1, Main.dooku, SqState.dark),
                  s_utils.setup_squad(2, Main.mace, SqState.light)]

        # pick boards
        # board_type = utils.choose_game_board()
        board_type = BoardType.ruins

        self.engine = Engine({'num_players': num_players,
                              'squads': squads,
                              'num_squads': len(squads),
                              'board_type': board_type})
コード例 #4
0
    def getSquads(self):
        """return list of squads"""
        # TODO: fix the rest of the characters and make a choose character
        squads = []
        for index, elem in enumerate(self.selectors):
            if elem['squad'].currentIndex():

                if elem['side'].isChecked():
                    state = SqState.light
                else:
                    state = SqState.dark

                char = Main(elem['squad'].currentIndex())
                squads.append(squad_utilities.setup_squad(index, char, state))
        return squads
コード例 #5
0
        self.setMinimumSize(375, 300)
        self.populate_tabs()
        self.show()

    def populate_tabs(self):
        """Populate the tabs with squad/character information."""
        # TODO:NOT sure about saving the number of squads as a variable
        # TODO: instead of just getting len() from the squads array
        for squad in self.engine.squads:
            tab_title = "{0} {1}".format(squad.player_num, squad.chars["main"].name)
            self.addTab(SquadWidget(squad), squad.chars["main"].name)


if __name__ == "__main__":
    from pyduel_engine.content.engine_states import Action, BoardType
    from pyduel_engine.utilities import squad_utilities as s_utils
    from pyduel_engine.model.engine import Engine
    from pyduel_engine.content.engine_states import SqState as SqState

    from pyduel_engine.epic_plugin.epic_states import Main

    squads = [s_utils.setup_squad(1, Main.dooku, SqState.dark), s_utils.setup_squad(2, Main.mace, SqState.light)]
    board_type = BoardType.ruins
    engine = Engine({"squads": squads, "board_type": board_type})
    engine.num_players = 2
    engine.num_squads = len(engine.squads)
    engine.initial_placement()
    app = QtGui.QApplication(sys.argv)
    ex = SquadTabWidget(engine)
    sys.exit(app.exec_())