How I Built a Working Poker Bot, Part 1
Friday, May 09, 2008   

Introduction

Several years ago, a client asked me to come up with a prototype for a real-money online poker bot. That's right: a piece of software you park on your computer while it goes out to a site like PokerStars or Full Tilt and plays no-limit Holdem for you, at 4 or 14 different tables, for real-money stakes.

If you're a poker player, and particularly if you're an online poker player, you've probably heard rumors about the rise of the poker bots. Unfortunately there's very little hard information out there (for obvious reasons) about how to build one of these bots. In fact, many so-called authorities still dismiss poker bots as a relic of the overactive poker player's imagination.

Well, I'm here to tell you that online poker bots are 100% real, and I know this because I've built one. And if I can build one, well. Anybody can build one. What's more, over the course of this multi-part article, I'll show you how. But first, a teaser (click on the image for a larger version):

Functional poker bot, playing 3 tables

That, ladies and gents, is a picture of a full-featured poker bot managing three play-money tables (note: this same bot also handles real-money tables) at an honest-to-goodness, real-money online poker site. Of course, it could be any site. The bot implementation I'm going to reveal will work at all major online poker sites, including Poker Stars, Full Tilt, Party Poker, Ultimate Bet, and most other major venues.

Why are you giving this information out?

I debated for a long time whether or not to make this information public, as I'm a poker player myself and have no desire to see the game ruined by an avalanche of poker bots. It's not that building a poker bot is some sort of black magic, known only to the privileged few. Any competent programmer can build one. But this information hasn't, so far as I know, been collected and presented in one place, certainly not as a "How To" complete with sample code. So the question I struggled with was this: is it irresponsible to publicize this information, such that every Internet script kiddie out there now has the ammunition he needs to actually build a bot?

After thinking about it, I've decided that keeping the technology of poker bot building secret is like declaring that only criminals can carry handguns. The fact is, there are people in the world right now who are doing this:

Poker bots, underground online poker boiler rooms, and collusion are a reality. That doesn't mean online poker's not worth playing, just that it pays to be educated about what's possible. Furthermore, there should be public discussion regarding what to do about it because one thing's certain: computers and programming languages aren't exactly going to be getting less powerful. The rise of the poker bots is a virtual certainty. I'd like to see the major online poker venues open up their famously vague "bot detection" and "anti-collusion" strategies to public scrutiny, as cryptography and security providers learned to do years ago. The best security algorithms and techniques all have the weight of public review behind them and I don't see how online poker's any different.

But even assuming all that weren't the case:

  • Poker bots already exist on the open market. Do a little creative Internet searching.
  • The poker community suffers from an irrational fear of bots. I'd gladly risk my money against most homegrown bots and trust me: you would too.
  • I believe that bots are actually good for the game of poker. Mike Caro, "the Mad Genius of Poker," expressed a similar idea years ago.
  • Any programmer worth his salt can build a bot with or without this document. They already have.

If you're visiting this page from 2 + 2 or another poker community, and you want to stay on top of this article (which will be in several parts), you can subscribe to the Coding the Wheel RSS feed or get it in your email inbox as I don't participate in these communities often. For easy digestibility, I'll be organizing these posts using a question and answer format, as there's a lot of highly technical material to cover.

Now, without further ado, let's talk about the basics. If you're not a programmer, fair warning: highly technical, possibly excruciatingly boring material ahead.

Basic poker bot responsibilities

At a very high level, the poker bot is best analyzed according to the classic model of information handling: Input, Processing, Output.

You'll find that your programming tasks decompose rather nicely into these three basic stages.

Input. The input to the system is the poker client software itself, including all its windows, log files, and hand histories, as well as internal (often private) state maintained by the running executable. The goal of the input stage is to interrogate the poker client and produce an accurate model of the table state - your hole cards, names and stack sizes of your opponents, current bets, and so forth.

Processing. The processing stage runs independently of the other two stages. It's job is to take the table model assembled during the Input phase, and figure out whether to fold, check, bet, raise, or call. That's it. The code that performs this analysis should (ideally) know nothing about screen scraping or interrogating other applications. All it knows is how to take an abstract model of a poker table (probably expressed as some sort of PokerTable class) and determine which betting action to make.

Output. Once the processing stage has made a decision, the Output stage takes over. It's tasked with clicking the correct buttons on the screen, or simulating whatever user input is necessary in order to actually make the action occur on a given poker site/client.

How does the bot figure out what its hole cards (and the board cards) are?

This is a broad question which it's better to break down into particulars. First of all, there's a very easy way to detect hole cards via a screen-scraping or "poor-man's OCR" approach. You don't have to be an image-recognition expert. All you have to know is how to get the color of a handful of different pixels on the screen. Or to put it another way, for any given card in the deck, there are a handful of pixels you can test which will uniquely identify that card

That's fairly easy to implement, and requires zero knowledge of OCR, image recognition, graphics processing, etc. But depending on the specific poker site, pulling card rank and suit information might be even easier. On some sites, the hole cards will be emitted into the real-time game summary info: 

Dealing Hole Cards (4h 2c)

Occasionally you'll find that hole cards are emitted into the log file. Poker Stars, for example, conveniently emits this information into its log file, and it does so in real time (meaning you can snoop on it in real time, and in the next installment, I'll show you how):

MSG_TABLE_SUBSCR_ACTION
MSG_TABLE_SUBSCR_DEALPLAYERCARDS
  sit1
  nCards=2
  sit3
  nCards=2
  sit5
  nCards=2
  sit6
  nCards=2
  sit7
  nCards=2
  dealerPos=3
TableAnimation::dealPlayerCards
MSG_TABLE_PLAYERCARDS 00260C82
::: 8s <-- Hole Card 1, Cool!
::: 13c <-- Hole Card 2, Cool!

Last but not least, hole cards are always included in the hand history for a given game:

*** HOLE CARDS ***
Dealt to CodingTheWheel [Qs 9h]
MargeLeb: calls 10
ke4njd: calls 10
diamondlover2nite: calls 10
franklg454: folds
WhoAmINot: calls 5
CodingTheWheel: checks
*** FLOP *** [4h 7c Qd]
WhoAmINot: checks
CodingTheWheel: bets 10

The only problem is that, in many cases, the hand history file isn't emitted until the end of the hand.

How should the poker bot be structured, as a single EXE, a bunch of DLLs, what?

You will need:

  • An executable file (.EXE) to display the bot's UI, and to contain the processing logic (the stuff that knows how to play poker).
  • A dynamic link library (.DLL) to handle the Input (screen scraping) and Output (clicking buttons) processing. You'll inject this DLL into the poker client's process so that your code is effectively running as part of PokerStars, or FullTilt, or whatever site you're using. This will make your life a lot easier both when it comes to collecting data as well as doing things like simulating genuine user input.

Those two pieces are essential. Other than that, you're free to structure things however you want. I'll have more to say on this as we get into the nitty-gritty details of the implementation.

How do I inject my code into the poker client process?

There are a number of well-documented techniques for injecting your code - for example, a DLL you've written - into another application's address space. The method I used, and the method I'm going to recommend you use, is by installing what's known as a Windows Hook and specifically a CBT Hook. The relevant Windows API is SetWindowsHookEx, and here's the actual source code. If you're familiar with C++ and the Windows API, it should be straightforward:

