Skip to content

Commit

Permalink
Merge pull request #374 from 403-Fruit/patch-1
Browse files Browse the repository at this point in the history
Blackjack game: fix bug counting more than one ace
  • Loading branch information
xMasterX authored Mar 5, 2023
2 parents f612357 + f1f2718 commit 2f567f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions applications/plugins/blackjack/common/card.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ uint8_t hand_count(const Card* cards, uint8_t count) {
}

for(uint8_t i = 0; i < aceCount; i++) {
if((score + 11) <= 21)
if((score + 11 + (aceCount - 1)) <= 21)
score += 11;
else
score++;
Expand Down Expand Up @@ -350,4 +350,4 @@ void add_hand_region(Hand* to, Hand* from) {
add_to_hand(to, from->cards[i]);
}
}
}
}

0 comments on commit 2f567f3

Please sign in to comment.