Saturday, November 10, 2012 a scrap library for linux

You want to create a bot ? ok, but how can you determine which cards you hold ? how much your opponent has bet ? 
Well ... there is several way to do this:
- reverse engineering of ram memory and find where are stored theses informations ? 
- reverse engineering of network communication ?
Well ... both way are not easy to do, in particulary because network communication are encrypted (maybe by openssl), and they may also encrypt all ram-information ? And not to mention that this method is not portable ! you will have to do this reverse engineering for every poker site !
So using OCR and scrap region we are interested is the best way.

OpenHoldem is a poker plateform and it scrap screen image to find all needed information. So I decided to port scrap files for linux, and I create a library

If you are a macos/BSD user, it's should also work for you.

Thursday, November 8, 2012

How to simulate mouse and keyboard ?


The easiest way to do it is to use SendInput function.
here is a link explaining how to do it, and, trust me, it does work

Be aware that you can be detected as using a bot, that why you should use this function only if you are playing on site where botting is not forbidden

The problem is the poker software can use GetAsyncKeyState function to check if the button was pressed, and unfortunately SendInput cannot trick this function. Maybe there is a workaround to clear this key state ? I don't know, but as long as you are using this kind of api, your program won't behave the same way as human does, and you will still have risk to be detected

OpenHoldem or WinHoldem platform are using bring.exe program which is a close source software, so I don't know how it works, but I suppose that it's using SendInput function. I would not try to use bring.exe with pokerstars without knowing what he is doing.

Create a fake mouse and keyboard driver

This is a good solution if you are using a real computer (not a virtual machine). There is no way to find if a button was pressed by the your bot or by a human, well ... it's not completely true.
The application may check the driver and check build date, checksum. (is it possible that a player have a unknown mouse driver ?)

Create a fake usb mouse and keyboard

I'm not talking about creating your own driver as I does previously, but I'm talking about using usb  communication to simulate a standard usb mouse or a standard usb keyboard.
If you are going this way, note that you can buy a dvi to usb (or vga to usb) adapator. So you will be able to analyse your picture without to have any running application on the computer where you run the poker client.

use vmware or virtualbox api/sdk

If you are using a virtual machine then you should try to use theses solutions as there is no way for the poker client to know if a button is pressed by your hardware or by the virtual machine api
For virtualbox, you can use putMouseEventAbsolute for mouse simulation and putScancode for keyboard simulation


Whatever the chosen solution, you may want to move your mouse and click like human:
- don't click the same pixel, even if the center of the button have more chance to be cicked than pixel in border of the button. (openholdem is using a Gaussian equation)
-  maybe the mouse moement should be as human as possible. (no teleportation, don't follow a mathematical straight line
 - wait some random time before 2 pressed buttons
- etc ...

Tuesday, August 14, 2012

all-in bot sample

updated on 12/08/14: bug fix. thanks to mr "TooMuchCoffee" from pokerai forum.

Here is an easy to understand bot code source: this bot will go all-in with good hands and will fold any other hands
#include "pbot_lib_intf.h"

/* IA strategy of this bot:
   play all in with strong cards, and fold any other cards */

static uint8_t card_color(uint8_t card)
        return card/13;

static uint8_t card_value(uint8_t card)
        return card%13;

/* return 1 if the hand is a good one */
static int is_good_hand(uint8_t cards[2])
        uint8_t c1 = card_value(cards[0]);
        uint8_t c2 = card_value(cards[1]);

        /* pair with at least {8,8} and up to {As,As} */
        if (c1 == c2 && c1 >= 7) {
                return 1;
        /* both cards are at least Jack */
        if (c1 >= 10 && c2 >= 10) {
                return 1;
        return 0;

/* main function called by bot-pokerth */
extern "C" double pb_process_frame(struct pb_frame *frame)
        uint8_t user_chair = frame->userchair;

        /* sanity check */
        if (frame->pbot_version != PBOT_INTF_VERSION) {
                printf("pbot_lib_intf version mismatch %d %d\n"
                   , frame->pbot_version, PBOT_INTF_VERSION);
                return PB_ACT_ERROR;

        if (is_good_hand(frame->players[user_chair].cards))
                return PB_ACT_ALLIN;
                return PB_ACT_FOLD;
For more information, go to bot-pokerth website If you have a bot, and if you want a bot fight, then please, let me know :)

Monday, August 13, 2012


Do you know pokerth ? it's an open source texas holdem poker software, and I'm using it to test my bot.
For that, I have patched pokerth to add the ability to load ia from ".so/.dll" library.
I'm working on linux, but it's easy to update for windows. (dlopen, dlsym have equivalent on windows world).
To build it for windows, you will have to cross-compile it. Follow the official pokerth instruction for that.
I may build windows binaries later.
I will also add some bot code source sample

here is bot-pokerth website
Happy bot-hacking :)

Saturday, August 11, 2012

Pokerbotting: Legal and Moral

Pokerbotting: Legal and Moral, says The Guardian. This is an evidence for me and I still don’t understand why some people are afraid about bot !
It would be much more easier if every bot room allow us to play with our bot, and I’m waiting the day when room will deliver an api to implement our own bot. A bot is not necessary better than human player, he can win or he can lose as any other player. Many bot are predictable,  and will not learn from his previous error, so the only thing you will have to do is to exploit them and win $$$. Of course, some bot will be stronger, but to create a bot with the strong level of a professional human player is very difficult. I never heard of such bot.
Here is the guardian article.