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

dealhand.cpp

// Dealers hand body
// Brandon Goldfedder

#include "dealhand.h"
#include "display.h"

StandardDealerHand::StandardDealerHand(Displayer *displayer): 
StandardBlackJackHand(displayer)
{
}

StandardDealerHand::~StandardDealerHand()
{
}

BlackJackHand::TURN_RESULT StandardDealerHand::TakeTurn()
{
   TURN_RESULT result = STAND;
   if (HighCount() < 17)
      result = HIT;
   else if (HighCount() > 21)
      result = BUST;
   GetDisplayer()->DisplayTurn(*this, result);
   return result;
}

const char* const StandardDealerHand::GetIdentity() const
{
   return "Dealer"; // should ensure static allocation
}


unsigned int StandardDealerHand::NumCardsDealtDown() const
{
   return 1;
}

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