Image Image Image




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Preflop equities
PostPosted: Tue Jun 19, 2012 8:27 am 
Offline
Senior member
User avatar

Posts: 477
Favourite Bot: Donbot
Want to run a preflop sim versus a weighted range of hands? Here is some code.
Code:
public static double sim(double[] oppDistro, int hand)
{
    double ret = 0;
    for (int i = 0; i < hand; i++) //loop hands lower than hand
    {
        double equity = 1-pfEquity[i][hand]; //equity is for opp, therefor 1-
        ret += (oppDistro[i] * equity);
    }
    for (int i = 0; i < pfEquity[hand].Length; i++) //loop hand (AI)
    {
        double equity = pfEquity[hand][i]; //equity is for hand (AI)
        ret += (oppDistro[i] * equity);
    }
    return ret;
}


The order in the array:
Code:
public static string[] pfHands = { "AA", "KK", "QQ", "JJ", "TT", "99", "88", "77", "66", "55", "44", "33", "22", "AKo", "AQo", "AJo", "ATo", "A9o", "A8o", "A7o", "A6o", "A5o", "A4o", "A3o", "A2o", "KQo", "KJo", "KTo", "K9o", "K8o", "K7o", "K6o", "K5o", "K4o", "K3o", "K2o", "QJo", "QTo", "Q9o", "Q8o", "Q7o", "Q6o", "Q5o", "Q4o", "Q3o", "Q2o", "JTo", "J9o", "J8o", "J7o", "J6o", "J5o", "J4o", "J3o", "J2o", "T9o", "T8o", "T7o", "T6o", "T5o", "T4o", "T3o", "T2o", "98o", "97o", "96o", "95o", "94o", "93o", "92o", "87o", "86o", "85o", "84o", "83o", "82o", "76o", "75o", "74o", "73o", "72o", "65o", "64o", "63o", "62o", "54o", "53o", "52o", "43o", "42o", "32o", "AKs", "AQs", "AJs", "ATs", "A9s", "A8s", "A7s", "A6s", "A5s", "A4s", "A3s", "A2s", "KQs", "KJs", "KTs", "K9s", "K8s", "K7s", "K6s", "K5s", "K4s", "K3s", "K2s", "QJs", "QTs", "Q9s", "Q8s", "Q7s", "Q6s", "Q5s", "Q4s", "Q3s", "Q2s", "JTs", "J9s", "J8s", "J7s", "J6s", "J5s", "J4s", "J3s", "J2s", "T9s", "T8s", "T7s", "T6s", "T5s", "T4s", "T3s", "T2s", "98s", "97s", "96s", "95s", "94s", "93s", "92s", "87s", "86s", "85s", "84s", "83s", "82s", "76s", "75s", "74s", "73s", "72s", "65s", "64s", "63s", "62s", "54s", "53s", "52s", "43s", "42s", "32s" };


