Nie wiem do końca jak temat nazwać. Generalnie mój problem jest taki. Piszę gierkę tekstową dla zabawy:
W skrócie wygląda to tak.
Na początku mamy input powitalny z 3 możliwymi opcjami:
a, b, c.
Po wybraniu b pokazuje się 5 opcji
po wybraniu dowolnej liczba opcji się zmniejsza. Nie mniej finalną opcja jest opcja wyjściowa.
Czyli w pierwszym kroku wybieramy b, potem a, znowu a aż w końcu wybranie a automatycznie jest równe opcji c z pierwszego wyboru.
if beginning == "a":
marketX = input("Welcome on the market of Xarthas, what you plan to do? \n [a] Go to horse merchant,\n "
"[b] Go to armor merchant,\n[c]Go to wine merchant,\n [d]Go to weapon merchant "
"\n[e] Go to wheat merchant \n[f] Try to sell your goods")
if marketX == "a":
print("Greetings, are you looking for new steed?")
elif marketX == "b":
print("Greetings, I see that you are not warrior, please let me show you my best crafts")
elif marketX == "c":
print("Here, take a look at the finest wines in Xarthas")
elif marketX == "d":
print("Welcome in the finest armory of this city")
elif marketX == "e":
print("Welcome in Jacobsen & Sons")
elif marketX == "f":
print("You set up your stool and wait for buyer of your stuff")
elif beginning == "b":
tavernX = input("Welcome in Hanging Bear. You can: \n [a] buy a beer for 5 talars. \n "
"[b] buy food for you for 15 talars .\n "
"[c] rent a room for 1 gulden. \n [d] buy food for your horses for 2 guldens. \n [e] leave tavern.")
if tavernX == "a":
totalMoney = totalMoney - beerPriceX
tavernXa = input("You feel happier, yet your pocket is lighter. You have " + str(totalMoney) + " total"
" Do you wish to do anything else? You can:\n [a] buy food for you for 15 talars. \n "
"[b] rent a room for 1 gulden. \n [c] buy food for your horses for 2 guldens. \n "
"[d] leave tavern.")
if tavernXa == "a":
totalMoney = totalMoney - foodPriceX
tavernXaA = input(" You feel healthier, but your money bag contains only " + str(totalMoney) + " now. "
"You can either:\n [a]rent a room for 1 gulden. \n "
"[b] buy food for your horses for 2 guldens."
"\n [c] leave tavern. ")
if tavernXaA == "a":
totalMoney = totalMoney - rentPriceX
tavernXaAa = input("Yaawn, that was good night Now you posses only a mere " + str(totalMoney) + ""
" guldens. You can: \n [a] feed your horses for 2 guldens.\n [b] leave the tavern.")
if tavernXaAa == "a":
totalMoney = totalMoney - horseFoodX
tavernXaAaA = input("Now you have " + str(totalMoney) + " guldens and your horses are well feed. "
"Having none activities here, you decided to leave tavern. Now you can :\n"
"[a] go to market \n[b] leave the city")
if tavernXaAaA == "a":
tavernXaAaA = marketX
else:
tavernXaAaA = outskirtsX
elif beginning == "c":
outskirtsX = input("You are at outskirts of the city")
Jak najszybciej/najprościej zrobić by zmienna lokalna tavernXaAaA zwracała input ze zmiennej outskirtsX? Co robię źle?