# Poker dice

Roll the five dice onto the table. Left hand side is ranks. I decided to try myself, and I ended up not using regular expressions -- I thought maybe with the simplicity of the searches required, regular expressions would add more complexity than they save. Those combinations are all valid Yahtzee full house examples. Your name Your email address Message. This page was last edited on 25 September , at

## ONE OF THE BEST COMBINATIONS IN THE YAHTZEE WORTH 25 POINTS AND MORE FOLLOWING VARIANTS

Since you have only possible combinations and one byte can store the resulting hand strength, this problem is much easier than a poker hand problem. You can have a lookup table, consisting of hands as indexes and associated with results some hands can have multiple results of that hand. Each byte can store all hand types as a binary representation hopefully, if not use a short. Each number you get eg. Speed would be enourmous, since the only operation you would need to do is convert number base, and the binary OR operation to extract a hand strenght.

What you will miss is the real strength of a hand. You can easily figure that out - you will need a bigger type to store result into: I decided to try myself, and I ended up not using regular expressions -- I thought maybe with the simplicity of the searches required, regular expressions would add more complexity than they save. I used similar logic to another answer though: I discovered, to my surprise, that the probability of a small straight and a large straight are equal in 5-die rolls.

Fixed; I see that when I include small straights that include a pair, the probability of a small straight goes up significantly. When I think about it, a pair and a small straight should probably use the pair as the highest die and the highest number in the straight as the next highest in order to [properly compare two rolls that are both a pair with a small straight.

If so, I'd replace the block of code for handling PairSmallStraight with this:. You could try to put your values in to a list. This would allow you to quickly sort your values. And if you add the values that would give you the hand. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service , privacy policy and cookie policy , and that your continued use of the website is subject to these policies.

Perhaps the best way to approach this seems to be to use regular expressions. Does anyone know how I would go about representing these rules in regex?

Or if you can provide a better solution, I'd appreciate that. Edit Changed wording to highlight that this is my inexperienced opinion. Why did you decide that regexes would be the best approach, if you don't know how to write the required regexes?

IMO, regexes are a very bad approach here. I hate this new "free question downvote" system. What is wrong with this question people?

Why do you vote it down? No need for Regular Expressions here. Armen, I agree, the question is ok, The OP should be delivered a proper solution, however his approach is wrong. Instead of downvoting ppl should answer and perhaps teach. Then match the counter string against these patterns: I accepted this as the answer, not because of the regex which is a good library matcher also , but for the simply fact that you mentioned the counter string.

I like this approach a lot and makes life much easier. Craig White 9, 4 15 I was thinking about it too. Since when do dice have Kings, Queens, Jacks and Aces? Everyone is reading Full House and automatically think it's poker and ignore the fact that dice are mentioned three times: It would be something similar to can't test it: We are dealing with a single pair.

The poker dice hand rankings and the corresponding probabilities of rolling that hand are as follows not sorted by probability but from highest to lowest ranking: Busts are much lower probability than in card poker, because there are only 6 values instead of 13, making pairs and straights much more likely than with cards.

In poker dice there are in fact only four possible bust hands: Consequently, in some variants of the rules, straights are counted as busts. Marlboro once marketed a set of octahedral poker dice that included suits; each die had slightly different numberings, ranging from 7 up to ace. A similar set is currently manufactured by Koplow Games. The remaining 8 faces featured stars and acted as wild cards allowing for every possible poker hand to be rolled. From Wikipedia, the free encyclopedia.

New York Times Company. Retrieved from " https: Dice games Poker variants. Views Read Edit View history.