Python文本冒险灾难

2024-10-01 00:31:25 发布

您现在位置:Python中文网/ 问答频道 /正文

if schoice == 1:
    print "You walk right up to the rat and proceed to BEAT THE SHIT OUT OF IT AHHHHHH. Ahem. Anyway, you look at your blood-covered fists and feel good about yourself. You know that you just leveled up your Unarmed to 11. BOOYA!"
    skills("Unarmed") = 11
else:
    "You proceed to be a little bitch and sneak past the rat. Even though you know that you are being a total coward, you feel good, and you know that you leveled up your sneak to 11. Oh Yeah!"
    skills("Sneak") = 11

首先,我想说的是,我已经准备好了raw_input其他的东西,但我只是想知道我是不是必须从这里分离出来,然后必须写上无数次同样的东西,或者我可以做出这两个选择,不管选哪一个,继续一个共同的新选择?你知道吗


Tags: andthetoyouyourthatfeelgood
1条回答
网友
1楼 · 发布于 2024-10-01 00:31:25

你不必每次有选择的时候就把所有的东西都分开,不

考虑一下:

print('This happens first')
choice = raw_input('Make a choice (1 or 2)')
if choice == 1:
    print('Conditional event no1')
else:
    print('Conditional event no2')
print('This happens after the choice, no matter what happened')

故事可以从那里继续下去。您可以将其可视化为类似以下内容的流程图:

                /    Choice 1    -\               
Starting point /                         \____ Happens in either case
               \                         /
                \    Choice 2    -/

相关问题 更多 >