예제 #1
0
 def test_premature_hand_end(self):
     evaluator = PokerEval()
     cards1 = ["ac", "ah"]
     pockets = [cards1]
     board = []
     result = evaluator.winners(game="holdem", pockets=pockets, board=board)
     self.assertEquals(1, len(result["hi"]))
     self.assertEquals(0, result["hi"][0])
예제 #2
0
 def test_board_plays(self):
     evaluator = PokerEval()
     cards1 = ["ac", "kh"]
     cards2 = ["as", "qd"]
     cards3 = ["2h", "5d"]
     pockets = [cards1, cards2, cards3]
     board = ["7s", "7d", "7c", "ts", "tc"]
     result = evaluator.winners(game="holdem", pockets=pockets, board=board)
     self.assertEquals(3, len(result["hi"]))
예제 #3
0
 def test_single_winner(self):
     evaluator = PokerEval()
     cards1 = ["ac", "ah"]
     cards2 = ["kc", "kd"]
     cards3 = ["2h", "5d"]
     pockets = [cards1, cards2, cards3]
     board = ["as", "ks", "2d", "2s", "5c"]
     result = evaluator.winners(game="holdem", pockets=pockets, board=board)
     self.assertEquals(1, len(result["hi"]))
     self.assertEquals(0, result["hi"][0])
예제 #4
0
def test_one(test_type, num_players):
    deck = make_deck()

    if test_type == 'rounder':
        from rounder.evaluator import PokerEval
    else:
        from pokereval import PokerEval

    evaluator= PokerEval()
    total = 0
    start_time = time.time()
    while True:
        board, pockets = get_random_setup(list(deck), num_players)

        winners = evaluator.winners(game="holdem",
                pockets=pockets, board=board)['hi']

        total += 1
        timed_progress(start_time, total)