from Card import Card
class Hand(object):
def __init__(self):
self.cards=[]
def takeCards(self, cards):
self.cards.append(card)
pass
def clear(self):
self.card=[]
pass
def getTotal(self):
for card in slef.cards:
if card.value >21 and card ==11:
return 1
elif not card.value:
return None
else:
total+=card.value
pass
def isBusted(self):
if getTotal>21:
return True
def __str__(self):
if self.__cards:
card = ""
for i in self.__cards:
card += str(i) + "\t"
else:
card = "Empty"
return card + "\t(value " + str(self.getTotal())+")"
from Hand import Hand
class Dealer():
def __init__(self,name):
super(Dealer,self).__init__()
self.name = name
pass
def takeCards(self,cards):
self.__hand.takeCards(cards)
pass
def clearHand(self):
self.Hand.clear(card)
pass
我正在写一个关于二十一点的游戏,但我有一些无法修复的错误......我有两个班级。当我测试我的代码时,程序说,经销商对象没有属性“手”。在明确的手的定义。我不知道如何解决这个问题。