Problem 054
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.
This forum is NOT meant to discuss solution methods for a problem.
In particular don't post any code fragments or results.
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
Don't start begging others to give partial answers to problems
Don't ask for hints how to solve a problem
Don't start a new topic for a problem if there already exists one
See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
- TheEvil
- Posts: 84
- Joined: Sun Nov 13, 2011 10:38 am
- Location: Szeged, Hungary
Re: Problem 054
Yes it is true. But lot's of other possibilities don't occur. If you could find that, you must be able to solve the problem.

- rayfil
- Administrator
- Posts: 1412
- Joined: Sun Mar 26, 2006 5:30 am
- Location: Quebec, Canada
- Contact:
Re: Problem 054
In such a case, someone is definitely cheating if playing with a 52-card deck!!!If both hands are three-of-a-kind, first compare the three-of-a-kind; if equal, ....
When you assume something, you risk being wrong half the time.
- SoboLAN
- Posts: 39
- Joined: Sat Aug 18, 2012 3:21 pm
Re: Problem 054
Actually, that's not necessarily true. Imagine this:rayfil wrote:In such a case, someone is definitely cheating if playing with a 52-card deck!!!If both hands are three-of-a-kind, first compare the three-of-a-kind; if equal, ....![]()
![]()
Player 1: Ad Ts
Player 2: Td 7h
Board: 5s Th 8d 3s Tc
Both players have three-of-a-kind (tens).

- TheEvil
- Posts: 84
- Joined: Sun Nov 13, 2011 10:38 am
- Location: Szeged, Hungary
Re: Problem 054
This is a different kind of poker, where you have five cards in your hands, and no one on the table. What you are suggesting is an another game, and it has nothing to do with this exercise, and rayfil was talking about this particular problem.SoboLAN wrote:Actually, that's not necessarily true. Imagine this:rayfil wrote:In such a case, someone is definitely cheating if playing with a 52-card deck!!!If both hands are three-of-a-kind, first compare the three-of-a-kind; if equal, ....![]()
![]()
Player 1: Ad Ts
Player 2: Td 7h
Board: 5s Th 8d 3s Tc
Both players have three-of-a-kind (tens).

-
mdean
- Posts: 206
- Joined: Tue Aug 02, 2011 2:05 am
Re: Problem 054
To be fair, the problem states nowhere what type of poker is being played, that a card cannot appear in both hands, or even that we're playing with a 52-card deck. Still, it doesn't change much.TheEvil wrote:
This is a different kind of poker, where you have five cards in your hands, and no one on the table. What you are suggesting is an another game, and it has nothing to do with this exercise, and rayfil was talking about this particular problem.

- SoboLAN
- Posts: 39
- Joined: Sat Aug 18, 2012 3:21 pm
Re: Problem 054
You are talking about Draw (the poker variant with 5 cards in the hand and no card on board), but ... that was not what I was talking about. Look at what I wrote: each player with 2 cards and 5 cards on the board. How is that not Texas Hold'em ? Actually, if you look at it, the problem doesn't state what poker variant is played, because it doesn't really matter. In every one of them, the combinations are of 5 cards...TheEvil wrote:This is a different kind of poker, where you have five cards in your hands, and no one on the table. What you are suggesting is an another game, and it has nothing to do with this exercise, and rayfil was talking about this particular problem.SoboLAN wrote: Actually, that's not necessarily true. Imagine this:
Player 1: Ad Ts
Player 2: Td 7h
Board: 5s Th 8d 3s Tc
Both players have three-of-a-kind (tens).
Anyway, I think this argument is not going to help anyone. I'm sorry I started it. I wish you good luck in solving problems

-
Loers
- Posts: 10
- Joined: Sun Aug 19, 2012 3:03 am
Re: Problem 054
can some one help me with my code ??
i finished coding everything and treated alot of tricks but still giving me a wrong answer..
i finished coding everything and treated alot of tricks but still giving me a wrong answer..
-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 054
If you PM me your results for the 1000 hands, one per line in order, I will point out the first wrong one.Loers wrote:can some one help me with my code ??
i finished coding everything and treated alot of tricks but still giving me a wrong answer..

