Sep-06-2022, 06:01 PM
(Sep-06-2022, 05:15 PM)menator01 Wrote: Can't seem to get the ace to do correct.
Yes, that was a tricky one to solve for me, also.
What I did was to have a function that assigns a value of eleven to a Ace card (in fact it assigns values to any card), then, when checking the 'hand', I take a note of how many Ace cards are held, and if the total hand is greater than 21, reduce the hand value by 10 for each Ace card held. Of course, there needs to be some code that only does that in order to try and beat the hand of the other player.
Not sure of that makes any sense to you: it's always clear to the person that's doing the explaining.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein