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...
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.
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"
Love this. Thanks! It's a really good problem to show off "modern" javascript.
Only piece of feedback... the nested ternary in
byCountFirst
is probably too terse.Thanks! Yeah that's fair on the ternary. I'll adjust it.
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.
Hey there! I totally get where you're coming from with the daily challenges on DEV - sometimes they can be a bit too time-consuming. By the way, I'm new to this forum, but I wanted to chime in and say that I've been having a blast trying out different coding challenges and learning new things. And speaking of new things, have you tried out any Gratis Casino Spielautomaten ohne Anmeldung in Österreich? I've been getting into online slots lately and it's been a fun way to unwind after a long day of coding. Anyway, thanks for sharing your experience with solving the poker hand problem - it's always cool to see how different people approach the same challenge. And thanks for the tip about js-coroutines - I'll have to check it out!
tortuga-casino.site/ is an online platform offering a pirate-themed gaming experience with over 500 games, including slots, table games, and video poker. It features generous welcome bonuses, loyalty rewards, and secure payment methods, including cryptocurrency. The site is designed to be mobile-friendly and provides 24/7 customer support. Players can enjoy an immersive, pirate-adventure atmosphere while exploring various gaming options.
king-chance-casino.com/ is known for its generous promotions and user-friendly interface, making it accessible and appealing to both new and seasoned players.
Wow nice post dev.to/miketalbot
Thanks!! I learn about min-max algo!!