-
Loers
- Posts: 10
- Joined: Sun Aug 19, 2012 3:03 am
- Yamaneko
- Posts: 6
- Joined: Wed Nov 14, 2012 9:54 pm
- Location: Budapest, Hungary
Re: Problem 054
I've been trying to find the error in my code for days now and I just can't wrap my head around it. I'm using Python; I analyze the cards in a player's hand and check if they match the criteria for a "poker pattern" (as I came to call them), then give the player his score based on the rank of their pattern.
Unit tests give expected results for the individual hands, and everything seems to be in order with hands that I checked manually. I even removed those hands where both players had the same pattern (like if they both had only a pair of kings, which means the next highest card would decide) and evaluated them manually. Could someone give me a hint where I might be going wrong? I am seriously out of ideas.
Unit tests give expected results for the individual hands, and everything seems to be in order with hands that I checked manually. I even removed those hands where both players had the same pattern (like if they both had only a pair of kings, which means the next highest card would decide) and evaluated them manually. Could someone give me a hint where I might be going wrong? I am seriously out of ideas.

- TheEvil
- Posts: 84
- Joined: Sun Nov 13, 2011 10:38 am
- Location: Szeged, Hungary
Re: Problem 054
If you want, you can send me a list of your results, and I will give you the first wrong row. Or if you are misunderstanding something, it can be easier, if I make it clear in Hungarian.

- Yamaneko
- Posts: 6
- Joined: Wed Nov 14, 2012 9:54 pm
- Location: Budapest, Hungary
- Yamaneko
- Posts: 6
- Joined: Wed Nov 14, 2012 9:54 pm
- Location: Budapest, Hungary
-
gothxx
- Posts: 2
- Joined: Fri Feb 14, 2014 4:11 pm
-
thundre
- Posts: 356
- Joined: Sun Mar 27, 2011 10:01 am
Re: Problem 054
No. For the purpose of this problem, Ace is high (only).gothxx wrote:It's not stated if 5♠ 4♦ 3♦ 2♠ A♥ is considered a straight or not. Anyone?

-
gothxx
- Posts: 2
- Joined: Fri Feb 14, 2014 4:11 pm
Re: Problem 054
thx, realised just that i could just try, and it worked!thundre wrote:No. For the purpose of this problem, Ace is high (only).gothxx wrote:It's not stated if 5♠ 4♦ 3♦ 2♠ A♥ is considered a straight or not. Anyone?
-
DeatH_StaR
- Posts: 16
- Joined: Sat Apr 19, 2014 5:09 pm
- nicolas.patrois
- Posts: 118
- Joined: Fri Jul 26, 2013 4:54 pm
- Contact:
-
tdk.001
- Posts: 1
- Joined: Fri Apr 03, 2015 1:51 pm
Re: Errors/Warnings/Bugs
Has the input text file in Problem 54: Poker Hands changed without updating the answer?
The p054_poker.txt file I pulled has 1001 entries in it when the problem description says 1000, and similarly, my answer was off by one from what was expected.
The p054_poker.txt file I pulled has 1001 entries in it when the problem description says 1000, and similarly, my answer was off by one from what was expected.
Last edited by tdk.001 on Fri Apr 03, 2015 4:31 pm, edited 1 time in total.
- mpiotte
- Administrator
- Posts: 1961
- Joined: Tue May 08, 2012 5:40 pm
- Location: Montréal, Canada
Re: Errors/Warnings/Bugs
Maybe you are parsing it incorrectly. I just downloaded the latest from the website and I get, as expected:tdk.001 wrote:Has the input text file in Problem 54: Poker Hands changed without updating the answer?
The p054_poker.txt file I pulled has 10001 entries in it when the problem description says 1000, and similarly, my answer was off by one from what was expected.
Code: Select all
>wc -l p054_poker.txt
1000 p054_poker.txt

