Poker Real Time Odds on Mac OS X: Part 4
In the last part I showed how I turned a screenshot into a 2-bit picture, which in text form looks like this:
I played on PokerStars for a couple of hours while my embryonic program grabbed screenshots, turned it into a string of 1’s and 0’s, then saved it. I now had a corpus of screen scrapings. Using a text editor, I manually augmented the text file with the character I could see. For example, a section of the text file looks like this:
It’s a manual way of training a computer to do optical character recognition.
Now I can compare future scraped characters to this corpus to find out what character it is.
The process of scraping doesn’t always return identical matches; sometimes the character ‘Q’ might have a couple more 1’s or a couple more 0’s. So I compare the scraped stream of 1’s and 0’s with my corpus using an “edit distance” algorithm. If the edit distance of the scraped text from an item in the corpus is no more than 4, then I count it as a match.
Let’s fire up PokerStars, play a hand, and see what SeeingStars does so far. Here’s the table:
Here’s what SeeingStars thinks is on the table:
cards = hand: Ks 4s, playerCount: 2, board: 3c 6c 2h 2d 5h
I think the hard part is done. Now to turn those cards and board into real time odds. That’s coming in part 5.