In late 2006 and early 2007, I tried to build a shortstacking poker bot.
Shortstacking, in a nutshell, is a strategy that advocates buying in for a relatively small amount of money compared to your opponents and then playing very aggressive preflop poker. Most opponents do not adjust correctly to your stack size, and, in theory, you can make a lot of money from their mistakes.
Here’s a quote from shortstacking strategy guide on what used to be DonkeyDevestation.com:
By buying in with 20bb, you control the size of the stacks that the hand is being played for, not your opponents. Most of your opponents will be making plays preflop that are suitable for a full stack game but would be losers against 20bb stacks, and therefore losers against you. They take the worst of it against you to play better against the others, and you profit from this. Many players will complain about short stack players, claiming they are “lame” or “unskilled”. And they are right. It is lame, and it does take less skill to play a short stack. But it is very profitable, especially in today’s games. Furthermore, unlike most strategies, short stack play actually becomes more effective as you move up in limits, because other players tend to be more aggressive preflop, meaning they are putting more money in with hands they would not raise if they were only playing against you.
Shortstacking was appealing to me as a first time bot developer because it had been written about fairly extensively and the strategy, at least from a preflop perspective, was pretty well defined.
Here, for example, is a chart of a player named cuzco, who successfully employed a shortstacking strategy:

How hard could it be to study his hand histories and have a bot emulate his decisions?
I already had a bit of experience writing add-ons for the PokerStars software (see PokerShark), so I figured it would only take a few weeks to get a prototype together.
In November 2006, I started programming.
The first major hurdle was figuring out how to read the chat box on the PokerStars client. PokerStars uses some custom controls which can’t easily be read using standard Windows API techniques, so I tried using Optical Character Recognition (OCR) to convert the pixels to words:

And later:

Eventually I figured out that PokerOffice, which makes a popular add-on for PokerStars, adds their own chat control on top of the default PokerStars one and it can be read using standard techniques. This was a big step because I no longer had to rely on OCR to get the text, which didn’t work very well (a lowercase L and a capital I look the same, for example).
Reading the text on the PokerStars Lobby was also important in order to automatically open new tables:

Using some shortstacking strategy guides as a starting point, I put together extensive preflop and postflop logic charts which were eventually implemented in the bot:

By the end of January, I had a working product:

It was capable of multitabling like the machine it was:

Most days it lost money, which was to be expected during development, but some days it did very well:

And that often gave me hope that the changes I had made the previous day were all that was needed to finally make it profitable.
I did a lot of A/B testing to try to measure what effect, if any, the changes I was making were effective:

Another thing I had to worry about were CAPTCHAs, which PokerStars is fond of using to identify bots:

Eventually I realized that conditional statements were not enough. There are simply too many situations in No Limit Texas Hold’em to account for–even when you’re shortstacking. For example, how do you take into account bet sizes and your opponent’s stack size? “IF … THEN” could not adequately handle that, so I started playing around with Expected Value (EV) calculations:

Unfortunately at the time I didn’t have the tools to implement these techniques.
Nonetheless, I persisted with the shortstacking bot, believing that it only would take a few more changes before it was profitable.
March rolled by…

And April came around…

But, despite my best efforts to turn it profitable, it kept losing.
By the time I decided to quit at the end April, the bot had played roughly 49K hands and blown through more than $1,300:

Eesh.
Shortstacking, it seemed, was harder than it looked.
What I eventually realized is that your profits from shortstacking come from a few key decisions and if you didn’t make the correct moves at those moments, you couldn’t win enough to be profitable. In other words, I may have had a 90% solution–though I doubt it–but because it couldn’t make the correct decision that remaining 10% of the time, it could never be profitable in the long run.
Frustrated but determined not to let the work go to waste, I decided to start from scratch and to build a No Limit Heads Up Sit-n-Go (HUSNG) bot. That was my game of choice and I figured as long as I’m going to work on something, it might as well be with a game that I enjoy and had a lot of experience with.
Tatta, one of the most profitable Sit-n-Go players on PokerStars, was my inspiration:

“If I could only achieve a fraction of his success,” I reasoned to myself, “this will have been worth it.”
For the rest of this story, I’ll point you to the previous 11 posts about the HUSNG bot.
To sum it it: after several more months of work it was profitable, but shortly thereafter, PokerStars caught it and closed my account.
Doh. :)