Poker-AI.org http://poker-ai.org/phpbb/ |
|
How to generate x% handrange? http://poker-ai.org/phpbb/viewtopic.php?f=24&t=2564 |
Page 1 of 2 |
Author: | Seikez [ Tue Aug 27, 2013 1:32 pm ] |
Post subject: | How to generate x% handrange? |
I need a method or a library that gives me a hand range from a percentage. With that, I could then let my opponent modeler guess a percentage figure for each opponent, get the hand range for that percentage and then run the hand evaluator with these hand ranges to get equities for all players. In PokerStove and ProPokertools you can get a hand range by specifying a percentage, which gives you a range with top x% hands. These programs seem to always generate the same ranges, independent of number of opponents. There is also a online tool that generates hand ranges from a percentage on this site: http://www.pokerhandrange.com/ This tool generates slightly different ranges depending on if there are 1, 2 or 3 opponents. 1. Should number of opponents affect the hand range for a certain percent figure? 2. When we get a range for top x% hands, what does that actually mean? Top x% according to what criterion? 3. Where can I get a library or code that generates hand ranges from a percentage? |
Author: | ibot [ Tue Aug 27, 2013 2:25 pm ] |
Post subject: | Re: How to generate x% handrange? |
There are a few posts in the old forum covering this, but this is the main part of code from it that I use. Code: static String[] reducedRange = new String[] { "AA", "KK", "QQ", "JJ", "TT", "AKs", "99", "AQs", "AJs", "KQs", "AKo", "88", "ATs", "KJs", "AQo", "KTs", "QJs", "77", "A9s", "AJo", "KQo", "QTs", "A8s", "K9s", "JTs", "A7s", "ATo", "66", "KJo", "Q9s", "A6s", "A5s", "QJo", "KTo", "K8s", "A4s", "J9s", "A9o", "T9s", "K7s", "A3s", "55", "Q8s", "QTo", "A2s", "K6s", "JTo", "J8s", "A8o", "K9o", "K5s", "T8s", "Q7s", "K4s", "44", "98s", "A7o", "Q6s", "J7s", "K3s", "Q9o", "K2s", "T7s", "Q5s", "A5o", "A6o", "J9o", "K8o", "97s", "87s", "33", "Q4s", "T9o", "J6s", "A4o", "K7o", "A3o", "Q8o", "Q3s", "Q2s", "J5s", "T6s", "22", "96s", "A2o", "76s", "86s", "J4s", "J8o", "K6o", "T8o", "J3s", "K5o", "J2s", "T5s", "Q7o", "75s", "98o", "T4s", "65s", "85s", "95s", "K4o", "J7o", "T3s", "T2s", "Q6o", "T7o", "94s", "K3o", "74s", "64s", "54s", "Q5o", "84s", "97o", "K2o", "93s", "87o", "Q4o", "92s", "53s", "J6o", "73s", "83s", "63s", "43s", "Q3o", "T6o", "J5o", "82s", "86o", "76o", "Q2o", "96o", "52s", "62s", "J4o", "42s", "72s", "T5o", "32s", "J3o", "75o", "65o", "95o", "85o", "J2o", "T4o", "T3o", "54o", "64o", "T2o", "94o", "84o", "74o", "93o", "53o", "92o", "63o", "73o", "43o", "83o", "82o", "52o", "62o", "42o", "72o", "32o" }; public static ArrayList<String> getRange(double percentage) { if (percentage <=1) percentage *= 100; double total = 0; ArrayList<String> range = new ArrayList<String>(); for (String s : reducedRange) { if (s.indexOf("s") > 0) { total += (4 / (double)1326); } else if (s.indexOf("o") > 0) { total += (12 / (double)1326); } else { total += (6 / (double)1326); } if (total > (percentage / (double)100)) { break; } else { range.add(s); } } return range; } The top x% usually refers to the hands in order of strength. So the top 10% of hands will return the strongest 10% of hands. As far as I know, the number of opponents doesn't affect the hand range of a certain figure. However, it would be important to remove any hands that are known (e.g. your own). |
Author: | shalako [ Tue Aug 27, 2013 4:34 pm ] |
Post subject: | Re: How to generate x% handrange? |
I have been dealing with this problem for awhile now. The big issue is that people do not follow TopX%. In a vacuum they should but in reality they do not. One reason/example is that suited connectors and gappers have poor hand strength but they are strong because of the pressure you can put on the villain post flop. So if you use TopX to construct a range many of those hands will not be in there. Another issue is low pairs. You will see many players set mine these types of hands but they will be out of range as well. I switched from TopX to a handset that is based on actual HH files. The differences are pretty big. |
Author: | Seikez [ Tue Aug 27, 2013 5:33 pm ] |
Post subject: | Re: How to generate x% handrange? |
Quote: There are a few posts in the old forum covering this, but this is the main part of code from it that I use Thanks ibot! I will try that code for a first attempt at generating handlists from percentage. However... Quote: The big issue is that people do not follow TopX%. ... sounds right to me. Thanks for your input, shalako. Could you please tell us more about your method? I gather you have analyzed a a list of hand histories and have boiled them down to a number of lookup tables. How did you do that? Then you will have to choose one of these tables depending on your opponent and his behavior. How do you do that? |
Author: | shadehs [ Tue Aug 27, 2013 8:04 pm ] |
Post subject: | Re: How to generate x% handrange? |
I'm curious me too about shalako method. I'm using custom ranges anyway because at micros everyone flats small pairs, so if you get called you must include 22+. Also i think that calling range table is different from raise range table. |
Author: | shalako [ Wed Aug 28, 2013 5:04 am ] |
Post subject: | Re: How to generate x% handrange? |
Well I use PPT and Pokerstove like everybody else but I pass a specific range to it using the HH cardset and not the TopX cardset that is so common. I do not use a LUT. I take the villains stats and form the range like normal. Where things get complicated is forming bluff ranges. An example is a high 3B percentage. if it is low..like say under 6% you know his 3 bets are pretty much all value. But if its higher..say above 10% (I think the standard is around 12) then there is some air or speculative hands in his range because any of the other hands would generally be calling (like broadways, smaller pairs etc) and not raising. These ranges you will have to form yourself because TopX will not work. An example is if his 3B% is 12% you cannot just use the top 12% to form his range as at least half of those hands would be better off flatting vs raising EV wise. So basically you construct a value range (like 99+, AK+, AQs etc) and a bluff range (SC, Suited gappers, AXs etc). Not a good idea to form a set range but for now I cannot figure out a better solution on the bluff side. Its not uncommon to run into players with 20+ 3B% in HU. If you dont 4B them you can get into trouble fast. The bot will have to widen its 4B range or flatting range or it will get run over quickly. The higher a villains 3B stat the more complicated it gets. This is where having some kind of weighted range would be of use. I can weight the cardset by just reducing the number of combos of certain hands when running equity which is one way to do it. One thing I am working on is using the showdown info to verify/add what hands are in his ranges. The only real ones of importance are the 3B and 4B hands pre and what he raises with post. This info will help figure out how polarized a villains betting habits are. |
Author: | Seikez [ Wed Aug 28, 2013 9:28 am ] |
Post subject: | Re: How to generate x% handrange? |
Thanks shalako! I am in the early stages of my bot. Still gathering basic information on botting and trying to decide on a general architecture and what technology to use (NN, rules based, etc...). Your answer therefore triggered a number of new questions: You say you "use PPT and Pokerstove like everybody else" 1. Does this mean you use PPT Poker Query Language in your bot via the XMLRPC server API? 2. Are you using the PokerStove evaluator code from https://github.com/andrewprock/pokerstove, or are you using PS in som other way? You say you are "using the HH cardset and not the TopX cardset" 3. Thanks to the answer from ibot, I now know how to generate TopX handranges. But what is the "HH cardset" and how do you get it? You say that "I take the villains stats and form the range like normal" 4. This sounds like a very high level description of the bots opponent modeller. I haven't started looking at the design of the OM yet, but I realize it will not be a trivial task. From what you say I almost get the impression there is a "normal" way to do it. How do I do it? Could you point me in the right direction? |
Author: | shalako [ Wed Aug 28, 2013 3:49 pm ] |
Post subject: | Re: How to generate x% handrange? |
Quote: You say you "use PPT and Pokerstove like everybody else" 1. Does this mean you use PPT Poker Query Language in your bot via the XMLRPC server API? 2. Are you using the PokerStove evaluator code from https://github.com/andrewprock/pokerstove, or are you using PS in som other way? I currently use the PPT command line tool but it is very slow. I am trying to get the pokerstove code to work but I am having some issues. One thing I do not like about pokerstove is that its equity engine based on hand vs three random hands. The upside is that its very fast. Quote: But what is the "HH cardset" and how do you get it? Here is a list of hand rank systems: http://www.bigbetsoftware.com/holdemviewer/rankings/ I use the Real Play Statistics HU set. As you can see there are quite a few different systems. HoldemViewer allows you to change the cardset which is a really cool feature. I wish Pokerstove did that. PPT has a few different ones as well. Quote: You say that "I take the villains stats and form the range like normal" 4. This sounds like a very high level description of the bots opponent modeller. I haven't started looking at the design of the OM yet, but I realize it will not be a trivial task. From what you say I almost get the impression there is a "normal" way to do it. How do I do it? Could you point me in the right direction? Naw that is easy. Rough examples for HU: Your on the BB and villain raises 80% of buttons your range would be AA-80% of hands. If your on the button and raise and he calls the range would be his 3B % up to his BB calling %. So lets say its 5% 3B and 35% call..so your range is 5-35% of hands. So basically you eliminate his raising hands. Now like I stated above it gets a little more involved then that but you get the idea. You have to program every scenario like limping, 3B, 4B, shove etc. Luckily there are not that many for HU. For ring it will get more complicated because there will be many more scenarios to deal with. For a preflop shove I think using a LUT is good. I just stoved all the hands down to 35% equity and created my own LUTs. I think I stoved it for 4 different ranges/scenarios. For anything below 20BB you can just use the NE charts. I use the Magriel number (Magriel = Stack/(BB+SB)) which I think is a better reflection of effective stack sizes. Magriel kicks in quite a bit earlier then what would be considered normal...like 50% earlier. I may change it but I am not sure which is better as I have never heard any discussion about it. |
Author: | Seikez [ Wed Aug 28, 2013 7:06 pm ] |
Post subject: | Re: How to generate x% handrange? |
Quote: I use the Real Play Statistics HU set Yes, I think that should reflect actual play better than a list generated by some synthetic algorithm. Maybe. But why do you say it is for HU? It doesn't say anything about HU on the page where you can get the list: http://www.pokerroom.com/poker/poker-school/ev-stats/total-stats-by-card/?sSortOrder=value&x=19&y=16 I get the impression it is based on all types of Holdem games. Right? Quote: Naw that is easy. Rough examples for HU: From your description here I guess that your bot is EV or rules based, not a N-Net bot. Right? I say this because I am trying to understand the different technologies you can use when making a bot. What you describe here is a kind of rules based function in your bot that will effect the actions it takes. As far as I understand, the Neural Net ARE the rules in a NN-bot. I guess that inserting another set of rules (your rules based opponent modeller) that affects the decisions taken by the NN-rules might not work very well. Right? Quote: For ring it will get more complicated because there will be many more scenarios to deal with. The bot I am developing will play ring games. How can I know all scenarios it has to handle? |
Author: | shalako [ Wed Aug 28, 2013 9:47 pm ] |
Post subject: | Re: How to generate x% handrange? |
Quote: But why do you say it is for HU? It doesn't say anything about HU on the page where you can get the list: http://www.pokerroom.com/poker/poker-school/ev-stats/total-stats-by-card/?sSortOrder=value&x=19&y=16 I get the impression it is based on all types of Holdem games. Right? There is another page in which you can specify what game you want stats from. Just look around the site. Quote: From your description here I guess that your bot is EV or rules based, not a N-Net bot. Right? I say this because I am trying to understand the different technologies you can use when making a bot. What you describe here is a kind of rules based function in your bot that will effect the actions it takes. As far as I understand, the Neural Net ARE the rules in a NN-bot. I guess that inserting another set of rules (your rules based opponent modeller) that affects the decisions taken by the NN-rules might not work very well. Right? Mine is all rules based. I have no idea have NN bots work. I like having total control of the bots actions so I have avoided any of that stuff. Quote: The bot I am developing will play ring games. How can I know all scenarios it has to handle? Well your just going to have to go thru each seat and set up scenarios. An example is the button. Your gonna have to have rules based on whether your first in, raised pot, limped pot, open shove etc. Then your also going to have to have rules based on not just your first action but subsequent actions..like if you get reraised. That is just preflop. For post flop your gonna have to have rules based on again..first in, bet into, LTA, FTA, preflop raiser, HU or multiway, hand strength etc |
Author: | shadehs [ Thu Aug 29, 2013 7:07 am ] |
Post subject: | Re: How to generate x% handrange? |
The problem with this reduced Range is that works only for raises and not for callers: ibot wrote: Code: static String[] reducedRange = new String[] { "AA", "KK", "QQ", "JJ", "TT", "AKs", "99", "AQs", "AJs", "KQs", "AKo", "88", "ATs", "KJs", "AQo", "KTs", "QJs", "77", "A9s", "AJo", "KQo", "QTs", "A8s", "K9s", "JTs", "A7s", "ATo", "66", "KJo", "Q9s", "A6s", "A5s", "QJo", "KTo", "K8s", "A4s", "J9s", "A9o", "T9s", "K7s", "A3s", "55", "Q8s", "QTo", "A2s", "K6s", "JTo", "J8s", "A8o", "K9o", "K5s", "T8s", "Q7s", "K4s", "44", "98s", "A7o", "Q6s", "J7s", "K3s", "Q9o", "K2s", "T7s", "Q5s", "A5o", "A6o", "J9o", "K8o", "97s", "87s", "33", "Q4s", "T9o", "J6s", "A4o", "K7o", "A3o", "Q8o", "Q3s", "Q2s", "J5s", "T6s", "22", "96s", "A2o", "76s", "86s", "J4s", "J8o", "K6o", "T8o", "J3s", "K5o", "J2s", "T5s", "Q7o", "75s", "98o", "T4s", "65s", "85s", "95s", "K4o", "J7o", "T3s", "T2s", "Q6o", "T7o", "94s", "K3o", "74s", "64s", "54s", "Q5o", "84s", "97o", "K2o", "93s", "87o", "Q4o", "92s", "53s", "J6o", "73s", "83s", "63s", "43s", "Q3o", "T6o", "J5o", "82s", "86o", "76o", "Q2o", "96o", "52s", "62s", "J4o", "42s", "72s", "T5o", "32s", "J3o", "75o", "65o", "95o", "85o", "J2o", "T4o", "T3o", "54o", "64o", "T2o", "94o", "84o", "74o", "93o", "53o", "92o", "63o", "73o", "43o", "83o", "82o", "52o", "62o", "42o", "72o", "32o" }; If Villain has VPIP=18% and PFR=14%, this works. Code: villainRaisingRange = getRange(14); But this doesn't: Code: villainCallingRange = getRange(18); for (int i = 0; i < villainRaisingRange.Count; i++ ) { villainRaisingRange.Remove(villainRaisingRange[i]); } because getRange(18) doesn't include 22+ but only 66+ and doesn't include many speculative hands, like 98s, 87s, AXs. So you should have a reduced Raising Range: Code: static String[] reducedRange = new String[] { "AA", "KK", "QQ", "JJ", "TT", "AKs", "99", "AQs", "AJs", "KQs", "AKo", "88", "ATs", "KJs", "AQo", "KTs", "QJs", "77", "A9s", "AJo", "KQo", "QTs", "A8s", "K9s", "JTs", "A7s", "ATo", "66", "KJo", "Q9s", "A6s", "A5s", "QJo", "KTo", "K8s", "A4s", "J9s", "A9o", "T9s", "K7s", "A3s", "55", "Q8s", "QTo", "A2s", "K6s", "JTo", "J8s", "A8o", "K9o", "K5s", "T8s", "Q7s", "K4s", "44", "98s", "A7o", "Q6s", "J7s", "K3s", "Q9o", "K2s", "T7s", "Q5s", "A5o", "A6o", "J9o", "K8o", "97s", "87s", "33", "Q4s", "T9o", "J6s", "A4o", "K7o", "A3o", "Q8o", "Q3s", "Q2s", "J5s", "T6s", "22", "96s", "A2o", "76s", "86s", "J4s", "J8o", "K6o", "T8o", "J3s", "K5o", "J2s", "T5s", "Q7o", "75s", "98o", "T4s", "65s", "85s", "95s", "K4o", "J7o", "T3s", "T2s", "Q6o", "T7o", "94s", "K3o", "74s", "64s", "54s", "Q5o", "84s", "97o", "K2o", "93s", "87o", "Q4o", "92s", "53s", "J6o", "73s", "83s", "63s", "43s", "Q3o", "T6o", "J5o", "82s", "86o", "76o", "Q2o", "96o", "52s", "62s", "J4o", "42s", "72s", "T5o", "32s", "J3o", "75o", "65o", "95o", "85o", "J2o", "T4o", "T3o", "54o", "64o", "T2o", "94o", "84o", "74o", "93o", "53o", "92o", "63o", "73o", "43o", "83o", "82o", "52o", "62o", "42o", "72o", "32o" }; and a reduced Calling Range that it's different. Code: static String[] reducedCallingRange = new String[] { ... };
|
Author: | AiWins [ Fri Aug 30, 2013 4:49 am ] |
Post subject: | Re: How to generate x% handrange? |
If you are going to go for a population based starting hand rankings (which is the only viable option for what you need) you will need to assign an independent chance to each initial hand. It is true that if villain raises .9% of the times, when he raises he is almost half of the time holding pocket aces (ignoring blockers). But this doesn't hold for wider ranges, if your villain raises 70% of the hands, that doesn't mean he is never raising bottom 30% of his hands, that should be clear. That's why a population based approach is so hard. Also, the handrange will depend on the type of situation and action the player is taken, all hand rankings will be different for raising, calling, betting and checking. And they will even be different depending on their opponent's hand range and their opponent's perception of his own hand range. It's cool that you thought you had the game solved once you figured the hand range, but getting an accurate hand range is the hard part. If you do know your opponent's range, then making the optimal decision is trivial. |
Author: | Seikez [ Fri Aug 30, 2013 6:32 am ] |
Post subject: | Re: How to generate x% handrange? |
Quote: If you do know your opponent's range, then making the optimal decision is trivial. So, how do you actually do it? Please enlighten me. In my experience, few things are trivial. Most are much more complicated than you at first guess. |
Author: | shadehs [ Fri Aug 30, 2013 7:51 am ] |
Post subject: | Re: How to generate x% handrange? |
Seikez wrote: Quote: If you do know your opponent's range, then making the optimal decision is trivial. So, how do you actually do it? Please enlighten me. I'm interested too in this topic, however can i assert that, at micros (NL 2, 5, 10) 6max and full ring , for the most of my opponents, this rule: Code: "For wider ranges, if your villain raises 70% of the hands, that mean he is never raising bottom 30% of his hands" is true the most of the times (let's say 90% of the times)? |
Author: | grab [ Fri Aug 30, 2013 10:09 am ] |
Post subject: | Re: How to generate x% handrange? |
imho the whole idea of generating a top x% range is very flawed. For example if villain is 3betting 11% in a given situation, that doesn't mean he is 3betting the top 11%, i.e. 77+, A9s+, KTs+, QTs+, ATo+, KQo. Most people 3bet the strongest hands, call the rest, and 3bet the strongest hands that can't profitably call a raise. So maybe something like that: 77+, AJs+, A5s-A2s, K8s-K6s, J9s, T9s, 98s, AKo, A9o-A8o, JTo And furthermore, even if you focus only on open raise and flat call ranges, 99% of the players (except the 24 tabling nits who know they ranges for any situation and never deviate) will heavily vary their ranges based on mood, reputation from the past few hands, table dynamics, perceived opponent behaviour... So something better might be to give each starting hand a weight based on past observations - for example, 99.99% to raise KK in a given spot, 78% for JTs, 14% for 56s, 3% for K2o, 0.2% for 63o... However, you're going to need a huge database to make statistically relevent conclusions for the exact numbers are. |
Author: | shalako [ Fri Aug 30, 2013 2:10 pm ] |
Post subject: | Re: How to generate x% handrange? |
Quote: imho the whole idea of generating a top x% range is very flawed. Yeah I agree with you totally. It has been a real thorn in my HU bot development. Quote: For example if villain is 3betting 11% in a given situation, that doesn't mean he is 3betting the top 11%, i.e. 77+, A9s+, KTs+, QTs+, ATo+, KQo. Most people 3bet the strongest hands, call the rest, and 3bet the strongest hands that can't profitably call a raise. Quote: So maybe something like that: 77+, AJs+, A5s-A2s, K8s-K6s, J9s, T9s, 98s, AKo, A9o-A8o, JTo So in general they are 3 betting all value, higher SC, low suited blockers and flatting the broadways etc. That is almost identical to what I have coded now but its not dynamically adjusting the range like the rest of my bot. I am going to have to widen the value and bluff range based on his 3B stat. For now its the only solution I can come up with. Quote: And furthermore, even if you focus only on open raise and flat call ranges, 99% of the players (except the 24 tabling nits who know they ranges for any situation and never deviate) will heavily vary their ranges based on mood, reputation from the past few hands, table dynamics, perceived opponent behaviour... This is a good point but is probably too difficult to figure out reliably. Quote: So something better might be to give each starting hand a weight based on past observations - for example, 99.99% to raise KK in a given spot, 78% for JTs, 14% for 56s, 3% for K2o, 0.2% for 63o... However, you're going to need a huge database to make statistically relevent conclusions for the exact numbers are. Yeah I think this is the only way to do it with any degree of accuracy in the long run. |
Author: | AiWins [ Fri Aug 30, 2013 10:26 pm ] |
Post subject: | Re: How to generate x% handrange? |
grab wrote: For example if villain is 3betting 11% in a given situation, that doesn't mean he is 3betting the top 11%, i.e. 77+, A9s+, KTs+, QTs+, ATo+, KQo. grab wrote: top 11%, i.e. 77+, A9s+, KTs+, QTs+, ATo+, KQo. That's funny. That's exactly what a hand range is, how else would you rank 11% best hands. |
Author: | AiWins [ Fri Aug 30, 2013 11:22 pm ] |
Post subject: | Re: How to generate x% handrange? |
Seikez wrote: Quote: If you do know your opponent's range, then making the optimal decision is trivial. So, how do you actually do it? Please enlighten me. In my experience, few things are trivial. Most are much more complicated than you at first guess. Taking the optimal decision when you know your opponent's hand is trivial, right? Now you know your opponent's true odds of having each card. Really trivial. Calculate the EV of each move for each of your opponent's card, then choose the option that gives the most EV on average. |
Author: | Seikez [ Sat Aug 31, 2013 10:18 am ] |
Post subject: | Re: How to generate x% handrange? |
Quote: Calculate the EV of each move for each of your opponent's card, then choose the option that gives the most EV on average. Yeah, that sounds simple enough. But how do you actually do it? Lets say I have just seen the flop. Now I want to find out what action my bot should take. How can I find the best EV in this situation in the time I have (say 15 seconds)? There can be a very large number of different games just on the flop depending on the actions taken by other players. Multiply that with all possible actions on turn and river an my bot would have to do approximately 6.97 gazillion evaluations to find the optimal action. That will not be ready by next Friday, and definitely not in 15 second or so when I need the answer. See my problem? (but maybe the problem is that I am missing something?) How to do it? |
Author: | spears [ Sat Aug 31, 2013 12:15 pm ] |
Post subject: | Re: How to generate x% handrange? |
Seikez wrote: How to do it? Look up tables, Monte Carlo Tree Search. But that isn't the whole answer, because it assumes you know oppo's strategy in some detail and assume it is stationary. |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |