How do i do this?
Posted on 2004-10-17
I have a list box of numbers and letters that are suppose to be cards (BlackJack 21):
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A
J, Q, K = 10
A = 11 or 1
How do i make it auto detect what the ACE should be if totaling the cards dosnt go over 21 and having it read how many aces are in the hand.
The problem I'm having is after totaling up the (ACES already in hand) values for the cards and then another ACE gets drawn the old ace remains a 10 which makes it go over 21. For example:
first calulation would add these cards as 8:
1, A, 6 = 18
then another card is drawn:
1, A, 6, K = 28
After the King is drawn it automatically brings it over 21 because the previous ACE was a 11.
Lets say 2 more cards were drawn:
1, A, 6, K , A, 1
if added right this would of been a perfect hand
but for me its adding 30 because its only deciding on the last ace.
I need it something like this: (lets pretend this was possible in a hand)
A,A,A = 13
A,A,A,A = 14
A,A,A,A,A = 15..etc
A,A,A,A etc...(21 x A's) = 21
Having it autodetect the best use for A's (1 or 11) for each A in the deck.
How can i make it make the best decision for totaling up the values to have it =21 or <21 or closest to 21 with multiple aces.