def test_new_deal(self): table = Table() john = Player(name=u'John') phil = Player(name=u'Phil') table.add_player(john, 100) table.add_player(phil, 100) deal = table.new_deal() deal.deal_preflop({ 'John': [Card('Ad'), Card('Kd')], 'Phil': [Card('As'), Card('5c')] }) print "--- GAME BEGINS ---" for name, hand in deal.starting_hands.items(): print name, str(hand) deal.deal_flop([Card('6s'), Card('7s'), Card('Ks')]) deal.deal_turn([Card('Kc')]) deal.deal_river([Card('2s')]) print 'Final board :', deal.board hand1 = deal.get_hand('John') hand2 = deal.get_hand('Phil') print 'John :', hand2, hand2.score print 'Phil :', hand1, hand1.score print "Winner is: %s" % deal.winner.name
def setup_method(self, method): self.table = Table() self.john = Player(name=u'John') self.phil = Player(name=u'Phil') self.table.add_player(self.john, 100) self.table.add_player(self.phil, 100) self.deal = self.table.new_deal()
class DealTestCase(object): def setup_method(self, method): self.table = Table() self.john = Player(name=u'John') self.phil = Player(name=u'Phil') self.table.add_player(self.john, 100) self.table.add_player(self.phil, 100) self.deal = self.table.new_deal()
def test_new_deal(self): table = Table() table.add_player(Player(name=u'Marjo'), 100) table.add_player(Player(name=u'Konsta'), 100) deal = table.new_deal() deal.deal_preflop({ 'Konsta': [Card('Ad'), Card('Kd')], 'Marjo': [Card('As'), Card('5c')] }) print "--- GAME BEGINS ---" for name, hand in deal.starting_hands.items(): print name, str(hand) deal.deal_flop([Card('6s'), Card('7s'), Card('Ks')]) deal.deal_turn([Card('Kc')]) deal.deal_river([Card('2s')]) print 'Final board :', deal.board hand1 = deal.get_hand('Konsta') hand2 = deal.get_hand('Marjo') print 'Marjon käsi :', hand2, hand2.score print 'Konsta käsi :', hand1, hand1.score print "Winner is: %s" % deal.winner.name