本文整理汇总了Python中utils.Utils.write方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.write方法的具体用法?Python Utils.write怎么用?Python Utils.write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.Utils
的用法示例。
在下文中一共展示了Utils.write方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: play
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [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())
示例2: pick_player
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [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]
示例3: start
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def start(self):
while not self.game_over():
self._initial_deal()
round_over = False
while not round_over:
for player in self.players:
active_players = [p for p in self.players if p.active]
if len(active_players) == 1:
# ROUND END
round_over = True
Utils.write("ROUND OVER: %s wins!" % active_players[0].name)
active_players[0].wins += 1
break
player.turn()
self.next_round()
示例4: effect
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [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: len
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
DIR_STAR = "StarAlign"
STAR_LOG = "alignmentLog.final.out"
# Flush old files
filetags = ["summary", "aligns", "genecounts"]
for x in filetags:
u.rm(x + "_" + EXPERIMENT + ".tsv")
# Get list of sample identifiers
IDENTIFIERS = [x for x in os.listdir(WORKING_DIRECTORY) if x.endswith("1")]
# print IDENTIFIERS, len(IDENTIFIERS)
# Write headers
HEADERS = ["Step"] + IDENTIFIERS + ["Avg"]
u.write(HEADERS, "summary_" + EXPERIMENT, compute_average=False)
# Count pretrims/samples (FastqcReports?)
reads = ["Pre-trimming"]
for IDENTIFIER in IDENTIFIERS:
subpath = IDENTIFIER + "/" + IDENTIFIER + "_fastqc/fastqc_data.txt"
path = os.path.join(TEMP_PRETRIM, subpath)
reads += [u.get_fastqc_reads(path)]
u.write(reads, "summary_" + EXPERIMENT)
# Count posttrims/sample (FastqcReports)
reads = ["Post-trimming"]
for IDENTIFIER in IDENTIFIERS:
IDENTIFIER_ROOT = os.path.join(WORKING_DIRECTORY, IDENTIFIER)
path = os.path.join(IDENTIFIER_ROOT, DIR_FASTQC)
示例6: turn
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def turn(self):
Utils.write('\n%s\'s Turn:\n' % self.name)
self.immune = False
self.draw()
self.play()
示例7: print_hand
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def print_hand(self):
for i, card in enumerate(self.hand):
(val, name) = card.type_
Utils.write('%d: %s (%d)' % (i, name, val))
Utils.write('')
示例8: discard
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def discard(self, card):
self.hand.remove(card)
self.played.append(card)
Utils.write('')
card.discard_effect(self)
示例9: check_immunity
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def check_immunity(self, player):
if player.immune:
Utils.write('\n%s is immune this turn.' % player.name)
return True
示例10: discard_effect
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def discard_effect(self, player):
Utils.write('%s discarded the Princess, and is out!' % player.name)
player.active = False
示例11: draw_effect
# 需要导入模块: from utils import Utils [as 别名]
# 或者: from utils.Utils import write [as 别名]
def draw_effect(self, player, card):
if isinstance(card, Prince) or isinstance(card, King):
Utils.write('%s had to discard the Countess.' % player.name)
player.hand.remove(self)