class PokerHand: def __init__(self): self.hand = [None, None, None, None, None] def set_card(self, position, card): self.hand[position] = card def eval_hand(self): faces = 13 * [0] suits = 4 * [0] for card in self.hand: face_val = card % 13 suit_val = card / 13 faces[face_val] += 1 suits[suit_val] += 1 if faces.count(4) == 1: return "four of a kind" if faces.count(3) == 1 and faces.count(2) == 1: return "full house" if suits.count(5) == 1: return "flush" x = faces.index(1) == 1 if x <= 8: for i in range(4): x+= x[1] return "straight"
I am trying to get the strings I have returned in the class above into the function below but I keep getting a message that says the class has no instance of the class
def deal_card():
win = GraphWin("Poker", 800, 600)
win.setBackground('green4')
deck = CardDeck()
deck.shuffle()
p1 = PokerHand()
p2 = PokerHand()
x = 100
for i in range(5):
x = x + 100
c = deck.deal_one()
filename = get_card_info(c)
draw_card(filename, x , 100, win)
p1.set_card(i, c)
p1.getText()
This post has been edited by losttoomuch: 06 December 2007 - 05:32 PM

New Topic/Question
Reply




MultiQuote



|