Problem 054

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
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.

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 post any spoilers
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
Posts: 1405
Joined: Sun Mar 26, 2006 5:30 am
Contact:

Re: Problem 054

If both hands are three-of-a-kind, first compare the three-of-a-kind; if equal, ....
In such a case, someone is definitely cheating if playing with a 52-card deck!!!
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

rayfil wrote:
If both hands are three-of-a-kind, first compare the three-of-a-kind; if equal, ....
In such a case, someone is definitely cheating if playing with a 52-card deck!!!
Actually, that's not necessarily true. Imagine this:

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

SoboLAN wrote:
rayfil wrote:
If both hands are three-of-a-kind, first compare the three-of-a-kind; if equal, ....
In such a case, someone is definitely cheating if playing with a 52-card deck!!!
Actually, that's not necessarily true. Imagine this:

Player 2: Td 7h
Board: 5s Th 8d 3s Tc

Both players have three-of-a-kind (tens).
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.

mdean
Posts: 165
Joined: Tue Aug 02, 2011 2:05 am

Re: Problem 054

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.
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.

SoboLAN
Posts: 39
Joined: Sat Aug 18, 2012 3:21 pm

Re: Problem 054

TheEvil wrote:
SoboLAN wrote: Actually, that's not necessarily true. Imagine this:

Player 2: Td 7h
Board: 5s Th 8d 3s Tc

Both players have three-of-a-kind (tens).
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.
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...

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..

thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 054

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..
If you PM me your results for the 1000 hands, one per line in order, I will point out the first wrong one.

Loers
Posts: 10
Joined: Sun Aug 19, 2012 3:03 am

Re: Problem 054

thanx in advance ^^ I sent the file..

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.

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

Re: Problem 054

Thanks! I sent you my results.

Yamaneko
Posts: 6
Joined: Wed Nov 14, 2012 9:54 pm
Location: Budapest, Hungary

Re: Problem 054

Aaand... done!

gothxx
Posts: 2
Joined: Fri Feb 14, 2014 4:11 pm

Re: Problem 054

It's not stated if 5♠ 4♦ 3♦ 2♠ A♥ is considered a straight or not. Anyone?

thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 054

gothxx wrote:It's not stated if 5♠ 4♦ 3♦ 2♠ A♥ is considered a straight or not. Anyone?
No. For the purpose of this problem, Ace is high (only).

gothxx
Posts: 2
Joined: Fri Feb 14, 2014 4:11 pm

Re: Problem 054

thundre wrote:
gothxx wrote:It's not stated if 5♠ 4♦ 3♦ 2♠ A♥ is considered a straight or not. Anyone?
No. For the purpose of this problem, Ace is high (only).
thx, realised just that i could just try, and it worked!

DeatH_StaR
Posts: 13
Joined: Sat Apr 19, 2014 5:09 pm

Re: Problem 054

What is 'T'? I know what is 'J', 'Q', 'K' and 'A', but what is 'T'?

nicolas.patrois
Posts: 118
Joined: Fri Jul 26, 2013 4:54 pm
Contact:

Re: Problem 054

Ten.

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.
Last edited by tdk.001 on Fri Apr 03, 2015 4:31 pm, edited 1 time in total.

mpiotte
Posts: 1914
Joined: Tue May 08, 2012 5:40 pm
>wc -l p054_poker.txt