playhand.cpp

// Players hand body
// Brandon Goldfedder

#include "playhand.h"
#include "display.h"
#include <string.h>
PlayerHand::PlayerHand(const char* name, Displayer
   *displayer): StandardBlackJackHand(displayer)
{
   id = new char[strlen(name) + 1];
   strcpy(id, name);
}

PlayerHand::~PlayerHand()
{
   delete[] id;
}

BlackJackHand::TURN_RESULT PlayerHand::TakeTurn()
{
   TURN_RESULT result = BUST;
   bool mayDouble = false;
   bool maySplit = false;
   if (NumCards() == 2) {
      unsigned int count = HighCount();
      mayDouble = (count == 9 || count == 10 || count == 11);
      maySplit = IsSplitable();
      }
   if (HighCount() <= 21)
      result = GetDisplayer()->InquireTurn(*this, mayDouble,
      maySplit);
   GetDisplayer()->DisplayTurn(*this, result);
   return result;
}

bool PlayerHand::TookInsurance() const
{
   return tookInsurance;
}

bool PlayerHand::OfferInsurance()
{
   tookInsurance = GetDisplayer()->InquireInsurance(*this);
   return tookInsurance;
}

const char* const PlayerHand::GetIdentity() const
{
   return id;
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.199.210