Poker-AI.org

Poker AI and Botting Discussion Forum
It is currently Mon Nov 13, 2023 2:23 pm

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Preflop Indexing
PostPosted: Thu Nov 14, 2013 1:30 pm 
Offline
Junior Member

Joined: Wed Sep 04, 2013 6:05 pm
Posts: 47
Hey Guyz,

Following my Preflop indexing :

Code:
static int Preflop_NonSuited_Offset[13] = {0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66};
static int Preflop_Suited_Offset[12] = {0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55};


int getPreflopCardsIndex(int holecard1, int holecard2)
{
   
   int suit_holecard1 = (int)holecard1/13;
   int suit_holecard2 = (int)holecard2/13;
   
   int rank_holecard1 = holecard1%13;
   int rank_holecard2 = holecard2%13;
   
   if(rank_holecard1>rank_holecard2)
   {
      std::swap(rank_holecard1,rank_holecard2);
   }
   
   if(suit_holecard1 != suit_holecard2)
   {
      int index = ((rank_holecard1*13) - Preflop_NonSuited_Offset[rank_holecard1]) + (rank_holecard2 - rank_holecard1);
      return index;
   }
   else
   {
      int index = 91 + (((rank_holecard1*12) - Preflop_Suited_Offset[rank_holecard1]) + ((rank_holecard2 - rank_holecard1)-1));
      return index;
   }

   return -1;
}


Probably there is a clever way to do it... Just tell me ;)


MrNice


Top
 Profile  
 
 Post subject: Re: Preflop Indexing
PostPosted: Thu Nov 14, 2013 1:32 pm 
Offline
Veteran Member

Joined: Thu Feb 28, 2013 2:39 am
Posts: 437
You might look at the HoldemHand library, or one of the many LUTs for ideas. I use a preflop 169 for bucketing, there's not much reason to do otherwise if you're working with disconnected rounds.


Top
 Profile  
 
 Post subject: Re: Preflop Indexing
PostPosted: Thu Nov 14, 2013 1:44 pm 
Offline
Junior Member

Joined: Wed Sep 04, 2013 6:05 pm
Posts: 47
HoldemHand library ? Have you a link to the library ?

I have checked on some lut... and investigated the one of PokerJokus...

The point is that he was using a search function (for loop) to find the patterns and deduce the index....

I was interested how to avoid the for loop....

This is why I have coded mine...


Top
 Profile  
 
 Post subject: Re: Preflop Indexing
PostPosted: Thu Nov 14, 2013 4:12 pm 
Offline
Junior Member

Joined: Thu Nov 14, 2013 2:56 pm
Posts: 12
MrNice wrote:
The point is that he was using a search function (for loop) to find the patterns and deduce the index....

I was interested how to avoid the for loop....

This is why I have coded mine...

Any reason you have to map the pairs like that?

If you just map pairs to be 22=[0], 33=[14], 44=[28], and so on, then the mapping function is way simpler:
Code:
int getPreflopCardsIndex(int holecard1, int holecard2)
{
   if ((holecard1/13)==(holecard2/13))
      return (max(holecard1,holecard2)*13 + min(holecard1,holecard2));
   else
      return (min(holecard1,holecard2)*13 + max(holecard1,holecard2));
}

Juk :)


Top
 Profile  
 
 Post subject: Re: Preflop Indexing
PostPosted: Thu Nov 14, 2013 4:55 pm 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 642
jukofyork wrote:
Juk :)


Long time no see. Welcome back.


Top
 Profile  
 
 Post subject: Re: Preflop Indexing
PostPosted: Thu Nov 14, 2013 5:09 pm 
Offline
Regular Member
User avatar

Joined: Wed Oct 02, 2013 5:00 pm
Posts: 64
Does this LUT helps?

Code:
private preflopHands = ["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"];


Top
 Profile  
 
 Post subject: Re: Preflop Indexing
PostPosted: Thu Nov 14, 2013 8:00 pm 
Offline
Junior Member

Joined: Thu Nov 14, 2013 2:56 pm
Posts: 12
spears wrote:
Long time no see. Welcome back.

Thanks!

Juk :)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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:
Powered by phpBB® Forum Software © phpBB Group