TwentyOne

First Flight #29
Beginner FriendlyGameFiFoundrySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

TwentyOne::playersHand() wrongfully count the 1 case

Summary

In blackjack, Ace is either 1 or 11. In playerhands(), the 1 case is wrongfully accounted

Vulnerability Details

Here we can see that cardValue is calculated %13 which represent a color and, is either it's value, or >=10 which represent 10, Jack, Queen, King.
cardValue == 0 represents the Ace case. In the code it's represented as 10, where it should be 1 or 11 if we follow the blackjack rules.

Impact

Ace's case in the player count is poorly managed, diverging from blackjack's original rules. It changes % of luck to wins. Also, players expect to play with blackjack rules and will make choices depending on that.

Tools Used

Manual

Recommendations

Change how aces are counted. As it's either 1 or 11, it should be reflected in the code.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Wrong ace value

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.