Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Learn how I made a working PokerBot for Pokerstars


  • Please log in to reply
38 replies to this topic
nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

 

1) Locate or create a combination table with all millions of entries. Make a cashe table and query it. Not so much an "evaluator"...

This is the better Idea. If you're doing this properly it's extremly fast.
As I said before a look up table would consume round about 224 GB.
The only thing you can do is leave out the color first and then calculate with it additionally afterwards.

 

The basic thought of the Cactus Kev evaluator is the following:

You assign every type of card a prime number and then you multiply them.

Afterwards you look in a table for the calculated number.

This works easy for a five card poker game, but not for Texas Hold 'em.

So we'll have to modify a few things:

 

1. There is a difference between your Hand cards and the other cards.

2. There are 7 cards.

 

So we'll have 26 types of cards:

13 types Hand cards and 13 types non-hand cards (dunno about the english word.)

This makes 26 types of cards in total.

We'll just assign each type a different prime number.

When we're now multiplying each number of each card we get a unique result.

If you want you can calculate further with the result.

We should be able to look up the final result in an small table.


Visit the new forum ahkscript.org.

http://ahkscript.org


bot
  • Members
  • 12 posts
  • Last active: Oct 21 2013 09:52 AM
  • Joined: 10 Sep 2013
Hi nnnik,
 
I have to read more about cactus kev method, so far I think is like multiplied all cards and looking the result in a table; Which sound neat, but I will have first to construct the table for 7 cards... I don't see much difference between that and making a table with Card1, Card2, Card3, Card4 ... Card7 - Hand. I know all about is faster to look for a integer than 7 separated pair of alfanumeric, I am ORACLE DBA and I see the difference in performance, but not in the method per se, am I wrong?
 
Also that doesn't help in the iteration part, because I will have to alter everything in order to implement cactus... I notice my way, even when far for perfect, is losing much of the time in the iteration itself, and not in the evaluation, I didn't see that when processing millions of hands, but when processing billions and trillions of hands... Only to register less than 1% ! Not worth it. I have to make a function that gives me a random hand in a range, and process only those thousands I want, not a complete iteration, only a loop of 10000 or so. In others words, true monte carlo.
 
I know you are right about cactus method being the best, but it requires I start almost from scratch. I think I am going to try this modification in the iteration process and see how it goes.
 
Mean while I have identified and implemented some points which made the bot even faster:
 
1) Implement LIFO (Last In First Out) in cards, so It finds the cards much faster.
2) Looking for the color and then look for the card. That way It would be max 17 searches, instead of max 52 searches.
3) Putting some other information in cashe.
4) Ordering the "number searching" so It finds quickly the amounts in the screen. Why search "0" first? when It would never start at 0. I ordered in a logic way: 321546789 first, and 0987... after (Most tourneys start with 3000 2000 1500 5000 10000 chips, and then appear the 9, 8, etc).
5) Moving some more file information into memory.
 
This helped a lot, specially first one. Everything related with imagesearch is time expensive. As you may see, I still am improving workflow events.
 
Right now my bot handles 5 to 7 tables just fine, I get to test it with 10 tables. Although It has trouble when multiple postflop activity in half of the tables, deemed pokerstove!
 
Something important I did, I don't know if I already told you this, Besides random delays when fewer tables are opened, in order to humanize the bot I included random pixel clicking in the Fold/Check/Bet/Max/Call button, and switching between clicking and sending the corresponding short cut. I know this is basic botting stuff, but I didn't have it in my program, and I think other people may fall into same mistake.
 
I love to improving my bot, and the final result is near fantastic ;) But I have a day job, a wife and a daughter, and balancing all this is exhausting. You see, my bot is not profiting enough for me to quit my job, hehehehehe One week it wins 2k, and the next two lose hundreds, and the next two it breaks even... In the long run It is still not producing enough to make me decide something so radical like quitting the job. But It generates way over much people win in my country with a 8 hour job ;P
 
My friends and I had a group which served to soft the bot fluctuations, and to program new functions but we thought different about the future and decided to split. Some thought the cash table bot is the way to go, others like me thought tourneys are already being lucrative, so we can multiplex even more this one. Also there was a question about stakes...
 
Thanks for your help,
 
PS: I am including information about time per function in the debug file; and I am using, beside A_TickCount, diff between dates with A_Now, but when:
v_Diff_Date := A_Now - v_Initial_Date
It treats them like numbers. I am trying with envsub without sucess. Have you done something like this?
 
Thanks again.


nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

 

 

I have to read more about cactus kev method, so far I think is like multiplied all cards and looking the result in a table; Which sound neat, but I will have first to construct the table for 7 cards... I don't see much difference between that and making a table with Card1, Card2, Card3, Card4 ... Card7 - Hand. I know all about is faster to look for a integer than 7 separated pair of alfanumeric, I am ORACLE DBA and I see the difference in performance, but not in the method per se, am I wrong?