///////////////////////////////////////////////////////////////////////////////
// This is the CBT hook procedure. The HCBT_CREATEWND notification generally
// doesn't give us any useful information about the window because WM_CREATE
// hasn't been called for the window yet.  So instead we don't consider the
// window as created until it's gotten it's first WM_ACTIVATE (note: this is
// how it works on Poker Stars, the behavior may need to be changed for other sites)
///////////////////////////////////////////////////////////////////////////////
LRESULT CALLBACK PokerBotCBTProc(int nCode, WPARAM wParam, LPARAM lParam)
{
   if (nCode < 0)
   {
      return CallNextHookEx(g_hHook, nCode, wParam, lParam);
   }
   else if (theInjector.getVenue() != Venue_Unknown) // ignore this bit of code for now..
   {
      // Since we can't use DllMain, perform initialization the first time the hook is called.
      if (g_bFirstTime)
      {
         theInjector.inject();
         bFirstTime = false;
      }

      // These are the only notifications we're interested in passing on.
      if (nCode == HCBT_ACTIVATE)
         return (LRESULT) theInjector.HandleIt(Hook_Activate, (HWND)wParam);
      else if (nCode == HCBT_CREATEWND)
         return (LRESULT) theInjector.HandleIt(Hook_Create, (HWND)wParam);
      else if (nCode == HCBT_DESTROYWND)
         return theInjector.HandleIt(Hook_Destroy, (HWND)wParam);
   }

   // Return 0 to allow window creation/destruction/activation to proceed as normal.
   return 0;
}

///////////////////////////////////////////////////////////////////////////////
// Publically exported hook installation function. The bot will call this on
// startup in order to inject this DLL (the DLL that contains this function)
// into the address space of every process, including every poker client process,
// on the machine.
///////////////////////////////////////////////////////////////////////////////
bool OPCHOOK_API InstallHooks()
{
   // Actually install the hook...
   g_hHook = SetWindowsHookEx(WH_CBT, (HOOKPROC) AutoCBTProc, hInstance, 0);
   return g_hHook != NULL;
}

The above source code would live in a DLL: the DLL you plan on injecting into the poker client's address space. This DLL will also contain whatever code you write to handle the "input" (screen-scraping) and "output" (button-clicking) stages of the bot.

An even better way is to use a two-stage injection process. The problem with global CBT hooks (or any other kind of global hook for that matter) is that they cause the hook DLL to be loaded into the address space of every process on the machine. If your hook DLL is very fat (for example, if it contains a bunch of code to do screen scraping and so forth) this can impact system performance as your DLL will get mapped into processes you care nothing about, like Notepad.exe.

So to get around that, make the hook DLL - the DLL that gets loaded into every process - as lightweight as possible. Then, whenever the hook DLL detects that it's been loaded by a poker client process, such as POKERSTARS.EXE, have it explicitly load another DLL (again, written by you) containing the bulk of the bot I/O processing code. This in fact is the purpose of the theInjector object in the above code sample - it figures out if the DLL is being mapped into a poker client process and, if so, uses LoadLibrary to load the actual DLL that knows how to do things like screen-scraping and so forth.

A picture might help to clarify: 

Here, INJECT.DLL would be a lightweight DLL, written by you, which contains the CBT Hook procedure and installation code I showed you above. POKERBOT.DLL is the fat, messy DLL, also written by you, that contains the poker bot's screen-scraping logic.

Do things this way, and the drag on the system shouldn't even be noticeable, other than a brief load period when you first install the hook. This method is a lot easier than most other methods of DLL injection, and more importantly, it's supported across all the major Windows operating systems.

How do I retrieve the game summary text from the poker table window?

Almost every online poker client displays a small window in which game summary text is displayed: 

Poker table summary text

Now, depending on which poker client you're using, this window may or may not be a standard Windows edit box or rich text control.

If it is a standard Windows control, you can get the handle (HWND) to the window, and then get its text via the GetWindowText API. Furthermore, you can do this even if the window you're interrogating is owned by another process.

But what you'll find is that many poker clients don't use "normal" Windows controls. They may write their own custom display controls, or they may subclass a standard Windows control and cause WM_GETTEXT to return an empty string.

In that case you have at least three options, none of them trivial:

  • You can investigate the control at the binary level. No matter how customized the control, somewhere in memory it's maintaining a string or a list of string which contains the game summary text. Since your code will be running inside the poker client's process, you're free to do whatever you want to do - investigate different areas of memory, subclass the control, etc.
  • You can use API hooking to hook the core Windows APIs that every control uses to display text: DrawText, ExtTextOut, etc.
  • You can use full-fledged OCR to analyze the text window and return the text. But this is probably overkill, especially since text tends to run through the summary window rapidly.

When building the bot, I went with the second approach: API Hooking. Once you know how to hook a particular Windows API, so that whenever POKERSTARS.EXE thinks it's calling DrawText, it's actually calling your custom version of DrawText, which snoops on the text before passing the call on to the original DrawText, it's a simple matter to examine the output coordinates to determine, aha: this text is being written to the summary window; this text is being written to the title bar; etc.

This is a deep enough topic that I'll roll it into its own installment along with specific code examples.

Hook a Windows API? Instrumentation? What does that mean?

Every Windows application in the world has to call into the Windows API to get things done: open files, create windows, display text, etc. Even language-specific libraries such as the C run time library or the C++ standard library internally will use the OS-provided facilities to work with things like files, memory, and so forth.

API hooking or "instrumentation" is the process of intercepting the function calls that an application (any application) makes, and redirecting them to a custom function defined by you. Specifically, you're going to intercept some of the calls that the poker application makes to the Windows API...

  • DrawText
  • ExtTextOut
  • WriteFile
  • etc

