dealer.cpp

 #include "dealer.h" bool Dealer::DealCard(BlackJackHand* hand) { Card card; if (!theDeck.GetCard(&card)) throw "Bad Deck"; hand->AddCard(card); return true; } bool Dealer::ProcessTurn(BlackJackHand* hand) { bool doneturn = false; bool retval = true; BlackJackHand::TURN_RESULT turn; while (!doneturn) { turn = hand->TakeTurn(); switch (turn) { case BlackJackHand::HIT: DealCard(hand); break; case BlackJackHand::BUST: retval = false; // allow fall through case BlackJackHand::STAND: doneturn = true; break; case BlackJackHand::DOUBLE_DOWN: DealCard(hand); retval = hand->HighCount() > 21; // did we bust doneturn = true; break; case BlackJackHand::SPLIT: throw "Not implemented"; // break; default: throw "Illegal result of move"; } } return ...

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.