Blackjack Trainer blackjackdoc.com/Practice blackjack basic strategy with the help of easy trainer Blackjack Game Advisor blackjackdoc.com/Input Blackjack rules and get advice on any hand depending on your and dealer cards.
Strategy Chart Generator blackjackdoc.com/Input game rules and get special strategy chart for any Blackjack variation.
I'm trying to calculate score of simple Black Jack game.
I want to be able for computer to choose when to count Ace card as 1 or 11 depending on the situation of cards but I don't want to hard code this situation. This is how I count score in my dealers/players hand class: thoroughly, but I'm pretty sure you don't need to check for multiple following aces, because the only way to bust would be if you hit on 21, which no one will do.
If that doesn't work, you might have to pass on a cumluative total of how many aces have been counted and use more complicated logic.
I don't think you can put all the logic for determining a cards value in the card object, because you don't know until you have counted the value of all the cards whether ace=11 would have caused the hand to go bust - in which case ace magically turns into 1.
I would modify the design so that card has except that if the card is an ace, then get Min Value returns 1 and get Max Value returns 11.
Now you redesign the calc Score to first calculate the score using get Max Value.
If the hand goes bust, you do a more complex calculation of get Max Value and get Min Value.
This way your card class does not have to encapsulate the As I kept in mind tips that you guys gave me plus few tips from another post on SO as fgb suggested, I came up with this.
Rather than count cards once when I need to I rather count cards as they come within inserting method of my Hand class.
This let me to count cards and decide whether to use 1 or 11 as Ace.