私の問題は、あなたが 'support'変数を見ればそれです。 (変数リストで)現在の消費量には適用されません。 EXの場合。 「S」を押してゲームを開始し、「M」を押してミッションを表示し、「S」を押してサバイバーミッションを選択します。私は2人の生存者を受け取ります。その数は、何らかの理由でサポートに追加されず、人間1人当たり0.1を加えなければならないので、「あなたは消費しています。申し訳ありませんが、これを理解することが難しい場合は、私はわずか11プログラムしようとしている!あなたがそうあなたがそれをプリントアウトするたびに、それは同じだ、それを最初に設定した後、PILインポートイメージ数式の誤差
print('\x1b[6;30;42m' + 'Zombie Survival Simulator' + '\x1b[0m')
print "Press [S] to start!"
resp = raw_input()
if 's' in resp or 'S' in resp:
foodmission = ['Convience Store','Grocery Store','Restraunt','Food Storage Area']
watermission = ['Convience Store', 'Old Gas Station', 'Water Tower','Toppled Coca-Cola truck.']
survivormission = ['Abandoned Refugee Camp','Bus','Army Camp','Train Station']
"FOOD"
#Pick Area
def pickfoodMission():
foodmis = random.choice(foodmission)
return foodmis
#Chance to get food
def chanceFood():
foodcha = random.randint(1,20)
return foodcha
#How much food you gain a mission
def foodPickup():
foodpick = random.randint(1,2)
return foodpick
"WATER"
#Pick the area
def pickwaterMission():
watermis = random.choice(watermission)
return watermis
#Chance for getting water
def chancewater():
watercha = random.randint(1,20)
return watercha
#Number of water you gain a mission
def waterPickup():
waterpick = random.randint(1,2)
return waterpick
"SURVIVORS"
#Pick the area
def picksurvivorMission():
survivormis = random.choice(survivormission)
return survivormis
#Chance for getting water
def chancehuman():
humancha = random.randint(1,20)
return humancha
#Number of water you gain a mission
def humanPickup():
humanpick = random.randint(1,2)
return humanpick
food = 3
water = 3
human = 5
healthy = 0
con = 0.1
level = 1
game = 1
new = 1
foodcon = 0
watercon = 0
support = 0.1 * human
newhuman = (human + (1 + (human/5)) + healthy)
newwater = (water + (1 + (human/5)) + healthy)
newfood = (water + (1 + (human/5)) + healthy)
while game == 1:
if food <= 0 or water <= 0:
print('\x1b[7;30;41m' + 'You and your friends are dead.' + '\33[3m')
break
if food >= 3 or water >= 3:
healthy = healthy + 1
if food <= 2 or water <= 2:
healthy = healthy - 1
print "Current Resources: Food: " +str(food) + " Day(s) Water: " + str(water) + " Day(s)"
print "Current Survivors " + str(human)
if healthy <= -3 and healthy >= -1:
print "Current Survivors are " + ('\x1b[7;30;41m' + 'Nearly Dead' + '\33[3m')
if healthy == 0:
print "Current survivors " + ('\x1b[7;30;41m' + 'Are not healthy' + '\33[3m')
if healthy >= 1 and healthy <= 3:
print "Current Survivors are " + ('\x1b[7;32;43m' + 'Ok' + '\x1b[0m')
if healthy >= 3 and healthy <= 5:
print "Current Survivors are " + ('\x1b[7;32;43m' + 'Great' + '\x1b[0m')
if healthy >= 5 and healthy <= 7:
print "Current Survivors are " + ('\x1b[7;32;43m' + 'Excellent' + '\x1b[0m')
foodcon = support
watercon = support
food = food - support
water = water - support
print human
print support
print "You are consuming " + str(support) + " food and " + str(support) + " water per day"
if food - support <= 0 or water - support <= 0:
print('\x1b[7;30;41m' + 'You will not survive the next day.' + '\33[3m')
print "[M]issions [B]uilding [H]oard [E]nd Day"
resp = raw_input()
if 'M' in resp or 'm' in resp:
print "[F]ood [W]ater [S]urvivor"
resp = raw_input()
if 'F' in resp or 'f' in resp:
foodmis = pickfoodMission()
print "You go to a " + foodmis
foodcha = chanceFood()
if foodcha >= 14:
foodpick = foodPickup()
food = newfood
img = Image.open('food.png')
img.show()
print('\x1b[7;32;43m' + 'You are now at ' + str(newfood) + ' day(s) of food' + '\x1b[0m')
elif foodcha < 14:
print('\x1b[7;30;41m' + 'You come back empty handed.' + '\x1b[0m')
elif 'w' in resp or 'W' in resp:
watermis = pickwaterMission()
print "You go to a " + watermis
watercha = chancewater()
if watercha >= 14:
waterpick = waterPickup()
water = newwater
img = Image.open('water.png')
img.show()
print('\x1b[7;32;43m' + 'You are now at ' + str(newwater) + ' day(s) of water' + '\x1b[0m')
elif watercha <= 14:
print('\x1b[7;30;41m' + 'You come back empty handed.' + '\x1b[0m')
elif 's' in resp or 'S' in resp:
humanmis = picksurvivorMission()
print "You go to a " + humanmis
humancha = chancehuman()
if humancha >= 14:
humanpick = humanPickup()
human = newhuman
print('\x1b[7;32;43m' + 'You are now at ' + str(human) + ' survivor(s)' + '\x1b[0m')
img = Image.open('cats.jpg')
img.show()
elif humancha <= 14:
print('\x1b[7;30;41m' + 'You come back with no one else new.' + '\x1b[0m')
if 'B' in resp or 'b' in resp:
print "[F]ood"
print str(サポート)+ "food and" + str(サポート)+ "1日当たりの水量" printステートメントは更新されません。 – CatsInSpace