stdhand.cpp

 // Standard Black jack hand body // Brandon Goldfedder #include <assert.h> #include "stdhand.h" #include "display.h" unsigned int StandardBlackJackHand::SingleCardCount(const Card& card, bool highCount) const { unsigned int count = 0; if (card.IsAce()) count += (highCount ? 11 : 1); else if (card.IsFaceCard() || card.CardType() == 'T') count += 10; else { assert (card.IsValueCard()); count = count + card.CardType() - '0'; } return count; } unsigned int StandardBlackJackHand::TotalCardCount(bool highCount) const { unsigned int count = 0; unsigned int numAces = 0; std::deque<Card>::const_iterator card = hand.begin(); while (!(card == hand.end())) { if ((*card).IsAce()) // Count the aces numAces++; count += SingleCardCount(*card, false); ...

Get Joy of Patterns: Using Patterns for Enterprise Development, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.