...and redirect these calls to a custom "interceptor" function, written by you. Your code thus gets a chance to examine the parameters of the call (which could be a string containing the player's name, for example) and do any other work you desire. When your "preprocessing" is done, you'll pass control back to the original API the poker application thought it was calling in the first place so that everything works transparently.

This technique can be used to extract all manner of useful internal information from any application, not just online poker clients. The best part is: you no longer have to write custom assembler code to achieve this. Instead you'll use a third-party library, and one of the best is a little-known Microsoft Research Project, Detours. Download it. Learn it. Love it. Learning how to accomplish API instrumentation means that ultimately, there's nothing the poker client can really hide from you - but that doesn't mean you'll be able to snoop around and figure out your opponent's hole cards. Don't even try. Unless the implementors have been sloppy, that information won't exist anywhere on your machine until your opponents have actually flipped their hole cards over.

And yes, if there's sufficient interest I'll put together a dedicated post with sample code showing exactly how to instrument a poker application.

Generally speaking, how do I go about harvesting data from an online poker game?

We've covered a few of the specifics so far, and we'll cover many, many more in future installments. But specific techniques aside, getting information from the poker client is an exercise in detective work. First of all, be aware of just how much information is available:

  • Visual Table State. Everything a human player sees when playing online poker: his hole cards; the names, stack sizes, and betting actions of all players at the table; the position of the button; and so forth..
  • Summary Text. Each table usually displays a text summary area which captures various betting actions, the beginning and end of new hands, etc.
  • Action Buttons. These are the buttons the user clicks in order to Fold, Raise, Call, etc. Note that we can use the presence or absence of various action buttons to infer table state.
  • Log File. Many poker clients output a log file which may contain helpful information.
  • Hand Histories. Most poker clients output a formal "hand history file" which contains a complete description of a single hand of poker.
  • Internal Stuff. Internally, most poker client makes standard calls to the C run-time library, the C++ standard library, and the Windows API. You can eavesdrop on these calls through a process known as API "hooking" or instrumentation. Additionally, poker clients, like all software, use memory to store things. Things like player names, cards, and betting actions.
  • And more. Stuff I may not know about, or may have chosen not to mention.

The bot's job is simply to eavesdrop on that information, and analyze it to produce an accurate model of the table's state at any given point in time. So any technique now or in the future which allows you to do that is potentially a technique you'll want to leverage in the bot. Later, I'll suggest an architecture whereby a number of different interrogators can be used to query poker tables in a simple, extensible, and above all tweakable way.

How do I create a bot that's intelligent enough to play winning poker?

That's the million-dollar question. I could tell you that the folks over at the University of Alberta's Computer Poker Research Group have made impressive headway towards producing a winning poker bot. I could tell you that extensible rules-based systems like the one I implemented for my bot...

...are a lot more powerful than you think. I could tell you a lot of things, and we'll investigate how to leverage some of the poker bot frameworks that are already out there, and how to combine those with your own custom rulesets. But understand one thing: you don't have to create a winning poker bot in order to make money with a poker bot. All you have to do is create a bot that's capable of breaking even.

If you can create a bot that breaks even - neither wins nor loses money - rakeback deals and specific programs like the Poker Stars Supernove Elite will ensure that you get a fairly hefty payday per bot account. I mean many tens of thousands of dollars per year, per account. And nothing except the logistical nightmare of it all restricts you to a single bot account; why not have ten; or a hundred?

And indeed, unbeknownst to the rest of the world, somewhere, someone probably does. But not me, and not you; and that's a disparity in basic firepower I'd like to see remedied, since none of the online poker sites have really stepped up to the plate and either a) made bots legal (similar to the way that they're legal on Internet Chess Club) or b) put effective prevention measures in place.

What skills will I need to write a bot?

Well, you'll want to be well-versed in the nuances of C++ and the Windows API, at a minimum.

In addition to that, you'll either need to be familiar with, or get familiar with, an assortment of Windows development topics that reads like a chapter out of Richter (whose books I highly recommend purchasing and studying if you plan on implementing a bot yourself).

  • Windowing & GDI
  • Windows Hooks
  • Kernel objects
  • DLL Injection (in general: the injecting of code into other processes)
  • API Instrumentation (via Detours or similar libraries)
  • Inter-process Communication (IPC)
  • Multithreading & synchronization
  • Simulating user input
  • Regular expressions (probably through Boost)
  • Spy++

While it would probably be possible to build a bot using C#, VB.NET, or any other language, you'll find that some of the powers you'll need are only available through specific Windows APIs, and getting access to these APIs from a managed language is a little clunky. Another reason you'll want to use native C++ is that you'll need to sneek some of your code into the client poker process, and it's a lot cleaner to inject a small DLL than it is to inject all the machinery necessary to get managed code to run inside another (native) process.

Conclusion 

This post has only scratched the surface of building a full-fledged poker bot. Hopefully it's given you food for thought and possibly whetted your appetite for the mountain of details left to be discussed. Assuming there's sufficient interest, I'll be posting a series of installments, each describing at a detailed level how to accomplish one specific poker bot task. If you found this document through a link on 2 + 2 or one of the other poker forums, you can subscribe to this site in a reader or get it in your email inbox, as I rarely post (or reply) on the poker forums these days.


Posted by James Devlin   127 comment(s)

SEARCH

COMMENTS

You know I once thought about rolling one of these myself. Couldn't quite get past some of the technical issues (didn't have the time to invest) and I'm horrible at poker though I like it-- still. Would've been fun.

Keith J. on 5/9/2008 4:05:03 PM (110 days ago)

WOW

cisco on 5/9/2008 4:08:12 PM (110 days ago)

This was an amazing read.

Mariano on 5/9/2008 4:27:43 PM (110 days ago)

Does that image actually say Fold for AA?

Andrew on 5/9/2008 4:36:38 PM (110 days ago)

Anonymous on 5/9/2008 4:45:59 PM (110 days ago)

Interesting, I've got a background in Artificial Intelligence and have done some stuff with genetic algorithms. I always thought it would be interesting (and perhaps lucrative) to build a poker-playing bot by having thousands of them play each-other, "breeding" the best ones, and then having the offspring play each other, and so on. I even did some initial work on this:

locut.us/.../

Are you aware of anyone applying GAs to this task?

Ian Clarke on 5/9/2008 4:53:09 PM (110 days ago)

I think it's a bit ignorant to worry that the "technology" (oh my, rocket science?) behind building a bot player will be out of the hands of a capable programmer, unless you publish this article.

Anonymous on 5/9/2008 5:51:24 PM (110 days ago)

@Ian Clarke:
Marc Cohen wrote an MSc dissertation on evolving poker playing agents. It's available via www.informatics.sussex.ac.uk/.../...heses2002.html

Jon on 5/9/2008 5:58:54 PM (110 days ago)

"cannot believe how little work there is in that... wow"

Being a professional software engineer, I can tell you that is a lot of work for 1 person. Kudos to the author.

Paul on 5/9/2008 6:48:44 PM (110 days ago)

Keep it going. This is fascinating.

Rodey on 5/9/2008 7:01:09 PM (110 days ago)

@Andrew: Good catch! It does indeed. I just whipped up a quick profile by way of example, should probably change that..

@Ian: have you checked out the University of Alberta's work? I believe they have some material on this, though I couldn't find it in the publications list. I DO specifically remember reading a paper on this.

http://poker.cs.ualberta.ca/

I enjoyed your post on Genetic Algorithms by the way- excellent stuff. I wish I had more time to play.

@Anonymous: I stated (a couple times) "Any competent programmer can build one." Probably got lost in the tracts of dense text though. My fault.

@Paul: Yes it's horrible. Countless late nights. A second (or third, fourth, fifth) head would've been helpful, but mostly there's just no real information out there to go on and its not the kind of thing you want to publicize during the fact. Thanks for the kudos.

@All: Thanks for your feedback. next installment will be out on Monday, hopefully in time for coffee.

James Devlin on 5/9/2008 7:21:49 PM (110 days ago)

Heh, I thought about making a poker bot about 2-3 years ago when a friend introduced me to PokerStars, and poker in general. I felt there are so many bad poker players playing online that if I could just tweak a bot to keep taking advantage of good strategies, and set it to play 20 hours a day, I'd be making steady money. That and the fact that I'd always have it sit at tables where it has at least 400x the BB, so the variance won't kill it.

Never got around to it, mainly because I was afraid PokerStars might confiscate the money I deposited and maybe even go after me. Now I wonder, were those fears completely unfounded? Thoughts...

Greg Magarshak on 5/9/2008 7:33:50 PM (110 days ago)

