
Title:
0140 Ace Low Straight Solution

Description:

Well, here's what I came up with.

Instead of returning the ranks directly,

what I want to do is say under 1 condition,

if the ranks is equal to this acehigh or acelow straight, rather,

then I want to fix it.

Otherwise I want to leave it the same.

If the ranks is equal to this ace lowand we'll fill in that later

if that's the case, then what I want to return

is a fix, which is 5, 4, 3, 2, 1.

This is the only time when I'm returning a 1 as a value.

Up here we had 2 and above.

There was no 1 that you could return.

But now an ace, instead of being 14,

we're going to count the ace as a 1,

and we're going to do that only in the case

when the ranks that we had so far was an ace, 2, 3, 4, 5,

which according to the sorting would have come out as 14,

5, 4, 3, 2.

And I got the syntax backwards here when I did the insertion,

so what I want to say is return 5, 4, 3, 2, 1,

which would be the correct ordering for where we want to put an ace

if we had ace, 2, 3, 4, 5, as our hand.

And for any other hand, just return the ranks as is.

And my claim is that this will make everything work because

now we've taken this one hand that was problematic,

and we corrected it by making an ace be a 1 instead of a 14,

and now all the other comparisons of ranks will work out properly.

This will, in fact, be a straight because 5  1 is 4, and there's 5 different cards.

And the high value in here will, in fact, be a 5 and not the ace.