Poker-AI.org Poker AI and Botting Discussion Forum 2018-09-01T11:03:31+00:00 http://poker-ai.org/phpbb/feed.php?f=24&t=2390 2018-09-01T11:03:31+00:00 2018-09-01T11:03:31+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=7745#p7745 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Statistics: Posted by HontoNiBaka — Sat Sep 01, 2018 11:03 am


]]>
2017-05-14T09:05:41+00:00 2017-05-14T09:05:41+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=7205#p7205 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Statistics: Posted by nefton — Sun May 14, 2017 9:05 am


]]>
2017-05-13T19:32:58+00:00 2017-05-13T19:32:58+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=7204#p7204 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Statistics: Posted by mru22 — Sat May 13, 2017 7:32 pm


]]>
2017-03-27T19:32:01+00:00 2017-03-27T19:32:01+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=7138#p7138 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> https://wiki.csc.calpoly.edu/CPE-480...andeval/klaatu ). So know I want to know how to proceed from this point on to calculate range vs range calculation. Do I run a 10k simulations for each hand in range 1 vs each hand range 2? This should takes time even with the fast hand evaluator. I use Poker equity calculator app on my phone and its calculating to 10 players range vs range equity. Is there a source code in java somewhere that I can use for my app?
The slowness of the range vs range calculation is making my app really frustrating to use.
Any help is much appreciated!
Thanks

Statistics: Posted by baalbaki — Mon Mar 27, 2017 7:32 pm


]]>
2016-03-25T21:37:32+00:00 2016-03-25T21:37:32+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=6951#p6951 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]>
you also need 5-card and 6-card evaluators for Holdem flop and turn hand strength evaluations.

I'll attach the evaluator we used in the old forum's SNG Testbed subgroup.
It uses a 130 MB lookup table and only jumps to the right index for an evaluation.

It's pretty darn fast and generates it's lookup table when the file is not available.

Statistics: Posted by supersonic — Fri Mar 25, 2016 9:37 pm


]]>
2013-10-31T10:37:45+00:00 2013-10-31T10:37:45+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5149#p5149 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]>
But back to the question why one would want a 5-card evaluator. Hint: Holdem is not the only poker variant.

Statistics: Posted by iKNOWpoker — Thu Oct 31, 2013 10:37 am


]]>
2013-10-27T23:24:54+00:00 2013-10-27T23:24:54+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5147#p5147 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> spears wrote:

algonoob wrote:
spears wrote:
- Why does anyone ever want a 5 or 6 card evaluator?

one might want to use immediate hand rank as part of a flop or turn abstraction


Why are these abstractions considered any good? Evaluations that omit future cards board are of very limited value. If you consider future cards you need a 7 card evaluator, or results derived therefrom.


using both immediate hand rank and potential is better than using only potential. but of course, this 2d method can't compare to state of the art abstractions

Statistics: Posted by algonoob — Sun Oct 27, 2013 11:24 pm


]]>
2013-10-27T16:10:29+00:00 2013-10-27T16:10:29+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5146#p5146 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> algonoob wrote:

spears wrote:
- Why does anyone ever want a 5 or 6 card evaluator?

one might want to use immediate hand rank as part of a flop or turn abstraction


Why are these abstractions considered any good? Evaluations that omit future cards board are of very limited value. If you consider future cards you need a 7 card evaluator, or results derived therefrom.

Statistics: Posted by spears — Sun Oct 27, 2013 4:10 pm


]]>
2013-10-27T13:52:28+00:00 2013-10-27T13:52:28+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5145#p5145 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> spears wrote:

- Why does anyone ever want a 5 or 6 card evaluator?


one might want to use immediate hand rank as part of a flop or turn abstraction

Statistics: Posted by algonoob — Sun Oct 27, 2013 1:52 pm


]]>
2013-10-27T08:10:32+00:00 2013-10-27T08:10:32+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5144#p5144 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]>

Statistics: Posted by spears — Sun Oct 27, 2013 8:10 am


]]>
2013-10-26T18:06:16+00:00 2013-10-26T18:06:16+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5143#p5143 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> My range evaluator is now working ;)

Statistics: Posted by bulgrozpok — Sat Oct 26, 2013 6:06 pm


]]>
2013-10-19T20:09:10+00:00 2013-10-19T20:09:10+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5124#p5124 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> bulgrozpok wrote:

I have that zip file too installed in netbeans, but there is no reference of twoplustwo package. I've rapidly browsed the code and StateTableEvaluator seems to be very close to Generator.
For the moment i'm testing with specific hand values.
And I've an ArrayIndexOutOfBoundsException in the following case :
Code:
Card[] cards = Card.parseArray("AdAcTh4c2c");
StateTableEvaluator.getRank(cards);



- twoplustwo is definitely in eval.zip above.
- Generator isn't referenced anywhere so don't worry about it
- "AdAcTh4c2c" is only 5 cards. StateTableEvaluator only works with 7 cards

- Why does anyone ever want a 5 or 6 card evaluator?

Statistics: Posted by spears — Sat Oct 19, 2013 8:09 pm


]]>
2013-10-19T19:39:13+00:00 2013-10-19T19:39:13+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5123#p5123 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> bulgrozpok wrote:

I'm a bit confused. I thought RayW (the fastest evaluator in town) was in spears2p2 package and that the difference with standard spearsevaluator was in the way to access data (by using handRanks[] array).

They are fundamentally the same. spears2p2 attempted to make it all nice and pretty with Card and Hand classes and the StateTableEvaluator.getRank methods. But as the comment on that method says it also makes it slow.

bulgrozpok wrote:

What you are saying is that RayW is in fact in twoplustwo package ? :o

Yes. Ray Wooton was the chief brain behind all this, though there were other important contributions. None of these were mine. Read the 2p2 thread for a great example of crack programmers at work together.

bulgrozpok wrote:

If so, is there a reason that this has not been added in all the PerformanceTest that are under pokerai.game.eval package ?

Haven't a clue. Ask Indiana

Now I've spent as much time helping people use it as I did writing it.

Statistics: Posted by spears — Sat Oct 19, 2013 7:39 pm


]]>
2013-10-19T18:41:28+00:00 2013-10-19T18:41:28+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5122#p5122 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> For the moment i'm testing with specific hand values.
And I've an ArrayIndexOutOfBoundsException in the following case :
Code:
Card[] cards = Card.parseArray("AdAcTh4c2c");
StateTableEvaluator.getRank(cards);

but there is no problem when retrieving rank with HR[HR[u4+c5]]. Is it normal ?

Statistics: Posted by bulgrozpok — Sat Oct 19, 2013 6:41 pm


]]>
2013-10-19T17:51:59+00:00 2013-10-19T17:51:59+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5121#p5121 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> pokerai.game.eval.tests. Did you really download the zip from my link? It differs from the archive in the op of this thread.

Statistics: Posted by iKNOWpoker — Sat Oct 19, 2013 5:51 pm


]]>
2013-10-19T17:06:02+00:00 2013-10-19T17:06:02+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5118#p5118 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Statistics: Posted by bulgrozpok — Sat Oct 19, 2013 5:06 pm


]]>
2013-10-19T16:30:30+00:00 2013-10-19T16:30:30+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5117#p5117 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> http://www.poker-ai.org/archive/www.pok ... 913#p28913 . And have a look at the pokerai.game.eval.tests package for working performance tests.

Statistics: Posted by iKNOWpoker — Sat Oct 19, 2013 4:30 pm


]]>
2013-10-19T16:17:26+00:00 2013-10-19T16:17:26+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5116#p5116 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> I'm a bit confused. I thought RayW (the fastest evaluator in town) was in spears2p2 package and that the difference with standard spearsevaluator was in the way to access data (by using handRanks[] array). What you are saying is that RayW is in fact in twoplustwo package ? :o
If so, is there a reason that this has not been added in all the PerformanceTest that are under pokerai.game.eval package ?

Statistics: Posted by bulgrozpok — Sat Oct 19, 2013 4:17 pm


]]>
2013-10-19T13:33:45+00:00 2013-10-19T13:33:45+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5115#p5115 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]>
In pokerai.game.eval.spears2p2 many of your questions are answered in Tester.main() and StateTableEvaluator.getRank()

pokerai.game.eval.twoplustwo is similar. Close reading of Evaluator.main() (63 loc) should tell you all you need to know.

Well I don't think it is all that hard to create the generic multirange evaluator that you have in mind using http://en.wikipedia.org/wiki/Adapter_pattern, but you do need to know the "raw" evaluators input and and output conventions before writing it. But what is the point of this thing? If you have enough memory, and most people do these days, an evaluator based on pokerai.game.eval.twoplustwo is the fastest there is. Even that isn't a huge issue because you will probably need preflop, flop, turn and river lookup tables anyway.

Statistics: Posted by spears — Sat Oct 19, 2013 1:33 pm


]]>
2013-10-19T08:51:52+00:00 2013-10-19T08:51:52+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5113#p5113 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> spears wrote:

- handRanks array contains ints that in some cases encode a state, and in others a rank and hand type

So I have to do this to retrieve handCategory :
Code:
int handCategory = handRanks >> 12
(taken from CTW). Is it the same instruction in java ?
And after that, the higher handCategory the better ?

And if handCategory is the same, I have to do this :
Code:
 int rankWithinCategory = handRanks & 0x00000FFF
(taken from CTW). Also, is it the same instruction in java ?
And after that, the higher rankWithinCategory the better ?

In fact, I'm a bit confused because I was trying to build upon jSim and developping a generic multirange evaluator that would be able to take any of the "raw" evaluators (RayW, SteveBrecher, mykey, supersonic and the like...). It seemed possible because all those evaluators had basically the same signatures like SomeClass.eval(long key) or SomeClass.eval(int[] hand). Some glue code and an interface in the multirange evaluator would have done the job. But what if the returned values of those evaluators are not comparable between them. I thought the rule 'the greater the returned value the better the hand' would be true amongst all the evaluators...but I'm not so sure now. And if this rule is wrong it means i have to develop a common system of classification for all the evaluators which will not be easy.

Statistics: Posted by bulgrozpok — Sat Oct 19, 2013 8:51 am


]]>
2013-10-18T11:06:40+00:00 2013-10-18T11:06:40+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5104#p5104 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> bulgrozpok wrote:

Hi all,
Sorry for noob question, but I wonder how exactly RayW evaluator works.
3 specific questions:
- what is the correspondance between integers and cards ? I'm asking this because in StableEvaluator it is given 2c = 1, 2d = 2 etc... but in Card class which is in the same package, 2c = 0 ... :shock:
- the value returned by StableEvaluator.handRanks array : the greater the better ? Or the other way round (like Cactus Kev evaluator that orders hands from 1 (strongest) to 7,462 (weakest) )
- does it work for 5 , 6 and 7 cards ?
Thanks.


- viewtopic.php?f=24&t=2448
- handRanks array contains ints that in some cases encode a state, and in others a rank and hand type
- http://poker-ai.org/archive/pokerai.org ... &start=170

Statistics: Posted by spears — Fri Oct 18, 2013 11:06 am


]]>
2013-10-17T20:32:39+00:00 2013-10-17T20:32:39+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=5101#p5101 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Sorry for noob question, but I wonder how exactly RayW evaluator works.
3 specific questions:
- what is the correspondance between integers and cards ? I'm asking this because in StableEvaluator it is given 2c = 1, 2d = 2 etc... but in Card class which is in the same package, 2c = 0 ... :shock:
- the value returned by StableEvaluator.handRanks array : the greater the better ? Or the other way round (like Cactus Kev evaluator that orders hands from 1 (strongest) to 7,462 (weakest) )
- does it work for 5 , 6 and 7 cards ?
Thanks.

Statistics: Posted by bulgrozpok — Thu Oct 17, 2013 8:32 pm


]]>
2013-08-07T04:46:53+00:00 2013-08-07T04:46:53+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=4622#p4622 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> http://www.poker-ai.org/archive/www.pok ... 913#p28913
It seems to be the latest version. I'm glad I just found this as I wasn't aware of some of the evaluators included there.

Statistics: Posted by iKNOWpoker — Wed Aug 07, 2013 4:46 am


]]>
2013-06-29T01:46:28+00:00 2013-06-29T01:46:28+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=4359#p4359 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> HontoNiBaka wrote:

Thanks for uploading the evaluators again. I was just trying to replace my naive hand evaluator with the RayW evaluator and rewriting my equity method, but my JUnit tests fail. Am I using it correctly? getEval() returns the corresponding integer value for a Card object.

Code:
   public static double riverEquity(HoleCards hero, Range range, Board board) {
      double win = 0;
      double runs = 0;
      // VillainRange
      Range villainRange = range.cardRemoval(board.getBoardCards());
      villainRange = villainRange.cardRemoval(hero.getCard1());
      villainRange = villainRange.cardRemoval(hero.getCard2());
      // All boardcards
      LinkedList<Card> boardCards = board.getBoardCards();
      // u Values for the board in the lookup table
      int u0 = Generator.handRanks[53 + boardCards.get(0).getEval()];
      int u1 = Generator.handRanks[u0 + boardCards.get(1).getEval()];
      int u2 = Generator.handRanks[u1 + boardCards.get(2).getEval()];
      int u3 = Generator.handRanks[u2 + boardCards.get(3).getEval()];
      int u4 = Generator.handRanks[u3 + boardCards.get(4).getEval()];
      // heroValue
      int h1 = Generator.handRanks[u4 + hero.getCard1().getEval()];
      int h2 = Generator.handRanks[h1 + hero.getCard2().getEval()];

      for (HoleCards villainCards : villainRange) {
         // Villain Value
         int v1 = Generator.handRanks[u4 + villainCards.getCard1().getEval()];
         int v2 = Generator.handRanks[v1 + villainCards.getCard2().getEval()];
         System.out.print(h2 + "   ");
         System.out.println(v2);
         if (h2 > v2) {
            win++;
            runs++;
         } else if (h2 < v2) {
            runs++;
         } else {
            win = win + 0.5;
            runs++;
         }
      }
      return win / runs;
   }




I have not used Rays code however I did notice that win = win +0.5 only works if you have two players. If you have more than two players then you'll need to keep a count of each player that participated on that particular tie. for example win = win + 1 / NumberOfTiesCount

Statistics: Posted by Sharkfacepoker — Sat Jun 29, 2013 1:46 am


]]>
2013-04-08T06:04:17+00:00 2013-04-08T06:04:17+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=3714#p3714 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Is there anyone using this evaluator as a compiled library and is willing to publish it?

Statistics: Posted by Blub478 — Mon Apr 08, 2013 6:04 am


]]>
2013-04-08T04:34:37+00:00 2013-04-08T04:34:37+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=3712#p3712 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]>
Code:
   public static double riverEquity(HoleCards hero, Range range, Board board) {
      double win = 0;
      double runs = 0;
      // VillainRange
      Range villainRange = range.cardRemoval(board.getBoardCards());
      villainRange = villainRange.cardRemoval(hero.getCard1());
      villainRange = villainRange.cardRemoval(hero.getCard2());
      // All boardcards
      LinkedList<Card> boardCards = board.getBoardCards();
      // u Values for the board in the lookup table
      int u0 = Generator.handRanks[53 + boardCards.get(0).getEval()];
      int u1 = Generator.handRanks[u0 + boardCards.get(1).getEval()];
      int u2 = Generator.handRanks[u1 + boardCards.get(2).getEval()];
      int u3 = Generator.handRanks[u2 + boardCards.get(3).getEval()];
      int u4 = Generator.handRanks[u3 + boardCards.get(4).getEval()];
      // heroValue
      int h1 = Generator.handRanks[u4 + hero.getCard1().getEval()];
      int h2 = Generator.handRanks[h1 + hero.getCard2().getEval()];

      for (HoleCards villainCards : villainRange) {
         // Villain Value
         int v1 = Generator.handRanks[u4 + villainCards.getCard1().getEval()];
         int v2 = Generator.handRanks[v1 + villainCards.getCard2().getEval()];
         System.out.print(h2 + "   ");
         System.out.println(v2);
         if (h2 > v2) {
            win++;
            runs++;
         } else if (h2 < v2) {
            runs++;
         } else {
            win = win + 0.5;
            runs++;
         }
      }
      return win / runs;
   }

Statistics: Posted by HontoNiBaka — Mon Apr 08, 2013 4:34 am


]]>
2013-03-17T01:15:35+00:00 2013-03-17T01:15:35+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=3328#p3328 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Statistics: Posted by Coffee4tw — Sun Mar 17, 2013 1:15 am


]]>
2013-03-16T15:06:12+00:00 2013-03-16T15:06:12+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=3311#p3311 <![CDATA[Re: Java 7-Card Poker Hand Evaluators]]> Statistics: Posted by birchy — Sat Mar 16, 2013 3:06 pm


]]>
2013-03-14T13:43:54+00:00 2013-03-14T13:43:54+00:00 http://poker-ai.org/phpbb/viewtopic.php?t=2390&p=3199#p3199 <![CDATA[Java 7-Card Poker Hand Evaluators]]> here

The code from the contest wasn't saved in the archive so it's attached below.

Statistics: Posted by spears — Thu Mar 14, 2013 1:43 pm


]]>