Ejemplo n.º 1
0
 def test_game_checkFour_method(self):
     game = Game_library.Game()
     game.addPlayers("Joe")
     crd = Card_library.Card('A', '♢')
     game.player_list[0].player_hand.addToHand(crd.card_value,
                                               crd.card_suit)
     crd2 = Card_library.Card('A', '♤')
     game.player_list[0].player_hand.addToHand(crd2.card_value,
                                               crd2.card_suit)
     crd3 = Card_library.Card('2', '♡')
     game.player_list[0].player_hand.addToHand(crd3.card_value,
                                               crd3.card_suit)
     crd4 = Card_library.Card('A', '♧')
     game.player_list[0].player_hand.addToHand(crd4.card_value,
                                               crd4.card_suit)
     crd5 = Card_library.Card('A', '♡')
     game.player_list[0].player_hand.addToHand(crd5.card_value,
                                               crd5.card_suit)
     game.checkFour(game.player_list[0])
     message = "checkFour did not add to books properly."
     self.assertEqual(len(game.player_list[0].books), 1, message)
     message2 = "checkFour did not add the proper card_value to books properly."
     self.assertEqual(game.player_list[0].books, ['A'], message2)
     message3 = "checkFour did not add to score properly."
     self.assertEqual(game.player_list[0].score, 1, message3)
Ejemplo n.º 2
0
 def FillDeck(self):
     for card_suit in CARD_SUITS:
         for card_value in CARD_VALUES:
             card = Card(card_suit, card_value, CARD_SCALE)
             card.position = START_X, BOTTOM_Y
             self.card_list.append(card)
     random.shuffle(self.card_list)
Ejemplo n.º 3
0
 def initializeGameBoard(self):
     card1 = Stack(Card(67, 5))
     card2 = Stack(Card(87, 4))
     card3 = Stack(Card(75, 7))
     card4 = Stack(Card(48, 2))
     cards = [card1, card2, card3, card4]
     self.gameBoard = GameBoard(cards)
Ejemplo n.º 4
0
 def __init__(self, interface):
     self.player = Card()
     self.computer = Card()
     self.pscore = 0    #player's score
     self.cscore = 0    #computer's score
     self.interface = interface
     self.hit = 0      # times of player's hitme
Ejemplo n.º 5
0
    def assembleHandsPlayers(self, hand):
        #street0VPI/vpip already called in Hand
        # sawShowdown is calculated in playersAtStreetX, as that calculation gives us a convenient list of names

        #hand.players = [[seat, name, chips],[seat, name, chips]]
        for player in hand.players:
            self.handsplayers[player[1]]['seatNo'] = player[0]
            self.handsplayers[player[1]]['startCash'] = int(100 * Decimal(player[2]))
            self.handsplayers[player[1]]['sitout'] = False #TODO: implement actual sitout detection
            if hand.gametype["type"]=="tour":
                self.handsplayers[player[1]]['tourneyTypeId']=hand.tourneyTypeId
                self.handsplayers[player[1]]['tourneysPlayersIds'] = hand.tourneysPlayersIds[player[1]]
            else:
                self.handsplayers[player[1]]['tourneysPlayersIds'] = None

        # XXX: enumerate(list, start=x) is python 2.6 syntax; 'start'
        #for i, street in enumerate(hand.actionStreets[2:], start=1):
        for i, street in enumerate(hand.actionStreets[2:]):
            self.seen(self.hand, i+1)

        for i, street in enumerate(hand.actionStreets[1:]):
            self.aggr(self.hand, i)
            self.calls(self.hand, i)
            self.bets(self.hand, i)
            if i>0:
                self.folds(self.hand, i)

        # Winnings is a non-negative value of money collected from the pot, which already includes the
        # rake taken out. hand.collectees is Decimal, database requires cents
        for player in hand.collectees:
            self.handsplayers[player]['winnings'] = int(100 * hand.collectees[player])
            #FIXME: This is pretty dodgy, rake = hand.rake/#collectees
            # You can really only pay rake when you collect money, but
            # different sites calculate rake differently.
            # Should be fine for split-pots, but won't be accurate for multi-way pots
            self.handsplayers[player]['rake'] = int(100* hand.rake)/len(hand.collectees)
            if self.handsplayers[player]['street1Seen'] == True:
                self.handsplayers[player]['wonWhenSeenStreet1'] = 1.0
            if self.handsplayers[player]['sawShowdown'] == True:
                self.handsplayers[player]['wonAtSD'] = 1.0

        for player in hand.pot.committed:
            self.handsplayers[player]['totalProfit'] = int(self.handsplayers[player]['winnings'] - (100*hand.pot.committed[player])- (100*hand.pot.common[player]))

        self.calcCBets(hand)

        for player in hand.players:
            hcs = hand.join_holecards(player[1], asList=True)
            hcs = hcs + [u'0x', u'0x', u'0x', u'0x', u'0x']
            #for i, card in enumerate(hcs[:7], 1): #Python 2.6 syntax
            #    self.handsplayers[player[1]]['card%s' % i] = Card.encodeCard(card)
            for i, card in enumerate(hcs[:7]):
                self.handsplayers[player[1]]['card%s' % (i+1)] = Card.encodeCard(card)
            self.handsplayers[player[1]]['startCards'] = Card.calcStartCards(hand, player[1])

        self.setPositions(hand)
        self.calcCheckCallRaise(hand)
        self.calc34BetStreet0(hand)
        self.calcSteals(hand)
Ejemplo n.º 6
0
 def test_from_str(self):
     exp = PokerHand([
         Card(Rank.Ace, Suit.Club),
         Card(Rank.Queen, Suit.Diamond),
         Card(Rank.Seven, Suit.Heart)
     ])
     hand = PokerHand.from_string('ACQD7H')
     self.assertEqual(exp, hand)
 def testRanks(self):
   """ creates cards of rank 1 through 13 of clubs and
   verifies that the created card's rank is equal to the
   rank it was created with """
   
   for i in range(1,14):
     myCard = Card(i,'c') # create i of clubs
     self.assertEqual(myCard.rank(),i) # verifies that the card's rank is i 
Ejemplo n.º 8
0
 def testHandSorted(self):
     hand = Hand.Hand([Card.Card(Card.Rank.JACK, Card.Suit.SPADES), \
         Card.Card(Card.Rank.ACE, Card.Suit.SPADES), \
         Card.Card(Card.Rank.FIVE, Card.Suit.SPADES), \
         Card.Card(Card.Rank.QUEEN, Card.Suit.SPADES), \
         Card.Card(Card.Rank.FOUR, Card.Suit.SPADES)])
     self.assertTrue(hand.cards[0].rank >= hand.cards[1].rank >=	\
     	hand.cards[2].rank >= hand.cards[3].rank >= hand.cards[4].rank)
  def testSuits(self):
    """ creates cards of rank ...  of c (clubs), d (diamonds),
    h(hearts) and s (spades), and verifies that the created card's suit
    is equal to the suit it was created with (c,d,h,s) """

    for i in 'cdhs':
      myCard = Card(13,i)
      self.assertEqual(myCard.suit(),i)
Ejemplo n.º 10
0
 def test_deck_resets_correct(self):
     deck = Deck_library.Deck()
     deck.reset()
     first_crd = Card_library.Card('A','♧') # test that first card vliue and last card value on the created deck is correct 
     last_crd = Card_library.Card('K', '♤') # and deck is populated correctly
     value_check = [first_crd._card_value, first_crd._card_suit, last_crd._card_value, last_crd._card_suit]
     deck_values = [deck._deck_of_cards[0]._card_value, deck._deck_of_cards[0]._card_suit, deck._deck_of_cards[51]._card_value, deck._deck_of_cards[51]._card_suit]
     self.assertEqual(deck_values, value_check)
Ejemplo n.º 11
0
 def loadCards(self, file_name):
     file = open(file_name, "r")
     for line in file:
         if line[0] != '#':
             #print(line)
             card = Card()
             card.loadFromFile(line)
             self.addCard(card)
Ejemplo n.º 12
0
 def __init__(self):
     self.list_member = []
     self.list_member.append(Card(1, 2))
     self.list_member.append(Card(1, 6))
     self.list_member.append(Card(1, 3))
     self.list_member.append(Card(1, 8))
     self.list_member.append(Card(1, 13))
     self.popped_sum = 0
