我目前正在用 python 进行简单的文本冒险。基本上我希望randint选择1或2然后分配给right_wire,然后raw_input成为wire_choice,然后匹配2以提供所需的结果。我相信你们无论如何都能弄清楚我想在这里做什么。我离这里很近还是真的很远?谢谢!
right_wire = randint(1, 2)
wrong_wire = 0
if right_wire == 1:
wrong_wire = 2
elif right_wire == 2:
wrong_wire = 1
else:
print "ERROR"
while True:
print "Which wire do you pull?"
print
print "1. The red one."
print "2. The blue one."
print
wire_choice = raw_input('*>>*')
if wire_choice == 1 and right_wire == 1:
print "**BOMB DEFUSED**"
return 'engineering2'
elif wire_choice == 2 and right_wire == 2:
print "**BOMB DEFUSED**"
return 'engineering2'
elif wire_choice == 1 and right_wire == 2:
print "**FAILED**"
return 'death'
elif wire_choice == 2 and right_wire ==1:
print "**FAILED**"
return 'death'
else:
print no_understand