Thread: Poker Bot Blog

Results 1 to 3 of 3
  1. #1
    sraeg's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0

    Lightbulb Poker Bot Blog

    Hello guys,

    Not sure if I was ever on this forum properly or not, but I'm a gamehacker from back in the day primarily on the Delta Force series.

    Today though, I'm starting a new project. A poker bot.

    Take this as you will. It's intended to be universal. Am I going to be using it to play arcade style texas hold'em games? Maybe. Play money online games? Maybe. Real cash games? Maybe.

    So, why? Well, I've played poker a long time and done alright for myself really. I stopped a few years ago, and now starting to get back into it with a small bankroll. Basically, I'm sick of having sessions like this:
    Removed image - Not allowed to post

    At the start of the session, I'm quite solid, however at the end I dip and dive a bit. Why? Bad play? Bad cards? Nah, I put it down to feelings and inconsistency. I'm used to playing well above this stake, so when I lose a $5 pot I feel like I'm 'owed' that $5 back, so chase it, and lose more.

    The idea then.. I wonder if I can make a bot to play consistently. Sure, check some of my old programming (google Evobyte aimbot tutorial or sraeG 3d -> 2d tutorial) and you'll see that I'm not great. There will be no AI here; it'll purely be rule based. Realistically, it won't ever be as good as me when I'm in my A game. However, I should be able to make a bot that will be better than me when I'm playing my C game.

    This will probably be a long project, and although I will limit what results I post on real sites (for legalities sake, I mean real play-money sites), I will try giving as much info on my progress, results and efforts to create a winning poker bot at low-level ability poker (e.g. play money, shit AI games, and micro stakes $2/5/10 BI cash games).

    The real check will be playing pokersnowie with it. For those that don't know, google it. It's essentially an AI bot that has played billions of hands and devised a way to be almost perfect..

    So, end of this post, and the next will be more info about the bot I intend to create.

    - - - Updated - - -

    So with the introduction out of the way, let's get to the crooks of it.
    • Will be programmed in Visual Studio in C++.. I haven't coded in about 4-5 years at least, so need to get my head back into it.
    • Will eventually be universal.. I intend to have captcha-like detection of cards/bets, though again, this is an afterthought.
    • Will be a winning player over a large sample at low-level poker.
    • Will provide logs of reasoning, to review after sessions
    • Will eventually be able to run on a different networked/screen monitoring machine, for less traceability


    And now for the hard bit, a bit that will probably need to be added to.. The pseudo formation.
    First draft: 08/02/2016

    Code:
    Start:
    Wait for our turn ; find a 'tag' pixel to let us know this
    Get our cards ; initially work on 1 site with known 'tags' on card.. build towards captcha style identifier
    Get our stack size ; could memory read but leaves us susceptible to tracking.. look for tags
    What position are we in? ; tag button
    How much is in the pot? ; more fucking tags
    What action was before us? ; tags on buttons
    What street are we on? - Jump to pre-flop/flop/turn/river ; tags on cards
    
    If pre-flop:
    Are we in our hand-range for this position? ; compare against static chart.. eventually, rank hands and make this a user defined percentage per position
    Act accordingly (fold/call/raise) ; as it says on the tin
    Goto Start ; check for our next turn
    
    If post-flop:
    What hand do we have? ; join our cards to the board cards are find our holdings
    Act accordingly (check/fold/call/bet/raise) ; the easy part
    Goto Start
    By tags, I mean identifiers that let me know what something is based on it's pixel usage. For example, if a space is usually black, but theres a group of pixels that turn white when it's my turn, I'll use GetPixel in that area for detection purposes. The poker game that I'm working on currently is quite easy there. For position for example, the button has white writing in the middle of it. I've therefore found 6 positions (I play 6-man games) around the board where it could appear, check for it using the function below, and if found I know where I am:

    Code:
    bool CheckWhite(int x, int y)
    {
    	COLORREF pixel;
    	HDC hdcs = GetDC(0);
    	pixel = GetPixel(hdcs, x, y);
    	if (pixel != CLR_INVALID){
    		int red = GetRValue(pixel);
    		int green = GetGValue(pixel);
    		int blue = GetBValue(pixel);
    
    		if (red == 255 && green == 255 && blue == 255)
    		{
    			ReleaseDC(0, hdcs);
    			return(true);
    		}
    
    	}
    	ReleaseDC(0, hdcs);
    	return(false);
    }
    To make it easy for cards too, I've gone for a 4 colour deck. This means that instead of the usual hearts/diamonds being red, and clubs/spades being black, each suit has it's own colour. These 4 colours are red/green/blue/black. Makes it easy to find my suit without tagging parts of the symbol; tag a corner of the card.. If my 'red' value is the biggest, its red, if 'green' is..its green...so on...and if they're all equal, it's black (or monochromatic).

    - - - Updated - - -

    For more of an explanation on 'tagging' in regards to finding position, i.e. where the button is, here's the code:

    Code:
    int GetPosition()
    {
    	POINT btnPos;
    	btnPos.x = 978;
    	btnPos.y = 416;
    
    	POINT sbPos;
    	sbPos.x = 1048;
    	sbPos.y = 245;
    
    	POINT bbPos;
    	bbPos.x = 978;
    	bbPos.y = 160;
    
    	POINT epPos;
    	epPos.x = 565;
    	epPos.y = 159;
    
    	POINT mpPos;
    	mpPos.x = 304;
    	mpPos.y = 246;
    
    	POINT coPos;
    	coPos.x = 565;
    	coPos.y = 418;-
    
    	char positionbuf[50];
    
    		if (CheckWhite(btnPos.x, btnPos.y))
    		{
    			sprintf(positionbuf, "We are BTN");
    			UpdateInfoBox(positionbuf);
    			return 5;
    		}
    
    		if (CheckWhite(sbPos.x, sbPos.y))
    		{
    			sprintf(positionbuf, "We are SB");
    			UpdateInfoBox(positionbuf);
    			return 0;
    		}
    
    		if (CheckWhite(bbPos.x, bbPos.y))
    		{
    			sprintf(positionbuf, "We are BB");
    			UpdateInfoBox(positionbuf);
    			return 1;
    		}
    
    		if (CheckWhite(epPos.x, epPos.y))
    		{
    			sprintf(positionbuf, "We are EP");
    			UpdateInfoBox(positionbuf);
    			return 2;
    		}
    
    		if (CheckWhite(mpPos.x, mpPos.y))
    		{
    			sprintf(positionbuf, "We are MP");
    			UpdateInfoBox(positionbuf);
    			return 3;
    		}
    
    		if (CheckWhite(coPos.x, coPos.y))
    		{
    			sprintf(positionbuf, "We are CO");
    			UpdateInfoBox(positionbuf);
    			return 4;
    		}
    		sprintf(positionbuf, "Can't find our position!");
    		UpdateInfoBox(positionbuf);
    		return 10;
    }
    Again, this is for one particular game. Eventually I'll make it so these can be user-saved on the fly.
    Last edited by sraeg; 02-08-2016 at 01:01 PM.

  2. #2
    Threadstarter
    New Member
    sraeg's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    I came across my first stumbling block and overcame it.

    The first stage is getting the cards. As mentioned, to do this I simple picked a row of a card and did a CheckWhite(x,y) across it to get the pattern of whites/non-white pixels.

    So I put checks in that checked this row of the card, compared it to the table.. and it worked.. sometimes.

    What I didn't vouch for is that depending on the suit, some of the anti-aliasing or whatever it is on the cards meant some of these were slightly coloured, and so different suit to suit. So then I had the painful task of taking note of this row for every card in the deck (1 being white, 0 being another colour):

    Code:
    2h - 00000000000000011111110000000000
    2d - 00000000000000011111110000000000
    2s - 00000000000000111111110000000000
    2c - 00000000000000111111110000000000
    
    3h - 00000000001111111111111100000000
    3s - 00000000001111111111111100000000
    3c - 00000000001111111111111100000000
    3d - 00000000001111111111111100000000
    
    4d - 00111111100000000111111000000000
    4h - 01111111000000000111110000000000
    4s - 00111111000000001111110000000000
    4c - 00011111100000000011111000000000
    
    5c - 00000001111100011111111110000000
    5s - 00000001111100001111111110000000
    5h - 00000000111100011111111100000000
    5d - 00000000111100011111111110000000
    
    6h - 00001111111100000001111111100000
    6s - 00111111111000000011111111000000
    6c - 00011111111100000001111111100000
    6d - 00011111111100000001111111100000
    
    7d - 00000000000000111110000000000000
    7h - 00000000000000111110000000000000
    7c - 00000000000000111110000000000000
    7s - 00000000000001111110000000000000
    
    8h - 00000000111111111111111100000000
    8d - 00000000111111111111111100000000
    8c - 00000001111111111111111100000000
    8s - 00000001111111111111111110000000
    
    9d - 00000111111111111111111111100000
    9s - 00000111111111111111111111100000
    9c - 00000001111111111111111111111000
    9h - 00000001111111111111111111111000
    
    Tc - 00001111000011111000000000011111
    Ts - 00001111000011111000000000011111
    Td - 00001111000011111000000000011111
    Th - 00000001110001111100000000001111
    
    Jh - 00000000000000111111100000000000
    Js - 00000000000000111111100000000000
    Jd - 00000000000000111111100000000000
    Jc - 00000000000000111111100000000000
    
    Qc - 11111100000000000000000011111100
    Qh - 11111100000000000000000011111100
    Qd - 11111100000000000010000011111100
    Qs - 11111100000000000000000011111100
    
    Kd - 00111111111111111100000000000000
    Ks - 00111111111111111000000000000000
    Kc - 00011111111111111000000000000000
    Kh - 00111111111111111000000000000000
    
    Ac - 00001111100000000111110000000000
    Ad - 00000111100000000111110000000000
    Ah - 00000111100000000011110000000000
    As - 00001111100000000111110000000000
    From here I deleted the similar ones (Jack for example is the same for every suit), filled arrays, and we were on to a winner:

    Code:
    int c2abuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c2bbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    int c3abuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    int c4abuf[32] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c4bbuf[32] = { 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c4cbuf[32] = { 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c4dbuf[32] = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    int c5abuf[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
    int c5bbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
    int c5cbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c5dbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
    
    int c6abuf[32] = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
    int c6bbuf[32] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 };
    int c6cbuf[32] = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
    
    int c7abuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c7bbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    int c8abuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c8bbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
    int c8cbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
    
    int c9abuf[32] = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
    int c9bbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0 };
    
    int ctabuf[32] = { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1 };
    int ctbbuf[32] = { 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 };
    
    int cjabuf[32] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    int cqabuf[32] = { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 };
    int cqbbuf[32] = { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0 };
    
    int ckabuf[32] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int ckbbuf[32] = { 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int ckcbuf[32] = { 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    
    int caabuf[32] = { 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int cabbuf[32] = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    int cacbuf[32] = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    On completion, I added a suit check using a corner of the card for colour, and voila, now I can detect any card on the table as long as I know it's top left corner. Excuse the code, it's sloppy (as it's just for my own use), and still has some debugging code in.

    Code:
    int GetCard(int x, int y)
    {
    	x = x + 22;
    	y = y + 56;
    
    	int cardv = 15;
    
    	char xbuf[2];
    
    
    	ZeroMemory(CardBuffer, 33);
    	ZeroMemory(xbuf2, 50);
    
    	for (int i = 0; i <= 31; i++)
    	{
    		if (CheckWhite(x, y))
    		{
    			CardBuffer[i] = 1;
    		}
    		else
    		{
    			CardBuffer[i] = 0;
    		}
    		x++;
    		sprintf_s(xbuf, "%d", CardBuffer[i]);
    		lstrcat(xbuf2, xbuf);
    	}
    
    	if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c2abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c2bbuf)))
    	{
    		cardv = 1;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c3abuf))){
    		cardv = 2;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c4abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c4bbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c4cbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c4dbuf))){
    		cardv = 3;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c5abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c5bbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c5cbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c5dbuf))){
    		cardv = 4;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c6abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c6bbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c6cbuf))){
    		cardv = 5;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c7abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c7bbuf))){
    		cardv = 6;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c8abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c8bbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c8cbuf))){
    		cardv = 7;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c9abuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(c9bbuf))){
    		cardv = 8;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(ctabuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(ctbbuf))){
    		cardv = 9;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(cjabuf))){
    		cardv = 10;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(cqabuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(cqbbuf))){
    		cardv = 11;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(ckabuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(ckbbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(ckcbuf))){
    		cardv = 12;
    	}
    	else if (std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(caabuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(cabbuf)) || std::equal(std::begin(CardBuffer), std::end(CardBuffer), std::begin(cacbuf))){
    		cardv = 0;
    	}
    
    	if (cardv == 15)
    	{
    		return 100;
    
    	}
    	else {
    		
    
    		x = x + 2;
    		y = y - 52;
    
    		COLORREF pixel;
    		HDC hdcScreen = GetDC(0);
    		pixel = GetPixel(hdcScreen, x, y);
    		if (pixel != CLR_INVALID){
    			int red = GetRValue(pixel);
    			int green = GetGValue(pixel);
    			int blue = GetBValue(pixel);
    
    			if (red == green == blue)
    			{
    				cardv = cardv + 39;
    			}
    			else if (green > red && green > blue){
    				cardv = cardv + 26;
    			}
    			else if (blue > red && blue > green){
    				cardv = cardv + 13;
    			}
    
    		}
    		ReleaseDC(0, hdcScreen);		
    	}
    	return(cardv);
    }
    On completion, I have a value returned (cardv) between 0 and 51. These equate to the following array:
    Code:
    const char *cardNames[52] = { "Ah", "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "Th", "Jh", "Qh", "Kh",
    				"Ad", "2d", "3d", "4d", "5d", "6d", "7d", "8d", "9d", "Td", "Jd", "Qd", "Kd",
    				"Ac", "2c", "3c", "4c", "5c", "6c", "7c", "8c", "9c", "Tc", "Jc", "Qc", "Kc",
    				"As", "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "Ts", "Js", "Qs", "Ks" };
    - - - Updated - - -

    The next logical step would be to capture bet sizes/pot size, however I'm getting bored of pixel grabbing at the minute so I'm going to look at sorting our preflop ranges for now.

  3. #3
    Threadstarter
    New Member
    sraeg's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    0
    Feeling like I'm making good progress now. Smilies are complete:

    Start:
    Wait for our turn ; find a 'tag' pixel to let us know this
    Get our cards ; initially work on 1 site with known 'tags' on card.. build towards captcha style identifier
    Get our stack size ; could memory read but leaves us susceptible to tracking.. look for tags
    What position are we in? ; tag button
    How much is in the pot? ; more fucking tags
    (kinda) What action was before us? ; tags on buttons
    What street are we on? - Jump to pre-flop/flop/turn/river ; tags on cards

    If pre-flop:
    Are we in our hand-range for this position? ; compare against static chart.. eventually, rank hands and make this a user defined percentage per position
    Act accordingly (fold/call/raise) ; as it says on the tin
    Goto Start ; check for our next turn

    If post-flop:
    What hand do we have? ; join our cards to the board cards are find our holdings
    Act accordingly (check/fold/call/bet/raise) ; the easy part
    Goto Start

    Everything has been done using pixel scanning. For example, here is how we get someones bet size (by counting the chips on the table), based on an x/y anchor point where I know their middle chip will go, check around it, and compare its red value to find the colour of the chip and if its a 1, 5, 25 or 100:

    Code:
    int GetBetSize(int x, int y)
    {
    
    	int loopx = x;
    	int loopy = y;
    
    	int betcounter = 0;
    	PIXEL_GRAB pixgrab;
    
    	for (int i = 0; i <= 6; i = i++)
    	{
    		loopx = x + (i * 12);
    		for (int j = 0; j <= 3; j = j++)
    		{
    			loopy = y + (j * 5);
    			pixgrab = GetColour(loopx, loopy);
    			
    			if (pixgrab.red >= 115 && pixgrab.red <= 119)
    			{
    				betcounter = betcounter + 1;
    				
    			}
    			else if (pixgrab.red >= 31 && pixgrab.red <= 33)
    			{
    				betcounter = betcounter + 5;
    			}
    			else if (pixgrab.red >= 251 && pixgrab.red <= 254)
    			{
    				betcounter = betcounter + 25;
    			}
    			else if (pixgrab.red >= 91 && pixgrab.red <= 95)
    			{
    				betcounter = betcounter + 100;
    			}
    		}
    
    	}
    
    	return(betcounter);
    }
    The part about getting our range was interesting. I found a list online of all cards in order.. looks like this:
    Code:
    AAo
    KKo
    QQo
    AKs
    JJo
    AQs
    KQs
    AJs
    KJs
    TTo
    AKo
    ATs
    QJs
    KTs
    QTs
    JTs
    99o
    AQo
    A9s
    KQo
    88o
    K9s
    T9s
    A8s
    Q9s
    J9s
    AJo
    A5s
    77o
    A7s
    KJo
    A4s
    A3s
    A6s
    QJo
    66o
    K8s
    T8s
    A2s
    98s
    J8s
    ATo
    Q8s
    K7s
    KTo
    55o
    JTo
    87s
    QTo
    44o
    22o
    33o
    K6s
    97s
    K5s
    76s
    T7s
    K4s
    K2s
    K3s
    Q7s
    86s
    65s
    J7s
    54s
    Q6s
    75s
    96s
    Q5s
    64s
    Q4s
    Q3s
    T9o
    T6s
    Q2s
    A9o
    53s
    85s
    J6s
    J9o
    K9o
    J5s
    Q9o
    43s
    74s
    J4s
    J3s
    95s
    J2s
    63s
    A8o
    52s
    T5s
    84s
    T4s
    T3s
    42s
    T2s
    98o
    T8o
    A5o
    A7o
    73s
    A4o
    32s
    94s
    93s
    J8o
    A3o
    62s
    92s
    K8o
    A6o
    87o
    Q8o
    83s
    A2o
    82s
    97o
    72s
    76o
    K7o
    65o
    T7o
    K6o
    86o
    54o
    K5o
    J7o
    75o
    Q7o
    K4o
    K3o
    96o
    K2o
    64o
    Q6o
    53o
    85o
    T6o
    Q5o
    43o
    Q4o
    Q3o
    74o
    Q2o
    J6o
    63o
    J5o
    95o
    52o
    J4o
    J3o
    42o
    J2o
    84o
    T5o
    T4o
    32o
    T3o
    73o
    T2o
    62o
    94o
    93o
    92o
    83o
    82o
    72o
    For those who don't know poker, o means offsuited (eg. 7 of hearts, 6 of clubs) and s means suited (eg. 7 of hearts, 6 of hearts). I added o's to the pairs so we had a set 3 byte format.

    From here, I've put boxes in the GUI to select the range. By default, it plays 16% of hands from the UTG position (first to act). To do this, it takes the number from the GUI (again, 16 by default), and then finds that percentage of 169 (number of possible combos). When comparing to see if our hand fits into the range we define, it will look down the above list however many hands it comes up with (in this case, 16% of 169, so it will check the first 27 hands).

    Now, the bot recognises when it's my turn, tells me what street we're on, what position we're in, what the pot is and how much we have left to call, if our hand is in range... now I just need to make it click fold if no, and call/raise/bet if yes. That's tomorrows job.

    If anyone can tell me what criteria I need to be able to put pics in here, it might make the project a lot more interesting!

Similar Threads

  1. [Request] zynga poker bot or hack
    By talking147 in forum Facebook & Messenger Game Hacks & Cheats
    Replies: 1
    Last Post: 06-04-2014, 02:34 AM
  2. [Request] Zynga Poker Bot or hack. Looking for a good one. Anyone know?
    By sepherin72 in forum Facebook & Messenger Game Hacks & Cheats
    Replies: 3
    Last Post: 04-18-2013, 05:58 PM
  3. Facebook texas hold em poker hack or bot?
    By Anwnimos in forum General Hacking
    Replies: 4
    Last Post: 04-29-2010, 04:29 PM
  4. Facebook texas hold em poker hack or bot?
    By Anwnimos in forum General Hacking
    Replies: 5
    Last Post: 02-22-2010, 02:05 AM
  5. aim bots
    By nutter in forum General Game Hacking
    Replies: 6
    Last Post: 12-27-2005, 11:56 AM