Ejemplo n.º 13
0
    def naiveMaxAIPlay(self):
        gameState = self.gameState
        validClubs = []
        validDiamonds = []
        validSpades = []
        validHearts = []

        validHand = [validClubs, validDiamonds, validSpades, validHearts]
        for suit in range(0, 4):
            handSuit = self.hand.hand[suit]
            for card in handSuit:
                if gameState.isValidCard(card, self):
                    validHand[suit].append(card)

        #if first, play highest card in a random suit
        if gameState.currentTrick.isUnset():
            # print("Going first!")
            #include hearts if hearts not broken or only has hearts
            if gameState.heartsBroken == True or self.hasOnlyHearts():
                suitRange = 3
            else:
                suitRange = 2
            randomSuit = randint(0, suitRange)
            #return highest card
            # print("Current trick suit is: ", gameState.currentTrick.suit.iden)
            # print("Going first and playing highest card")
            return Hand.highestCard(validHand[randomSuit])
        #if not first:
        else:
            # print("Not going first!")
            trickSuit = gameState.currentTrick.suit.iden
            #if there are cards in the trick suit play highest card in trick suit
            if (len(validHand[trickSuit]) > 0):
                # print("Still cards in trick suit")
                return Hand.highestCard(validHand[trickSuit])
            else:
                # print("No cards in trick suit")

                #play cards by points, followed by rank
                minPoints = sys.maxsize
                minCard = None
                for suit in range(0, 4):
                    for card in validHand[suit]:
                        cardPoints = -card.rank.rank
                        if card.suit == Card.Suit(hearts):
                            cardPoints -= 15  #Greater than rank of all non-point cards
                        if card.suit == Card.Suit(
                                spades) and card.rank == Card.Rank(queen):
                            cardPoints -= 13
                        if cardPoints < minPoints:
                            minPoints = cardPoints
                            minCard = card
                return minCard

        #should never get here
        raise Exception("failed programming")

        return None
Ejemplo n.º 14
0
 def testChooseCard(self):
     self.initializeGameBoard()
     player1 = Player(1)
     player1.cards = [Card(25, 2), Card(54, 5), Card(79, 1), Card(17, 6), Card(20, 3)]
     bestCard = player1.chooseCard(self.gameBoard)
     # Since a Player's strategy can can be altered with a patch, we leave this test out for now
     # until we abstract a strategy
     # self.assertEquals(bestCard, Card(79, 1))
     self.assertEquals(len(player1.cards), 4)
Ejemplo n.º 15
0
    def __init__(self):
        self.window = Tk()
        self.window.title("Dori")
        self.window.geometry("800x600")
        self.window.configure(bg="green")

        self.fontstyle = font.Font(self.window,
                                   size=24,
                                   weight='bold',
                                   family='Consolas')
        self.fontstyle2 = font.Font(self.window,
                                    size=15,
                                    weight='bold',
                                    family='Consolas')
        self.fontstyle3 = font.Font(self.window,
                                    size=11,
                                    weight='bold',
                                    family='Consolas')

        self.sound = Sound()

        # 카드 이미지 + 월 + 조합 + 승패
        self.images = {}
        for i in range(10):
            for j in range(2):
                self.images[str(i + 1) + '.' + str(j + 1)] = PhotoImage(
                    file='resource/doriCards/' + str(i + 1) + '.' +
                    str(j + 1) + '.gif')
        self.images['back'] = PhotoImage(
            file='resource/doriCards/cardback.gif')

        self.dealer = Player("dealer")
        self.players = []
        self.players.append(Player("player1"))
        self.players.append(Player("player2"))
        self.players.append(Player("player3"))
        self.money = 1000

        self.SetupGUI()
        self.Initialize()

        l = []
        l.append(Card(16, isVisible=True))
        l.append(Card(18, isVisible=True))
        l.append(Card(0, isVisible=True))
        l.append(Card(3, isVisible=True))
        l.append(Card(7, isVisible=True))
        combos = self.GetCombos(l)
        print(combos)

        for combo in combos:
            print(self.GetComboString(combo))

        combos.sort(key=lambda x: x['power'], reverse=False)
        print(self.GetComboString(combos[0]))

        self.window.mainloop()
Ejemplo n.º 16
0
    def assembleHands(self, hand):
        self.hands['tableName'] = hand.tablename
        self.hands['siteHandNo'] = hand.handid
        self.hands[
            'gametypeId'] = None  # Leave None, handled later after checking db
        self.hands[
            'sessionId'] = None  # Leave None, added later if caching sessions
        self.hands[
            'gameSessionId'] = None  # Leave None, added later if caching sessions
        self.hands['startTime'] = hand.startTime  # format this!
        self.hands['importTime'] = None
        self.hands['seats'] = self.countPlayers(hand)
        #self.hands['maxSeats']      = hand.maxseats
        self.hands['texture'] = None  # No calculation done for this yet.
        self.hands['tourneyId'] = hand.tourneyId

        # This (i think...) is correct for both stud and flop games, as hand.board['street'] disappears, and
        # those values remain default in stud.
        boardcards = []
        for street in hand.communityStreets:
            boardcards += hand.board[street]
        boardcards += [u'0x', u'0x', u'0x', u'0x', u'0x']
        cards = [Card.encodeCard(c) for c in boardcards[0:5]]
        self.hands['boardcard1'] = cards[0]
        self.hands['boardcard2'] = cards[1]
        self.hands['boardcard3'] = cards[2]
        self.hands['boardcard4'] = cards[3]
        self.hands['boardcard5'] = cards[4]

        self.hands['boards'] = []
        self.hands['runIt'] = False
        for i in range(hand.runItTimes):
            self.hands['runIt'] = True
            boardcards = []
            for street in hand.communityStreets:
                boardId = i + 1
                street_i = street + str(boardId)
                if street_i in hand.board:
                    boardcards += hand.board[street_i]
            boardcards = [u'0x', u'0x', u'0x', u'0x', u'0x'] + boardcards
            cards = [Card.encodeCard(c) for c in boardcards[-5:]]
            self.hands['boards'] += [[boardId] + cards]

        #print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" %  hand.getStreetTotals()
        totals = hand.getStreetTotals()
        totals = [int(100 * i) for i in totals]
        self.hands['street1Pot'] = totals[0]
        self.hands['street2Pot'] = totals[1]
        self.hands['street3Pot'] = totals[2]
        self.hands['street4Pot'] = totals[3]
        self.hands['showdownPot'] = totals[4]

        self.vpip(hand)  # Gives playersVpi (num of players vpip)
        #print "DEBUG: vpip: %s" %(self.hands['playersVpi'])
        self.playersAtStreetX(hand)  # Gives playersAtStreet1..4 and Showdown
        #print "DEBUG: playersAtStreet 1:'%s' 2:'%s' 3:'%s' 4:'%s'" %(self.hands['playersAtStreet1'],self.hands['playersAtStreet2'],self.hands['playersAtStreet3'],self.hands['playersAtStreet4'])
        self.streetXRaises(hand)
Ejemplo n.º 17
0
 def testRankNames(self): 
   """test the names of the rank function 'rankName(...)' """
   RN = ['Two', 'Three', 'Four', 'Five', 'Six',
                 'Seven', 'Eight', 'Nine', 'Ten', 
                 'Jack', 'Queen', 'King', 'Ace']
   s = "c" #testing rank not suit
   for r in range(2,14):
     myCard = Card(r,s)
     self.assertEqual(myCard.rankName(),RN[r-2]) #index of rank - 2 
Ejemplo n.º 18
0
 def afterStay(self):  #딜러의 카드 추가
     while self.dealer.value() < 17:
         self.deckN += 1  # 공개된카드
         test = Card(self.cardDeck[self.deckN])
         self.dealer.addCard(test.getValue(), test.filename())
         self.updateDealerCards(self.dealer.inHand() - 1)
         self.LdealerPts.configure(text=str(self.dealer.value() -
                                            self.dealer.cards[0][0]))
     self.checkWinner()
Ejemplo n.º 19
0
async def removeCardsFromPlayer(session, playersConnected, player):
	print("remove cards for player ", player["player"].name)
	player["cards"] = []
	Card.deleteAllCardsForAPlayer(session, player["player"].playerId)

	cards = Card.getCards(session)
	response = convertToJson({'operation' : 'get', 'table' : 'Cards', 'data' : cards})
	for player in filterOpenedConnectionPlayers(playersConnected):
		 await player['socket'].send(response)
Ejemplo n.º 20
0
 def hitDealer(self, n):
     newCard = Card(self.cardDeck[self.deckN])
     self.deckN += 1
     self.dealer.addCard(newCard)
     p = PhotoImage(file="cards/" + newCard.filename())
     self.LcardsDealer.append(Label(self.window, image=p))
     self.LcardsDealer[self.dealer.inHand() - 1].image = p
     self.LcardsDealer[self.dealer.inHand() - 1].place(x=250 + n * 30, y=150)
     PlaySound('sounds/cardFlip1.wav', SND_FILENAME)
Ejemplo n.º 21
0
def createCard(cardId):
    card = CardById(cardId)
    cardtype = cardType(card)
    _card = Card(id(card), name(card), cardtype, manaCost(card))
    if cardtype == Cardtype.MINION:
        _card._attack = attackValue(card)
        _card._health = healthValue(card)
    if cardtype == Cardtype.HERO:
        _card._health = healthValue(card)
    return _card
Ejemplo n.º 22
0
 def hitPlayer(self, n):
     newCard = Card(self.cardDeck[self.deckN])
     self.deckN += 1
     self.player.addCard(newCard)
     p = PhotoImage(file="cards/" + newCard.filename())
     self.LcardsPlayer.append(Label(self.window, image=p))
     self.LcardsPlayer[self.player.inHand() - 1].image = p
     self.LcardsPlayer[self.player.inHand() - 1].place(x=250 + n * 30, y=350)
     self.LplayerPts.configure(text=str(self.player.value()))
     PlaySound('sounds/cardFlip1.wav', SND_FILENAME)
Ejemplo n.º 23
0
 def hitPlayer(self, n):  #n은 카드의 위치
     #이부분에서 플레이어 포인트가 21 이상일 때 게임오버 먼저 처리#
     self.deckN += 1
     self.cardsphotoimage[self.deckN] = Card(self.cardDeck[self.deckN])
     self.cardsphotoimage[self.deckN] = Card(self.cardDeck[self.deckN])
     self.player.addCard(self.cardsphotoimage[self.deckN].getValue(),
                         self.cardsphotoimage[self.deckN].filename())
     self.updatePlayerCards(self.player.inHand() - 1)
     self.LplayerPts.configure(text=str(self.player.value()))
     PlaySound('Resources/sounds/cardFlip1.wav', SND_FILENAME)
Ejemplo n.º 24
0
 def testClearStack(self):
     self.initializeGameBoard()
     self.gameBoard.stacks[0].addToStack(Card(30, 7))
     self.gameBoard.stacks[0].addToStack(Card(7, 3))
     self.gameBoard.stacks[0].addToStack(Card(66, 2))
     player1 = Player(1)
     self.gameBoard.clearStack(player1, Card(32, 3), 0)
     stackResult = Stack(Card(32, 3))
     self.assertEquals(stackResult, self.gameBoard.stacks[0])
     self.assertEquals(player1.bullPoints, 17)
Ejemplo n.º 25
0
 def setFieldCard(self):
     newCard = Card(self.cardDeck[self.deckN])
     self.deckN += 1
     n = self.deckN - 4
     self.fieldCard.append(newCard)
     p = PhotoImage(file="cards/" + newCard.filename())
     self.LfieldCard.append(Label(self.window, image=p))
     self.LfieldCard[n - 1].image = p
     self.LfieldCard[n - 1].place(x=130 + n * 80, y=200)
     PlaySound('sounds/cardFlip1.wav', SND_FILENAME)
Ejemplo n.º 26
0
 def test_function_count_request_2(self):
     rules = Rules()
     hand = Hand()
     hand += [
         Card(rank=Rank.THREE, suit=Suit.DIAMONDS),
         Card(rank=Rank.THREE, suit=Suit.SPADES)
     ]
     self.assertEqual(
         rules.count_request(hand, Rank.THREE), 2,
         "count request not returning 2 for hand with two rank matches")
Ejemplo n.º 27
0
    def assembleHands(self, hand):
        self.hands['tableName']     = hand.tablename
        self.hands['siteHandNo']    = hand.handid
        self.hands['gametypeId']    = None                    # Leave None, handled later after checking db
        self.hands['sessionId']     = None                    # Leave None, added later if caching sessions
        self.hands['gameSessionId'] = None                    # Leave None, added later if caching sessions
        self.hands['startTime']     = hand.startTime          # format this!
        self.hands['importTime']    = None
        self.hands['seats']         = self.countPlayers(hand) 
        #self.hands['maxSeats']      = hand.maxseats
        self.hands['texture']       = None                    # No calculation done for this yet.
        self.hands['tourneyId']     = hand.tourneyId

        # This (i think...) is correct for both stud and flop games, as hand.board['street'] disappears, and
        # those values remain default in stud.
        boardcards = []
        for street in hand.communityStreets:
            boardcards += hand.board[street]
        boardcards += [u'0x', u'0x', u'0x', u'0x', u'0x']
        cards = [Card.encodeCard(c) for c in boardcards[0:5]]
        self.hands['boardcard1'] = cards[0]
        self.hands['boardcard2'] = cards[1]
        self.hands['boardcard3'] = cards[2]
        self.hands['boardcard4'] = cards[3]
        self.hands['boardcard5'] = cards[4]
        
        self.hands['boards']     = []
        self.hands['runIt']      = False           
        for i in range(hand.runItTimes):
            self.hands['runIt']  = True
            boardcards = []
            for street in hand.communityStreets:
                boardId = i+1
                street_i = street + str(boardId)
                if street_i in hand.board:
                    boardcards += hand.board[street_i]
            boardcards = [u'0x', u'0x', u'0x', u'0x', u'0x'] + boardcards
            cards = [Card.encodeCard(c) for c in boardcards[-5:]]
            self.hands['boards'] += [[boardId] + cards]

        #print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" %  hand.getStreetTotals()
        totals = hand.getStreetTotals()
        totals = [int(100*i) for i in totals]
        self.hands['street1Pot']  = totals[0]
        self.hands['street2Pot']  = totals[1]
        self.hands['street3Pot']  = totals[2]
        self.hands['street4Pot']  = totals[3]
        self.hands['showdownPot'] = totals[4]

        self.vpip(hand) # Gives playersVpi (num of players vpip)
        #print "DEBUG: vpip: %s" %(self.hands['playersVpi'])
        self.playersAtStreetX(hand) # Gives playersAtStreet1..4 and Showdown
        #print "DEBUG: playersAtStreet 1:'%s' 2:'%s' 3:'%s' 4:'%s'" %(self.hands['playersAtStreet1'],self.hands['playersAtStreet2'],self.hands['playersAtStreet3'],self.hands['playersAtStreet4'])
        self.streetXRaises(hand)
Ejemplo n.º 28
0
    def testForPair(self):
        cards = []
        cards.append(Card.Card(1, SuitEnum.Hearts))
        cards.append(Card.Card(3, SuitEnum.Spades))
        cards.append(Card.Card(1, SuitEnum.Hearts))

        target = PokerCalculator.PokerCalculator(cards)
        actual = target.Calculate()

        self.assertTrue(actual.result == PokerResultEnum.Pair,
                        "should be a pair")
Ejemplo n.º 29
0
    def testForThreeOfAKind(self):
        cards = []
        cards.append(Card.Card(7, SuitEnum.Hearts))
        cards.append(Card.Card(7, SuitEnum.Clubs))
        cards.append(Card.Card(7, SuitEnum.Clubs))

        target = PokerCalculator.PokerCalculator(cards)
        actual = target.Calculate()

        self.assertTrue(actual.result == PokerResultEnum.ThreeOfAKind,
                        "should be a Three of a kind")
Ejemplo n.º 30
0
 def test_function_add_card_array_addTest(self):
     hand = Hand()
     card1 = Card(suit=Suit.SPADES, rank=Rank.TEN)
     card2 = Card(suit=Suit.DIAMONDS, rank=Rank.FIVE)
     card3 = Card(suit=Suit.SPADES, rank=Rank.THREE)
     card4 = Card(suit=Suit.DIAMONDS, rank=Rank.KING)
     card5 = Card(suit=Suit.CLUBS, rank=Rank.ACEHIGH)
     new_cards = [card1, card2, card3, card4, card5]
     hand.add_card(new_cards)
     self.assertEqual(hand.card_count, 5,
                      "Add card not properly adding array")
Ejemplo n.º 31
0
class Deck:
    deck = []
    for x in range(52):
        if x <= 12:
            deck.append(Card.Card(x % 13 + 2, 's'))
        elif x <= 25:
            deck.append(Card.Card(x % 13 + 2, 'c'))
        elif x <= 38:
            deck.append(Card.Card(x % 13 + 2, 'h'))
        else:
            deck.append(Card.Card(x % 13 + 2, 'd'))
Ejemplo n.º 32
0
	def __init__(self):
		"""
		Initializes this class and creates a PinochleDeck
		"""
		for i in range(52): #goes through all cards
			if Card(i).rank() < 7: #if the rank is not 9 it passes
				pass
			else:
				self.extend((Card(i),Card(i))) # addeds the 9 or greater card twice to deck
		self.sort() #sorts the deck
		return
Ejemplo n.º 33
0
 def get_hero_cards(self, hero):
     """Formats the hero cards for inclusion in the table."""
     if hero == '':
         return "xxxxxx"
     else:
         # find the hero's seat from the stat_dict
         for stat in self.parent.hud.stat_dict.itervalues():
             if stat['screen_name'] == hero:
                 return Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][0]) +\
                        Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][1]) +\
                        Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][2])
     return "xxxxxx"
Ejemplo n.º 34
0
    def get_hero_cards(self, hero, cards):
        """Formats the hero cards for inclusion in the tree."""
        trans = ('0', 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'T', 'J', 'Q', 'K', 'A')
        if hero == '':
            return "xxxxxx"
        else:
#    find the hero's seat from the stat_dict
            for stat in self.parent.hud.stat_dict.itervalues():
                if stat['screen_name'] == hero:
                    return Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][0]) +\
                           Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][1]) +\
                           Card.valueSuitFromCard(self.parent.hud.cards[stat['seat']][2])
        return "xxxxxx"
Ejemplo n.º 35
0
    def __init__(self):
        """Initialize a deck of 52 pinochle cards."""

        p_deck = []

        for i in range(52):
            # We only want 9's and above i.e. 9, 10, J, Q, K, A
            if i % 13 >= 7:
                # We want two copies of each card, so append twice
                p_deck.append(Card(i))
                p_deck.append(Card(i))

        list.__init__(self, p_deck)
Ejemplo n.º 36
0
def card_renderer_cell_func(tree_column, cell, model, tree_iter, data):
    card_width  = 30
    card_height = 42
    col = data
    coldata = model.get_value(tree_iter, col)
    if coldata == None or coldata == '':
        coldata = "0x"
    coldata = coldata.replace("'","")
    coldata = coldata.replace("[","")
    coldata = coldata.replace("]","")
    coldata = coldata.replace("'","")
    coldata = coldata.replace(",","")
    #print "DEBUG: coldata: %s" % (coldata)
    cards = [Card.encodeCard(c) for c in coldata.split(' ')]
    n_cards = len(cards)

    #print "DEBUG: cards: %s" % cards
    pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, card_width * n_cards, card_height)
    if pixbuf:
        x = 0 # x coord where the next card starts in scratch
        for card in cards:
            if card == None or card ==0:
                card_images[0].copy_area(0, 0, card_width, card_height, pixbuf, x, 0)

            card_images[card].copy_area(0, 0, card_width, card_height, pixbuf, x, 0)
            x = x + card_width
    cell.set_property('pixbuf', pixbuf)
Ejemplo n.º 37
0
 def process_bind_param(self, value, dialect):
     if value is None or isinstance(value, int):
         return value
     elif isinstance(value, basestring) and len(value) == 2:
         return Card.encodeCard(str(value))
     else:
         raise Exception, "Incorrect card value: " + repr(value)
Ejemplo n.º 38
0
    def is_row_in_card_filter(self, row):
        """ Returns true if the cards of the given row are in the card filter """
        #Does work but all cards that should NOT be displayed have to be clicked.
        card_filter = self.filters.getCards() 
        hcs = row[self.colnum['Street0']].split(' ')
        
        if '0x' in hcs:      #if cards are unknown return True
            return True
        
        gt = row[self.colnum['Game']]

        if gt not in ('holdem', 'omahahi', 'omahahilo'): return True
        # Holdem: Compare the real start cards to the selected filter (ie. AhKh = AKs)
        value1 = Card.card_map[hcs[0][0]]
        value2 = Card.card_map[hcs[1][0]]
        idx = Card.twoStartCards(value1, hcs[0][1], value2, hcs[1][1])
        abbr = Card.twoStartCardString(idx)
        return False if card_filter[abbr] == False else True
    def __init__(self, deck):
        """A hand is simply the first five cards in the deck, if there are
        five cards available. If not, return None."""

        
        hand = 5              # Number of cards in a hand (int)
        self._mysuits = [0] * 4     # a list of 4 zeros used for evaluation
        self._myranks = [0] * 13    # a list of 13 zeros used for evaluation

        #checks if there are enough cards in deck for a hand
        if len(deck) >= hand:
            
            #list to contain cards in hand
            self._cards = []

            #for each card in hand
            for cards in range(hand):

                #deal a new card
                newCard = deck.deal()
                self._cards.append(newCard)

                #Get suit and rank for each card in hand
                suit = Card.getSuit(newCard)
                rank = Card.getRank(newCard)

                #increase rank count for evaluation
                rank -= 1
                self._myranks[rank] += 1

                #increase suit count for evaluation
                if suit == "Spades":
                    self._mysuits[0] += 1
                if suit == "Diamonds":
                    self._mysuits[1] += 1
                if suit == "Hearts":
                    self._mysuits[2] += 1
                if suit == "Clubs":
                    self._mysuits[3] += 1               

        else:
            return None
Ejemplo n.º 40
0
    def update_contents(self, container, i):

        if not self.hud.cards.has_key(i): return
        
        cards = self.hud.cards[i]
        # Here we want to know how many cards the given seat showed;
        # board is considered a seat, and has the id 'common'
        # 'cards' on the other hand is a tuple. The format is:
        # (card_num, card_num, ...)
        n_cards = valid_cards(cards)
        if n_cards > 1:
#    scratch is a working pixbuf, used to assemble the image
            scratch = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
                                        has_alpha=True, bits_per_sample=8,
                                        width=int(self.card_width)*n_cards,
                                        height=int(self.card_height))
            x = 0 # x coord where the next card starts in scratch
            for card in cards:
#    concatenate each card image to scratch
                # flop game never(?) has unknown cards.
                # FIXME: if "show one and fold" ever becomes an option,
                # this needs to be changed
                if card == None or card ==0:
                    break

                # This gives us the card symbol again
                (_rank, _suit) = Card.valueSuitFromCard(card)
                _rank = Card.card_map[_rank]
                # We copy the image data. Technically we __could__ use
                # the pixmap directly but it seems there are some subtle
                # races and explicitly creating a new pixbuf seems to
                # work around most of them.
                #
                # We also should not use copy_area() but it is far
                # easier to work with than _render_to_drawable()
                px = self.card_images[_suit][_rank].copy()
                px.copy_area(0, 0,
                        px.get_width(), px.get_height(),
                        scratch, x, 0)
                x += px.get_width()
                
            if container is not None:
                container.seen_cards.set_from_pixbuf(scratch)
                container.resize(1,1)
                container.move(self.positions[i][0] + self.hud.table.x,
                            self.positions[i][1] + self.hud.table.y)   # here is where I move back
                container.show()

            self.displayed = True
            if i != "common":
                id = self.get_id_from_seat(i)
                # sc: had KeyError here with new table so added id != None test as a guess:
                if id is not None:
                    self.m_windows[i].eb.set_tooltip_text(self.hud.stat_dict[id]['screen_name'])
Ejemplo n.º 41
0
    def init_card_images(self, config):
        suits = ('s', 'h', 'd', 'c')
        ranks = (14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2)

        for j in range(0, 13):
            for i in range(0, 4):
                loc = Card.cardFromValueSuit(ranks[j], suits[i])
                card_im = self.deck_inst.card(suits[i], ranks[j])
                #must use copy(), method_instance not usable in global variable
                card_images[loc] = card_im.copy()
        back_im = self.deck_inst.back()
        card_images[0] = back_im.copy()
        return card_images
Ejemplo n.º 42
0
    def get_card_images(self, card_width=30, card_height=42):

        card_images = 53 * [0]
        suits = ('s', 'h', 'd', 'c')
        ranks = (14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2)
        deckimg = self.params['deck']
        try:
            pb = gtk.gdk.pixbuf_new_from_file(self.config.execution_path(deckimg))
        except:
            #FIXME: this can't be right? /usr will not exist on windows
            stockpath = '/usr/share/python-fpdb/' + deckimg
            pb = gtk.gdk.pixbuf_new_from_file(stockpath)
        
        for j in range(0, 13):
            for i in range(0, 4):
                card_images[Card.cardFromValueSuit(ranks[j], suits[i])] = self.cropper(pb, i, j, card_width, card_height)
#    also pick out a card back and store in [0]
        card_images[0] = self.cropper(pb, 2, 13, card_width, card_height)
        return(card_images)
Ejemplo n.º 43
0
    def get_card_images(self):

        card_images = 53 * [0]
        suits = ('s', 'h', 'd', 'c')
        ranks = (14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2)
        deckimg = self.params['deck']
        try:
            pb = gtk.gdk.pixbuf_new_from_file(self.config.execution_path(deckimg))
        except:
            stockpath = '/usr/share/python-fpdb/' + deckimg
            pb = gtk.gdk.pixbuf_new_from_file(stockpath)
        
        for j in range(0, 13):
            for i in range(0, 4):
                card_images[Card.cardFromValueSuit(ranks[j], suits[i])] = self.cropper(pb, i, j)
        temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(),  30,  42)
#    also pick out a card back and store in [0]
        card_images[0] = self.cropper(pb, 2, 13)
        return(card_images)
Ejemplo n.º 44
0
    def update_gui(self, new_hand_id):
        self.clear()
        for c, cards in self.parent.hud.cards.iteritems():
            if c == 'common': continue
            self.grid_contents[(1, c - 1)].set_text(self.get_screen_name(c))
            for i in ((0, cards[0]), (1, cards[1]), (2, cards[2]), (3, cards[3]), 
                      (4, cards[4]), (5, cards[5]), (6, cards[6])):
                if not i[1] == 0:
                    # Pixmaps are stored in dict with rank+suit keys
                    (_rank, _suit) = Card.valueSuitFromCard(i[1])
                    _rank = Card.card_map[_rank]
                    px = self.card_images[_suit][_rank].copy()
                    self.seen_cards[(i[0], c - 1)].set_from_pixbuf(px)
##    action in tool tips for 3rd street cards
        for c in (0, 1, 2):
            for r in range(0, self.rows):
                #self.eb[(c, r)].set_tooltip_text(self.tips[0])
                pass

#    action in tools tips for later streets
        round_to_col = (0, 3, 4, 5, 6)
Ejemplo n.º 45
0
    def assembleHands(self, hand):
        self.hands['tableName']  = hand.tablename
        self.hands['siteHandNo'] = hand.handid
        self.hands['gametypeId'] = None                     # Leave None, handled later after checking db
        self.hands['handStart']  = hand.starttime           # format this!
        self.hands['importTime'] = None
        self.hands['seats']      = self.countPlayers(hand) 
        self.hands['maxSeats']   = hand.maxseats
        self.hands['texture']    = None                     # No calculation done for this yet.

        # This (i think...) is correct for both stud and flop games, as hand.board['street'] disappears, and
        # those values remain default in stud.
        boardcards = []
        for street in hand.communityStreets:
            boardcards += hand.board[street]
        boardcards += [u'0x', u'0x', u'0x', u'0x', u'0x']
        cards = [Card.encodeCard(c) for c in boardcards[0:5]]
        self.hands['boardcard1'] = cards[0]
        self.hands['boardcard2'] = cards[1]
        self.hands['boardcard3'] = cards[2]
        self.hands['boardcard4'] = cards[3]
        self.hands['boardcard5'] = cards[4]

        #print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" %  hand.getStreetTotals()
        totals = hand.getStreetTotals()
        totals = [int(100*i) for i in totals]
        self.hands['street1Pot']  = totals[0]
        self.hands['street2Pot']  = totals[1]
        self.hands['street3Pot']  = totals[2]
        self.hands['street4Pot']  = totals[3]
        self.hands['showdownPot'] = totals[4]

        self.vpip(hand) # Gives playersVpi (num of players vpip)
        #print "DEBUG: vpip: %s" %(self.hands['playersVpi'])
        self.playersAtStreetX(hand) # Gives playersAtStreet1..4 and Showdown
        #print "DEBUG: playersAtStreet 1:'%s' 2:'%s' 3:'%s' 4:'%s'" %(self.hands['playersAtStreet1'],self.hands['playersAtStreet2'],self.hands['playersAtStreet3'],self.hands['playersAtStreet4'])
        self.streetXRaises(hand) # Empty function currently
Ejemplo n.º 46
0
    def update_data(self, new_hand_id, db_connection):
        #this method called once for every hand processed
        # self.hud.stat_dict contains the stats information for this hand

        if not self.active:
            return

        if (debugmode):
            debugfile=open("~Rushdebug.data", "a")
            debugfile.write(new_hand_id+"\n")
            now = datetime.now()
            debugfile.write(now.strftime("%Y%m%d%H%M%S")+ " update_data begins"+ "\n")
            debugfile.write("hero="+str(self.heroid)+"\n")
            #debugfile.write(str(self.hud.stat_dict)+"\n")
            debugfile.write("table="+self.hud.table.name+"\n")
            debugfile.write("players="+str(self.hud.stat_dict.keys())+"\n")
            debugfile.write("db="+str(db_connection)+"\n")

        if self.hud.table.name not in self.rushtables:
            return
        #
        # Grab a list of player id's
        #
        handplayers = self.hud.stat_dict.keys()  

        #
        # build a dictionary of stats text for each player in the hand (excluding the hero)
        # xmlqueuedict contains {playername : stats text}
        #
        xmlqueuedict = {}
        for playerid in handplayers:
            # ignore hero, no notes available for hero at Full Tilt
            if playerid == self.heroid: continue

            playername=unicode(str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'playername')[1]))
            # Use index[3] which is a short description
            n=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'n')[3] + " ")
            vpip=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'vpip')[3] + " ")
            pfr=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'pfr')[3] + " ")
            three_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'three_B')[3] + " ")
            four_B=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'four_B')[3] + " ")            
            cbet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'cbet')[3] + " ")
            
            fbbsteal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_BB_steal')[3] + " ")
            f_3bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_3bet')[3] + " ")
            f_4bet=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'f_4bet')[3] + " ")
                        
            steal=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'steal')[3] + " ")
            ffreq1=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'ffreq1')[3] + " ")
            agg_freq=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'agg_freq')[3] + " ")
            BBper100=str(Stats.do_stat(self.hud.stat_dict, player = playerid, stat = 'BBper100')[3])
            if BBper100[6] == "-": BBper100=BBper100[0:6] + "(" + BBper100[7:] + ")"

            #
            # grab villain known starting hands
            # only those where they VPIP'd, so limp in the BB will not be shown
            # sort by hand strength.  Output will show position too,
            #  so KK.1 is KK from late posn etc.
            # ignore non-rush hands (check against known rushtablenames)
            #  cards decoding is hard-coded for holdem, so that's tuff atm
            # three categories of known hands are shown:
            #    agression preflop hands
            #    non-aggression preflop hands
            #    bigblind called to defend hands
            #
            # This isn't perfect, but it isn't too bad a starting point
            #

            PFcall="PFcall"
            PFaggr="PFaggr"
            PFdefend="PFdefend"

            c = db_connection.get_cursor()
            c.execute(("SELECT handId, position, startCards, street0Aggr, tableName " +
                        "FROM Hands, HandsPlayers " +
                        "WHERE HandsPlayers.handId = Hands.id " +
                        "AND street0VPI " +
                        "AND startCards > 0 " +
                        "AND playerId = %d " +
                        "ORDER BY startCards DESC " +
                        ";")
                         % int(playerid))

            for (qid, qposition, qstartcards, qstreet0Aggr, qtablename) in c.fetchall():
                if (debugmode):
                    debugfile.write("pid, hid, pos, cards, aggr, table player"+
                                    str(playerid)+"/"+str(qid)+"/"+str(qposition)+"/"+
                                    str(qstartcards)+"/"+str(qstreet0Aggr)+"/"+
                                    str(qtablename)+"/"+str(playername)+
                                    "\n")

                humancards = Card.decodeStartHandValue("holdem", qstartcards)
                
                if qtablename not in self.rushtables:
                    pass
                elif qposition == "B" and qstreet0Aggr == False:
                    PFdefend=PFdefend+"/"+humancards
                elif qstreet0Aggr == True:
                    PFaggr=PFaggr+"/"+humancards+"."+qposition
                else:
                    PFcall=PFcall+"/"+humancards+"."+qposition
            c.close

            #
            # build up final text package (top/tail with ~fpdb~ ~ends~
            # for later search/replace by Merge module
            #
            xmlqueuedict[playername] = ("~fpdb~" + "\n" +
                                        n + vpip + pfr + "\n" +
                                        steal + cbet + fbbsteal + ffreq1 + "\n" +
                                        three_B + four_B + f_3bet + f_4bet + "\n" +
                                        agg_freq + BBper100 + "\n" +
                                        PFcall+"\n"+
                                        PFaggr+"\n"+
                                        PFdefend +"\n"+
                                        "~ends~")

        if (debugmode):
            now = datetime.now()
            debugfile.write(now.strftime("%Y%m%d%H%M%S")+" villain data has been processed" + "\n")
            debugfile.write(str(xmlqueuedict)+"\n")

        #
        # delaying processing of xml until now.  Grab current queuefile contents and
        # read each existing NOTE element in turn, if matched to a player in xmlqueuedict
        # update their text in the xml and delete the dictionary item
        # 
        xmlnotefile = minidom.parse(self.queuefile)
        notelist = xmlnotefile.getElementsByTagName('NOTE')
        
        for noteentry in notelist:                              #for each note in turn
            noteplayer = noteentry.getAttribute("PlayerId")     #extract the playername from xml
            if noteplayer in xmlqueuedict:                      # does that player exist in the queue?
                noteentry.setAttribute("Text",xmlqueuedict[noteplayer])
                del xmlqueuedict[noteplayer]                    #remove from list, does not need to be added later on

        #
        #create entries for new players (those remaining in the dictionary)
        #
        if len(xmlqueuedict) > 0:
            playerdata=xmlnotefile.lastChild #move to the PLAYERDATA node (assume last one in the list)
            notesnode=playerdata.childNodes[0] #Find NOTES node 

            for newplayer in xmlqueuedict:
                newentry = xmlnotefile.createElement("NOTE")
                newentry.setAttribute("PlayerId", newplayer)
                newentry.setAttribute("Text", xmlqueuedict[newplayer])
                notesnode.insertBefore(newentry,None)
                newentry = xmlnotefile.createTextNode("\n")
                notesnode.insertBefore(newentry,None)

        if (debugmode):
            now = datetime.now()
            debugfile.write(now.strftime("%Y%m%d%H%M%S")+" xml pre-processing complete"+ "\n")

        #
        # OverWrite existing xml file with updated DOM and cleanup
        #
        updatednotes = open(self.queuefile, 'w')
        xmlnotefile.writexml(updatednotes)
        updatednotes.close()

        xmlnotefile.unlink

        if (debugmode):
            now = datetime.now()
            debugfile.write(now.strftime("%Y%m%d%H%M%S")+" dom written, process finished"+ "\n")
            debugfile.close()
Ejemplo n.º 47
0
	def test_Card3(self):
		#same
		t1 = Card('H',11)
		t2 = Card('H',11)
		t4 = t1.__eq__(t2)
		self.assertEqual(t4,True)
 def testsuitName(self):
     c = Card(1, 'c')
     self.assertEqual(c.suitName(), 'clubs')
Ejemplo n.º 49
0
def starthands(stat_dict, player, handid):
    
    
    #summary of known starting hands+position
    # data volumes could get crazy here,so info is limited to hands
    # in the current HH file only
    
    # this info is NOT read from the cache, so does not obey aggregation
    # parameters for other stats
    
    #display shows 3 categories
    # PFcall - limp or coldcall preflop
    # PFaggr - raise preflop
    # PFdefBB - defended in BB
    
    # hand is shown, followed by position indicator
    # (b=SB/BB. l=Button/cutoff m=previous 3 seats to that, e=remainder)
    
    # due to screen space required for this stat, it should only
    # be used in the popup section i.e.
    # <pu_stat pu_stat_name="starthands"> </pu_stat>
    
    stat_descriptions["starthands"] = _("starting hands at this table") + " (starting hands)"
    PFlimp=" PFlimp:"
    PFaggr=" PFaggr:"
    PFcar=" PFCaRa:"
    PFdefend=" PFdefBB:"
    count_pfl = count_pfa = count_pfc = count_pfd = 2
    
    if handid == -1:
        return ((''),
                (''),
                (''),
                (''),
                (''),
                (''))

    c = Configuration.Config()
    db_connection = Database.Database(c)
    sc = db_connection.get_cursor()

    sc.execute(("SELECT distinct startCards, street0Aggr, street0CalledRaiseDone, " +
    			"case when HandsPlayers.position = 'B' then 'b' " +
                            "when HandsPlayers.position = 'S' then 'b' " +
                            "when HandsPlayers.position = '0' then 'l' " +
                            "when HandsPlayers.position = '1' then 'l' " +
                            "when HandsPlayers.position = '2' then 'm' " +
                            "when HandsPlayers.position = '3' then 'm' " +
                            "when HandsPlayers.position = '4' then 'm' " +
                            "when HandsPlayers.position = '5' then 'e' " +
                            "when HandsPlayers.position = '6' then 'e' " +
                            "when HandsPlayers.position = '7' then 'e' " +
                            "when HandsPlayers.position = '8' then 'e' " +
                            "when HandsPlayers.position = '9' then 'e' " +
                            "else 'X' end " +
                        "FROM Hands, HandsPlayers, Gametypes " +
                        "WHERE HandsPlayers.handId = Hands.id " +
                        " AND Gametypes.id = Hands.gametypeid "+
                        " AND Gametypes.type = " +
                        "   (SELECT Gametypes.type FROM Gametypes, Hands   " +
                        "  WHERE Hands.gametypeid = Gametypes.id and Hands.id = %d) " +
                        " AND Gametypes.Limittype =  " +
                        "   (SELECT Gametypes.limitType FROM Gametypes, Hands  " +
                        " WHERE Hands.gametypeid = Gametypes.id and Hands.id = %d) " +
                        "AND Gametypes.category = 'holdem' " +
                        "AND fileId = (SELECT fileId FROM Hands " +
                        " WHERE Hands.id = %d) " +
                        "AND HandsPlayers.playerId = %d " +
                        "AND street0VPI " +
                        "AND startCards > 0 " +
                        "ORDER BY startCards DESC " +
                        ";")
                         % (int(handid), int(handid), int(handid), int(player)))

    for (qstartcards, qstreet0Aggr, qstreet0CalledRaiseDone, qposition) in sc.fetchall():
        humancards = Card.decodeStartHandValue("holdem", qstartcards)
                
        if qposition == "B" and qstreet0Aggr == False:
            PFdefend=PFdefend+"/"+humancards
            count_pfd += 1
            if (count_pfd / 8.0 == int(count_pfd / 8.0)):
                PFdefend=PFdefend+"\n"
        elif qstreet0Aggr == True:
            PFaggr=PFaggr+"/"+humancards+"."+qposition
            count_pfa += 1
            if (count_pfa / 8.0 == int(count_pfa / 8.0)):
                PFaggr=PFaggr+"\n"
        elif qstreet0CalledRaiseDone:
            PFcar=PFcar+"/"+humancards+"."+qposition
            count_pfc += 1
            if (count_pfc / 8.0 == int(count_pfc / 8.0)):
                PFcar=PFcar+"\n"
        else:
            PFlimp=PFlimp+"/"+humancards+"."+qposition
            count_pfl += 1
            if (count_pfl / 8.0 == int(count_pfl / 8.0)):
                PFlimp=PFlimp+"\n"
    sc.close()
    
    returnstring = PFlimp + "\n" + PFaggr + "\n" + PFcar + "\n" + PFdefend  #+ "\n" + str(handid)

    return ((returnstring),
            (returnstring),
            (returnstring),
            (returnstring),
            (returnstring),
            (''))
Ejemplo n.º 50
0
 def process_result_value(self, value, dialect):
     return Card.valueSuitFromCard( value )
 def testSuit(self):
     c = Card(1, 'c')
     self.assertEqual(c.suit(), 'c')
    def addGrid(self, vbox, query, flags, playerids, sitenos, limits, type, seats, groups, dates, games):
        counter = 0
        row = 0
        sqlrow = 0
        if not flags:  holecards,grid = False,0
        else:          holecards,grid = flags[0],flags[2]

        tmp = self.sql.query[query]
        tmp = self.refineQuery(tmp, flags, playerids, sitenos, limits, type, seats, groups, dates, games)
        #print "DEBUG: query: %s" % tmp
        self.cursor.execute(tmp)
        result = self.cursor.fetchall()
        colnames = [desc[0].lower() for desc in self.cursor.description]

        # pre-fetch some constant values:
        colshow = colshowsumm
        if groups['posn']:  colshow = colshowposn 
        self.cols_to_show = [x for x in self.columns if x[colshow]]
        hgametypeid_idx = colnames.index('hgametypeid')

        assert len(self.liststore) == grid, "len(self.liststore)="+str(len(self.liststore))+" grid-1="+str(grid)
        self.liststore.append( gtk.ListStore(*([str] * len(self.cols_to_show))) )
        view = gtk.TreeView(model=self.liststore[grid])
        view.set_grid_lines(gtk.TREE_VIEW_GRID_LINES_BOTH)
        #vbox.pack_start(view, expand=False, padding=3)
        vbox.add(view)
        textcell = gtk.CellRendererText()
        textcell50 = gtk.CellRendererText()
        textcell50.set_property('xalign', 0.5)
        numcell = gtk.CellRendererText()
        numcell.set_property('xalign', 1.0)
        assert len(self.listcols) == grid
        self.listcols.append( [] )

        # Create header row   eg column: ("game",     True, "Game",     0.0, "%s")
        for col, column in enumerate(self.cols_to_show):
            if column[colalias] == 'game' and holecards:
                s = [x for x in self.columns if x[colalias] == 'hand'][0][colheading]
            else:
                s = column[colheading]
            self.listcols[grid].append(gtk.TreeViewColumn(s))
            view.append_column(self.listcols[grid][col])
            if column[colformat] == '%s':
                if column[colxalign] == 0.0:
                    self.listcols[grid][col].pack_start(textcell, expand=True)
                    self.listcols[grid][col].add_attribute(textcell, 'text', col)
                    cellrend = textcell
                else:
                    self.listcols[grid][col].pack_start(textcell50, expand=True)
                    self.listcols[grid][col].add_attribute(textcell50, 'text', col)
                    cellrend = textcell50
                self.listcols[grid][col].set_expand(True)
            else:
                self.listcols[grid][col].pack_start(numcell, expand=True)
                self.listcols[grid][col].add_attribute(numcell, 'text', col)
                self.listcols[grid][col].set_expand(True)
                cellrend = numcell
                #self.listcols[grid][col].set_alignment(column[colxalign]) # no effect?
            self.listcols[grid][col].set_clickable(True)
            self.listcols[grid][col].connect("clicked", self.sortcols, (col,grid))
            if col == 0:
                self.listcols[grid][col].set_sort_order(gtk.SORT_DESCENDING)
                self.listcols[grid][col].set_sort_indicator(True)
            if column[coltype] == 'cash':
                self.listcols[grid][col].set_cell_data_func(numcell, self.ledger_style_render_func)
            else:
                self.listcols[grid][col].set_cell_data_func(cellrend, self.reset_style_render_func)

        rows = len(result) # +1 for title row

        while sqlrow < rows:
            treerow = []
            for col,column in enumerate(self.cols_to_show):
                if column[colalias] in colnames:
                    value = result[sqlrow][colnames.index(column[colalias])]
                    if column[colalias] == 'plposition':
                        if value == 'B':
                            value = 'BB'
                        elif value == 'S':
                            value = 'SB'
                        elif value == '0':
                            value = 'Btn'
                else:
                    if column[colalias] == 'game':
                        if holecards:
                            value = Card.decodeStartHandValue(result[sqlrow][colnames.index('category')], result[sqlrow][hgametypeid_idx] )
                        else:
                            minbb = result[sqlrow][colnames.index('minbigblind')]
                            maxbb = result[sqlrow][colnames.index('maxbigblind')]
                            value = result[sqlrow][colnames.index('limittype')] + ' ' \
                                    + result[sqlrow][colnames.index('category')].title() + ' ' \
                                    + result[sqlrow][colnames.index('name')] + ' $'
                            if 100 * int(minbb/100.0) != minbb:
                                value += '%.2f' % (minbb/100.0)
                            else:
                                value += '%.0f' % (minbb/100.0)
                            if minbb != maxbb:
                                if 100 * int(maxbb/100.0) != maxbb:
                                    value += ' - $' + '%.2f' % (maxbb/100.0)
                                else:
                                    value += ' - $' + '%.0f' % (maxbb/100.0)
                    else:
                        continue
                if value and value != -999:
                    treerow.append(column[colformat] % value)
                else:
                    treerow.append(' ')
            iter = self.liststore[grid].append(treerow)
            #print treerow
            sqlrow += 1
            row += 1
        tips = DemoTips(column[colformat])
        tips.add_view(view)     

        vbox.show_all()
        view.show()
        if len(self.liststore) == 1:
            #print "view hieght is ", view.get_allocation().height, view.size_request(), view.get_visible_rect().height, view.get_vadjustment().get_value()
            self.top_pane_height = view.size_request()[1]
Ejemplo n.º 53
0
#!/usr/bin/env python2.7

from Card import *

card = Card('31790')
card.print_card()
Ejemplo n.º 54
0
class App:
    def __init__(self, interface):
        self.player = Card()
        self.computer = Card()
        self.pscore = 0    #player's score
        self.cscore = 0    #computer's score
        self.interface = interface
        self.hit = 0      # times of player's hitme

    def run(self):
        #start game
        if self.interface.wantToPlay():
            self.player.start()
            self.computer.start()
            self.interface.setPlayerScore(self.pscore)
            self.interface.setComputerScore(self.cscore)
            self.interface.computergetCards()
            self.interface.playergetCards("%s.gif"%(self.player.showcard(1)),"%s.gif"%(self.player.showcard(2)))
            winsound.PlaySound("deal.wav",winsound.SND_FILENAME)
            self.interface.setMessage("Do you want more card?")

        else:
            self.interface.close()

    def Hit1(self):
        # Offer first hitme
        if self.interface.wantToHit():
            self.hit += 1
            self.player.get1Card()
            self.interface.Pget1MoreCard("%s.gif"%(self.player.showcard(3)))
            winsound.PlaySound("deal.wav",winsound.SND_FILENAME) 

        else:
            self.ComputerHit()
            
            
            
    def Hit2(self):
        
        if self.interface.wantToHit() and self.hit == 1:
            self.hit += 1
            self.player.get2Card()
            self.interface.Pget2MoreCard("%s.gif"%(self.player.showcard(4)))
            winsound.PlaySound("deal.wav",winsound.SND_FILENAME)
            self.ComputerHit()

        else:
            self.ComputerHit()
        

        
    def result(self):
        #show the winner and loser
        winsound.PlaySound("untap.wav",winsound.SND_FILENAME)
        if self.player.score() <= 21 and self.computer.score()<=21:
            if self.player.score() - self.computer.score() == 0:
               self.interface.setMessage("Well, it's a Tie")
               self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         
               winsound.PlaySound("laugh.wav",winsound.SND_FILENAME)
               self.pscore += 1
               self.cscore += 1
            elif self.player.score() - self.computer.score() > 0:
                self.interface.setMessage("Yeah, You win")
                self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         
                winsound.PlaySound("applause.wav",winsound.SND_FILENAME)
                self.pscore += 3
                self.cscore += 0
            else:
                self.interface.setMessage("Oops, You lose")
                self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         
                winsound.PlaySound("cryout.wav",winsound.SND_FILENAME)
                self.pscore += 0
                self.cscore += 3
        elif self.player.score() > 21:
            self.interface.setMessage("Oops, You lose")
            self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         
            winsound.PlaySound("cryout.wav",winsound.SND_FILENAME)
            self.pscore += 0
            self.cscore += 3
        elif self.computer.score() >21:
            self.interface.setMessage("Yeah, You win")
            self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         
            winsound.PlaySound("applause.wav",winsound.SND_FILENAME)
            self.pscore += 3
            self.cscore += 0
        elif self.player.score() > 21 and self.computer.score() >21:
            self.interface.setMessage("Well, it's a Tie")
            self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         
            winsound.PlaySound("laugh.wav",winsound.SND_FILENAME)
            self.pscore += 1
            self.cscore += 1
        self.interface.setPlayerScore(self.pscore)
        self.interface.setComputerScore(self.cscore)
        #self.interface.ShowResult("%s.gif"%(self.computer.showcard(1)),"%s.gif"%(self.computer.showcard(2)),"%s.gif"%(self.computer.showcard(3)),"%s.gif"%(self.computer.showcard(4)))         

    def ComputerHit(self):
        # #This is the step that simulate the computer thinking # #
        if 1000*random.random() < 1000*self.computer.score()/21.00:
            self.computer.get1Card()
            self.interface.Cget1MoreCard()
            winsound.PlaySound("deal.wav",winsound.SND_FILENAME)

    def allclear(self):
        #clear the table
        self.player.cardclear()
        self.computer.cardclear()
        self.hit = 0
        self.interface.ClearField()
        self.interface.setMessage("Click Deal to Restart or Click Quit to exit...")

    def quit(self):
        if self.interface.wantToQuit():
            return True
        else:
            return False
Ejemplo n.º 55
0
import Card
import CurrentScreen
import EnumsCards

# 0: Player, 1: KI
numberOf = []
startPlayer = 0
numberOf.append(int(input("How many players? ")))
numberOf.append(int(input("How many computers? ")))
# direction 1: clockwise, -1: counter-clockwise
pointsOfPlayers = Card.initPointsOfPlayers(numberOf[0] + numberOf[1])
# drawCards[1] 0=> + Cards not drawn, 1=> are drawn
drawCards = [0, 0]
names = Card.getNames(numberOf[0])
names.extend(Card.getKINames(numberOf[1]))
while(Card.someHasEnoughtPoints(pointsOfPlayers) == -1):
    cardStack = Card.initStackOfCards()
    Card.shuffleDeckofCards(cardStack)
    handsOfCards = []
    for player in range((numberOf[0] + numberOf[1])):
        handsOfCards.append(Card.initHand(cardStack))
    direction = 1
    otherColor = -1
    lastCard = Card.drawCard(cardStack)
    whichPlayer = startPlayer % (numberOf[0]+numberOf[1])
    startPlayer += 1
    if lastCard.getValue() == "draw2":
        if lastCard.backInDeck == 1:
            drawCards[0] = 0
        else:
            drawCards[0] += 2
