O'Reilly logo

Joy of Patterns: Using Patterns for Enterprise Development, The by Brandon Goldfedder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required