FTA:
but that doesn't mean you'll be able to snoop around and figure out your opponent's hole cards. Don't even try. Unless the implementors have been sloppy, that information won't exist anywhere on your machine until your opponents have actually flipped their hole cards over.

Actually, somebody figured out how to do this by determining what the seed value was for the server's random number generator.

See: http://www.cigital.com/papers/download/developer_gambling.php

Kuhsay on 5/9/2008 7:34:46 PM (110 days ago)

@Kuhsay: Yes! classic exploit. What I wouldn't give to know what I know now, back in the early days of poker. Actually that particular link is now (and this is hilariously funny to me) cited by many poker sites on their security page- right around the place where they talk about the security of their RNG (eg, now that they've stopped using rand())

humor.

James Devlin on 5/9/2008 7:51:27 PM (110 days ago)

James: are you currently running this bot on Poker Stars or any of the major venues?

if so- how's it faring?

Give us some details!!

damn_dreamer on 5/9/2008 8:11:06 PM (110 days ago)

I don't think there's gonna be a way to defeat bots. Every technique that could be used can be worked around so easily and the AI in them will just get better and better. The best thing the poker sites could do is do away with human players altogether and get some bot on bot action going. That would level the playing field and make it much more interesting ("for who?" you might ask, to which I respond, "for me!").

The only way I see around this is if the poker site developers really get a taste for virtual violence. That is, putting nasty instructions in random locations in the address space, while making their programs immune from such malarky. It would be the ultimate struggle.

Anonymous on 5/9/2008 8:23:41 PM (110 days ago)

Is it against the TOS to do the actual playing youself, but have the bot make the decisions for you? What about if you had a friend helping you? What if you had a book of poker strategies you consulted with during the game?

Joel on 5/9/2008 8:44:14 PM (110 days ago)

Awesome article. Great work!

Bryan on 5/9/2008 9:04:28 PM (110 days ago)

Looks like I'm gonna have to go back to learning C++. Any chance of porting this into an Adobe AIR application?

Joe on 5/9/2008 9:23:06 PM (110 days ago)

Rather than writing one with hooks into Windows APIs, I was thinking of using one of those automated GUI-driving QA systems to play. Like Borland Silk.

If the poker sites start implementing countermeasures, an GUI-automater would be more immune.

Anonymous on 5/9/2008 9:33:40 PM (110 days ago)

It is only a matter of time where poker sites allow the battle of the bots. This will be where the best artificial intelligence can beat up other artificial intelligences.

prelox on 5/9/2008 9:41:32 PM (110 days ago)

Shhhhh!

Anonymous on 5/9/2008 9:45:46 PM (110 days ago)

Very nice! Everybody is going to try and build a bot now.

business on 5/9/2008 10:11:47 PM (110 days ago)

Whatup fellow power bot buddy. The way I got data from partypoker was to hook into the WriteFile API by using code from Sysinternal's Filemon program (at one point it was open source) and scraping the (unreadable) hand history files.

I *believe* it was breakeven, but I didn't play it long enough to be sure.

Plus my input back into the program was rather sloppy and unreliable (I'd hijack the mouse and send click messages which doesn't work 100%).

Maybe what I learn from your articles will help me get back into it Smile

Good job though. While writing it, I always figured it was tough enough to make it that there must be very few people out there who could do it (and thus be very few bots).

You've gone one step further and are going to make it easy enough for other people to know how to do it, too.

Well done.

Anonymous on 5/9/2008 10:48:50 PM (110 days ago)

Ack. "power" = "poker"

I was also big into machine learning in college and was trying to come up with something for poker, but I decided a probability/simulation/rules based framework was easiest.

I should get back into it, but that was back in college and I'm a bit short on free time nowadays.

Anonymous on 5/9/2008 10:55:54 PM (110 days ago)

Why not just reverse engineer the network protocol and go from there? Seems easier (and more scalable) than the psuedo-OCR and injection...

Anonymous on 5/9/2008 11:13:09 PM (110 days ago)

ssh dood.

Anonymous on 5/9/2008 11:36:42 PM (110 days ago)

java robots class and log file output is really all you need. no need for special API hooks or anything. much simpler..

Anonymous on 5/9/2008 11:46:16 PM (110 days ago)

Excellent, excellent post.

I thought about rolling one of these myself but on the Mac side of things. I couldn't imagine trying to do this in Windows world … entirely too many hoops to jump through.

I am an avid online poker player and really don't mind bots. Unless they're using top-shelf AI, they'll be predictable to a point. Still, I'd love to play against a few of them to get a feel.

Cool series though, subscribed to the feed and can't wait for the next couple articles on this.

Chris on 5/10/2008 12:12:42 AM (110 days ago)

Can I play your bot HU for real money? please... pretty please

(Yes I play poker on-line for a living, no bots in themselves don't scare me, collusion does but there are anti colluding measures in place, I've been banned from playing with friends before who even though we weren't colluding, they're not perfect but theirs a risk involved, and well you don't need bots to collude I'm more afraid of good human players colluding than bots.)

Rob on 5/10/2008 12:35:50 AM (110 days ago)

A great post. I am looking forward to the future installments. Thanks!

Andy on 5/10/2008 1:38:38 AM (109 days ago)

I am far from a programmer and didn't understand any of that shit. But would it screw a bot up if the site redesigned their cards on a daily basis. I noticed the bot gathers the hole card information by analyzing pixels. If the sites found a way to change how the cards looked on a daily basis or even more frequent basis, would that help prevent bots? Like how brick and mortar casinos change the deck of cards regularly.

Neverheeb on 5/10/2008 5:39:22 AM (109 days ago)

Will someone stake me a few bucks so I can go tanning. Daddy Micon is busto and we are on a budget.

MiconsGirlMartha on 5/10/2008 5:49:11 AM (109 days ago)

Nice article James. Did you ever think that the poker sites may like the bots? Sounds crazy on level one, but as long as they aren't infesting the games or taking tons of money out of circulation, I doubt they care because it's more rake for them.


Looking forward to hearing more from you.

Anonymous on 5/10/2008 6:33:03 AM (109 days ago)

Excellent article, I can’t wait for Monday!

rsk on 5/10/2008 9:21:33 AM (109 days ago)

I just want to say thanks, this is immensely interesting. I can't say i have the desire to build out the same app but it's very cool to understand how it works.... er at least how you have designed it to work.

I'm sure another option could be something like SilkTest that, for those who don't know, is primarily used by QA engineers to do windows GUI testing. I know from experience that silk can easily do screen comparisons etc.

Thanks for the cool read. (Found you via reddit.com)

Zigzo Links on 5/10/2008 10:21:04 AM (109 days ago)

Yep, java robots class is much simpler, and immune to any pokersite intervention; I aggree Smile If things get really hairy, you can for example run the poker client in a virtual machine like VMware and still figure out the table model from OUTSIDE VMware.
And with JavaDB you can save both your learned statistics and the GUI-Model for a website in a safe way.

Steven on 5/10/2008 10:28:47 AM (109 days ago)

I started my bot running in 2005. Here is what I found.

> Interesting, I've got a background in Artificial Intelligence and have done some stuff with
> genetic algorithms. I always thought it would be interesting (and perhaps lucrative) to
> build a poker-playing bot by having thousands of them play each-other, "breeding" the
> best ones, and then having the offspring play each other, and so on. I even did some initial work on this:

