1 回答
TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超2個贊
如果您確實(shí)愿意,您可以添加臨時玩家分?jǐn)?shù)來測試該功能,然后如果您發(fā)現(xiàn)它們有效,則可以再次將其刪除。通常運(yùn)行它就足夠了,但正如你提到的,它會永遠(yuǎn)循環(huán)。我想,這確實(shí)表明它是有效的,但我同意這不是最佳的。
def DiceGame(count, p1, p2):
Count = count
Player1Score = p1
Player2Score = p2
...
然后在文件底部將其稱為DiceGame(5, 1, 1),并在決勝局中將其稱為DiceGame(0, 0, 0)。這將在第一次運(yùn)行時強(qiáng)制平局,并在第二次運(yùn)行時正常運(yùn)行。
if Player1Score == Player2Score:
print ("It is a tie!")
print ("There will be a final tiebreaker.")
Count -= 1
DiceGame(0, 0, 0)
... # code inbetween
# end of file
return score2
DiceGame(5, 1, 1)
添加回答
舉報
