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 
#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;
        else
                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

bot-pokerth

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.