所以,我正在研究一个掷骰子程序模拟器,从浏览网页,以及来自这个论坛上的用户的一些帮助.我能够在大多数情况下完成它.至少,我认为我有正确的游戏逻辑.
它是我上次使用它时运行但是我必须在没有意识到它的情况下改变了一些东西,因为现在while循环正在运行.在该计划中,骰子在没有用户干预的情况下永远滚动.
有人可以看一看,看看代码是否有问题?我已经在这个工作了几个小时,没有在哪里.
我再也不会赌博了!:/
from Dice import PairOfDice
print("Now Let's play with two dice!")
#
def MainDouble():
bdice = PairOfDice()
doubleDiceRoll = ''
global myPoint #declare global variable
input("Press Enter to Roll the Dice once")
while doubleDiceRoll == '': #Roll the dice (both die objects)
bdice.toss()
print ('The first die reads.. ' + str(bdice.getValue1()) + '\n')
print ('The second die reads.. ' + str(bdice.getValue2()) + '\n')
Val = bdice.getTotal()
##Beginning of conditional blocks##
if Val == 7 or Val == …Run Code Online (Sandbox Code Playgroud)