我的基本模块中有一个代码:
class start_Game(object):
def __init__(self):
print "You landed on planet and see three rooms."
print "You need to choose one room to enter"
self.door=raw_input("Pick number of door (1,2 or 3)>>>")
try:
assert(int(self.door)>0 and int(self.door)<=3)
self.password=('%d%d%d')%(randint(1,9),randint(1,9),randint(1,9))
print self.password
self.ROOMs={'1':Medical_room,'2':Library,'3':basement,'4':End}
while True:
# break
room=self.ROOMs[self.door]
# print room()
if self.door=='1':
self.door=room().play(self.password)
else:
self.door=room().play()
这样我想运行输入 3 个数字的地下室模块。我的地下室模块是:
from End import *
class basement(object):
def __init__(self):
print"You enterd dark room and something makes noise"
def play(self):
choice=raw_input("Do you want to continue?y/n")
if choice=='y':
End().play()
else:
start_Game()???
我的问题是如何返回 start_game 课程并从一开始就开始我的游戏?