Image Image Image




Post new topic Reply to topic  [ 399 posts ]  Go to page Previous  1 ... 16, 17, 18, 19, 20
Author Message
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 3:43 pm 
Offline
Regular member
User avatar

Posts: 62
Favourite Bot: OpenHoldem
try to use The Two Plus Two Evaluator

http://www.codingthewheel.com/archives/ ... oundup#2p2

but dont uderstand
If they use cards from 1 to 52

why for example this cards

int cards[] = { 1, 14, 27, 40, 52, 48, 49 };

return Category = 2

Its must be four of kind and Category = 8


And this
int cards[] = { 1, 2, 3, 4, 5, 6, 7 };
return Category = 8

But its straight flush and I think Category = 9

_________________
http://poker-bot.ru


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 4:25 pm 
Offline
Senior member
User avatar

Posts: 226
Location: Stockholm
Favourite Bot: ---
trom wrote:
And this
int cards[] = { 1, 2, 3, 4, 5, 6, 7 };
return Category = 8

But its straight flush and I think Category = 9


rank is 2..A (integer representation 0..12) and suit has integer representation 0..4

each card is generated by (integer representation of rank) * 4 + (integer representation of suit)

so what you've pasted actually has an equivalent rank vector of
floor(cards / 4) == [ 0 0 0 1 1 1 1] == 3 deuces and 4 threes

Edit: Just recalled cards in rankrayw begin at 1, so just add 1 to every card after doing what I just did to get the proper card id for rankrayw code.


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 5:34 pm 
Offline
Regular member
User avatar

Posts: 62
Favourite Bot: OpenHoldem
djhemlig

can you show it on exapmple

what number for cards in Two Plus Two Evaluator

1) 2c
2) 3c
4) 4c
5) 5c
6) 6c
7) 7c

And finally i get straight flush

I try to understand what you say but I think i need exaplme

_________________
http://poker-bot.ru


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 5:47 pm 
Offline
Senior member
User avatar

Posts: 226
Location: Stockholm
Favourite Bot: ---
trom wrote:
djhemlig

can you show it on exapmple


Cards in RayW implementation are 2c = 1, 2d = 2, ..., As = 52


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 6:19 pm 
Offline
Regular member
User avatar

Posts: 62
Favourite Bot: OpenHoldem
no I about you formula (integer representation of rank) * 4 + (integer representation of suit)
I uderstand that

2c = 0
3c = 4
4c = 8
5c = 12
6c = 16
7c = 20
8c = 24

but its dont work
if delete 2c and add 9c(26)
all works i get 9 (its sraght flush)

but for exapmple

10s = 191
Js = 195
Qs = 199
Ks = 203
As = 207

I get wrong result
I think I dont uderstand you formula

for example

10s = 48
then using you formula i get

(48-1)*4+3

I think its not right but where is error?

_________________
http://poker-bot.ru


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 6:52 pm 
Offline
Senior member
User avatar

Posts: 226
Location: Stockholm
Favourite Bot: ---
trom wrote:
no I about you formula (integer representation of rank) * 4 + (integer representation of suit)

...

10s = 48
then using you formula i get

(48-1)*4+3

I think its not right but where is error?


Error is that you're taking the card integer representation * 4 insteaf of rank integer representation * 4

djhemlig wrote:
rank is 2..A (integer representation 0..12) and suit has integer representation 0..3

Cards in RayW implementation are 2c = 1, 2d = 2, ..., As = 52


(Yeah suit should be 0..3 not 0..4)

According to the formulas I've given you:

integer rank representation of 10s = 8
integer suit representation of 10s = 3

card representation of 10s = 8 * 4 + 3

And since RayW cards start at 1, add 1 to the result so

RayW card representation of 10s = 8 * 4 + 3 + 1


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Jun 16, 2010 8:08 pm 
Offline
Regular member
User avatar

Posts: 62
Favourite Bot: OpenHoldem
djhemlig

thank you very much!
now all works :D

