while True:
print("We have entered in the open sea, but the current is pushing us.
We can veer left and"
+"\nmiss the storm, or go straight through it. Type [left] or
[straight] exactly as it is in the box.")
turnChoice = input()
if turnChoice == "left":
food = food - 2
time.sleep(2)
print("You missed the storm, but you lost a little food. Your
current
food level is 5. If you let it go to zero, "
+"\nyour health will decrease.")
break
if turnChoice == "straight":
time.sleep(2)
random.randint(1,5)
break
if random == 1:
food = food - 2
print("You tried to go through the storm, but the ship was damaged.
You lost some food.")
break
if random == 2:
print("The ship made it through the storm without taking damage
somehow.
You did not loose any supplies or health.")
break
if random == 3:
print("The ship made it through. It made a lot of noise, but no
supplies were lost.")
break
if random == 4:
health = health - 20
print("The ship made it through, but there was damage. While you
were inside the ship, a stack of barrels fell on you."
+"\n You took some damage, receiving a concussion and fracturing
your arm. But you will live.")
break
if random == 5:
water = water - 2
print("You made it through the storm, but some water barrels were
lost to the storm. ")
time.sleep(2)
print("Here is your water status, don't let it get to zero: ")
print(water)
break
if turnChoice not in("left", "straight"):
print("Invalid input, please try again.")
Извините, если формат неверный, я новичок в stackoverflow.Я программирую игру в слова для своего английского проекта.Я пытаюсь запустить эти разные функции if внутри цикла while, но он либо игнорирует их, либо просто зацикливает всю функцию.Если вы выбираете «прямой», то он должен потянуть генератор случайных чисел и выбрать случайный сценарий.Если вы выберете «налево», это только уменьшит вашу еду.Функция «левый» работает, а «прямой» - нет.Кроме того, я пытаюсь заставить его сломаться после того, как он проходит через функцию 'left' или функцию 'direct', но я не уверен, как это сделать из-за функций 'if'.Это запрограммировано на Pycharm, и я считаю, что это Python 3.7.0.