The current implementation doesn't correctly account for the dual value of Aces (1 or 11) in Twenty-One.
An Ace can be counted as either 1 or 11, whichever is more beneficial to the hand without causing it to exceed 21 (a bust). The existing playersHand and dealersHand functions treat an Ace (represented by a card value of 0 or values >= 10 after the modulo operation) as always having a value of 10. This is incorrect.
This flaw leads to inaccurate hand totals. Here are some specific scenarios:
False Busts: A player might have a hand like Ace + 6, which should be 17. The current code would calculate it as 16, potentially leading the player to hit and bust unnecessarily.
Incorrect Dealer Wins: The dealer might have a hand like Ace + 8, which should be 19. The current code would calculate it as 18. If the player has 19, the game would be incorrectly declared a draw or a player loss, depending on how ties are handled.
Misleading Player Decisions: Because the player's hand total is inaccurate, they'll make decisions (hit or stand) based on incorrect information, leading to suboptimal play.
Foundry and Manual reading
The hand calculation logic must be modified to handle Aces correctly. Here's a refined approach:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.