コード例 #1
0
    def no_test_preflop_state1(self):
        strategy = 'snowie1'

        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/76s.png',
                                   strategy=strategy)
        p = StrategyHandler()
        p.read_strategy(strategy)
        lst = MagicMock()
        t.totalPotValue = 0.5
        t.equity = 0.5
        t.checkButton = False
        d = Decision(t, h, p, lst)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"
        d.__init__(t, h, p, lst)
        d.preflop_table_analyser(t, h, p)
        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Call'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)

        self.assertEqual(t.preflop_sheet_name, '6R4')

        # flop
        t, p, _, h, _ = init_table('tests/screenshots/76ss.png',
                                   strategy=strategy)
        sheet_name = ''
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)

        self.assertEqual('4', sheet_name)
コード例 #2
0
    def no_test_ranges(self):
        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/709250829_PreFlop_0.png')
        d = reverse_init(t, h, p)
        d.preflop_table_analyser(t, h, p)

        self.assertEqual('3R1', t.preflop_sheet_name)

        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Call'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)

        # river round 2
        t, p, _, h, _ = init_table('tests/screenshots/709250829_Flop_0.png')
        sheet_name = ''
        ranges = ''
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)
                ranges = preflop_state.get_rangecards_from_sheetname(
                    abs_pos, sheet_name, t, h, p)

        self.assertEqual('1', sheet_name)
        self.assertEqual(38, len(ranges))
コード例 #3
0
 def no_test3(self):
     t, _, _, h, _ = init_table('tests/screenshots/test3.png')
     t.get_game_number_on_screen(h)
     self.assertEqual(t.mycards, ['3H', 'TS'])
     self.assertEqual(t.checkButton, True)
     self.assertEqual(t.callButton, False)
     self.assertEqual(t.bet_button_found, True)
     self.assertEqual(t.cardsOnTable, ['5C', 'AS', '5H', 'KH', '9S'])
コード例 #4
0
    def no_test_ranges_call_column(self):
        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/KQ2.png')
        reverse_init(t, h, p)
        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Bet'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)
        t, p, _, h, _ = init_table('tests/screenshots/KQ.png')
        sheet_name = ''
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)
                preflop_state.get_rangecards_from_sheetname(
                    abs_pos, sheet_name, t, h, p)

        self.assertEqual('42R5', sheet_name)
        self.assertEqual("Call", preflop_state.range_column_name)
コード例 #5
0
 def no_test1(self):
     t, _, _, h, _ = init_table('tests/screenshots/test1.png')
     t.get_game_number_on_screen(h)
     # self.assertEqual(h.game_number_on_screen, "16543145686")
     self.assertEqual(t.mycards, ['QD', 'QS'])
     self.assertEqual(t.checkButton, True)
     self.assertEqual(t.callButton, False)
     self.assertEqual(t.bet_button_found, True)
     self.assertEqual(t.cardsOnTable, ['KH', '3C', 'TS'])
コード例 #6
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def first_round_98h(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/98h.png', strategy='Snowie3', round_number=0)
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"
        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)

        self.assertEqual(t.preflop_sheet_name, '4R3')
コード例 #7
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def sheet_12R4R6(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/12R4R6.png', round_number=1)
        l = MagicMock()
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"
        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)

        self.assertEqual(t.preflop_sheet_name, '12R4R6')
コード例 #8
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def second_round_with_raiser(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/QQ.png', strategy='Snowie3', round_number=1)
        l = MagicMock()
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"
        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)

        self.assertEqual(t.preflop_sheet_name, '22R6')
コード例 #9
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def incorrect_preflop_table2(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/3Ts.png', strategy='Snowie3')
        l = MagicMock()
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"
        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)

        self.assertEqual(t.preflop_sheet_name, '6R1C2')
コード例 #10
0
    def no_test_incorrect_second_round(self):
        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/3R12.png')
        reverse_init(t, h, p)
        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Bet'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)
        t, p, _, h, _ = init_table('tests/screenshots/3R1.png')
        reverse_sheet_names = []
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)
                preflop_state.get_rangecards_from_sheetname(
                    abs_pos, sheet_name, t, h, p)
                reverse_sheet_names.append(sheet_name)

        self.assertEqual('3R1', reverse_sheet_names[0])
        self.assertEqual('6R1', reverse_sheet_names[1])
        self.assertEqual("Call", preflop_state.range_column_name)
コード例 #11
0
    def no_test_reversetable_88(self):
        strategy = 'Snowie3'
        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/88.png',
                                   strategy=strategy)
        reverse_init(t, h, p)
        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Bet'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)

        # river round 2
        t, p, _, h, _ = init_table('tests/screenshots/88F.png',
                                   strategy=strategy)
        sheet_name = ''
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)

        self.assertEqual('6R1', sheet_name)
