You, like me, may have a play at solving some of the daily challenges here on DEV. Usually if the answer is more than one or two lines of some fan...
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
The original challenge specified no low straights from the Ace, but it jarred with me and this routine is easily adjustable to support it. We just have to worry about sort orders during straights and to recognise the straight in the first place. The following updated version of getHandDetails() manages both of these:
We perform a simple string check for the low straight and then switch the order of 'A' to 'N' for aces in this circumstance.
Yes, that's in the article list of hands picture and in the solution.
The topic of gambling is very interesting and exciting for me, so I often study similar JavaScript map/reduce. Thanks for your post, I really liked it, as I'm getting ready to launch my project. Now I play a lot in online casinos in my free time, I study various content of sites, and I recommend you a useful source aussiebestcasinos.com/paysafecard-... where you can study a useful review at the best Australian online casino that accept PaySafe 2021, which will help you make a choice and to you.
Love this. Thanks! It's a really good problem to show off "modern" javascript.
Only piece of feedback... the nested ternary in
byCountFirstis probably too terse.Thanks! Yeah that's fair on the ternary. I'll adjust it.
To take into account the "steel wheel" (straight 5432A) you need to add an imaginary face value of 1:
const order = "123456789TJQKA"
And if the input contains 2, 3, 4, 5 and A, then make the replacement of A by 1:
function SteelWheel(str) { if((str.indexOf('2') + 1) && (str.indexOf('3') + 1) && (str.indexOf('4') + 1) && str.indexOf('5') + 1) && (str.indexOf('A') + 1)) { return str.replace('A', '1') } else { return str } }
As mentioned in my comment above, the initial challenge had no straight from the ace. My version in the comment above supports the "steel wheel"
Thanks!! I learn about min-max algo!!
Wow nice post dev.to/miketalbot
dcfgngfjfghkmg
Nice code here... But this does not seem to take "kicker" cards into account as you compare hands...
It uses the "value" sorted string to do that. When the rank is the same
valueresolves it using the kickers:rdhuyftjhuf
Hi ih ihi hi
asdgdsf
sghdhd