Wild Poker Hand Counting

I'm looking for code or a description of an algorithm to determine poker scores when two are wild. I need code that is not burdened with license fees, GPL, patents, etc.

I know several ways to approach this, but I would prefer not to write code if it is already available somewhere. Therefore, I would appreciate it if the answers were limited to links to the actual working code or detailed algorithmic descriptions.

(I don’t ask anyone to β€œdo their homework for me.” I can write the code myself, so the pseudo-code and implementation suggestions are not needed. I just don’t want to waste time solving an already solved problem.)

+4
source share
5 answers

http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup

Page about poker libraries. - list of libraries / algorithms

+2
source

I think because you said that you specifically do not want the ideas you just need for a working solution.

I think the general idea is that it is best to do this in the most effective attractive way, not just the way some guy did before. I think one of the benefits of this community is a pool of programmers who can reflect ideas and help you do things best.

I think that most of us are emotionally involved in our code base and are wondering what would be the motivation of someone who could give up only something-so-so-so-or-so- then in them.

Is this for homework? Or perhaps for someone else?

+4
source

Without writing all the code, the beginning looks something like this:

/* * 2.1 Straight flush * 2.2 Four of a kind * 2.3 Full house * 2.4 Flush * 2.5 Straight * 2.6 Three of a kind * 2.7 Two pair * 2.8 One pair * 2.9 High card */ // Note, the vector cards is sorted low to high. All cards have a numeric value 2-13 and a suit 0-3 int noDuces(Cards[] cards) { int duces = 0; int cursor = cards.length; while(cards[cursor--].value == 2) duces++; return duces; } bool isFlush(Cards [] cards) { int duces = noDuces(cards); int firstColour = cards[cards.length].colour; for (int i = cards.length -1; i > duces; i--) { if (cards[i].colour != firstColour) return false; } return true; } bool isStraight(Cards[] cards) { int duces = noDuces(cards); int usedDuces = 0; // TODO Handle A - 5 straight. card prevCard = cards[cards.length]; for (int i = cards.length -1; i > duces; i--) { if ((prevCard.value + 1) != cards[i].value) { if (usedDuces >= duces) { return false; } usedDuces++; } prevCard = cards[i]; } return true; } 
+4
source

The full source code for the Texas Hold'em poker poker appraiser can be found here:

http://www.advancedmcode.org/poker-predictor.html

It is built for matlab, the GUI identifier is m-encoded, but the computing engine is C ++.

This allows you to calculate the probability and probability. On my 2.4Ghz laptop, it can deal with computing a game of 100,000 10 players in 0.3 seconds.

Exact computer in real time :-)

+2
source

While directly calculating and comparing hands seems attractive, there are almost no applications (for computers with a reasonable amount of RAM / disk) for which they would be practical. If you compare more than a handful of hands, this approach allows you to calculate the same hand values ​​over and over again.

Since a comprehensive preliminary calculation of all poker hands and their values ​​is possible, a single creation of search tables is --BY FAR - the fastest and most practical solution. The differences between such algorithms are primarily associated with tricks for controlling the size of the table. The main answer has a link to a wide range of algorithms, repeated here for convenience, ranging from naive bit-twiddling computations to various types of searches, His educational and entertaining reading.

0
source

Source: https://habr.com/ru/post/1276609/


All Articles