本文整理汇总了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())
示例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
示例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()
示例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()
示例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:
示例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: