私は簡単なゲーム プログラムに取り組んでいますが、ゲームの最初の起動に問題があります。Start、game、end の 3 つの関数を設定しました。問題は、プログラムが関数を作成すると、関数を再度通過するための再起動がないため、プログラムが終了することです。
最後の関数 gameEnd は次のとおりです。
def gameEnd ( ):
print ('Would you like to play again? Y/N.')
playAgain = '' **part of the problem is here; the computer reads playAgain as **
input (playAgain) **''. Because playAgain is not equal to Y or y, the program **
if playAgain == 'Y' or 'y': **exits without ever starting. I need to move **
gameCore **playAgain somewhere logical.**
else:
print ('You won Caves of Doom, Caves of Delight ' + wins + ' times.')
print ('You lost Caves of Doom, Caves of Delight ' + losses + ' times.')
if wins > losses:
print ('Good for you. You have a winning record!')
elif wins == losses:
print ('Well, you did okay; neither good nor bad.')
elif wins < losses:
print ('Tough luck. You have a losing record.')
time.sleep (1)
print ('Farewell, ' + name + ',' + ' and may we meet again sometime soon.')