Poker-AI.org
http://poker-ai.org/phpbb/

Preflop Indexing
http://poker-ai.org/phpbb/viewtopic.php?f=24&t=2639
Page 1 of 1

Author:  MrNice [ Thu Nov 14, 2013 1:30 pm ]
Post subject:  Preflop Indexing

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

Author:  cantina [ Thu Nov 14, 2013 1:32 pm ]
Post subject:  Re: Preflop Indexing

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.

Author:  MrNice [ Thu Nov 14, 2013 1:44 pm ]
Post subject:  Re: Preflop Indexing

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...

Author:  jukofyork [ Thu Nov 14, 2013 4:12 pm ]
Post subject:  Re: Preflop Indexing

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 :)

Author:  spears [ Thu Nov 14, 2013 4:55 pm ]
Post subject:  Re: Preflop Indexing

jukofyork wrote:
Juk :)


Long time no see. Welcome back.

Author:  corintio [ Thu Nov 14, 2013 5:09 pm ]
Post subject:  Re: Preflop Indexing

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"];

Author:  jukofyork [ Thu Nov 14, 2013 8:00 pm ]
Post subject:  Re: Preflop Indexing

spears wrote:
Long time no see. Welcome back.

Thanks!

Juk :)

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/