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


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
User avatar
TheEvil
Posts: 84
Joined: Sun Nov 13, 2011 10:38 am
Location: Szeged, Hungary

Re: Problem 054

Post by TheEvil »

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

User avatar
rayfil
Administrator
Posts: 1405
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 054

Post by rayfil »

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!!! :( :shock: :lol:
When you assume something, you risk being wrong half the time.

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

Re: Problem 054

Post by SoboLAN »

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!!! :( :shock: :lol:
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).
Image

User avatar
TheEvil
Posts: 84
Joined: Sun Nov 13, 2011 10:38 am
Location: Szeged, Hungary

Re: Problem 054

Post by TheEvil »

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!!! :( :shock: :lol:
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).
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.
Image

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

Re: Problem 054

Post by mdean »

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

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

Re: Problem 054

Post by SoboLAN »

TheEvil wrote:
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).
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 :) .
Image

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

Re: Problem 054

Post by Loers »

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

Post by thundre »

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

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

Re: Problem 054

Post by Loers »

thanx in advance ^^ I sent the file..

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

Re: Problem 054

Post by Yamaneko »

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. :-?
Image

User avatar
TheEvil
Posts: 84
Joined: Sun Nov 13, 2011 10:38 am
Location: Szeged, Hungary

Re: Problem 054

Post by TheEvil »

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

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

Re: Problem 054

Post by Yamaneko »

Thanks! I sent you my results. :)
Image

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

Re: Problem 054

Post by Yamaneko »

Aaand... done! :)
Image

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

Re: Problem 054

Post by gothxx »

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

Post by thundre »

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

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

Re: Problem 054

Post by gothxx »

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! :D

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

Re: Problem 054

Post by DeatH_StaR »

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

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

Re: Problem 054

Post by nicolas.patrois »

Ten.
Image

tdk.001
Posts: 1
Joined: Fri Apr 03, 2015 1:51 pm

Re: Errors/Warnings/Bugs

Post by tdk.001 »

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.

User avatar
mpiotte
Administrator
Posts: 1914
Joined: Tue May 08, 2012 5:40 pm
Location: Montréal, Canada

Re: Errors/Warnings/Bugs

Post by mpiotte »

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.
Maybe you are parsing it incorrectly. I just downloaded the latest from the website and I get, as expected:

Code: Select all

>wc -l p054_poker.txt 
1000 p054_poker.txt
Image

Post Reply