本文整理汇总了Python中utils.Utils.read方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.read方法的具体用法?Python Utils.read怎么用?Python Utils.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Utils
的用法示例。
在下文中一共展示了Utils.read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import read [as 别名]
def __init__(self):
self.deck = []
self.players = []
num_players = int(Utils.read("Number of players? "))
for i in range(num_players):
name = Utils.read("Player %d name? " % (i + 1))
self.players.append(Player(name, self))
self.make_deck()
示例2: play
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import read [as 别名]
def play(self):
if len(self.hand) > 1:
pick = int(Utils.read('Card to Play? '))
played = self.hand[pick]
self.discard(played)
Utils.write('')
played.effect(self, self._other_players())
示例3: pick_player
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import read [as 别名]
def pick_player(self, others):
for i, player in enumerate(others):
text = '%d: %s' % (i, player.name)
if player.immune:
text += " (immune)"
Utils.write(text)
pick = int(Utils.read('Which Player? '))
return others[pick]
示例4: effect
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import read [as 别名]
def effect(self, player, others):
for i, t in enumerate(CARD_TYPES[1:]):
_, name = t
Utils.write('%d: %s' % (i, name))
pick = int(Utils.read('\nCard Type? '))
card_type = CARD_TYPES[pick+1]
other = self.pick_player(others)
if self.check_immunity(other): return
self.assert_hand(other)
if other.hand[0].type_ == card_type:
Utils.write('\nMATCH! %s is out of the round.' % other.name)
other.active = False
else:
Utils.write('\nNo match.')
示例5: load_articles
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import read [as 别名]
def load_articles(self):
sections = {'TITLE': 0, 'BOLD': 1, 'BODY': 2}
for ID in self.timeline:
article = Utils.read(ID, self.serwismap[ID])
self.titles.insert(ID, article[sections['TITLE']])
self.texts.insert(ID, ' '.join([article[sections['BOLD']], article[sections['BODY']]]))