_________________
http://poker-bot.ru


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Sat Jul 03, 2010 12:51 pm 
Offline
Regular member
User avatar

Posts: 62
Favourite Bot: OpenHoldem
How I can using Two Plus Two evaluator detect hand rank if I have only 5 or 6 cards

when set unknown cards to zero I have wrong result
Code:
int cards[] = { 1, 2, 3, 4, 5, 0, 0 };
int MY_handInfo =0;
int MY_handCategory =0;
int MY_rankWithinCategory =0;

MY_handInfo = GetHandValue(cards);
MY_handCategory = MY_handInfo >> 12;
MY_rankWithinCategory = MY_handInfo & 0x00000FFF;


is it possible to detect combination If i have only 5 or 6 cards?
If yes please give me code example

_________________
http://poker-bot.ru


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Tue Jul 13, 2010 9:23 am 
Offline
Senior member
User avatar

Posts: 226
Location: Stockholm
Favourite Bot: ---
trom wrote:
How I can using Two Plus Two evaluator detect hand rank if I have only 5 or 6 cards


Code:
#define BASE_ADDRESS 53

static __inline int rankrayw_handrank5(int c0, int c1, int c2, int c3, int c4)
{
   int *p1 = HR + HR[BASE_ADDRESS+c0];
   int *p2 = HR + p1[c1];
   int *p3 = HR + p2[c2];
   int *p4 = HR + p3[c3];
   int *p5 = HR + p4[c4];

   return p5[0];
}

static __inline int rankrayw_handrank6(int c0, int c1, int c2, int c3, int c4, int c5)
{
   int *p1 = HR + HR[BASE_ADDRESS+c0];
   int *p2 = HR + p1[c1];
   int *p3 = HR + p2[c2];
   int *p4 = HR + p3[c3];
   int *p5 = HR + p4[c4];
   int *p6 = HR + p5[c5];

   return p6[0];
}


Not sure if I wrote it, copied it or whatever but it works.


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Tue Jul 13, 2010 11:19 am 
Offline
Regular member
User avatar

Posts: 62
Favourite Bot: OpenHoldem
djhemlig
thanks for answer

but I now use this code for 5 cards evaluator

Code:
int GetHandValue_5_cards(int* pCards)
{
   int p = HR[53 + *pCards++];
   p = HR[p + *pCards++];
   p = HR[p + *pCards++];
   p = HR[p + *pCards++];
   p = HR[p + *pCards++];
   return HR[p];
}


and for 6 cards
I just set null to the last member in cards array
Code:
int cards[] = { 1, 2, 3, 4, 5, 6, 0 };


think its correct
but i be happy if you confirm that is correct method!

_________________
http://poker-bot.ru


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Sat Nov 20, 2010 9:10 am 
Offline
PokerAI fellow
User avatar

Posts: 1239
Favourite Bot: my bot
bmnds wrote:
http://pokerai.org/pj2/code/eval.zip
I've just downloaded it but com.biotools.meerkat.{Hand, Card, Deck} are breaking the code because they didn't come with the .zip file.

What is the workaround to this issue?


http://www.poker-academy.com/downloads/ ... PI-2.5.zip


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Fri Dec 03, 2010 2:16 am 
Offline
New member
User avatar

Posts: 3
Favourite Bot: None
SpecialKEval http://code.google.com/p/specialkpokereval/
made it into the iTunes store! It's fast, try it out here:

http://itunes.apple.com/us/app/poker-ace/id392530020?mt=8

:drink


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Sun Aug 28, 2011 12:04 pm 
Offline
Junior member
User avatar

Posts: 31
Favourite Bot: none
Is it possible, that some Evaluators do not work with an 64-Bit Java?

And does anybody still maintain this thread? ^^


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Sun Aug 28, 2011 1:58 pm 
Offline
PokerAI fellow
User avatar

Posts: 1239
Favourite Bot: my bot
Omniknight wrote:
Is it possible, that some Evaluators do not work with an 64-Bit Java?

Is this just random musing?
Do you have some reason why this might be so?
Do you have a particular evaluator in mind?
Can you show us some evidence?