And if you need the index from the hand string:
Code:
public static Dictionary<string, int> pfIndex = new Dictionary<string, int>(169, StringComparer.OrdinalIgnoreCase) { { "AA", 0 }, { "KK", 1 }, { "QQ", 2 }, { "JJ", 3 }, { "TT", 4 }, { "99", 5 }, { "88", 6 }, { "77", 7 }, { "66", 8 }, { "55", 9 }, { "44", 10 }, { "33", 11 }, { "22", 12 }, { "AKo", 13 }, { "AQo", 14 }, { "AJo", 15 }, { "ATo", 16 }, { "A9o", 17 }, { "A8o", 18 }, { "A7o", 19 }, { "A6o", 20 }, { "A5o", 21 }, { "A4o", 22 }, { "A3o", 23 }, { "A2o", 24 }, { "KQo", 25 }, { "KJo", 26 }, { "KTo", 27 }, { "K9o", 28 }, { "K8o", 29 }, { "K7o", 30 }, { "K6o", 31 }, { "K5o", 32 }, { "K4o", 33 }, { "K3o", 34 }, { "K2o", 35 }, { "QJo", 36 }, { "QTo", 37 }, { "Q9o", 38 }, { "Q8o", 39 }, { "Q7o", 40 }, { "Q6o", 41 }, { "Q5o", 42 }, { "Q4o", 43 }, { "Q3o", 44 }, { "Q2o", 45 }, { "JTo", 46 }, { "J9o", 47 }, { "J8o", 48 }, { "J7o", 49 }, { "J6o", 50 }, { "J5o", 51 }, { "J4o", 52 }, { "J3o", 53 }, { "J2o", 54 }, { "T9o", 55 }, { "T8o", 56 }, { "T7o", 57 }, { "T6o", 58 }, { "T5o", 59 }, { "T4o", 60 }, { "T3o", 61 }, { "T2o", 62 }, { "98o", 63 }, { "97o", 64 }, { "96o", 65 }, { "95o", 66 }, { "94o", 67 }, { "93o", 68 }, { "92o", 69 }, { "87o", 70 }, { "86o", 71 }, { "85o", 72 }, { "84o", 73 }, { "83o", 74 }, { "82o", 75 }, { "76o", 76 }, { "75o", 77 }, { "74o", 78 }, { "73o", 79 }, { "72o", 80 }, { "65o", 81 }, { "64o", 82 }, { "63o", 83 }, { "62o", 84 }, { "54o", 85 }, { "53o", 86 }, { "52o", 87 }, { "43o", 88 }, { "42o", 89 }, { "32o", 90 }, { "AKs", 91 }, { "AQs", 92 }, { "AJs", 93 }, { "ATs", 94 }, { "A9s", 95 }, { "A8s", 96 }, { "A7s", 97 }, { "A6s", 98 }, { "A5s", 99 }, { "A4s", 100 }, { "A3s", 101 }, { "A2s", 102 }, { "KQs", 103 }, { "KJs", 104 }, { "KTs", 105 }, { "K9s", 106 }, { "K8s", 107 }, { "K7s", 108 }, { "K6s", 109 }, { "K5s", 110 }, { "K4s", 111 }, { "K3s", 112 }, { "K2s", 113 }, { "QJs", 114 }, { "QTs", 115 }, { "Q9s", 116 }, { "Q8s", 117 }, { "Q7s", 118 }, { "Q6s", 119 }, { "Q5s", 120 }, { "Q4s", 121 }, { "Q3s", 122 }, { "Q2s", 123 }, { "JTs", 124 }, { "J9s", 125 }, { "J8s", 126 }, { "J7s", 127 }, { "J6s", 128 }, { "J5s", 129 }, { "J4s", 130 }, { "J3s", 131 }, { "J2s", 132 }, { "T9s", 133 }, { "T8s", 134 }, { "T7s", 135 }, { "T6s", 136 }, { "T5s", 137 }, { "T4s", 138 }, { "T3s", 139 }, { "T2s", 140 }, { "98s", 141 }, { "97s", 142 }, { "96s", 143 }, { "95s", 144 }, { "94s", 145 }, { "93s", 146 }, { "92s", 147 }, { "87s", 148 }, { "86s", 149 }, { "85s", 150 }, { "84s", 151 }, { "83s", 152 }, { "82s", 153 }, { "76s", 154 }, { "75s", 155 }, { "74s", 156 }, { "73s", 157 }, { "72s", 158 }, { "65s", 159 }, { "64s", 160 }, { "63s", 161 }, { "62s", 162 }, { "54s", 163 }, { "53s", 164 }, { "52s", 165 }, { "43s", 166 }, { "42s", 167 }, { "32s", 168 } };


See the attached file for code to load the equity array.

Happy botting!
0


Attachments:
File comment: Hand vs hand equity
preflopEquity.rar [47.54 KB]
Downloaded 51 times

_________________
I'm doing my part
Top
 Profile E-mail  
 
 Post subject: Re: Preflop equities
PostPosted: Wed Jun 20, 2012 12:40 pm 
Offline
Junior member
User avatar

Posts: 16
Favourite Bot: Crushex
Nice, pretty much the same I have though :)

What are you using to balance weights during gameplay?


Top
 Profile E-mail  
 
 Post subject: Re: Preflop equities
PostPosted: Thu Jun 21, 2012 12:40 pm 
Offline
Senior member
User avatar

Posts: 477
Favourite Bot: Donbot
I have models, and not the ones in flesh ;)

_________________
I'm doing my part


Top
 Profile E-mail  
 
 Post subject: Re: Preflop equities
PostPosted: Fri Jul 06, 2012 11:18 am 
Offline
New member
User avatar

Posts: 7
Favourite Bot: none
Thanks, using it!


Top
 Profile E-mail  
 
 Post subject: Re: Preflop equities
PostPosted: Mon Jul 09, 2012 8:41 am 
Offline
Senior member
User avatar

Posts: 477
Favourite Bot: Donbot
goofy12 wrote:
Thanks, using it!


Glad to be of help :)

0

_________________
I'm doing my part


Top
 Profile E-mail  
 
 Post subject: Re: Preflop equities
PostPosted: Mon Jul 09, 2012 11:27 am 
Offline
New member
User avatar

Posts: 7
Favourite Bot: none
Anyone experience with adjusting the code above to different situations?

For example, drawing hand situations (SB with 56s and 5 callers before, you better call)?


Top
 Profile E-mail  
 
 Post subject: Re: Preflop equities
PostPosted: Wed Feb 13, 2013 9:33 am 
Offline
Senior member
User avatar

Posts: 477
Favourite Bot: Donbot
Above file was sometimes in the wrong order. Please use this new file. Sorry guys.


Attachments:
pfSim.rar [49.41 KB]
Downloaded 14 times

_________________
I'm doing my part
Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: No registered users and 14 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: