Mari's Tarot
 All Classes Files Functions Variables Enumerations Enumerator Friends
Classes | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Player Class Referenceabstract

Player is an abstract class presenting a common interface for AI and Human players. More...

#include <Player.hpp>

Inheritance diagram for Player:
Inheritance graph
Collaboration diagram for Player:
Collaboration graph

Classes

struct  cardOrder
 A structure to automatically fix an insert order into cards' sets. More...
 

Public Member Functions

 Player (const string &name)
 The unique constructor of Player. More...
 
void addCard (const shared_ptr< Card > card)
 Add a card among player's initial cards. More...
 
virtual Biddings bid (const Biddings bestBid, const bool chelemAnnounced) const =0
 Pure virtual function to make a choice for biddings. More...
 
virtual shared_ptr< CardchooseKing (const Deck &deck) const =0
 Pure virtual function to make a choice for partnership in a 5-player game. More...
 
vector< shared_ptr< Card > > getAllCards () const
 Returns the vector of all cards in player's hand. More...
 
set< AnnouncementsgetAnnounced () const
 Inline assessor to the set of announcements. More...
 
vector< shared_ptr< Card > > getInitialCards () const
 Inline assessor to the player's initial cards. More...
 
int getNumberOudlers () const
 Inline assessor to the number of oudlers the player has with his/her initial hand. More...
 
virtual set< shared_ptr< Card > > makeEcart (const int dogSize)=0
 Pure virtual function to make the ecart when the player is the best bidder. More...
 
virtual void newGame ()=0
 Pure virtual function to prepare the player for a new game. More...
 
virtual shared_ptr< CardplayCard (const Suits referenceSuit, const shared_ptr< Card > highTrump)=0
 playCard is a pure virtual function returning the card the player chooses to play. More...
 
void showCards () const
 To print all player's cards in his/her current hand. More...
 
vector< shared_ptr< Card > > validCards (const Suits referenceSuit, const shared_ptr< Card > greaterTrump) const
 Returns the vector of cards the player can currently play, regarding the asked suit and the greater trump of the trick. More...
 

Public Attributes

string name
 The player's name. More...
 
double score
 The player's score. More...
 

Protected Member Functions

vector< shared_ptr< Card > > callableCards (const Deck &deck) const
 To compute the vector of cards we can call during a 5-player game. More...
 
void delCard (const shared_ptr< Card > card)
 To delete a card from the player's current hand. More...
 

Protected Attributes

set< shared_ptr< Card >
, cardOrder
hearts
 The set of Hearts owned by the player. More...
 
set< shared_ptr< Card >
, cardOrder
spades
 The set of Spades owned by the player. More...
 
set< shared_ptr< Card >
, cardOrder
diamonds
 The set of Diamonds owned by the player. More...
 
set< shared_ptr< Card >
, cardOrder
clubs
 The set of Clubs owned by the player. More...
 
set< shared_ptr< Card >
, cardOrder
trumps
 The set of trumps owned by the player. More...
 
shared_ptr< Cardfool
 The pointer toward the Fool, if owned by the player. More...
 
vector< shared_ptr< Card > > initialCards
 The vector of player's initial cards, from his/her starting hand. More...
 
int numberOudlers
 The number of oudlers the player has among his/her initial cards. More...
 
double initialPoints
 The number of points the player has with his/her initial cards. More...
 
set< Announcementsannounced
 The set of announcements (for what?). More...
 

Detailed Description

Player is an abstract class presenting a common interface for AI and Human players.

Constructor & Destructor Documentation

Player::Player ( const string &  name)

The unique constructor of Player.

Parameters
nameThe player name.

Member Function Documentation

void Player::addCard ( const shared_ptr< Card card)

Add a card among player's initial cards.

Parameters
cardThe card to add.
virtual Biddings Player::bid ( const Biddings  bestBid,
const bool  chelemAnnounced 
) const
pure virtual

Pure virtual function to make a choice for biddings.

Parameters
bestBidThe best bid proposed so far.
chelemAnnouncedA Boolean to know if someone has declared a chelem.
Returns
The chosen bid (Biddings::none if one passes).

Implemented in AI, and Human.

vector< shared_ptr< Card > > Player::callableCards ( const Deck deck) const
protected

To compute the vector of cards we can call during a 5-player game.

Parameters
deckThe deck used form the game.
Returns
The vector of cards the taker can call (usually, the four kings).
virtual shared_ptr<Card> Player::chooseKing ( const Deck deck) const
pure virtual

Pure virtual function to make a choice for partnership in a 5-player game.

Parameters
deckThe current deck used for the game
Returns
The chosen king (or card).

Implemented in AI, and Human.

void Player::delCard ( const shared_ptr< Card card)
protected

To delete a card from the player's current hand.

Parameters
cardThe card to delete from the player's hand.
vector< shared_ptr< Card > > Player::getAllCards ( ) const

Returns the vector of all cards in player's hand.

Returns
The union of hearts, spades, etc, sets.
set< Announcements > Player::getAnnounced ( ) const
inline

Inline assessor to the set of announcements.

vector< shared_ptr<Card> > Player::getInitialCards ( ) const
inline

Inline assessor to the player's initial cards.

int Player::getNumberOudlers ( ) const
inline

Inline assessor to the number of oudlers the player has with his/her initial hand.

virtual set< shared_ptr<Card> > Player::makeEcart ( const int  dogSize)
pure virtual

Pure virtual function to make the ecart when the player is the best bidder.

Parameters
dogSizeThe number of card one must include into the ecart.
Returns
A set of Card pointers for the cards one places into the ecart.

Implemented in AI, and Human.

virtual void Player::newGame ( )
pure virtual

Pure virtual function to prepare the player for a new game.

Implemented in AI, and Human.

virtual shared_ptr<Card> Player::playCard ( const Suits  referenceSuit,
const shared_ptr< Card highTrump 
)
pure virtual

playCard is a pure virtual function returning the card the player chooses to play.

Parameters
referenceSuitThe asked suit for the trick.
highTrumpThe highest trump played so far for the trick, if any.
Returns
The chosen card to play.

Implemented in AI, and Human.

void Player::showCards ( ) const

To print all player's cards in his/her current hand.

vector< shared_ptr< Card > > Player::validCards ( const Suits  referenceSuit,
const shared_ptr< Card greaterTrump 
) const

Returns the vector of cards the player can currently play, regarding the asked suit and the greater trump of the trick.

Parameters
referenceSuitThe asked suit for the trick.
greaterTrumpA pointer on the greater trump of the trick, if any.
Returns
The vector of all cards the player can play in his/her situation.

Member Data Documentation

set< Announcements > Player::announced
protected

The set of announcements (for what?).

set< shared_ptr<Card>, cardOrder > Player::clubs
protected

The set of Clubs owned by the player.

set< shared_ptr<Card>, cardOrder > Player::diamonds
protected

The set of Diamonds owned by the player.

shared_ptr<Card> Player::fool
protected

The pointer toward the Fool, if owned by the player.

set< shared_ptr<Card>, cardOrder > Player::hearts
protected

The set of Hearts owned by the player.

vector< shared_ptr<Card> > Player::initialCards
protected

The vector of player's initial cards, from his/her starting hand.

double Player::initialPoints
protected

The number of points the player has with his/her initial cards.

string Player::name

The player's name.

int Player::numberOudlers
protected

The number of oudlers the player has among his/her initial cards.

double Player::score

The player's score.

set< shared_ptr<Card>, cardOrder > Player::spades
protected

The set of Spades owned by the player.

set< shared_ptr<Card>, cardOrder > Player::trumps
protected

The set of trumps owned by the player.


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