我正在开发一个简单的游戏程序,但在游戏的初始启动时遇到了问题。我设置了三个功能:开始,游戏,结束。问题是,一旦程序创建了函数,它就会终止,因为没有重新启动来再次通过函数。
这是最后一个函数,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.')