Omniknight wrote:
And does anybody still maintain this thread? ^^

What do you mean by "maintain"?


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Mon Aug 29, 2011 11:57 am 
Offline
Junior member
User avatar

Posts: 31
Favourite Bot: none
spears wrote:
What do you mean by "maintain"?

The ToDo list never changed since I have an account here.


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Mon Aug 29, 2011 12:23 pm 
Offline
PokerAI fellow
User avatar

Posts: 1239
Favourite Bot: my bot
View it as an opportunity to contribute.


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Wed Aug 31, 2011 10:55 pm 
Offline
New member
User avatar

Posts: 9
Favourite Bot: QuazarBot
Hi all,

i played with that eval-stuff for a while, just to test 2p2-evaluator.


And i was wondering about the results:

Quote:
Loading evaluation tables ...
Evaluation tables loaded in 0.362 seconds
Memory used: 127 Mb
( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 441533201, hands 133784560, checksum 1528972275512, total time: 0.303

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 486489309, hands 133784560, checksum 1528972275512, total time: 0.275

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 929059444, hands 133784560, checksum 1528972275512, total time: 0.144

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 935556364, hands 133784560, checksum 1528972275512, total time: 0.143

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 935556364, hands 133784560, checksum 1528972275512, total time: 0.143

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 935556364, hands 133784560, checksum 1528972275512, total time: 0.143

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 942144789, hands 133784560, checksum 1528972275512, total time: 0.142

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 922652138, hands 133784560, checksum 1528972275512, total time: 0.145

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 929059444, hands 133784560, checksum 1528972275512, total time: 0.144

( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com
--- Hands per second: 935556364, hands 133784560, checksum 1528972275512, total time: 0.143


eeehhhmm right... :xx04

Only modifications i did were in PerformanceTest2.java and here it is:

Code:
package pokerai.game.eval;

import pokerai.game.eval.spears2p2.StateTableEvaluator;


public class PerformanceTest2 {

   /*

    This is the primary class that is used for benchmarking the hand evaluators
      from March 30-th 2008

    It is the same benchmark used for comparing the 2+2 hand evaluators.

    @Author Indiana 2008

    Todo:
    - RayW/LUV works for 7-card hands only, for 5 and 6 card hands, ArrayIndexOutOfBonud exception - Doublecheck.
    - Steve B. with partial state generation, implement and try

    */

   static String[] ref = {
      "( 1) Indiana-1, 2006, http://pokerai.org/pf3",
      "( 2) Indiana-3, 2007, http://pokerai.org/pf3",
      "( 3) University of Alberta, 2000, http://spaz.ca/poker",
      "( 4) Spears port of Kevin Suffecool's C evaluator, http://pokerai.org/pf3",
      "( 5) Spears port of 2+2 evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com",
      "( 6) Steve Brecher HandEval, http://www.stevebrecher.com/Software/software.html",
      "( 7) Spears adaptation of RayW LUT hand evaluator, http://pokerai.org/pf3, http://forumserver.twoplustwo.com",
      "( 8) Steve Brecher HandEval with [url=http://archives1.twoplustwo.com/showthreaded.php?Cat=0&Number=8582014&page=0&vc=1]partial state generation[/url], http://pokerai.org/pf3",
      "( 9) Pokerstove (Andrew Prock's) jpoker, http://www.pokerstove.com/download/jpoker.tar.gz",
   };

   public static final void waitfor(int ms) { try { Thread.currentThread().sleep(ms); } catch (Exception e) { e.printStackTrace(); }}

   public static void main(String args[]) {
      testRayW();
   }



   
   
   public static void permutate() {
      long time = System.currentTimeMillis();
      int h1, h2, h3, h4, h5, h6, h7;
      int u0, u1, u2, u3, u4, u5;
      int[] handRanks = StateTableEvaluator.handRanks;
      int[]          handEnumerations = new int[10];
      int[][] equivalencyEnumerations = new int[10][3000];
      String[] handDescriptions = {"Invalid Hand", "High Card", "One Pair", "Two Pair", "Three of a Kind",
            "Straight", "Flush", "Full House", "Four of a Kind", "Straight Flush"};
      int numHands = 0;
      int handRank;
      long sum = 0;
      sum = 0;
      for (h1 = 1; h1 < 47; h1++) {
         u0 = handRanks[53 + h1];
         for (h2 = h1 + 1; h2 < 48; h2++) {
            u1 = handRanks[u0 + h2];
            for (h3 = h2 + 1; h3 < 49; h3++) {
               u2 = handRanks[u1 + h3];
               for (h4 = h3 + 1; h4 < 50; h4++) {
                  u3 = handRanks[u2 + h4];
                  for (h5 = h4 + 1; h5 < 51; h5++) {
                     u4 = handRanks[u3 + h5];
                     for (h6 = h5 + 1; h6 < 52; h6++) {
                        u5 = handRanks[u4 + h6];
                        for (h7 = h6 + 1; h7 < 53; h7++) {
                           sum += handRanks[u5 + h7];
/*
                           handRank = handRanks[u5 + h7];
                           handEnumerations[handRank >>> 12]++;
                           numHands++;
                           equivalencyEnumerations[handRank >>> 12][handRank & 0xFFF]++;
*/
                        }}}}}}}
      print(sum, time, 133784560, 6);
   }

   public static void testRayW() {
      //pokerai.game.eval.spears2p2.Card c = pokerai.game.eval.spears2p2.Card.parse("Th");
      //System.out.println("should be 34: " + c.ordinal());
      System.gc(); // try { Thread.currentThread().sleep(1000); } catch (Exception e) {};
      long mem1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
      StateTableEvaluator.initialize();
      System.gc(); //try { Thread.currentThread().sleep(1000); } catch (Exception e) {};
      long mem2 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();

      System.out.println("Memory used: " + ((mem2-mem1)/(1024*1024)) + " Mb");
      
      
      for (int i = 0; i < 10; i++) {
         permutate();
      }
      
   }

   public static void print(long sum, long time, long n, int ind) {
      time = System.currentTimeMillis() - time; // time given is start time
      //long handsPerSec = Math.round(1000 / ((time*1.0)/ n));
      long handsPerSec = Math.round(n / (time / 1000.0));
      System.out.println(ref[ind]);
      System.out.println(" --- Hands per second: [b]" + handsPerSec + "[/b], hands " + n + ", checksum " + sum + ", total time: " + time/1000.0);
      System.out.println();
   }

}


Can that be right? :shock:

my system: 2.93 GHz Intel Core i7 4GB 1333MHz DDR3

_________________
English is not my native language, so if you find spelling mistakes you can keep them. ;)


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Thu Sep 01, 2011 9:00 am 
Offline
Junior member
User avatar

Posts: 31
Favourite Bot: none
Quazar wrote:
Can that be right? :shock:

my system: 2.93 GHz Intel Core i7 4GB 1333MHz DDR3


I think it is ok with your system.
With my mobile i7 1.6 GHz it takes ~doubled time.

Or do you care about the speedup after the second loop?
I guess, that's because of the Java-JIT-Optimizer and/or caching several results by the CPU/OS/Java.


Top
 Profile E-mail  
 
 Post subject: Re: 7-card Poker Hand Evaluators
PostPosted: Fri Sep 02, 2011 3:32 pm 
Offline
New member
User avatar

Posts: 9
Favourite Bot: QuazarBot
Omniknight wrote:
I think it is ok with your system.
With my mobile i7 1.6 GHz it takes ~doubled time.

Or do you care about the speedup after the second loop?
I guess, that's because of the Java-JIT-Optimizer and/or caching several results by the CPU/OS/Java.


Hmm ok. I was so amazed at the results... :)

_________________
English is not my native language, so if you find spelling mistakes you can keep them. ;)


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 399 posts ]  Go to page Previous  1 ... 16, 17, 18, 19, 20


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: