Esempio n. 1
0
def main(options):
    check_and_adjust(options)

    matching.__okErrF = sw.fedList(options.okErrF)
    matching.__utcaBcnDelta = options.utcaBcnDelta
    matching.__utcaPipelineDelta = options.utcaPipelineDelta
    if options.noColor:
        printer.__color = False

    if options.noLoop:
        goCode = 0
    else:
        analyze.setup()
        if options.profile:
            import cProfile
            cProfile.runctx("go(options)", globals(), locals(), sort="time")
            goCode = 0  # FIXME
        else:
            goCode = go(options)

    if options.feds2 and 0 <= options.dump:
        analyze.printChannelSummary(options.outputFile)

    if not options.noPlot:
        graphs.main(options)

    return goCode
Esempio n. 2
0
def main(options):
    check_and_adjust(options)

    matching.__okErrF = sw.fedList(options.okErrF)
    matching.__utcaBcnDelta = options.utcaBcnDelta
    matching.__utcaPipelineDelta = options.utcaPipelineDelta
    if options.noColor:
        printer.__color = False

    if options.noLoop:
        goCode = 0
    else:
        analyze.setup()
        if options.profile:
            import cProfile
            cProfile.runctx("go(options)", globals(), locals(), sort="time")
            goCode = 0  # FIXME
        else:
            goCode = go(options)

    if options.feds2 and 0 <= options.dump:
        analyze.printChannelSummary(options.outputFile)

    if not options.noPlot:
        graphs.main(options)

    return goCode
Esempio n. 3
0
 def test_straight_flush(self):
     """ Can we identify a straight flush? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     expected = [8, 14]
     self.assertEqual(expected, pot.players[0].hand)
Esempio n. 4
0
 def test_straight(self):
     """ Can we identify the highest straight in a hand """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     expected = [4, 14]
     self.assertEqual(expected, pot.players[4].hand)
Esempio n. 5
0
 def test_straight_flush(self):
     """ Can we identify a straight flush? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     expected = [8, 14]
     self.assertEqual(expected, pot.players[0].hand)
Esempio n. 6
0
 def test_straight(self):
     """ Can we identify the highest straight in a hand """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     expected = [4, 14]
     self.assertEqual(expected, pot.players[4].hand)
Esempio n. 7
0
 def test_3_of_a_kind(self):
     """ Can we identify a hand with 3 of a kind in proper format? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     expected = [3, 5, 14, 12]
     self.assertEqual(expected, pot.players[5].hand)
Esempio n. 8
0
 def test_3_of_a_kind(self):
     """ Can we identify a hand with 3 of a kind in proper format? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     expected = [3, 5, 14, 12]
     self.assertEqual(expected, pot.players[5].hand)
Esempio n. 9
0
 def test_full_house(self):
     """ Can we identify a hand with a full house? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     expected = [6, 5, 10]
     self.assertEqual(expected, pot.players[2].hand)
Esempio n. 10
0
 def test_full_house(self):
     """ Can we identify a hand with a full house? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     expected = [6, 5, 10]
     self.assertEqual(expected, pot.players[2].hand)
Esempio n. 11
0
 def test_flush(self):
     """ Can we find a flush in the players' hands """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     expected3 = [5, 12, 11, 10, 4, 3]
     expected8 = [5, 12, 11, 10, 4, 2]
     self.assertEqual(expected3, pot.players[3].hand)
     self.assertEqual(expected8, pot.players[8].hand)
Esempio n. 12
0
 def test_order(self):
     """ Can we order the hands in a proper order, left to right """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     for player in pot.players:
         for i in range(6):
             v1 = player.hole_cards[i].value
             v2 = player.hole_cards[i + 1].value
             self.assertTrue(v2 <= v1)
Esempio n. 13
0
 def test_order(self):
     """ Can we order the hands in a proper order, left to right """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     for player in pot.players:
         for i in range(6):
             v1 = player.hole_cards[i].value
             v2 = player.hole_cards[i + 1].value
             self.assertTrue(v2 <= v1)
Esempio n. 14
0
 def test_flush(self):
     """ Can we find a flush in the players' hands """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     expected3 = [5, 12, 11, 10, 4, 3]
     expected8 = [5, 12, 11, 10, 4, 2]
     self.assertEqual(expected3, pot.players[3].hand)
     self.assertEqual(expected8, pot.players[8].hand)
Esempio n. 15
0
 def test_compare(self):
     """ Can we determine a single winner? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     expected = self.player1
     self.assertEqual(expected, pot.players[-1])
     self.assertTrue(len(pot.players) == 1)
Esempio n. 16
0
 def test_wheel(self):
     """ Can we identify a wheel? """
     pot = analyze.setup(self.table)
     pot.players[4].hole_cards[0].value = 14
     pot.players[4].hole_cards[1].value = 4
     self.table.community_cards[0].value = 3
     self.table.community_cards[1].value = 2
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     expected = [4, 5]
     self.assertEqual(expected, pot.players[4].hand)
Esempio n. 17
0
 def test_flush_returns_card_values(self):
     """ For all none flush hands do we return card
     values instead of card objects """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     for player in pot.players:
         if not player.hand:
             for card in player.hole_cards:
                 self.assertIsInstance(card, int)
Esempio n. 18
0
 def test_award(self):
     """ can we award a single winner the entire pot? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     analyze.award(pot, self.table.sb_amount)
     self.assertTrue(self.player1.stack == 200)
     self.assertTrue(len(pot.players) == 1)
