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

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.