In the dealersHand() function of the TwentyOne contract, Kings are incorrectly valued as 0 instead of 10. This miscalculation disrupts the dealer's hand totals, affecting the game's fairness and balance.
Issue: Kings are represented by cardValue == 0 after the modulo operation (cardValue = card % 13).
Problematic Code:
Explanation: The condition cardValue >= 10 does not capture Kings (cardValue == 0), causing them to add 0 to dealerTotal instead of 10.
Altered Dealer Hand Totals: Dealer's hand totals are inaccurately low when Kings are drawn.
Disrupted Game Balance: The fairness of the game is affected, potentially giving an unintended advantage.
Deviation from Rules: The game deviates from standard blackjack rules, affecting player trust.
Manual code review of the dealersHand() function.
Correct King Valuation:
Ensure Consistency: Verify that all face cards are correctly valued in all functions.
Implement Tests: Add unit tests to confirm that Kings are valued at 10.
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.