Each game is 1 to 3 minutes. This means you are collecting data very slowly. The problem space is fairly large so this would take years. You need to do bot vs bot simulations off of the poker sites in order to get enough evolution generations completed. It also requires manually understanding poker techniques in order to look for tells.

Then run the game on the site and monitor it closely.

Bot Code on 5/10/2008 11:15:19 AM (109 days ago)

Are you blind? Clearly this is a generic advertisement for online poker sites, trying to encourage you to gamble online..

gatzke on 5/10/2008 12:11:42 PM (109 days ago)

It folds for AA because he doesn't want to create a winning bot.

Anonymous on 5/10/2008 1:40:29 PM (109 days ago)

James: I sent you a private message via your contact page- fascinating article, I'd like to discuss this privately with you. Email included in this comment. Drop me a line when you get a chance.

Btw

David on 5/10/2008 3:11:34 PM (109 days ago)

how much money have you made off this poker bot?

LOWLUX on 5/10/2008 9:36:11 PM (109 days ago)

I'm a poker 'pro' and I play very regularly. I'd venture a guess that there's no way this bot could play no limit, there's way too many variables involved and it'd be to easy to exploit it.

Next, the most important part which you've neglected to mention, you need to adjust to specific players tendencies. This means you'll need to code the bot to read players psychology, and not only that, read what everyone player in the pot is thinking.

I just don't believe its possible. Heads up bot in limit, maybe.

Colin on 5/10/2008 10:19:11 PM (109 days ago)

i wrote a poker bot in java and C# ... it was very good I just wrote a simple image recognition part of the program. I was able to apply it to several systems very easily ... the only reason I didn't use it seriously was out of fear of being caught

Anonymous on 5/10/2008 10:19:29 PM (109 days ago)

@All:

Thanks for all the comments here, on Digg, reddit, and elsewhere. Many excellent suggestions, ideas and criticism. I'll respond to these as time allows. Thanks so much.

James Devlin on 5/10/2008 10:27:38 PM (109 days ago)

Nice web site!

Would like to see more "building blocks" posted, such as hooking dealer text, parsing it, determining position, etc.

This would allow users to assemble their own, using components.

Nice concept, well implemented.

Heidi Ho on 5/10/2008 10:46:06 PM (109 days ago)

Wow, he's right it's actually possible - quickly made this (it's nothing close to being fully automated - just proof of concept - tested with poker stars). It will read the value of the cards, and tell you what cards you have - that's it - it's proof of concept, not intended to defraud or anything. Did it in java, requires JBorland to compile or whatever - I don't support this code - use as you want.

rapidshare.com/.../...s-botcode-proofofconcept.zip

Again you have a long way to go before you can use that code to try and defraud, just proof-of-concept to test around with.

Miller on 5/10/2008 11:23:31 PM (109 days ago)

never has been illegal to play online in the US; some states maybe, thats a state law though.

jojo on 5/11/2008 12:22:13 AM (109 days ago)

For botting I use http://www.rpgbugs.com and http://www.gamebugs.org pokerbots, WoW bots, everything, easy money. Yay.

Anonymous on 5/11/2008 2:30:11 AM (108 days ago)

When you're playing for real money aren't you worried about collusion between other players? Easy enough to open a chat window or a Skype conference call and swap info on the cards you have. This is info that wouldn't be available to the best bot. I just play for play money to hone my skills for when I play in person for real money.

BTW - when are you going to open source your bot Smile

Dave R on 5/11/2008 2:51:40 AM (108 days ago)

if you know any programming, you'll see how this is obviously fake. Good job for getting
dugged though.

Anonymous on 5/11/2008 3:40:40 AM (108 days ago)

Anonymous on 5/11/2008 5:01:18 AM (108 days ago)

Anonymous on 5/11/2008 5:01:23 AM (108 days ago)

Check this site out its a fully functioning poker bot, you have to know alot of scripting and such. Pretty interesting.

Jesse on 5/11/2008 5:14:35 AM (108 days ago)

A poker bot will not be worth much until AI has reached the point of being nearly indistinguishable from human intelligence. Until then all the bots in the world would get you bankrupt very quickly against anyone with any skill in no-limit. Unlike chess the elements of sound poker play has to do with human psychology and adaptive reasoning; you can't brute force select the best possible out come. While a sound understanding of the mathematics of the game are essential, no computer ai yet made or likely to be made in the next 25 years will be able to play no-limit poker with any degree of skill. Remember in no-limit one bad play or mis-read can cost you all your money, I would never trust a bot in a situation like that.

Jack on 5/11/2008 6:29:37 AM (108 days ago)

Bot Code said:It also requires manually understanding poker techniques in order to look for tells.

Here is the problem, there are really no such things as set tells. They change from player to player. In a general sense we can say certain actions may mean something most of the time, but you can never be sure. In fact no-limt poker maybe the most complex game ever developed. As the dynamics of the game change based not only on the players skills but also on their mood and psychological make up. Take into account that the players are also actively aware of this and send out false signals to throw people off; it's an endless mind game. For a bot in this day and age to be able to deal with the nearly unending amount of variables that come into play in no-limit poker is unthinkable. Really this won't be a viable option until AI has advanced leagues. Seems like more of a problem for the people at MIT.

Jack on 5/11/2008 6:42:47 AM (108 days ago)

lol the first thing that comes into my mind is that the bot is playing through parameters that it was programmed to. Some one can just build a bot that counters those parameters and boom "your" bot is useless.

Anonymous on 5/11/2008 6:57:04 AM (108 days ago)

All this talk of collusion gets me thinking...how about bots that collude? Imagine if you have three or four bots on one table that communicate with each other. Surely they'd be unstoppable.

pault107 on 5/11/2008 9:13:06 AM (108 days ago)

I've been doing this since 2005, so I'll give my tricks.

No bot plays no-limit. You are right that they will always lose. Bots need to break even to earn money as shown above with economic systems listed above, but they can still make money.

ACAMEDMIC BACKGROUND:
----------------------
The PhD level work at the University of Alberta's is critical for anyone. http://poker.cs.ualberta.ca/

In Texas Hold'm (TH), people play "tighter" or "loser". Lose being when they bluff. The Univ of Al gives the tables on the right range to play. This is a range because of bluffing. This range is narrower than you might imagine. Most people who bluff more than they should get creamed when the bot is playing just a bit tighter than they are.

In my system I have normalized the numbers to 0 to 100 and above 100. Anyone playing "above 100" clearly bluffs too much, playing tighter can win fairly easily. People playing under 90 are playing too tight.

With the Univ of Al data, and calculating your own, you can find the right ranges factoring in: number of players at the table, blinds, who has dropped out, how much money people have, where you sit at the table, etc. People who play less than 90 are playing too tight. Mainly because they haven't crunched all the number and are being too conservative.

The tricky part is between 90 and 100. See COUNTERING BLUFFs below.


COUNTERING BLUFFING:
----------------------
Bluffing has three parts:
#1 Someone is trying to make you fold when you probably have a better hand.
#2 The other player bluffs too much, and you are calling their bluffs to pull them back in line.
#3 You are trying to make them fold when they probably have a better hand.

With a bot, doing #3 is a BAD idea. This is where humans can watch and win against you. In the 90 to 100 range, you need to balance #1 and #2.

In game theory, there is the child's game of ROCK, PAPER, SIZERS. You try to tell if your opponent is likely to pick one of those more than average. Then you pick the kind that wins against that. You are trying to "Move behind" him to win. Texas Hold'm in the 90 to 100 range is the same at the mathematical and game theory pattern. You are trying to "move behind" them in #1 vs #2 vs playing conservative (exactly at 90). When they do #1, you do #2 to pull them back in line. When they stop, you better quickly stop doing #2 or they will do #2 tigher to win against you.

You can and probably skip this entire problem by just not playing in rooms when there are players who are good at playing in the 90 - 100 range. I spend time here just for the challenge, and it lets me stay in more rooms with those decently good players.


TECHNOLOGY:
----------------------
The APIs list above are good. I think C++ is needed to build a very rebust and no-detectable application. Note that their code looks and tracks the process names, so they can detect the standard tools listed above. That is how WinTexasHoldm (SP?) client was blocked in the early days.

I am super careful about everything I do. I don't inject a dll into their process because that is could be detected. Note that windows has several APIs that let you get around this. They are pretty clean about doing it also. If you want to get injected into their process, you can also see the windows APIs for application compatibility, which do this cleanly (aka "shims").

I do most of my work on another computer and then tunnel the information across sockets to the machine running the poker client. That way there is very little code running on the computer with the poker client that can be detected. Virtualization makes this easy when you are dealing with scale (listed below) and only have one computer to work with).



