当前位置: 首页>>代码示例>>Python>>正文


Python Game.start方法代码示例

本文整理汇总了Python中hearthbreaker.engine.Game.start方法的典型用法代码示例。如果您正苦于以下问题:Python Game.start方法的具体用法?Python Game.start怎么用?Python Game.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hearthbreaker.engine.Game的用法示例。


在下文中一共展示了Game.start方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_deck_shortening

# 需要导入模块: from hearthbreaker.engine import Game [as 别名]
# 或者: from hearthbreaker.engine.Game import start [as 别名]
 def test_deck_shortening(self):
     deck1 = Deck([RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(), RagnarosTheFirelord(),
                   GoldshireFootman(), GoldshireFootman()], CHARACTER_CLASS.DRUID)
     deck2 = StackedDeck([StonetuskBoar()], CHARACTER_CLASS.HUNTER)
     game = Game([deck1, deck2], [RandomAgent(), RandomAgent()])
     replay = record(game)
     game.start()
     replay.write(StringIO())
开发者ID:jademcgough,项目名称:hearthstone-simulator,代码行数:16,代码来源:replay_tests.py

示例2: run_game

# 需要导入模块: from hearthbreaker.engine import Game [as 别名]
# 或者: from hearthbreaker.engine.Game import start [as 别名]
 def run_game(self, other):
     mydeck = self.breakerdeck()
     game = Game([mydeck, other.breakerdeck()], [RandomAgent(), RandomAgent()])
     tries = 0
     while tries < 10:
         try:
             game.start()
             result = game.players[0].hero.dead and game.players[0].deck == mydeck
             if result:
                 database.create_game('mutational', self.id, other.id, self.id)
             else:
                 database.create_game('mutational', self.id, other.id, other.id)
             return
         except:
             tries += 1
     return True
开发者ID:slaymaker1907,项目名称:hearthbreaker,代码行数:18,代码来源:util.py

示例3: test_first_turn

# 需要导入模块: from hearthbreaker.engine import Game [as 别名]
# 或者: from hearthbreaker.engine.Game import start [as 别名]
    def test_first_turn(self):
        card_set1 = []
        card_set2 = []

        for cardIndex in range(0, 30):
            card_set1.append(card_lookup("Stonetusk Boar"))
            card_set2.append(card_lookup("Novice Engineer"))

        deck1 = Deck(card_set1, Malfurion())
        deck2 = Deck(card_set2, Jaina())

        agent1 = mock.Mock(spec=DoNothingAgent(), wraps=DoNothingAgent())
        agent2 = mock.Mock(spec=DoNothingAgent(), wraps=DoNothingAgent())
        game = Game([deck1, deck2], [agent1, agent2])

        game.start()
开发者ID:5alamander,项目名称:hearthbreaker,代码行数:18,代码来源:game_object_tests.py

示例4: test_recording_game

# 需要导入模块: from hearthbreaker.engine import Game [as 别名]
# 或者: from hearthbreaker.engine.Game import start [as 别名]
    def test_recording_game(self):
        self.maxDiff = None
        random.seed(9876)
        deck1 = hearthbreaker.engine.Deck([StonetuskBoar() for i in range(0, 30)], CHARACTER_CLASS.MAGE)
        deck2 = hearthbreaker.engine.Deck([Naturalize() for i in range(0, 30)], CHARACTER_CLASS.DRUID)
        agent1 = PredictableAgent()
        agent2 = PredictableAgent()

        game = Game([deck1, deck2], [agent1, agent2])
        replay = record(game)
        game.start()
        output = StringIO()
        replay.write_json(output)
        f = open("tests/replays/stonetusk_innervate.hsreplay", 'r')
        dif = self.__compare_json(output.getvalue(), f.read())
        self.assertTrue(dif)
        f.close()
开发者ID:jademcgough,项目名称:hearthstone-simulator,代码行数:19,代码来源:replay_tests.py

示例5: render_game

# 需要导入模块: from hearthbreaker.engine import Game [as 别名]
# 或者: from hearthbreaker.engine.Game import start [as 别名]

