Function dealersHand() in TwentyOne.sol incorrectly handles the case where the cardValue is 0 . Instead of treating it as a high-value card worth 10, it incorrectly adds 0 to the dealer's total, leading to miscalculations in the dealer's hand total.
In the dealersHand() function, the following code calculates the dealer's hand total:
The issue lies in the lack of a condition to handle cardValue == 0. When a card's modulo operation results in 0 , it is incorrectly added as 0 instead of 10. The logic assumes all valid cardValues will be non-zero, which is not the case.
Miscalculation in dealersHand: The dealer's hand may be significantly lower than it should be, leading to an unfair advantage for the player.
Manual code review.
Add the cardValue == 0 condition in the if statement that updates the dealerTotal
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.