Kind of:

The look up table would be larger due to the fact that it matters in wich order the cards are on the Table.

e.g. you have too look for QK and for KQ

If its 13*12 the result is always the same, the order doesn't matter.

So it's simply less work.

 

 

 

Also that doesn't help in the iteration part, because I will have to alter everything in order to implement cactus... I notice my way, even when far for perfect, is losing much of the time in the iteration itself, and not in the evaluation, I didn't see that when processing millions of hands, but when processing billions and trillions of hands... Only to register less than 1% ! Not worth it. I have to make a function that gives me a random hand in a range, and process only those thousands I want, not a complete iteration, only a loop of 10000 or so. In others words, true monte carlo.

The main point of the Speed up is too save the reult of an Monte Carlo in Array wich can be loaded very easily.

You can even use an more complex Algorithm cause if you store the results you don't need the calculation every time.

This way you'll make your bot more optimized it will produce better results.

 

But something you could also improve is behavior:

It shouldn't only be able to say something random.

If it bluffs it should say something like hmmm... I'll bet (large amount).

As soon as the others realize that they can predict his cards based on his behavior he should just do the opposite :He has good cards and says hmmm... I'll bet (large amount) and the people will stay assuming that he's just bluffing.

This is just one of the tricks your bot could learn. Simply watching peoples behavior won't do it cause your bot would fall for tricks like that.


Visit the new forum ahkscript.org.

http://ahkscript.org


bot
  • Members
  • 12 posts
  • Last active: Oct 21 2013 09:52 AM
  • Joined: 10 Sep 2013

About the table cards, you don't have to make those two entries (KQ and QK) if you order the input cards first, just have to do that once, which I already do.

 

On the other hand, right now my bot is working with string recognition. For example, for a three of a kind, without ordering:

 

if (isCard(v_cards,"Ac")+isCard(v_cards,"Ad")+isCard(v_cards,"As")+isCard(v_cards,"Ah")=3)
   v_out := "07 - A"
else if (isCard(v_cards,"Kc")+isCard(v_cards,"Kd")+isCard(v_cards,"Ks")+isCard(v_cards,"Kh")=3)
   v_out := "07 - K"
...
 
Or if you like, after ordering:
 
if (instr(v_cards,"AAA")>=0)
   v_out := "07 - A"
else if (instr(v_cards,"KKK")>=0)
   v_out := "07 - K"
...
 
Remember, It only be executed after others better ranked hands, so It would never have a poker... This part was kind of easy, I expected something harder.
 
I still think cactus is better; But I will give my pity method a try :( That's because I already have this method working perfectly. I tell you as it goes after improving the iteration part, which as I said, it is working just fine for 2 and 3 players.

 

Finally, I think you have some pretty good ideas about using comments based on my cards in order to get calls. Until now they were separated modules, which work based on priorities and load: less tables more comments. Beside work load, they never communicate.

 

I think your idea is really nice, and it is on my to do list.

 

Nevertheless, I have to say that idea is better for cash games, where bluff have an even bigger impact. Poker skills are important in cash game, but in tourneys strategy is much more important, that's why I reduced bluff to minimum and never show the cards, after 4 hours in a tourney a bluff could be mortal ! Even more in not limit.

 

Right now I am fixing a problem that came with an opportunity: Golden tables, which are super nice to my bot income, but they bring new images that generated bugs. Until I solve this I'll do nothing else. Also I have a lot of work in my day job...

 

Thanks nnnik, I will be in touch.



bot
  • Members
  • 12 posts
  • Last active: Oct 21 2013 09:52 AM
  • Joined: 10 Sep 2013

Hi nnnik,

 

Forget about the timestamp problem. I finally understood A_TickCount is referring time in miliseconds... I thought It was number of cpu processor ticks... So I used that variable instead.

 

Problem solved.

 

I just have to fix my pokerstove problem.

 

Thanks



nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

I 'll be traing to write an faster evaluation and iteration, ok?


Visit the new forum ahkscript.org.

http://ahkscript.org


gemini
  • Members
  • 1 posts
  • Last active: Oct 28 2013 08:59 AM
  • Joined: 22 Oct 2013

hi guys, I'm trying to develop a simple bot that works in the cash tables with the short strategy...
 

I have a problem with the pot size recognition, I use the ocr's technique, but my recognition software (capture2text) is quite inaccurate, especially with the little tables (400x320).

 

from what I read, you are skilled enough ... what technique (or support software) do you use?

can you give me some example code? thanks for the answers ...



sinkfaze
  • Moderators
  • 6367 posts
  • Last active: Nov 30 2018 08:50 PM
  • Joined: 18 Mar 2008

Have you tried checking at the 2+2 forums?  There's a sizable crowd of AHK users amongst online poker players, and those forums tends to be home to a lot of them.



nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Thanks for the advice.


Visit the new forum ahkscript.org.

http://ahkscript.org