proj home

Files   Classes   Functions   Hierarchy  

dealer Class Reference

The dealer is a player with special powers. More...

#include <dealer.h>

Collaboration diagram for dealer:

List of all members.

Public Member Functions

 dealer (deck &_cards)
 The dealer sees and needs a deck of cards.
void play ()
 The dealers hand is played from the hnd state.
int const playAgainst (uintc player, uintc dealer0)
 -1 is a loss for the player 0 is a draw 1 is a win to the player
void playAgainst (double &prPlayerLoss, double &prDraw, double &prPlayerWin, long unsigned int n, uintc player, uintc dealer0)
 Simulate the dealer playing against a player where both the dealer and the player have set hands.

Public Attributes

deckcards
 The deck of cards.
hand hnd
 The dealer has a hand to play agains the players.


Detailed Description

The dealer is a player with special powers.

This class is written from the perspective of the dealer.

Additional simulation functions were added for experimentation to determine probabilities of win or loss.

Definition at line 19 of file dealer.h.


Constructor & Destructor Documentation

dealer::dealer ( deck _cards  )  [inline]

The dealer sees and needs a deck of cards.

Definition at line 29 of file dealer.h.

00030     : cards(_cards) {}


Member Function Documentation

void dealer::play (  ) 

The dealers hand is played from the hnd state.

This is independent of any player.

Definition at line 5 of file dealer.cpp.

References hand::add(), cards, deck::draw(), hnd, and hand::value.

Referenced by playerGame::alive_hold(), and playAgainst().

00006 {
00007   for ( ; hnd.value<17; )
00008     hnd.add(cards.draw());
00009 }

void dealer::playAgainst ( double &  prPlayerLoss,
double &  prDraw,
double &  prPlayerWin,
long unsigned int  n,
uintc  player,
uintc  dealer0 
)

Simulate the dealer playing against a player where both the dealer and the player have set hands.

Definition at line 27 of file dealer.cpp.

00035 {
00036 assert(false);
00037 
00038 }

int const dealer::playAgainst ( uintc  player,
uintc  dealer0 
)

-1 is a loss for the player 0 is a draw 1 is a win to the player

Definition at line 11 of file dealer.cpp.

References hand::calculate(), hnd, play(), and hand::reset().

00012 {
00013   hnd.reset(dealer0);
00014   play();
00015 
00016   uint val = hnd.calculate();
00017   if (player<val)
00018     return -1;
00019 
00020   if (val<player)
00021     return 1;
00022 
00023   return 0;
00024 }


Member Data Documentation

The deck of cards.

Definition at line 24 of file dealer.h.

Referenced by play().

The dealer has a hand to play agains the players.

Definition at line 26 of file dealer.h.

Referenced by playerGame::alive_hold(), playerGame::notalive_dealCards(), play(), playAgainst(), and textGame::printGameState().


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:49:55 2011 for Chelton Evans Source by  doxygen 1.5.8