当前位置: 首页>>代码示例>>Python>>正文


Python Utils.write方法代码示例

本文整理汇总了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())
开发者ID:jawsthegame,项目名称:loveletter,代码行数:9,代码来源:player.py

示例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]
开发者ID:jawsthegame,项目名称:loveletter,代码行数:10,代码来源:card.py

示例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()
开发者ID:jawsthegame,项目名称:loveletter,代码行数:17,代码来源:game.py

示例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.')
开发者ID:jawsthegame,项目名称:loveletter,代码行数:19,代码来源:card.py

示例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)
开发者ID:ppavlidis,项目名称:rnaseq-pipeline,代码行数:33,代码来源:tabulate_reads.py

示例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()
开发者ID:jawsthegame,项目名称:loveletter,代码行数:7,代码来源:player.py

示例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('')
开发者ID:jawsthegame,项目名称:loveletter,代码行数:7,代码来源:player.py

示例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)
开发者ID:jawsthegame,项目名称:loveletter,代码行数:7,代码来源:player.py

示例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
开发者ID:jawsthegame,项目名称:loveletter,代码行数:6,代码来源:card.py

示例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
开发者ID:jawsthegame,项目名称:loveletter,代码行数:5,代码来源:card.py

示例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)
开发者ID:jawsthegame,项目名称:loveletter,代码行数:6,代码来源:card.py


注:本文中的utils.Utils.write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。