本文整理汇总了Python中UI.inline_print方法的典型用法代码示例。如果您正苦于以下问题:Python UI.inline_print方法的具体用法?Python UI.inline_print怎么用?Python UI.inline_print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UI
的用法示例。
在下文中一共展示了UI.inline_print方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: breed
# 需要导入模块: import UI [as 别名]
# 或者: from UI import inline_print [as 别名]
def breed(self, mate):
if not mate.breedable():
return
for partner in self.crew:
# no sterile or pregnant partners
if not partner.breedable():
continue
if partner.sex == mate.sex:
continue
# no fathers or mothers
if partner.crew_id == mate.mom.crew_id or partner.crew_id == mate.dad.crew_id:
continue
if mate.crew_id == partner.mom.crew_id or mate.crew_id == partner.dad.crew_id:
continue
prob = .006
# half siblings and full siblings
if mate.dad.crew_id == partner.dad.crew_id:
prob *= .01
if mate.mom.crew_id == partner.mom.crew_id:
prob *= .01
if random.random() < prob:
baby = Crewmate()
mate.breeding = True
partner.breeding = True
if mate.sex == Sex.Male:
baby.be_born(mate, partner)
else:
baby.be_born(partner, mate)
self.crew.append(baby)
print UI.inline_print(baby)+" has been born."
print "Their parents are "+mate.name+" and "+partner.name
return
示例2: assign_job
# 需要导入模块: import UI [as 别名]
# 或者: from UI import inline_print [as 别名]
def assign_job(s):
mate = UI.pick_list_crew(s.crew)
if mate == -1:
return
colorful_jobs = map(UI.color_code, Jobs)
for quest in quest_list:
colorful_jobs.append(quest.description+" "+str(quest.quest_id))
job = UI.list_options(colorful_jobs, UI.inline_print(s.crew[mate]))
if job < len(Jobs):
s.crew[mate].job = Jobs[job]
else:
index = job - len(Jobs)
s.crew[mate].job = quest_list[index].description+" "+str(quest_list[index].quest_id)
示例3: death
# 需要导入模块: import UI [as 别名]
# 或者: from UI import inline_print [as 别名]
def death(self, mate):
mate.alive = False
self.crew.remove(mate)
print UI.inline_print(mate)+" has died at age "+str(mate.age)