Image Image Image




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Java boter wannabe
PostPosted: Tue Dec 06, 2011 5:17 am 
Offline
New member
User avatar

Posts: 4
Favourite Bot: betbot
Hi!

I am new and very interested in poker bots in general. I am a java developer who has some experience in C++, but I don't really like the win api coding. I just started developing my first poker bot and my approach is learning about every aspect of bot development one at the time. So for startes I am not interested in any game logic and ai, just gathering the game state (is it my turn?, what cards do i have, who is next to act, what is in the pot, what are the stack sizes..etc).

For tracking the game state i will use screen reading + ocr. So far I created a program that knows when it's my turn to act by reading the pixels below my cards. There is the timer progress bar that turns green, yellow and red when it's time to act. I just check for that bar in a thread every 2 - 4 seconds. My next challenge is reading my whole cards. I am already screen scraping them, I just dont know If I know all the options for recognizing specific card. My intention is to find the unique pixel colors in a unique position. I think this should not be to hard. But the main question is , how do I get the coordinates of opened poker client window programatically. I know that I can't do that in java, so I'll have to use C++ and bridge it with JNI. Now I have to manually check the coordinates with a program autoIT and hardcoding them into my source. What I would like to do is, say I have 4 tables opened, I would like to know the absolute coordinates of the left corners and possibly the size of the window. Then I can calculate the coordinates of cards, players, stacks..using relative coordinates.

:xx07 be gentle with me I'm just a noob :)

Also I am opening this thread for other java bot development questions, hence I added Q&A in the subject.


Top
 Profile E-mail  
 
 Post subject: Re: Java boter wannabe Q&A
PostPosted: Tue Dec 06, 2011 9:32 am 
Offline
Senior member
User avatar

Posts: 124
Favourite Bot: coming
Hi betbot,

OpenHoldem is perfect for screen scraping. Don't waste time re-coding the wheel to get a game state or you'll be like numerous people giving up because pokerbotting is a time consumer.

AI is the real challenge, focus on it.


Top
 Profile E-mail  
 
 Post subject: Re: Java boter wannabe Q&A
PostPosted: Tue Dec 06, 2011 7:53 pm 
Offline
New member
User avatar

Posts: 4
Favourite Bot: betbot
Played a bit with C today, figured out how to get the window information.
Code:
HWND my_window;
   LPCWSTR className = TEXT("#32770");
   LPCWSTR title = TEXT("PartyPoker.com: Poker Lobby - xxxxxxx     ");

   LPCWSTR strWinInfo;
   RECT windowInfo;

   my_window = FindWindow(className,title);
   if(my_window != NULL){
      MessageBox(NULL,TEXT("Hello , found window!"),TEXT("Title!"),0);
      GetWindowRect(my_window,&windowInfo);
      long top = windowInfo.top;
      long bottom = windowInfo.bottom;
      long left = windowInfo.left;
      long right = windowInfo.right;
   }
   



LOLWorld, thanks for your concern. Maybe I'll give openholdem a look. I remembered once, that I was poking a bit through the manual of open holdem and it's quite huge, all that table map creating and stuff...I thought things could be simpler than that.
Ok, as for AI, where should I start, can you point me in any direction ? decision trees in poker ? opponent modelling ? What would be the basic AI (losing player ofcourse) ?


Top
 Profile E-mail  
 
 Post subject: Re: Java boter wannabe Q&A
PostPosted: Tue Dec 06, 2011 7:57 pm 
Offline
New member
User avatar

Posts: 4
Favourite Bot: betbot
I forgot to mention, that in a distance future I would like to create a PLO 1-table SNG bot. Is openholdem capable of scraping omaha ?


Top
 Profile E-mail  
 
 Post subject: Re: Java boter wannabe Q&A
PostPosted: Tue Dec 06, 2011 10:23 pm 
Offline
Senior member
User avatar

Posts: 124
Favourite Bot: coming
Reading everything on this forum is a good beginning. :)

OpenHoldem can't handle omaha.


Top
 Profile E-mail  
 
 Post subject: Re: Java boter wannabe Q&A
PostPosted: Fri Dec 09, 2011 10:39 pm 
Offline
Senior member
User avatar

Posts: 360
Favourite Bot: Zander
Most newbies (myself included) want to get their hands dirty straight away, so concentrate on gathering the game state and clicking buttons. And I can tell you from experience that the AI is by far the most difficult part of the project. I always thought that a simple rules based AI would be good enough but I've not (yet) seen one that is profitable over a significant number of games. But I guess it all depends on what games you want to play and how simple you can get the decision making process AND still be profitable.

Poker botting is far from easy. You are just embarking on a very long development project. I hope you haven't planned anything for the next couple of years. :lol:

If I was starting again, I'd certainly setup a test bed so you can run bot vs bot and also use it for fictitious play. Most game theory programming such as ICM and Nash Equilibria require some sort of fictitious play, so it's a good place to start.

_________________
http://www.bespokebots.com


Top
 Profile  
 
 Post subject: Re: Java boter wannabe
PostPosted: Sat Dec 10, 2011 4:19 pm 
Offline
PokerAI fellow
User avatar

Posts: 1562
Location: Finland
Favourite Bot: Self-made
betbot wrote:
So far I created a program that knows when it's my turn to act by reading the pixels below my cards. There is the timer progress bar that turns green, yellow and red when it's time to act. I just check for that bar in a thread every 2 - 4 seconds.
I'd recommend refactoring that to read the action button pixels instead of the progress bar, IMO that's more robust. Just check if the action buttons are there to find out if it's your turn to act. That way you can also easily find out whether you can e.g. Fold/Call/Raise or just Fold/Call (all-in).

And you need to also check if your action has been accepted by the table (one click won't always do it with multitabling woth tables are fighting for focus etc) and for that it's good to use the action buttons again (=see if they have disappeared after some delay once you have pushed your action on the table).

_________________
Opinions expressed are my own, your mileage may vary... ;)
Warning: If I spot an opportunity to give sarcastic replies, I will take it. Nothing personal. I don't even know you.


Top
 Profile  
 
 Post subject: Re: Java boter wannabe
PostPosted: Sat Dec 10, 2011 4:35 pm 
Offline
Senior member
User avatar

Posts: 360
Favourite Bot: Zander
betbot wrote:
So far I created a program that knows when it's my turn to act by reading the pixels below my cards.
Waiting for the Fold button to appear may be more reliable (and portable to other sites) as it's always visible when it's your turn to act.

It's probably easiest to convert all images you capture to a 2-bit black and white image and then save those to a database. If you name each card image ("As" or "Qh" or "5c", etc) then you can compare the images and use the file name as the identifier. You might find that some sites use fancy graphics and highlighting to make screen scraping difficult. If that's the case, then you'll need an image comparison routine that can check if an image is similar but not necessarily an exact match (i.e. a 90% match or whatever).

_________________
http://www.bespokebots.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: