我的缩进问题始于第40行在我的代码中。如果有人能告诉我如何修复它,我会非常感谢基于Python文本的游戏缩进
print "You wake up in a dark room, There is a box of matches in your pocket. What do you do?"
print "#1 Light a match #2 Do nothing"
door = raw_input(">")
if door == "1":
print "You light a match, In the room there is an axe and a door without a handle. What do you do?"
print "#1 Grab the axe #2 Punch the door #3 Do nothing"
axe = raw_input(">")
if axe == "1":
print "You grab the axe, What do you do?"
print "#1 Knock down the door #2 Do nothing"
end = raw_input(">")
if end == "1":
print "You are free! You Win!"
elif end == "2":
print"You wait and then the axe slips out of your hand, decapacitating you. You die"
else:
print "Ivalid input. Game End"
elif axe == "2":
print"Ow, that hurt. What to do now?"
print "#1 Grab the axe #2 do nothing"
chop = raw_input(">")
if chop == "1":
print" You grab the axe, What do you do?"
print "#1 Knock down the door #2 Do nothing"
end = raw_input(">")
if end == "1":
print "You are free! You Win!"
elif end == "2":
print"You wait and then the axe slips out of your hand, decapacitating you. You die"
else:
print "Ivalid input. Game End"
elif chop == "2":
print "You go insane from waiting. Game Over"
else:
print "Ivalid input. Game End"
elif axe == "3":
print "You go insane from waiting. Game Over"
else:
print "Ivalid input. Game End"
elif door == "2":
print"You wait in the darkness until something grabs your arm. Whate do you do?"
print"#1 Use your ninja skills to escape the clutches of whatever is grabbing you. #2 Flail your arms around"
flail = raw_input('>')
if flail == "1":
print"You escape from the things grasp. What do you do now?"
print"#Light a match. #2 Throw a punch at the whatever was attacking you"
punch = raw_input('>')
if punch == "1":
print"You light a match only to see a hideous monster in front of you. What do you do now"
print"#1 Throw the match at the monster #2 Punch the monster"
match = raw_input('>')
if match == "1":
print"You throw a match at the monster. The monster eats the match then turns dissapears. What do you do"
print"#1 PaniC#2 Look around"
panic = raw_input('>')
if panic == "1":
print"You panic then have a heart attack. You die. Game over"
elif panic == "2":
print"You look around, it appears the monster is gone.In the room there is an axe and a door without a handle. What do you do?"
print "#1 Grab the axe #2 Punch the door #3 Do nothing"
axe = raw_input(">")
if axe == "1":
print "You grab the axe, What do you do?"
print "#1 Knock down the door #2 Do nothing"
end = raw_input(">")
if end == "1":
print "You are free! You Win!"
elif end == "2":
print"You wait and then the axe slips out of your hand, decapacitating you. You die"
else:
print "Ivalid input. Game End"
elif axe == "2":
print"Ow, that hurt. What to do now?"
print "#1 Grab the axe #2 do nothing"
chop = raw_input(">")
if chop == "1":
print" You grab the axe, What do you do?"
print "#1 Knock down the door #2 Do nothing"
end = raw_input(">")
if end == "1":
print "You are free! You Win!"
elif end == "2":
print"You wait and then the axe slips out of your hand, decapacitating you. You die"
else:
print "Ivalid input. Game End"
elif chop == "2":
print "You go insane from waiting. Game Over"
else:
print "Ivalid input. Game End"
elif axe == "3":
print "You go insane from waiting. Game Over"
else:
print "Ivalid input. Game End"
else:
print"Invalid Input. Game end"
else:
print"Invalid Input. Game end"
elif match == "2":
print"You punch the hideous monster in its face and it dies. You look around and you see a axe and a door without a handle. What do you do?"
print "#1 Grab the axe #2 Punch the door #3 Do nothing"
axe = raw_input(">")
if axe == "1":
print "You grab the axe, What do you do?"
print "#1 Knock down the door #2 Do nothing"
end = raw_input(">")
if end == "1":
print "You are free! You Win!"
elif end == "2":
print"You wait and then the axe slips out of your hand, decapacitating you. You die"
else:
print "Ivalid input. Game End"
elif axe == "2":
print"Ow, that hurt. What to do now?"
print "#1 Grab the axe #2 do nothing"
chop = raw_input(">")
if chop == "1":
print" You grab the axe, What do you do?"
print "#1 Knock down the door #2 Do nothing"
end = raw_input(">")
if end == "1":
print "You are free! You Win!"
elif end == "2":
print"You wait and then the axe slips out of your hand, decapacitating you. You die"
else:
print "Ivalid input. Game End"
elif chop == "2":
print "You go insane from waiting. Game Over"
else:
print "Ivalid input. Game End"
elif axe == "3":
print "You go insane from waiting. Game Over"
else:
print "Ivalid input. Game End"
else:
print"Invalid Input. Game end"
else:
print"Invalid Input. Game end"
elif punch == "2":
print"The monster eats your hand whole and you bleed to death. Game Over"
else:
print"Invalid Input. Game end"
elif flail == "2":
print"You flail your arms and then you get killed by the mmonster. Nice job. You lose. Game Over"
else:
print"Invalid input. Game end."
else:
print"Invalid Input. Game end."
请重新格式化代码格式您的文章,并张贴确切的错误消息你收到。在此之前,给你一个解决方案或多或少是不可能的。 –
@JakobBowyer“你在做什么?你做得很糟糕,你应该做得更好。”这就是你刚才告诉他的。这是怎样的建设性?如果你有一个特定的方法,他可以更好地实现这一点,你应该写它作为一个答案(就像我建议一个有限状态机时那样) –
指示哪一行是第40行可能是一个好开始... – twalberg