#.........这里部分代码省略.........
                    renderer.selection_index += 1
                    if renderer.selection_index > len(player.minions):
                        renderer.selection_index = 0
                renderer.draw_game()
                self.window.refresh()
            index = renderer.selection_index
            renderer.selection_index = -1
            if ch == 27:
                return -1

            return index

        def choose_option(self, options, player):
            self.window.addstr(0, 0, "Choose option")
            index = 0
            selected = 0
            for option in options:
                if index == selected:
                    color = curses.color_pair(4)
                else:
                    color = curses.color_pair(3)

                if isinstance(option, Card):
                    self.text_window.addstr(0, index * 20, "{0:^19}".format(option.name[:19]), color)
                else:
                    self.text_window.addstr(0, index * 20, "{0:^19}".format(option.card.name[:19]), color)
                index += 1
            self.window.refresh()
            self.text_window.refresh()
            ch = 0
            while ch != 10 and ch != 27:
                ch = self.game_window.getch()
                if ch == curses.KEY_LEFT:
                    starting_selected = selected
                    selected -= 1
                    if selected < 0:
                        selected = len(options) - 1

                    while not options[selected].can_choose(player) and selected != starting_selected:
                        selected -= 1
                        if selected < 0:
                            selected = len(options) - 1
                if ch == curses.KEY_RIGHT:
                    starting_selected = selected
                    selected += 1
                    if selected == len(options):
                        selected = 0
                    while not options[selected].can_choose(player) and selected != starting_selected:
                        selected += 1
                        if selected == len(options):
                            selected = 0

                index = 0
                for option in options:
                    if index == selected:
                        color = curses.color_pair(4)
                    else:
                        color = curses.color_pair(3)
                    if isinstance(option, Card):
                        self.text_window.addstr(0, index * 20, "{0:^19}".format(option.name[:19]), color)
                    else:
                        self.text_window.addstr(0, index * 20, "{0:^19}".format(option.card.name[:19]), color)
                    index += 1
                self.window.refresh()
                self.text_window.refresh()
            if ch == 27:
开发者ID:jomyhuang,项目名称:sdwle,代码行数:70,代码来源:text_runner.py

示例6: render_game

# 需要导入模块: from hearthbreaker.engine import Game [as 别名]
# 或者: from hearthbreaker.engine.Game import start [as 别名]

#.........这里部分代码省略.........
                    renderer.selection_index += 1
                    if renderer.selection_index > len(player.minions):
                        renderer.selection_index = 0
                renderer.draw_game()
                self.window.refresh()
            index = renderer.selection_index
            renderer.selection_index = -1
            if ch == 27:
                return -1

            return index

        def choose_option(self, options, player):
            self.window.addstr(0, 0, "Choose option")
            index = 0
            selected = 0
            for option in options:
                if index == selected:
                    color = curses.color_pair(4)
                else:
                    color = curses.color_pair(3)

                if isinstance(option, Card):
                    self.text_window.addstr(0, index * 20, "{0:^19}".format(option.name[:19]), color)
                else:
                    self.text_window.addstr(0, index * 20, "{0:^19}".format(option.card.name[:19]), color)
                index += 1
            self.window.refresh()
            self.text_window.refresh()
            ch = 0
            while ch != 10 and ch != 27:
                ch = self.game_window.getch()
                if ch == curses.KEY_LEFT:
                    starting_selected = selected
                    selected -= 1
                    if selected < 0:
                        selected = len(options) - 1

                    while not options[selected].can_choose(player) and selected != starting_selected:
                        selected -= 1
                        if selected < 0:
                            selected = len(options) - 1
                if ch == curses.KEY_RIGHT:
                    starting_selected = selected
                    selected += 1
                    if selected == len(options):
                        selected = 0
                    while not options[selected].can_choose(player) and selected != starting_selected:
                        selected += 1
                        if selected == len(options):
                            selected = 0

                index = 0
                for option in options:
                    if index == selected:
                        color = curses.color_pair(4)
                    else:
                        color = curses.color_pair(3)
                    if isinstance(option, Card):
                        self.text_window.addstr(0, index * 20, "{0:^19}".format(option.name[:19]), color)
                    else:
                        self.text_window.addstr(0, index * 20, "{0:^19}".format(option.card.name[:19]), color)
                    index += 1
                self.window.refresh()
                self.text_window.refresh()
            if ch == 27:
开发者ID:jirenz,项目名称:CS229_Project,代码行数:70,代码来源:demo.py


注:本文中的hearthbreaker.engine.Game.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。