TwentyOne

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

Incorrect Handling of Aces Leads to Unfair Game Outcomes

Root Cause

In blackjack, Aces can be counted as either 1 or 11, depending on which value benefits the player's hand without causing a bust. The contract currently counts Aces only as 1:

if (cardValue == 0 || cardValue >= 10) {
playerTotal += 10;
} else {
playerTotal += cardValue;
}

This logic does not account for the dual value of Aces, disadvantaging the player and deviating from standard blackjack rules.

Impact

  • Player Disadvantage: Players are unfairly disadvantaged as they cannot utilize the flexibility of Aces, potentially leading to unnecessary losses.

  • Game Integrity Compromised: The game does not adhere to traditional blackjack rules, which may lead to player dissatisfaction and mistrust.

  • Financial Losses: Players may lose funds in situations where they should have had a winning hand if Aces were correctly handled.

Recommendations

  • Implement Dual Ace Values: Modify the hand calculation logic to account for Aces being either 1 or 11. Use algorithms that adjust the Ace value based on the current hand total.

  • Hand Evaluation Logic: Introduce a function that recalculates the hand total when an Ace is drawn, choosing the most advantageous value for the player that doesn't result in a bust.

  • Testing and Validation: Thoroughly test the updated logic with various hand combinations to ensure accurate hand totals.

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.