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.
tommyjcarpenter
Posts: 3
Joined: Wed May 03, 2017 4:58 pm

problem 054 needs updated wording

Post by tommyjcarpenter »

I am a poker player, and at least in HoldEm an Ace can start a straight. The wording on the problem is incorrect and ambiguous, because from it it would seem that an ace can only end a straight as in TJQKA because of the value listing, but A1234 is a valid poker straight.

So can an ace start a straight and can this be clarified in the wording?
Last edited by tommyjcarpenter on Wed May 03, 2017 6:20 pm, edited 1 time in total.
User avatar
rayfil
Administrator
Posts: 1406
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: problem 54 needs updated wording

Post by rayfil »

Being a new member on this forum, please be advise that problem numbers are listed with leading "0s" to provide a 3-digit number in order to facilitate archiving and easier searching.
When you assume something, you risk being wrong half the time.
th72
Posts: 1
Joined: Tue Aug 15, 2017 3:52 pm

Re: Problem 054

Post by th72 »

Hi! This one really has me stumped.
I've been doing random checks on the winning hands, but I really can't find the mistake. And I'm pretty sure I've evaluated the tie-breakers properly (again, random checks seem to work).

Would anyone be willing to take a look at my list of who won which hand and tell me the first result I've gotten wrong? I think that would put me on the right track, thanks!
User avatar
rayfil
Administrator
Posts: 1406
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 054

Post by rayfil »

th72
Send me a PM with your list and I'll try to have a look at it.
When you assume something, you risk being wrong half the time.
Junglemath
Posts: 54
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

Re: Problem 054

Post by Junglemath »

I've seen conflicting answers about whether an ace can be considered the lowest card for the purposes of making a straight. In every version of (high) poker, which this problem seems to be about, the lowest straight is A2345, with the ace assuming the value of 1. For all other purposes it is considered to rank above a king.

Does anyone know for sure what this problem wants?

And to the admins, if A2345 does not count as a straight, it should be changed. This is extremely nonstandard. At the very least, a sentence should be included in the problem statement as this is a huge ambiguity to anyone who knows anything about poker.

Thanks
LilStalker
Posts: 73
Joined: Thu Nov 03, 2016 4:32 pm

Re: Problem 054

Post by LilStalker »

I do think this is considered a straight 5 high.

Are there many hands where this is a problem? Otherways you can try 2 or 3 values if there are a few hands with this occurence.
Image
Junglemath
Posts: 54
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

Re: Problem 054

Post by Junglemath »

LilStalker wrote: Fri Sep 20, 2019 9:47 pm I do think this is considered a straight 5 high.

Are there many hands where this is a problem? Otherways you can try 2 or 3 values if there are a few hands with this occurence.
Someone on reddit claimed they solved it without assuming that the ace counts as low. I tried it this way and indeed I got the right answer.

BTW, did you really solve 509 problems? Did you omit 54 for some reason?

Unlikely spoiler ahead:
(No spoilers allowed on this forum. <moderator>)
s4mp
Posts: 5
Joined: Sat Apr 25, 2020 6:28 pm

Problem 054

Post by s4mp »

I've coded a solution, but for some reason the answer i get is one off.

My only thought at the moment is that it counts a straight from a low ace (e.g A 2 3 4 5), As i haven't programmed this. Is this true? I've searched for similar posts but it seems to be getting mixed answers.
Junglemath
Posts: 54
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

Re: Problem 054

Post by Junglemath »

There is a thread about this problem already. Did you look there?

viewtopic.php?f=50&t=6550

By the way, how do you know you're one off if you haven't solved it yet?
s4mp
Posts: 5
Joined: Sat Apr 25, 2020 6:28 pm

Re: Problem 054

Post by s4mp »

I've looked through the thread and that answers about the ace but i still cant work out why im off by one.

Is there any chance i could PM you a list of my results for each pair of hands and you let me know which one is wrong?

EDIT: I managed to solve it, no help needed anymore
Last edited by s4mp on Wed May 06, 2020 2:05 pm, edited 1 time in total.
Junglemath
Posts: 54
Joined: Fri Sep 20, 2019 1:25 pm
Location: Minsk

Re: Problem 054

Post by Junglemath »

s4mp wrote: Wed May 06, 2020 10:00 am I've looked through the thread and that answers about the ace but i still cant work out why im off by one.

Is there any chance i could PM you a list of my results for each pair of hands and you let me know which one is wrong?
Sure. But how do you know you're one off if you haven't solved it yet?
User avatar
hk
Administrator
Posts: 10984
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 054

Post by hk »

s4mp wrote: Wed May 06, 2020 10:00 am I've looked through the thread and that answers about the ace but i still cant work out why im off by one.

Is there any chance i could PM you a list of my results for each pair of hands and you let me know which one is wrong?

EDIT: I managed to solve it, no help needed anymore
Great.
Next time please read the pink box at the top of the page carefully.
Image
DeKlod
Posts: 19
Joined: Tue Aug 21, 2018 8:55 am

Re: Problem 054

Post by DeKlod »

Junglemath wrote: Wed May 06, 2020 1:40 pm
s4mp wrote: Wed May 06, 2020 10:00 am I've looked through the thread and that answers about the ace but i still cant work out why im off by one.

Is there any chance i could PM you a list of my results for each pair of hands and you let me know which one is wrong?
Sure. But how do you know you're one off if you haven't solved it yet?
Allow me to add my pinch of salt in s4mp's defence: any internet search on an Euler-like problem (particularly the older ones) will invariably turn up page after page of spoilers!
Now, it is everyone's decision - and in Covid times, we're all supposed to act responsibly so we do the same with Euler Project questions - but one of the cheats I personally find quite acceptable is to look up the answer. Not the algorithm that gets you there - just the actual answer.
I should state that my goal, in tackling Euler questions, is to teach myself computer programming. In formal education, there would be a tutor or teacher who would look at my code/thinking behind the code and give me some feedback: am I getting close or is my approach ridiculously wrong.
So I too have benefitted from looking up the odd answer - value - and find that I inadvertently missed setting the initial sum-value to 5 because my loop only started at 6, or some similar mistake. Easy to spot if you're a seasoned programmer, but a devilish trap for the self-taught novice.
So what I really want to say is: please can we avoid judging someone's message from the simple fact that he/she may have looked up (or inadvertently seen - that's Google for you!) the answer beforehand? The great thing about Project Euler is that it allows people like me to start self-taught coding without any pressure!
Besides: I know from bitter experience how hard it can be - again as a self-taught novice programmer - to find stupid little errors like the one s4mp might have made... Have you ever converted an integer into a double by forcing and multiplying by '1.*' only to find after hours and hours that you missed the dot and simply multiplied by '1' ...
There are enough traps for us novices - at least allow us to seek some guidance to keep us on the right track! :-)

Here endeth the lesson ;-)

Claude
User avatar
hk
Administrator
Posts: 10984
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 054

Post by hk »

There's actually no need to have looked up the answer somewhere.
Some people simply try some answers around the value their program gives. Just to rule out off by one answers.
Image
DeKlod
Posts: 19
Joined: Tue Aug 21, 2018 8:55 am

Re: Problem 054

Post by DeKlod »

hk wrote: Fri May 08, 2020 9:28 am There's actually no need to have looked up the answer somwhere.
Some people simply try some answers around the value their program gives. Just to rule out off by one answers.
Never thought of that :-D
Post Reply