Ejemplo n.º 56
0
    def area_expose(self, area, event):
        self.style = self.area.get_style()
        self.gc = self.style.fg_gc[gtk.STATE_NORMAL]

        if self.tableImage is None or self.playerBackdrop is None:
            try:
                self.playerBackdrop = gtk.gdk.pixbuf_new_from_file(os.path.join(self.conf.graphics_path, u"playerbackdrop.png"))
                self.tableImage = gtk.gdk.pixbuf_new_from_file(os.path.join(self.conf.graphics_path, u"Table.png"))
                self.area.set_size_request(self.tableImage.get_width(), self.tableImage.get_height())
            except:
                return
        if self.cardImages is None:
            self.cardwidth = CARD_WIDTH
            self.cardheight = CARD_HEIGHT
            self.cardImages = [gtk.gdk.Pixmap(self.area.window, self.cardwidth, self.cardheight) for i in range(53)]
            suits = ('s', 'h', 'd', 'c')
            ranks = (14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2)
            for j in range(0, 13):
                for i in range(0, 4):
                    index = Card.cardFromValueSuit(ranks[j], suits[i])
                    image = self.deck_inst.card(suits[i], ranks[j])
                    self.cardImages[index].draw_pixbuf(self.gc, image, 0, 0, 0, 0, -1, -1)
            back_im = self.deck_inst.back()
            self.cardImages[0].draw_pixbuf(self.gc, back_im, 0, 0, 0, 0, -1,-1)

        self.area.window.draw_pixbuf(self.gc, self.tableImage, 0, 0, 0, 0)

        if len(self.states) == 0:
            return

        state = self.states[int(self.state.get_value())]

        padding = 6
        communityLeft = int(self.tableImage.get_width() / 2 - 2.5 * self.cardwidth - 2 * padding)
        communityTop = int(self.tableImage.get_height() / 2 - 1.5 * self.cardheight)

        cm = self.gc.get_colormap() #create colormap toi be able to play with colours

        color = cm.alloc_color("white") #defaults to black
        self.gc.set_foreground(color)

        convertx = lambda x: int(x * self.tableImage.get_width() * 0.8) + self.tableImage.get_width() / 2
        converty = lambda y: int(y * self.tableImage.get_height() * 0.6) + self.tableImage.get_height() / 2

        for player in state.players.values():
            playerx = convertx(player.x)
            playery = converty(player.y)
            self.area.window.draw_pixbuf(self.gc, self.playerBackdrop, 0, 0, playerx - self.playerBackdrop.get_width() / 2, playery - padding / 2)
            if player.action=="folds":
                color = cm.alloc_color("grey") #player has folded => greyed out
                self.gc.set_foreground(color)
            else:
                color = cm.alloc_color("white") #player is live
                self.gc.set_foreground(color)
                if state.gametype == 'holdem':
                    cardIndex = Card.encodeCard(player.holecards[0:2])
                    self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, playerx - self.cardwidth - padding / 2, playery - self.cardheight, -1, -1)
                    cardIndex = Card.encodeCard(player.holecards[3:5])
                    self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, playerx + padding / 2, playery - self.cardheight, -1, -1)
                elif state.gametype in ('omahahi', 'omahahilo'):
                    cardIndex = Card.encodeCard(player.holecards[0:2])
                    self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, playerx - 2 * self.cardwidth - 3 * padding / 2, playery - self.cardheight, -1, -1)
                    cardIndex = Card.encodeCard(player.holecards[3:5])
                    self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, playerx - self.cardwidth - padding / 2, playery - self.cardheight, -1, -1)
                    cardIndex = Card.encodeCard(player.holecards[6:8])
                    self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, playerx + padding / 2, playery - self.cardheight, -1, -1)
                    cardIndex = Card.encodeCard(player.holecards[9:11])
                    self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, playerx + self.cardwidth + 3 * padding / 2, playery - self.cardheight, -1, -1)

            color_string = '#FFFFFF'
            background_color = ''
            self.pangolayout.set_markup('<span foreground="%s" size="medium">%s %s%.2f</span>' % (color_string, player.name, self.currency, player.stack))
            self.area.window.draw_layout(self.gc, playerx - self.pangolayout.get_pixel_size()[0] / 2, playery, self.pangolayout)

            if player.justacted:
                color_string = '#FF0000'
                background_color = 'background="#000000" '
                self.pangolayout.set_markup('<span foreground="%s" size="medium">%s</span>' % (color_string, player.action))
                self.area.window.draw_layout(self.gc, playerx - self.pangolayout.get_pixel_size()[0] / 2, playery + self.pangolayout.get_pixel_size()[1], self.pangolayout)
            else:
                color_string = '#FFFF00'
                background_color = ''
            if player.chips != 0:  #displays amount
                self.pangolayout.set_markup('<span foreground="%s" %s weight="heavy" size="large">%s%.2f</span>' % (color_string, background_color, self.currency, player.chips))
                self.area.window.draw_layout(self.gc, convertx(player.x * .65) - self.pangolayout.get_pixel_size()[0] / 2, converty(player.y * 0.65), self.pangolayout)

        color_string = '#FFFFFF'

        self.pangolayout.set_markup('<span foreground="%s" size="large">%s%.2f</span>' % (color_string, self.currency, state.pot)) #displays pot
        self.area.window.draw_layout(self.gc,self.tableImage.get_width() / 2 - self.pangolayout.get_pixel_size()[0] / 2, self.tableImage.get_height() / 2, self.pangolayout)

        if state.showFlop:
            cardIndex = Card.encodeCard(state.flop[0])
            self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, communityLeft, communityTop, -1, -1)
            cardIndex = Card.encodeCard(state.flop[1])
            self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, communityLeft + self.cardwidth + padding, communityTop, -1, -1)
            cardIndex = Card.encodeCard(state.flop[2])
            self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, communityLeft + 2 * (self.cardwidth + padding), communityTop, -1, -1)
        if state.showTurn:
            cardIndex = Card.encodeCard(state.turn[0])
            self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, communityLeft + 3 * (self.cardwidth + padding), communityTop, -1, -1)
        if state.showRiver:
            cardIndex = Card.encodeCard(state.river[0])
            self.area.window.draw_drawable(self.gc, self.cardImages[cardIndex], 0, 0, communityLeft + 4 * (self.cardwidth + padding), communityTop, -1, -1)

        color = cm.alloc_color("black")      #we don't want to draw the filters and others in red
        self.gc.set_foreground(color)
Ejemplo n.º 57
0
def add_card(item_id,tmp):
  card = Card(item_id, db)
  if not card.name == '':
    card.save_card()
  working_list.remove(item_id)
Ejemplo n.º 58
0
    #print "load cards in ",f
    try :
        d = pickle.load( open(f, "rb" ))
    except :
        print "#### ERROR with ",f
    all_cards.update(d)

all_deks={}
for f in glob.glob("Decks/*.dek"):    
    #print "load cards in ",f
    d = pickle.load( open(f, "r" ))
    all_deks.update(d)

#print "all_cards = ",all_cards
#print "all_deks = ",all_deks
blocked_decks = Card.get_blocked_decks()
get_blocked_decks = Card. get_blocked_decks
#all_cards = pickle.load( open( "all_monsters.sav", "rb" ))
#all_decks=pickle.load( open( "all_decks.sav", "rb" ))

from PIL import Image, ImageTk


class DeckCreator():
    def __init__(self,fenetre):
        
        self.galeries = []
        
        self.all_cards_open = getCards("CardFiles/unknown_monsters.sav")
        self.refreshCardSelector(fenetre)
        
Ejemplo n.º 59
0
    def old_insert_from_Hand(self, db):
        """ Function to insert Hand into database
Should not commit, and do minimal selects. Callers may want to cache commits
db: a connected Database object"""
        # TODO:
        # Players - base playerid and siteid tuple
        sqlids = db.getSqlPlayerIDs([p[1] for p in self.players], self.siteId)

        #Gametypes
        gtid = db.getGameTypeId(self.siteId, self.gametype)

        # HudCache data to come from DerivedStats class
        # HandsActions - all actions for all players for all streets - self.actions
        # Hands - Summary information of hand indexed by handId - gameinfo
        #This should be moved to prepInsert
        hh = {}
        hh['siteHandNo'] =  self.handid
        hh['handStart'] = self.starttime
        hh['gameTypeId'] = gtid
        # seats TINYINT NOT NULL,
        hh['tableName'] = self.tablename
        hh['maxSeats'] = self.maxseats
        hh['seats'] = len(sqlids)
        # Flop turn and river may all be empty - add (likely) too many elements and trim with range
        boardcards = self.board['FLOP'] + self.board['TURN'] + self.board['RIVER'] + [u'0x', u'0x', u'0x', u'0x', u'0x']
        cards = [Card.encodeCard(c) for c in boardcards[0:5]]
        hh['boardcard1'] = cards[0]
        hh['boardcard2'] = cards[1]
        hh['boardcard3'] = cards[2]
        hh['boardcard4'] = cards[3]
        hh['boardcard5'] = cards[4]

             # texture smallint,
             # playersVpi SMALLINT NOT NULL,         /* num of players vpi */
                # Needs to be recorded
             # playersAtStreet1 SMALLINT NOT NULL,   /* num of players seeing flop/street4 */
                # Needs to be recorded
             # playersAtStreet2 SMALLINT NOT NULL,
                # Needs to be recorded
             # playersAtStreet3 SMALLINT NOT NULL,
                # Needs to be recorded
             # playersAtStreet4 SMALLINT NOT NULL,
                # Needs to be recorded
             # playersAtShowdown SMALLINT NOT NULL,
                # Needs to be recorded
             # street0Raises TINYINT NOT NULL, /* num small bets paid to see flop/street4, including blind */
                # Needs to be recorded
             # street1Raises TINYINT NOT NULL, /* num small bets paid to see turn/street5 */
                # Needs to be recorded
             # street2Raises TINYINT NOT NULL, /* num big bets paid to see river/street6 */
                # Needs to be recorded
             # street3Raises TINYINT NOT NULL, /* num big bets paid to see sd/street7 */
                # Needs to be recorded
             # street4Raises TINYINT NOT NULL, /* num big bets paid to see showdown */
                # Needs to be recorded

        #print "DEBUG: self.getStreetTotals = (%s, %s, %s, %s, %s)" %  self.getStreetTotals()
        #FIXME: Pot size still in decimal, needs to be converted to cents
        (hh['street1Pot'], hh['street2Pot'], hh['street3Pot'], hh['street4Pot'], hh['showdownPot']) = self.getStreetTotals()

             # comment TEXT,
             # commentTs DATETIME
        #print hh
        handid = db.storeHand(hh)
        # HandsPlayers - ? ... Do we fix winnings?
        # Tourneys ?
        # TourneysPlayers

        pass
Ejemplo n.º 60
0
	def test_Card2(self):
		#Make sure that __eq__ that checks if cards are teh same, works
		t1 = Card('H',10)
		t2 = Card('H',11)
		t4 = t1.__eq__(t2)
		self.assertEqual(t4,False)