Esempio n. 19
0
 def test_flush_returns_card_values(self):
     """ For all none flush hands do we return card
     values instead of card objects """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     for player in pot.players:
         if not player.hand:
             for card in player.hole_cards:
                 self.assertIsInstance(card, int)
Esempio n. 20
0
 def test_award(self):
     """ can we award a single winner the entire pot? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     analyze.award(pot, self.table.sb_amount)
     self.assertTrue(self.player1.stack == 200)
     self.assertTrue(len(pot.players) == 1)
Esempio n. 21
0
 def test_wheel(self):
     """ Can we identify a wheel? """
     pot = analyze.setup(self.table)
     pot.players[4].hole_cards[0].value = 14
     pot.players[4].hole_cards[1].value = 4
     self.table.community_cards[0].value = 3
     self.table.community_cards[1].value = 2
     analyze.order(pot)
     analyze.convert_to_card_value(pot)
     expected = [4, 5]
     self.assertEqual(expected, pot.players[4].hand)
Esempio n. 22
0
 def test_compare(self):
     """ Can we determine a single winner? """
     pot = analyze.setup(self.table)
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     expected = self.player1
     self.assertEqual(expected, pot.players[-1])
     self.assertTrue(len(pot.players) == 1)
Esempio n. 23
0
 def test_compare_multiple(self):
     """ if there are multiple winners do we return all of them? """
     pot = analyze.setup(self.table)
     pot.players[1].hole_cards[0].value = 14
     pot.players[1].hole_cards[0].suit = 'h'
     pot.players[1].hole_cards[1].value = 13
     pot.players[1].hole_cards[1].suit = 'h'
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     expected = [self.player1, self.player2]
     self.assertEqual(expected, pot.players)
Esempio n. 24
0
 def test_compare_multiple(self):
     """ if there are multiple winners do we return all of them? """
     pot = analyze.setup(self.table)
     pot.players[1].hole_cards[0].value = 14
     pot.players[1].hole_cards[0].suit = 'h'
     pot.players[1].hole_cards[1].value = 13
     pot.players[1].hole_cards[1].suit = 'h'
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     expected = [self.player1, self.player2]
     self.assertEqual(expected, pot.players)
Esempio n. 25
0
 def test_award_multiple(self):
     """ Can we pay out evenly to multiple winners """
     pot = analyze.setup(self.table)
     pot.players[1].hole_cards[0].value = 14
     pot.players[1].hole_cards[0].suit = 'h'
     pot.players[1].hole_cards[1].value = 13
     pot.players[1].hole_cards[1].suit = 'h'
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     analyze.award(pot, self.table.sb_amount)
     expected = [self.player1, self.player2]
     self.assertEqual(expected, pot.players)
Esempio n. 26
0
 def test_award_multiple(self):
     """ Can we pay out evenly to multiple winners """
     pot = analyze.setup(self.table)
     pot.players[1].hole_cards[0].value = 14
     pot.players[1].hole_cards[0].suit = 'h'
     pot.players[1].hole_cards[1].value = 13
     pot.players[1].hole_cards[1].suit = 'h'
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     analyze.award(pot, self.table.sb_amount)
     expected = [self.player1, self.player2]
     self.assertEqual(expected, pot.players)
Esempio n. 27
0
 def test_award_indivisible(self):
     """Can we properly pay pots that don't divide
     evenly?"""
     pot = analyze.setup(self.table)
     pot.amount = 101
     pot.players[1].hole_cards[0].value = 14
     pot.players[1].hole_cards[0].suit = 'h'
     pot.players[1].hole_cards[1].value = 13
     pot.players[1].hole_cards[1].suit = 'h'
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     analyze.award(pot, self.table.sb_amount)
     expected1 = 151
     expected2 = 150
     self.assertEqual(expected1, pot.players[0].stack)
     self.assertEqual(expected2, pot.players[1].stack)
Esempio n. 28
0
 def test_award_indivisible(self):
     """Can we properly pay pots that don't divide
     evenly?"""
     pot = analyze.setup(self.table)
     pot.amount = 101
     pot.players[1].hole_cards[0].value = 14
     pot.players[1].hole_cards[0].suit = 'h'
     pot.players[1].hole_cards[1].value = 13
     pot.players[1].hole_cards[1].suit = 'h'
     analyze.order(pot)
     analyze.flush(pot)
     analyze.convert_to_card_value(pot)
     analyze.matching(pot)
     analyze.compare(pot)
     analyze.award(pot, self.table.sb_amount)
     expected1 = 151
     expected2 = 150
     self.assertEqual(expected1, pot.players[0].stack)
     self.assertEqual(expected2, pot.players[1].stack)
Esempio n. 29
0
 def test_setup(self):
     """ Do we join the hole cards with the community cards? """
     analyze.setup(self.table)
     self.assertEqual(7, len(self.player1.hole_cards))
     self.assertEqual(7, len(self.player2.hole_cards))
Esempio n. 30
0
 def test_setup(self):
     """ Do we join the hole cards with the community cards? """
     analyze.setup(self.table)
     self.assertEqual(7, len(self.player1.hole_cards))
     self.assertEqual(7, len(self.player2.hole_cards))