PDA

View Full Version : Reading In Data from the Screen


Big_Jim
10-07-2005, 04:41 PM
(x-posted in Computer Technical Help)

I am attempting to write a program to do various calculations based on a particular hand in real-time.

I am currently working with PartyPoker and clones.

I have been able to read from the chat box all the information about any bets/raises/calls/etc as well as the information about the community cards.

However, I would like to be able to read the cards themselves, primarily to figure out the player's hole cards, and opponents cards if/when they are shown.

I have found a decent Screen OCR library (Textract. Google for it), but I cannot figure out how to read in the cards.

I think that I may be able to do it by creating a font which matches the PartyPoker font, but I have thus far been unsuccessful.

Any suggestions?

If you have suggestions that you feel to be too technical for explanation here, PM me.

Edit: I'm using C++ with Visual Studio 2003

OrcaDK
10-07-2005, 04:56 PM
You're going about this the hardest (and most likely wrong way). All Party skins write the hands to a text file in real time, including the hole cards. It's much much easier to parse these files than it is to read from the screen.

Big_Jim
10-07-2005, 05:14 PM
I was fairly sure that the information about the hole cards is not written until the hand is over... although I should probably check this out again.

callydrias
10-07-2005, 05:16 PM
[ QUOTE ]
Any suggestions?

[/ QUOTE ]

Yeah, YSSCKY. You should also publicly post more about blatantly breaking Party's T&Cs.

Big_Jim
10-07-2005, 05:19 PM
[ QUOTE ]
You should also publicly post more about blatantly breaking Party's T&Cs.

[/ QUOTE ]

I don't know how to be any more blatant. I suppose I could change the subject.

Big_Jim
10-07-2005, 05:20 PM
Looks like you're right. Thanks.

Jeff W
10-07-2005, 05:30 PM
[ QUOTE ]
I am attempting to write a bot.

[/ QUOTE ]

Big_Jim
10-07-2005, 05:39 PM
That would be good too, if that's what I was doing.

I could also just keep bumping this thread.

Sniper
10-08-2005, 02:08 AM
Aside from the advice you've already received about using the HH, if you truly want to read the cards, you should note that the card graphics are all stored locally (all you have to do is match them up).

Its also probably worth noting that there are already a few programs that probably do what you are trying to create!

10-08-2005, 10:49 AM
There are multiple multiple ways to go about this. Personally I would just take a shot of the screen, cut the coordinates from the screen where the cards are, and then md5 that rectangle for a unique fingerprint. THEN whatever that card was, equals THAT particular fingerprint.

I.e. if you take a shot of the King of Hearts, you grab the coordinates for that card, get the pixels, save that rectangle as King-of-Hearts.bmp and then md5(King-of-Hearts.bmp) to get the unique fingerprint.

Now, when you want to read a screen, your program fetches those same coordinates and checks the md5. If the md5 equals any of the md5's of the cards, then you can work out what card it is.

e.g.

# grab pixels from screen
x=blah.grab(coords)
y=save(x,'KoH.bmp')

x=md5(x)
y=md5(y)

if x==y:
# grabbed pixels are the same as a card in our md5 db
print "x==y, therefore x is the king of hearts"


Hopefully that made sense. I'm still on my first coffee.