Hi, I've been trying to make a poker game, i got the basic things running like giving the cards to the player and dealer, but i am having trouble coming up with a way to compare the 2 hands... I'm new to python, i tried different ways and didn't really work out.. Right now i have the cards put in order. Can someone please tell me a good way to compare the hands between the player and dealer >< that will be great. Thanks
yari
0
Newbie Poster
Recommended Answers
Jump to PostYou need a system that creates an ordinal value for each hand (the rank of the hand) and you just compare the ranks. The trick, then, is to write that function. I'm not a poker expert, but I'd do something like:
Recognize all the possible ways the hand can be …
Jump to PostI think he meant scores as in rank
Like a flush is worth more then a pair.
Jump to PostDon't use 'list' as a variable. It is a built-in function.
I rewrote your function to make it more readable. However, without the complete code, I don't know exactly how I can helpdef straightFlush(list1): number = int(list1[0][0]) suit = list1[0][1] count = number print "number is", …
Jump to Post...And here's my definition of class Card, along with a very minor exercise
class Card: """ A standard poker card with suit and value Value is intended to be an integer for easy sorting and comparison Suit can be anything. Test code uses a single capital letter …
All 13 Replies
griswolf
304
Veteran Poster
yari
0
Newbie Poster
redyugi
5
Junior Poster in Training
yari
0
Newbie Poster
redyugi
5
Junior Poster in Training
yari
0
Newbie Poster
griswolf
304
Veteran Poster
griswolf
304
Veteran Poster
yari
0
Newbie Poster
griswolf
304
Veteran Poster
yari
0
Newbie Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
yari
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.