1

我已经能够在我的扑克程序中多次复制此错误并尝试了各种不成功的解决方案。这是最新的:

Traceback (most recent call last):
  File "C:\Users\Pangloss\Desktop\tgchanpoker\poker.py", line 1868, in <module>
    if __name__ == '__main__': main()
  File "C:\Users\Pangloss\Desktop\tgchanpoker\poker.py", line 1866, in main
    mainGame = Game(opponent)
  File "C:\Users\Pangloss\Desktop\tgchanpoker\poker.py", line 1443, in __init__
    if randint(1,betCheck+(10-handValue[1]))<5 or gameStage == "bettingStay":
  File "C:\Python27\lib\random.py", line 241, in randint
    return self.randrange(a, b+1)
  File "C:\Python27\lib\random.py", line 217, in randrange
    raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)
ValueError: empty range for randrange() (1,-7, -8)

这是相关的代码:

                    handValue = checkHand(opponent.cards.cards)
                    if gameStage == "betting" or gameStage == "final" or gameStage == "finalresponding":
                        betCheck = 18-handValue[1]-round(betAmount/(setMax/5))+opponent.brashness
                    elif gameStage == "extendedFinal":
                        betCheck = 16-handValue[1]-round(betAmount/(setMax/5))+opponent.brashness-(pot/100)
                    else:
                        betCheck = 16-handValue[1]-round(betAmount/(setMax/5))+opponent.brashness
                    foldCheck = 16-handValue[1]-round(betAmount/(setMax/3))+opponent.brashness+(pot/100)
                    if randint(1,betCheck+(10-handValue[1]))<5 or gameStage == "bettingStay":
4

2 回答 2

0

检查你的价值betCheck+(10-handValue[1])。从回溯来看,它是-8。

于 2013-07-11T04:24:39.643 回答
0

这段代码

randint(1,betCheck+(10-handValue[1]))

给你这个

randrange(1,-7,-8)

这意味着betCheck+(10-handValue[1])给你 -8

该范围根本不会给您任何数字,因为 betCheck+(10-handValue[1])) 是负数并且范围无效

您需要检查设置 betcheck 和 handvalue[1] 的代码,看看为什么它是如此负面

于 2013-07-11T04:26:18.430 回答