예제 #1
0
def test_ocr_ps1():
    mongo = MongoManager()
    table_dict = mongo.get_table("Official Poker Stars")
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(
        os.path.join(get_dir('tests', 'screenshots'),
                     'ps473830744_Flop_1.png'))
    table_scraper.crop_from_top_left_corner()

    result = ocr(table_scraper.screenshot, 'total_pot_area',
                 table_scraper.table_dict)
    assert result == 0.29

    result = ocr(table_scraper.screenshot, 'call_value',
                 table_scraper.table_dict)
    assert result == 0.04

    result = ocr(table_scraper.screenshot, 'raise_value',
                 table_scraper.table_dict)
    assert result == 0.08

    result = ocr(table_scraper.screenshot,
                 'player_funds_area',
                 table_scraper.table_dict,
                 player='0')
    assert result == 1.67
예제 #2
0
def test_ocr_pp1():
    mongo = MongoManager()
    table_dict = mongo.get_table("Official Party Poker")
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(
        os.path.join(get_dir('tests', 'screenshots'),
                     '53269218_PreFlop_0.png'))
    table_scraper.crop_from_top_left_corner()

    result = ocr(table_scraper.screenshot, 'total_pot_area',
                 table_scraper.table_dict)
    assert result == 0.08

    result = ocr(table_scraper.screenshot, 'call_value',
                 table_scraper.table_dict)
    assert result == 0.03

    result = ocr(table_scraper.screenshot, 'raise_value',
                 table_scraper.table_dict)
    assert result == 0.08

    result = ocr(table_scraper.screenshot,
                 'player_funds_area',
                 table_scraper.table_dict,
                 player='0')
    assert result == 1.98
예제 #3
0
def test_ocr_pp1():
    mongo = MongoManager()
    table_dict = mongo.get_table(
        "PartyPoker 6 Players Fast Forward $1-$2 NL Hold'em")
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(
        os.path.join(get_dir('tests', 'screenshots'),
                     '173280759_PreFlop_0.png'))
    table_scraper.crop_from_top_left_corner()

    result = ocr(table_scraper.screenshot, 'total_pot_area',
                 table_scraper.table_dict)
    assert result == 0.09

    result = ocr(table_scraper.screenshot, 'call_value',
                 table_scraper.table_dict)
    assert result == 0.04

    result = ocr(table_scraper.screenshot, 'raise_value',
                 table_scraper.table_dict)
    assert result == 0.1

    result = ocr(table_scraper.screenshot,
                 'player_funds_area',
                 table_scraper.table_dict,
                 player='0')
    assert result == 1.32
예제 #4
0
    def test_all(self):
        """Test table button"""
        self.table_name = self.ui.table_name.currentText()
        from poker.scraper.table_scraper import TableScraper
        table_dict = mongo.get_table(table_name=self.table_name)

        table_scraper = TableScraper(table_dict)
        table_scraper.nn_model = None

        if 'use_neural_network' in table_dict and table_dict['use_neural_network'] == '2':
            from tensorflow.keras.models import model_from_json
            table_scraper.nn_model = model_from_json(table_dict['_model'])
            mongo.load_table_nn_weights(self.table_name)
            table_scraper.nn_model.load_weights(get_dir('codebase') + '/loaded_model.h5')

        table_scraper.screenshot = self.original_screenshot
        table_scraper.crop_from_top_left_corner()
        table_scraper.is_my_turn()
        table_scraper.lost_everything()
        table_scraper.get_my_cards2()
        table_scraper.get_table_cards2()
        table_scraper.get_dealer_position2()
        table_scraper.get_players_in_game()
        table_scraper.get_pots()
        table_scraper.get_players_funds()
        table_scraper.get_player_pots()
        table_scraper.get_call_value()
        table_scraper.get_raise_value()
        table_scraper.has_all_in_call_button()
        table_scraper.has_call_button()
        table_scraper.has_raise_button()
        table_scraper.has_bet_button()
        log.info("Test finished.")
예제 #5
0
def test_table_scraper():
    mongo = MongoManager()
    table_dict = mongo.get_table("PartyPoker Old")
    table_scraper = TableScraper(table_dict)
    table_scraper.screenshot = Image.open(
        os.path.join(get_dir('tests', 'screenshots'),
                     '53269218_PreFlop_0.png'))
    table_scraper.crop_from_top_left_corner()
    table_scraper.is_my_turn()
    table_scraper.lost_everything()
    table_scraper.get_my_cards2()
    table_scraper.get_table_cards2()
    table_scraper.get_dealer_position2()
    table_scraper.get_players_in_game()
    table_scraper.get_pots()
    table_scraper.get_players_funds()
    table_scraper.get_call_value()
    table_scraper.get_raise_value()
    table_scraper.has_all_in_call_button()
    table_scraper.has_call_button()
    table_scraper.has_raise_button()
예제 #6
0
 def test_all(self):
     """Test table button"""
     self.table_name = self.ui.table_name.currentText()
     from poker.scraper.table_scraper import TableScraper
     table_dict = mongo.get_table(table_name=self.table_name)
     table_scraper = TableScraper(table_dict)
     table_scraper.screenshot = self.original_screenshot
     table_scraper.crop_from_top_left_corner()
     table_scraper.is_my_turn()
     table_scraper.lost_everything()
     table_scraper.get_my_cards2()
     table_scraper.get_table_cards2()
     table_scraper.get_dealer_position2()
     table_scraper.get_players_in_game()
     table_scraper.get_pots()
     table_scraper.get_players_funds()
     table_scraper.get_call_value()
     table_scraper.get_raise_value()
     table_scraper.has_all_in_call_button()
     table_scraper.has_call_button()
     table_scraper.has_raise_button()