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

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

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