本文整理汇总了Python中Game.Game.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Game.reset方法的具体用法?Python Game.reset怎么用?Python Game.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game.Game
的用法示例。
在下文中一共展示了Game.reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import reset [as 别名]
class SimulatorController:
def __init__(self):
self.game = Game(input_type='')
self.game.pre_main_phases()
self._init_simulator_casting_hexes()
def advance(self):
result = self.game.post_main_phases()
if result is not None:
return result
self.game.pre_main_phases()
def play_unit_card(self, card_name, player_id, location):
self.add_card_and_gold(card_name, player_id)
self.game.play_unit(card_name, player_id, location)
def play_spell_card(self, card_name, player_id, slot):
self.add_card_and_gold(card_name, player_id)
self.game.play_spell(card_name, player_id, slot)
def play_building_card(self, card_name, player_id, slot):
self.add_card_and_gold(card_name, player_id)
self.game.play_building(card_name, player_id, slot)
def clear(self):
self.game.reset()
def next(self):
self.advance()
def add_card_and_gold(self, card_name, player_id):
card = Card.get_card(card_name)
self.game.players[player_id].hand.append(card)
self.game.players[player_id].gold += card.cost
def _init_simulator_casting_hexes(self):
sector_dict = {}
for x in xrange(self.game.board.field_length):
for y in xrange(self.game.board.field_width):
if x == self.game.board.field_length - 1 and y % 2 == 1:
continue
pos = BoardTools.get_backend_position_for_visual_position((x, y), self.game.board.field_width)
sector = self.game.board.get_sector_for_position(pos)
if sector in sector_dict:
sector_dict[sector].append(pos)
else:
sector_dict[sector] = [pos]
self.game.board.right_facing_casting_zones = []
self.game.board.right_facing_casting_zones.extend(sector_dict[0])
self.game.board.right_facing_casting_zones.extend(sector_dict[1])
self.game.board.left_facing_casting_zones = []
self.game.board.left_facing_casting_zones.extend(sector_dict[3])
self.game.board.left_facing_casting_zones.extend(sector_dict[4])
示例2: open
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import reset [as 别名]
import numpy.random as random
from Game import Game
import numpy
report = open('output.o', 'w')
data = {}
size = 30
density = 0
g = Game(size, density, 0.5, 0.3, 0.3)
count = 0
for r in g.readers():
for p in g.publishers():
g.reset()
g.Graph.add_edge(r, p)
steps = g.playGame()
count += 1
data[count] = []
data[count].append(steps)
report.write(str(data))
report.close()
示例3:
# 需要导入模块: from Game import Game [as 别名]
# 或者: from Game.Game import reset [as 别名]
event_list = pygame.event.get()
for event in event_list:
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_q:
game.player.alive = False
# control the game state
# an object will always return its own state
# number unless input events set otherwise
if state == home_state:
state = home.run(event_list)
player.reset()
health_bar.reset(player)
game.reset(player)
shop.reset(player, health_bar)
elif state == info_state:
state = info.run(event_list)
elif state == game_state:
state = game.run(event_list)
elif state == pause_state:
state = paused.run(event_list)
elif state == shop_state:
state = shop.run(event_list)
elif state == settings_state:
state = settings.run(event_list)
elif state == game_over_state:
state = game_over.run(event_list)
elif state == reset_game_state:
player.reset()