當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。