と入力するplay
と、 に乱数が割り当てられnumber1
ます。予測を求められ、5 などの数字を入力します。5 を入力すると、else
ステートメントではなく、常にステートメントが得られif
ます。print()
生成された数を調べるために a も入れました。時々、私は 1 以内か 1 以内です (ゲームでは 1 以内も許容されます) が、それでもelse
ステートメントにリダイレクトされます。誰でも助けてもらえますか?ありがとう。
money = 1000000
def luckyrollgame():
global money
from random import choice
print('You are in the game lobby of Lucky Roll.')
print('Choose either \'rules,\' \'play,\' or \'back\'')
lobby = input()
if lobby == 'rules':
luckyrollgamerules()
if lobby == 'play':
die = [1, 2, 3, 4, 5, 6]
number1 = choice(die)
prediction = input('Please type your prediction number: ')
if prediction == number1:
print('Good job! You guessed right!')
money = money + 3
print('You now have ' + str(dollars) + 'dollars.')
if prediction == number1 - 1:
print('Good job! You guessed right!')
money = money + 3
print('You now have ' + str(dollars) + 'dollars.')
if prediction == number1 + 1:
print('Good job! You guessed right!')
money = money + 3
print('You now have ' + str(dollars) + 'dollars.')
else:
print('I\'m sorry. You didn\'t get the number right.')
print('The number was ' + str(number1) + '.')
money = money - 1
print('You now have ' + str(money) + 'dollars.')
print('--------------------------------------------------')
altluckyrollgame()
if lobby == 'back':
altvillagescene()
else:
print('Please type a valid option.')
print('--------------------------------')
altluckyrollgame()
*altluckyrollgame()
やなどの機能altvillagescene()
はゲーム ロジックの一部であり、別の場所で定義されているため、無視してかまいません。