探索と狩りオプションで1ターンのターンカウンターが必要です。それを現在の時代に加えてください。どうやってやるの?私はPython 2.7を使用しています。初期turn=0
は、あなたの探求/ハントケースでPython 2.7でカウントターンを行うには
from main import name
import os
import random
kenyan_sand_boa = {
"snek": "kenyan sand boa",
"prey": "mice, " "birds, " "lizards",
"biome": "desert",
"predators": "desert monitor lizard",
"adult age": 156,
"baby size": 10,
"adult size": 20,
"current size": 10,
"current age": "0",
"name": name,
}
os.system('cls')
def menu():
os.system('cls')
print '''Now that you have chosen what snek to be, you have a couple
options
1. Read info about kenyan sand boas.
2. Explore.
3. Hunt.
4. View inventory.
5. Save.
6. Exit.
'''
loop = 1
choice = 0
while loop == 1:
menu()
choice = int(raw_input())
if choice == 1:
#information about kenyan sand boas
if choice == 2:
#exploring
if choice == 3:
#huntinng
if choice == 4:
#view inventory
else:
menu()
trun = 0; .....もしかして.... + + 1? –
ありがとうございます。それは完全に機能します。 –
上部に 'INFO = 1'、' EXPLORING = 2'、 'HUNTING = 3'、' INVENTORY = 4'があると便利かもしれません。これにより、 'if choice == INFO:'などを行うことができます。また、最初の 'elif'の後に' if'をすべて変更することができます。 – user2471379