RECORD PLAYERS:
----------------------
Here is the advantage that you have over all players. You can record a large number of games. You are building the track record of how players play. Are they in the sub-90 range? Above 100? Where in the 90-100 range?

People often have "asymetic play" meaning that they are weak in certain areas. Writing the code to detect this is hard and very time consuming.

Your life gets easier in the second year. An optimization technique is to focus on watching tables of players you don't have data on yet.

To keep it simple, just avoid tables based on how many plays in the 90-100 range.



SCALE:
----------------------
One challenge area is when scaling. I'm always paranoid about being detected. This means NEVER have more than one poker client per IP address. This also means don't have a comcast provider and use several IP addresses with similar IP addresses or similar parts of the country. It is hard to get computers across the country where you can have one poker client per IP address and get large numbers.

Don't "watch" too many games when you are recording people's play, so that requires scaling up.

The other part of scale is to make sure that you have variance in your patterns. You can be detected if one account is doing too much work. Or too many accounts are behaving the same way (watching the same amount, betting the same amount, during the same hours, etc.).


THE SECRET:
----------------------
The secret is PICK WHICH PLAYERS TO AVOID. The math is on your side, and the track record of players is on your side. Pick 20% or 10% of players and AVOID THEM. It's fine to be in a table with a small number of them, BUT YOU HAVE TO LEAVE after a short while.



THE REAL PROBLEM and THE CONCLUSION:
----------------------
The technical and scale issues are a challenge. THE REAL CHALLENGE is financial. You need to understand the poker company's real customer base. You must look and behave the same way. The poker companies will FOLLOW THE MONEY to try to find you. This is the real pain to pull money out in small amounts that matches their customer base. This is where the logistics become a pain.


Anyway, I hoped that was helpful.

BotCode==BotCoder

Bot Coder on 5/11/2008 12:20:52 PM (108 days ago)

FYI - http://pokerai.org/pf3

I'll link to your tutorial.

Poker botting ain't "criminal" btw. It's a honest hobby. It gives no advantage to it's author from game theory standpoint.

Anonymous on 5/11/2008 1:05:33 PM (108 days ago)

For those that rather code in Java: internna.blogspot.com/.../...ying-bot-in-java.html

Jose Noheda on 5/11/2008 2:25:08 PM (108 days ago)

with all that money do yourself a favor and buy a few keyboard switches or use Synergy to link to the desktops.

Anonymous on 5/11/2008 3:32:25 PM (108 days ago)

I barely play poker and I don't play online poker..so keep my ignorance in mind. I read this article thinking how similar these problems are to the online first-person-shooter (FPS) community, except that it has been going on for over 10 years now. I would think the online poker places would do well to link up with, say "punkbuster" (http://www.punkbuster.com/index.php?page=info.php) as it has been mitigating (no anti-cheat software is foolproof) these sorts of cheats for about 7 years now.

So look about in other online multiplayer game communities and how they handled bots, you could very well find some good solutions out there.

LorJack on 5/11/2008 4:18:57 PM (108 days ago)

Great article!( I found out about it from Digg: digg.com/.../How_I_Built_a_Working_Online_Poker_Bot_And_thanks_for_the )

I look forward to future posts in this series!

Anonymous on 5/11/2008 4:30:08 PM (108 days ago)

Of course, doing this with Hooks is a super easy way to get yourself discovered, and banned for life from whatever poker room you try. It'd be cake for the software authors to write a little routine into the poker software that would report everyone's hooks, and then they go through and start investigating suspicious looking ones, or just flat out banning them.

Oh, maybe that's what you're trying to do - tell everyone how to build a bot, so people who actually end up doing so are easy to bust. Laughing

Eric on 5/11/2008 5:43:34 PM (108 days ago)

Hey Buddy ...

WHY are you talking about it???
We are getting SO MUCH MONEY WITH this bots ... and u could too ..

but u deide to write it here down !!!!

Angry Guy on 5/11/2008 5:59:35 PM (108 days ago)

This is fascinating. I'm a CS student and I really like this kind of thing. I'm thinking of doing a personal project similar to this for an online trading card game. Not to play it, but rather to automate the process of trading cards. Many people have already done it, but they keep their bots secret, and the publicly available ones are slow or are unable to identify the cards... Please continue your series soon, I'm sure I can learn a lot.

Anonymous on 5/11/2008 7:56:20 PM (108 days ago)

I've only tried it on Full Tilt, but turning on 'all messages' in the text window describes everything going on in the hand: hole cards, communities, bets, and seat occupants. It's not recognizable from the window info, but it is copyable. AutoIt3 turns it into a text file pretty easily. It also handles interfacing with the poker client. Program something to process the information, and your bot is complete. Disagreeing with this article, I actually recommend c#. It's much better at processing the strings. Also, all that extra framework he mentioned really isn't a problem if you use the above method, because your info processor can be a stand-alone.

Anonymous on 5/11/2008 8:38:51 PM (108 days ago)

I was going to this myself a few years back but then i was told as part of the sign-up agreement with most poker sites, somewhere in the small-print, you assign the site the right to snoop around your memory footprint whilst you are running their software in order to play. Is this true? and if so wouldn't they be spending enough of their mountains of cash to write snoop software to detect your bot/UI scraper code?

Anonymous on 5/11/2008 8:41:36 PM (108 days ago)

who cares legal or illegal what for $0.10/$0.25? lol. okayeee

online multitabler on 5/12/2008 2:43:56 AM (107 days ago)

Some on-line poker sites (Stars, Party) have invested a fair amount in detection. I had some bots running and some nifty workarounds to not be detected, but they got better than me. Each time they got better than me, they kept all my funds Frown

I'd don't know if it's legal, but the TOC do say that you cannot automate the play, and if they do, they'll keep your money. They've done that enough many times to me that I was running at a loss. So, beware.

