/* Player.h - Stores the name, bankroll, and hand of cards for each player. */


#ifndef PLAYER_H
#define PLAYER_H

#include "Hand.h"			


class Player    {
public:

     Player(Deck& ref) : the_deck(ref) {}            

     Hand<Card*> hand;                                               // Player's hand of cards
        
     void  set_score(int n)      { the_score = n; }
     void  add_score(int n)      { the_score = the_score + n; }
     void  sub_score(int n);				
     int   get_score() const     { return the_score; }
   
     void  set_name(char *name ) { strcpy(the_name,name); }    
     char* Name()                { return the_name; }
    
    
     class NoMoney   {
         public:
             NoMoney()   { cout << "You lost all your money!  Game over." << endl; }
     };        


private:

     Deck&  the_deck;
     int    the_score;
     char   the_name[80];
};


// Subtract n from the player's score.

void Player::sub_score(int n)
{
   the_score = the_score - n;
      
   if (the_score == 0) 
       throw NoMoney();
}

#endif