Texas Hold'em Poker Odds Calculator
Keith I am having trouble running the file once downloaded. Have you considered splitting code to modules? The highest ranking of 21 combinations is the one you want to know. So I looked at poker-eval again. History First version released - Dec 1 st If you are asking if there is a place to download your hand history or the hand history of folks you've played -- probably not.
The Design may be Incomplete
Either start both types with PlayingCard or both with Card. I prefer the former, because this is a playing card library, there is not much chance of confusion with credit cards or other kinds of cards. I would use auto-property with private setter like you did in PlayingCard here.
It won't enforce the readonly constraint, but I think shorter code is worth that here. Also, this pretty dangerous code, any user of this class can modify the dictionary. I question whether IDictionary is actually the right type here.
I believe that the common operation would be to find the hand for a collection of cards, not finding out whether a given hand matches the cards. I agree that the lambdas are overly verbose, but I'm not sure it actually helps readability.
Home Questions Tags Users Unanswered. I started by enumerating the possible hands: What are you trying to do? Determine what hand a person has? Your evaluator doesn't have an evaluate method. Ace , new PlayingCard CardSuit. Two , new PlayingCard CardSuit.
Three , new PlayingCard CardSuit. I need to work on that. I had a Dealer class I forgot to include. Some code for shuffling and dealing from the deck because a deck doesn't really shuffle or deal itself. Was a poor decision that sacrificed practicality for purity. Would be easier if they were methods on the deck. Have you considered splitting code to modules? Just using return self. Edited 7 Years Ago by pyTony: The only problem remaining as far as I know is that if two hands are of equal rank but one has higher kickers, my test code will display text suggesting that they are equal.
Differences in kickers are significant in this program though. If one hand has higher kickers than another it will be greater than the other. Edited 7 Years Ago by lrh9: I know suits aren't an issue when you compare two cards in a standard game of poker, but if you want to use deck. It doesn't change hand evaluation.
Other comparison methods will remain the same unless I find a reason to alter them. Well done, unit test, cleaner code etc. Some places I would have written little differently, but this is much better than the function test jungle you had before!
If you want to propose changes, feel free. You won't be stepping on any toes. I've been collaborating with people on python on irc. They've given advice and recommendations. Some I've adopted and some I've rejected. Posting the source in this thread was a mistake. I won't make it again. I've had to split the source and make it a package. I'm going to get project hosting and then post the link. Right now I'm working on adding code for hole cards in hold'em.
My first goal is to create a collection of possible hole cards. Welcome to Code Review! You seem to be missing a closing brace. Also, to make your code easier to review, could you post your Card and Rank classes too? TwoPair is wrong, in my opinion. What if the allCards array is [2,2,3,2]? You'll get a two pair, but it obviously isn't one. You seem to only be checking for Straights and Flushes with the flop.
Same with all the other ones. In isARoyalFlush Card flop switch c. I would simply remove getRank in Rank and use toString instead: TheCoffeeCup 7, 3 23 Thank you so so much! I cannot begin to describe how helpful this is.