概述
所以我知道这个网站上有太多关于Zed Shaw的《艰难的学习Python》的问题,但是我正在经历ex42,Ex credit 3,让我挂断了电话。在
我很难让类引擎有效地启动并转换到类映射中,在这里游戏可以开始执行我定义的不同函数
代码如下:from sys import exit
from random import randint
class Map(object):
def death():
print quips[randint (0, len(quips)-1)]
exit(1)
def princess_lives_here():
print "You see a beautiful Princess with a shiny crown."
print "She offers you some cake."
eat_it = raw_input(">")
if eat_it == "eat it":
print "You explode like a pinata full of frogs."
print "The Princess cackles and eats the frogs. Yum!"
return 'death'
elif eat_it == "do not eat it":
print "She throws the cake at you and it cuts off your head."
print "The last thing you see is her munching on your face. Yum!"
return 'death'
elif eat_it == "make her eat it":
print "The Princess screams as you cram the cake in her mouth."
print "Then she smiles and cries and thank you for saving her."
print "She points to a tiny door and says, 'The Koi needs cake too.'"
print "She gives you the very last bit of cake and shoves you in."
return 'gold_koi_pond'
else:
print "The Princess looks at you confused and just points at the cake."
return 'princess_lives_here'
class Engine(Map):
def _init_(self, start):
self.quips = [
"You died. You suck at this.",
"Your mom would be proud, if she were smarter",
"Such a luser.",
"I have a small puppy that's better at this."
]
self.start = start
def play(self):
next = self.start
while True:
print "n-----"
room = getattr(self, next)
next = room()
e = "princess_lives_here".Map.Engine
e.play()
现在问题不在于Map类中的其他函数,而是如何从类引擎转换到类映射,这样游戏才能继续。它要么没有在类引擎中定义'Map',也没有在我最后设置的变量中定义'Map',并尝试使用play()命令运行。在
任何其他的链接,你可以指向我的课堂互动将是伟大的。再来一次
最后
以上就是端庄发箍为你收集整理的python可以参加的比赛_参加两级比赛的全部内容,希望文章能够帮你解决python可以参加的比赛_参加两级比赛所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复