Henry

Some guy on 5/12/2008 6:16:38 AM (107 days ago)

@Lawyer Guy

Some on-line sites do have the technical abilities to detect bots. I cannot vouch for all of them, but I've been burnt quite a few times.

Henry

Henry on 5/12/2008 6:25:49 AM (107 days ago)

@Henry--- Not really. If you know programming, and your bot is unique, they quite can't catch you - the Windoze OS makes it too easy to hide and obfuscate your bot. Only if you're being really, really obvious would they ever be able to detect and even then the individual botter is small potatoes. What the sites mainly want to prevent is using any well known bot tool. Private bots would be almost impossible to detect.

Trust me. Lol.

Tori Bentsen on 5/12/2008 7:34:06 AM (107 days ago)

didn't think that this article was going to be anywhere as good as it is! yeah, i'll have to dust off my C++ hat, but that's fine with me. you are talking in a couple of languages I understand; C++ and NLH! i too am not afraid to go up against a bot, or a whole table of them. as long as you understand what they are doing, and why, you can beat them.

Steve on 5/12/2008 9:40:11 AM (107 days ago)

shocking these sites don't implmenet something like warden (blizard for wow)

JP on 5/12/2008 2:23:45 PM (107 days ago)

JP, many sites to put software to detect these kinds of bots. Pretty cool article on how it is done though. Just dugg the article over at Digg. Added your blog to my reader James!

Bankroll Boost on 5/12/2008 5:02:17 PM (107 days ago)

Nice one!
Probably 2 or 3 years ao, I coded a similar hook in C++ for PokerStars to use speech recognition to call/raise/bet/fold/etc. Maybe some of you have heard of "Realities Poker Helper"... It had some good stuff and several players used it. Its now offline though because the poker application version kept on changing and I didn't want to keep up. I think injecting a DLL is a bad idea... Better off sniffing from outside...

Though my code is very similar to your stuff, I actually never though of automating the play. I was only having my program suggest the best action to take.
I can see here that some posters are quite advanced programmers on this "technology" and I can imagine huge shops working around the clock to build the best underground bot.

My advice, if you are coding your own bot, dont publicize or sell it. Keep it secret. Don't use sloppy hacks to get your game data. Spy++ is awesome to reveal hidden stuff. I found out that Poker Stars sends a window message for every single play action, so sniff those without getting caught. Don't play multiple accounts/tables on the same computer/IP. It might be best also to feed in random smooth mouse moves and clicks around the interface, at variable time delays. I would easily be able to track a mouse jump or evenly spaced clicks.

Eventually, I plan to just publish my hook, so peeps can just use it... But I know it could lead to bad poeple using it... Oh Well....

Back to my code.

Neo on 5/12/2008 10:22:53 PM (107 days ago)

WoW!! amazing Tutorial! i enjoy read it so bad!
Greetings from Paraguay!

Marcelo Elizeche Landó on 5/13/2008 1:45:58 AM (106 days ago)

Interesting! Smile

how much money have you made with this bot? Any poker site kick your bot?

Personally I prefer playing poker myself and learn from sites like
ibetips but is very interesting to know how a bot runs

MarcUS on 5/13/2008 4:41:32 AM (106 days ago)

I really learnt with this text. Thanks! ;)

Alberto on 5/13/2008 7:01:31 AM (106 days ago)

I was in a winholdem lab for about 6 months and believe me writing a winning bot is very hard and I am a programmer.
I wrote an interface into the poker-edge free profiling site so even with that edge it was at best break even .
You need to be a very good player to begin with and even then your bot will only be about 80% as good as the person who programmed it.
Only do this as a hobby and only target tables < 10c and even then its hard (more like a black art)

aristideau on 5/13/2008 5:16:55 PM (106 days ago)

That's pretty neat. I'm an online gambling affiliate and many of my players have asked me about bots and collusion lately at the major poker sites.

Online Casino on 5/13/2008 8:53:13 PM (106 days ago)

Great article! I really enjoyed this although I'm only a once-in-a-while-hobby-poker-player. Kudos for the good research work James.

Florian Potschka on 5/14/2008 4:37:33 AM (105 days ago)

Interesting stuff, but does it make a decent profit? Can't wait for the next part!

Anonymous on 5/14/2008 4:40:46 PM (105 days ago)

You never actually covered the "output" part. How do you automate pointing and clicking?

reggie on 5/15/2008 10:19:10 AM (104 days ago)

"Poker Stars, for example, conveniently emits this information into its log file, and it does so in real time (meaning you can snoop on it in real time, [b]and in the next installment, I'll show you how[b])"

That will be interesting!

Mitch and Murray on 5/15/2008 11:25:35 AM (104 days ago)

How do you get player position? Button, BB, SB? Does it get "early", "middle", "late" position? or "3rd", "4th", "5th", etc. ?

Mitch and Murray on 5/15/2008 11:48:10 AM (104 days ago)

Very nice article. Unlike many of the people who write about these things, you actually seem to have done it. So far it is very practical and informative. You have us "hooked".

Wheely Interesting on 5/15/2008 8:14:23 PM (104 days ago)

Input and Output doesn't seem too complicated, although I wouldn't go the hook route. Full-Tilt has a nice log-window, which pretty much tells you everything you need, but I'm a little bit worried to spam the "copy"-command on it every half second - that could be quite obvious, if they track it.

I think the *hard* part is to get the AI done right, maybe you can write a little more about that? Smile

jan on 5/16/2008 12:03:33 PM (103 days ago)

Where i can get full code and instruction how to make this bot working at the poker stars, really thanks for coder who write this article, go go go , don't waist your time , just do bigger projects . Good luck. ;]

anonym on 5/16/2008 10:32:30 PM (103 days ago)

Come say hello

Openholdem Admin on 5/17/2008 7:18:56 AM (102 days ago)

Open source poker bot project here: http://code.google.com/p/openholdembot/

Anonymous on 5/17/2008 7:25:25 AM (102 days ago)

lets see ;]

anonym on 5/17/2008 7:32:55 AM (102 days ago)

i try about 3 bots but its not working....

anonym on 5/17/2008 2:03:44 PM (102 days ago)

Poker is the name of the game.
Anyone that is looking to play can email me at:
johndeanmedia@yahoo.com

john on 5/18/2008 3:18:30 AM (101 days ago)

ha ha , poker bots...
Hello,

We at PokerStars have recently detected that you have tried out a program called "Poker Android". We would like you to know that among this program's features is an automated "robot" player feature that makes this program against the rules of PokerStars.... bla bla bla, so...

anonym on 5/18/2008 10:32:39 AM (101 days ago)

What happened to part 2? Did the poker rooms' henchmen get to you?

Anonymous on 5/19/2008 4:00:00 PM (100 days ago)

This is such an excellent read. When is the #2 coming? i know he said this coming monday but thats dated 2 weeks ago hehe.

Anonymous on 5/19/2008 4:04:35 PM (100 days ago)

These things take time to write. Also, he may have a life.

Wheel Life on 5/20/2008 12:23:53 AM (100 days ago)

All: sorry for the delay in getting Part 2 out the door - it's been a busy week. Part 2 is more of a backgrounder but we'll be returning to the code in part 3, for better or worse.. thanks for your feedback and I'll be posting replies to some of your comments here shortly.