コード例 #12
0
    def no_test_preflop_state2(self):
        strategy = 'snowie1'

        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/458770525_PreFlop_0.png',
                                   strategy=strategy)
        reverse_init(t, h, p)
        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Call'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)

        # flop
        t, p, _, h, _ = init_table('tests/screenshots/458770525_Flop_0.png',
                                   strategy=strategy)
        sheet_name = ''
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)

        self.assertEqual('3', sheet_name)
コード例 #13
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def incorrect_preflop_table2(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/3Ts.png', strategy='Snowie3')
        l = MagicMock()
        table.checkButton = False
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "PreFlop"
        d.__init__(table, history, strategy, l)
        d.preflop_table_analyser(table, history, strategy)

        self.assertEqual(table.preflop_sheet_name, '6R1C2')
コード例 #14
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def first_round_98h(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/98h.png', strategy='Snowie3', round_number=0)
        table.checkButton = False
        l = MagicMock()
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "PreFlop"
        d.__init__(table, history, strategy, l)
        d.preflop_table_analyser(table, history, strategy)

        self.assertEqual(table.preflop_sheet_name, '4R3')
コード例 #15
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def sheet_12R4R6(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/12R4R6.png', round_number=1)
        l = MagicMock()
        table.checkButton = False
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "PreFlop"
        d.__init__(table, history, strategy, l)
        d.preflop_table_analyser(table, history, strategy)

        self.assertEqual(table.preflop_sheet_name, '12R4R6')
コード例 #16
0
    def no_test_ranges_2nd_round(self):
        # preflop
        t, p, _, h, _ = init_table('tests/screenshots/709250829_PreFlop_0.png')
        reverse_init(t, h, p)

        self.assertEqual('3R1', t.preflop_sheet_name)

        preflop_state = CurrentHandPreflopState()
        bot_preflop_decision = 'Bet'
        d = MagicMock()
        preflop_state.update_values(t, bot_preflop_decision, h, d)

        # flop after 2nd round preflop
        t, p, _, h, _ = init_table('tests/screenshots/709250829_Flop_0.png')
        sheet_name = ''
        for abs_pos in range(5):
            if t.other_players[abs_pos]['status'] == 1:
                sheet_name = preflop_state.get_reverse_sheetname(abs_pos, t, h)
                preflop_state.get_rangecards_from_sheetname(
                    abs_pos, sheet_name, t, h, p)

        self.assertEqual('12R3', sheet_name)
コード例 #17
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def test_preflop_round2_3(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/897376414_PreFlop_1.png', round_number=1)
        p = StrategyHandler()
        p.read_strategy('Pokemon4')
        l = MagicMock()
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"

        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)
        self.assertEqual(t.first_raiser_utg, 2)
コード例 #18
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def incorrect_preflop_table1(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/K9o.png', strategy='Snowie3')
        l = MagicMock()
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"
        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)

        self.assertEqual(t.first_raiser_utg, 4)
        self.assertEqual(np.isnan(t.second_raiser_utg), True)
        self.assertEqual(t.preflop_sheet_name, '6R5')
コード例 #19
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def incorrect_preflop_table1(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/K9o.png', strategy='Snowie3')
        l = MagicMock()
        table.checkButton = False
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "PreFlop"
        d.__init__(table, history, strategy, l)
        d.preflop_table_analyser(table, history, strategy)

        self.assertEqual(table.first_raiser_utg, 4)
        self.assertEqual(np.isnan(table.second_raiser_utg), True)
        self.assertEqual(table.preflop_sheet_name, '6R5')
コード例 #20
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def no_test_preflop_round2_3(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/897376414_PreFlop_1.png', round_number=1)
        strategy = StrategyHandler()
        strategy.read_strategy('Pokemon4')
        l = MagicMock()
        table.checkButton = False
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "PreFlop"

        d.__init__(table, history, strategy, l)
        d.preflop_table_analyser(table, history, strategy)
        self.assertEqual(table.first_raiser_utg, 2)
コード例 #21
0
 def no_test2(self):
     t, _, _, h, _ = init_table('tests/screenshots/test2.png')
     t.get_game_number_on_screen(h)
     # self.assertEqual(h.game_number_on_screen, "16547195085")
     self.assertEqual(t.mycards, ['3H', 'TS'])
     self.assertEqual(t.checkButton, False)
     self.assertEqual(t.callButton, True)
     self.assertEqual(t.bet_button_found, True)
     self.assertEqual(t.cardsOnTable, [])
     self.assertEqual(t.currentCallValue, 0.05)
     self.assertEqual(t.other_players[0]['pot'], '')
     self.assertEqual(t.other_players[1]['pot'], '')
     self.assertEqual(t.other_players[2]['pot'], 0.10)
     self.assertEqual(t.other_players[3]['pot'], '')
     self.assertEqual(t.other_players[4]['pot'], 0.02)
コード例 #22
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def test_position_adjustment(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/467381034_PreFlop_0.png', strategy='Pokemon4')
        t.gameStage = "PreFlop"
        p = StrategyHandler()
        p.read_strategy('Nickpick12')
        l = MagicMock()
        t.checkButton = True
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "Flop"
        p.selected_strategy['FlopBluffMinEquity'] = 0.3
        p.selected_strategy['FlopBluff'] = "1"
        p.selected_strategy['pre_flop_equity_reduction_by_position'] = 0.02

        d.__init__(t, h, p, l)
        self.assertAlmostEqual(d.preflop_adjustment, 0.1, delta=0.01)
コード例 #23
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def test_preflop_call_before_raise(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/1791526_PreFlop_0.png', round_number=0)
        p = StrategyHandler()
        p.read_strategy('Pokemon4')
        l = MagicMock()
        t.checkButton = False
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "PreFlop"

        d.__init__(t, h, p, l)
        d.preflop_table_analyser(t, logger, h, p)

        self.assertEqual(t.first_raiser, 2)
        self.assertEqual(t.second_raiser, 4)

        self.assertEqual(t.preflop_sheet_name, '6R5C3')
コード例 #24
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def no_test_preflop_call_before_raise(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/1791526_PreFlop_0.png', round_number=0)
        strategy = StrategyHandler()
        strategy.read_strategy('Pokemon4')
        l = MagicMock()
        table.checkButton = False
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "PreFlop"

        d.__init__(table, history, strategy, l)
        d.preflop_table_analyser(table, history, strategy)

        self.assertEqual(table.first_raiser, 2)
        self.assertEqual(table.second_raiser, 4)

        self.assertEqual(table.preflop_sheet_name, '6R5C3')
コード例 #25
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def no_test_position_adjustment(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/467381034_PreFlop_0.png', strategy='Pokemon4')
        table.gameStage = "PreFlop"
        strategy = StrategyHandler()
        strategy.read_strategy('Nickpick12')
        l = MagicMock()
        table.checkButton = True
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "Flop"
        strategy.selected_strategy['FlopBluffMinEquity'] = 0.3
        strategy.selected_strategy['FlopBluff'] = "1"
        strategy.selected_strategy[
            'pre_flop_equity_reduction_by_position'] = 0.02

        d.__init__(table, history, strategy, l)
        self.assertAlmostEqual(d.preflop_adjustment, 0.1, delta=0.01)
コード例 #26
0
ファイル: test_decision.py プロジェクト: rayotropic/Poker
    def test_bluff(self):
        t, p, gui_signals, h, logger = init_table('tests/screenshots/751235173_PreFlop_0.png')
        p = StrategyHandler()
        p.read_strategy('Pokemon')
        l = MagicMock()
        t.totalPotValue = 0.5
        t.equity = 0.7
        t.checkButton = True
        d = Decision(t, h, p, l)
        t.isHeadsUp = True
        t.gameStage = "Flop"
        p.selected_strategy['FlopBluffMinEquity'] = 0.3
        p.selected_strategy['FlopBluff'] = "1"

        d.decision = DecisionTypes.check
        t.playersAhead = 0
        d.bluff(t, p, h)
        self.assertEqual(d.decision, DecisionTypes.bet_bluff)

        d.decision = DecisionTypes.check
        t.playersAhead = 1
        d.bluff(t, p, h)
        self.assertEqual(d.decision, DecisionTypes.check)
コード例 #27
0
ファイル: test_decision.py プロジェクト: yvikentiev/Poker-1
    def no_test_bluff(self):
        table, strategy, _, history, _ = init_table(
            'tests/screenshots/751235173_PreFlop_0.png')
        strategy = StrategyHandler()
        strategy.read_strategy('Pokemon')
        l = MagicMock()
        table.totalPotValue = 0.5
        table.equity = 0.7
        table.checkButton = True
        d = Decision(table, history, strategy, l)
        table.isHeadsUp = True
        table.gameStage = "Flop"
        strategy.selected_strategy['FlopBluffMinEquity'] = 0.3
        strategy.selected_strategy['FlopBluff'] = "1"

        d.decision = DecisionTypes.check
        table.playersAhead = 0
        d.bluff(table, strategy, history)
        self.assertEqual(d.decision, DecisionTypes.bet_bluff)

        d.decision = DecisionTypes.check
        table.playersAhead = 1
        d.bluff(table, strategy, history)
        self.assertEqual(d.decision, DecisionTypes.check)
コード例 #28
0
 def no_test4(self):
     t, _, _, h, _ = init_table('tests/screenshots/test4.png')
     t.get_game_number_on_screen(h)
     self.assertEqual(t.mycards, ['JC', '2C'])