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


Python Trainer.name方法代码示例

本文整理汇总了Python中trainer.Trainer.name方法的典型用法代码示例。如果您正苦于以下问题:Python Trainer.name方法的具体用法?Python Trainer.name怎么用?Python Trainer.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在trainer.Trainer的用法示例。


在下文中一共展示了Trainer.name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: City

# 需要导入模块: from trainer import Trainer [as 别名]
# 或者: from trainer.Trainer import name [as 别名]
bp = City(name='Budapest', available_pokemon_object=Pokemon(name='Caterpie', pokemon_type='Bug'))
kv = City(name='Kaposvár', available_pokemon_object=Pokemon(name='Weedle', pokemon_type='Poison'))
hb = City(name='Hajdúszoboszló', available_pokemon_object=Pokemon(name='Pikachu', pokemon_type='Electric'))
db = City(name='Debrecen', available_pokemon_object=None)

# Create the basic of player
player = Trainer(location_object=bp)

"""
"Tutorial" or prologue in the game. The player create your own character.
"""

print("Welcome to the PokeHunter 1.0")
print("All instructions or available choices will be in [] .. Follow them! ;)")
input("[Any button to skip]")
player.name = input("I greet you, stranger! My name is professor Oak. What's yours?\n")
age = input("And.. How old are you?\n")
while True:
    try:
        player.age = int(age)
        break
    except ValueError:
        age = input("Please, give me a number!\n")
gender = input("I see not well, so please, tell me! What is your gender?\n[female/male]\n")
while gender not in player.gender:
    gender = input("Please, select an available!\n")
player.gender = gender
starting_pokemon_object = input("I can offer one pokemon from below.\n[Charizard/Squirtle/Bulbasaur]\n")
while starting_pokemon_object not in Trainer.available_pokemon_names:
    starting_pokemon_object = input("Please, select an available!\n")
if starting_pokemon_object == 'Charizard':
开发者ID:matolaypal,项目名称:poke-hunter,代码行数:33,代码来源:main.py


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