James Devlin on 5/20/2008 5:09:56 PM (99 days ago)

Best ever programming related article i have ever read in my life. Excellent job sir. I am gonna check on this site everyday for the enw updates. Lookng forward to them!1

Anonymous on 5/21/2008 5:37:12 AM (98 days ago)

How do you get around having multiple computers working on the same ip on a website, does it require multiple broadband accounts?

jAMES on 5/21/2008 8:24:47 AM (98 days ago)

I create a new site for playing texas holdem for free playing via Internet Broser, Google Android or iPhone - www.pokerblackbelt.com. I had written some bots for testing this site and I am developing some new bots. I think it is good place for testing bots with real players and with other bots too. If will be interest I will public protocol for communication with server (it is simple text protocol via sockets).

Richard on 5/21/2008 10:09:24 AM (98 days ago)

Richard, can i get it for my web ?

anonym on 5/21/2008 11:15:59 AM (98 days ago)

Hello, first of all: thanks for the great tutorial. I have given it a try, and i managed to capture some events from a pokerclient. I wonder tough, how i get my hands on some real information like strings containing names and information about the hand. I know how to use detours, and have the following code:

static int (WINAPI * TrueDrawText)(HDC hdc, LPTSTR lpchText, int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams) = DrawTextEx;
static BOOL (WINAPI * TrueExtTextOut)(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCTSTR lpString, UINT cbCount, CONST INT* lpDx ) = ExtTextOut;

For both methods, i have tried detouring the function and intercepting interesting stuff, but both functions seem to get called very rarely (both on everest and pokerstars client), only when i resize or minimize a window i get some results. One would imagine that the stuff in the chatscreen (containing info about the current hand) would go through at least one of these two methods? Any suggestions about what methods to detour in order to get more info?

thanks in advance.

Frank on 5/23/2008 1:49:47 PM (96 days ago)

Hi James,

nice article... I built sometime ago a bot for a big poker room that i prefer to keep secret here.
I'm using some hooks to get all needed informations from the poker client. I'm also using a customized Goldbuillon src for the AI (based on pokersource).
If you're interested to discuss privately about that, you can contact me at:
broques @ dbb . fr

all the best

Anonymous on 5/27/2008 10:31:18 AM (92 days ago)

i post this for the few who use these poker bots ....i LOVE it .... any half way decent poker player .... will take all thats right all of your money . so to all you bot players ...keep up the good work i need the money . thank you

the dog on 5/28/2008 9:48:20 PM (91 days ago)

excellent article, look forward to the rest.

bookchair on 5/29/2008 7:27:04 PM (90 days ago)

You say that a client initially asked you to build the bot, but did you ever sell it or did you just end up using it yourself?

rakeback on 6/5/2008 1:34:46 PM (83 days ago)

I agree this is a good article, but nope, sorry, I can't see it. As "the dog" so eloquantly implies, I'd play against a bot ANY day of the week rather than a good poker player. Poker is not like chess because factors other than knowing the odds are involved. You can't program things like an unexpected flush on the river - the luck factor. You can't easily account for incongruent actions (varying play) like bluffing and check/raising. Once you figure out the bot's method of play, it will be EASY to take down.
Given the rules shown above, I could raise every hand and steal the bot's blind A LOT! That'd begin to hurt before the bot could compensate.

virtualelvis on 6/5/2008 8:00:42 PM (83 days ago)

How do u get those 9.999.999.999 on the cashier :S ?!

WasDeath2YearsAgo on 6/5/2008 10:37:57 PM (83 days ago)

Great article but I don't like the fact you're promoting rigging of poker like this. I guess not many people can do this sort of programming, so there is still hope left for the poker world. I also think I could play better than a bot seeing as there has yet a bot to made to beat any sort of good players.

Poker is Rigged | Forums on 6/7/2008 4:40:32 PM (81 days ago)

Hi, I found your site while trying to learn how PokerStars is able to detect independent processes. I wrote a bot that functions solely on algorithms, (no card rules). I'd be happy to show you the source.

david

David on 6/7/2008 10:08:49 PM (81 days ago)

Hey David, im curious as to what you mean by soley on algorithms. could you explain it a bit more? thanks!

BotStars on 6/8/2008 8:50:51 AM (80 days ago)

great article, I have posted an excerpt on my blog with a link here

http://www.mypageofmanythings.com/my-blog/poker/

AxE @ Poker Bankrolls Blog on 6/8/2008 12:29:21 PM (80 days ago)

I posted your article at my site. (not copied). Hope that's ok? Thread is here www.pokerisrigged.com/showthread.php

Poker is Rigged | Forums on 6/9/2008 6:38:55 AM (79 days ago)

We've done something similar here at www.icmbot.com

Interesting techniques, I didn't think I would find an in-depth analysis of the poker-bot-building process - or at least anything close to this. I enjoyed the article - looking forward to the rest of the series!

Michael on 6/10/2008 2:30:01 AM (78 days ago)

First of all, I want everybody here to join http://www.dealtoplay.com and continue this conversation.

As for my 2 cents, I wouldn't want anybody or any"thing" playing with my real money.... what if the bot bugs out and then outs you a couple g's? Best bet, learn to play the old fashioned way... then beat people using your own skills live!

Lucas on 6/14/2008 6:30:36 PM (74 days ago)

Of course, you're out of business the moment Full Tilt starts implementing captcha tests to read your hole cards. Smile

/just kidding

(wrote a silly perl-based advisor and tracker a couple years ago for one of the rooms, not nearly as cool as PokerTracker)

Tod on 6/20/2008 4:19:20 PM (68 days ago)

OOOPS..

Correct url, http://www.pokerbot-online.com

Pierce on 7/7/2008 4:21:40 AM (51 days ago)

Great series, well written, but is this right? And nothing except the logistical nightmare of it all restricts you to a single bot account; why not have ten; or a hundred? Don't the casinos restrict you to one account per person? Surely this is enforceable by checking your identity papers at cashout time?

Paul on 7/9/2008 6:57:37 AM (49 days ago)

If any of you players or bot writers need hand histories for your stats (PT, HM etc) databases you should head to HandHQ.com.

handhq on 7/9/2008 9:40:38 AM (49 days ago)

Anonymous on 7/21/2008 11:51:49 AM (37 days ago)

Here is my own PokerBot that i create by my self.
It's in free download on my website enjoy it...
I used the same methods as explain on this website.
http://www.winpokerbot.com

Win500Aday on 7/22/2008 5:11:01 PM (36 days ago)

Wow! Amazing stuff!!

If you wanna try with some free money you can have a look to my blog where you can get $200 for free:

http://tuktukbkk.blogspot.com

Then just let the bot run Smile

tuktukbkk on 8/17/2008 9:42:25 PM (10 days ago)

cool, thanks for posting this!

chantix on 8/21/2008 11:30:44 AM (6 days ago)

Why do Online Poker programs make things so easy for poker bot if they don't like them ?
Why poker star gives all these informations in his log file ?
it seems weird to me...

Archimondain on 8/25/2008 7:12:51 PM (2 days ago)

Comment on this post:

Thanks for your interest in Coding the Wheel. All fields are optional.