This class defines AI players. More...
#include <AI.hpp>
Public Member Functions | |
AI (const string &name, const vector< string > &knownPartners) | |
AI constructor. More... | |
Biddings | bid (const Biddings bestBid, const bool chelemAnnounced) const |
Called to decide if one proposes a bid or not, and if any, what bid. More... | |
shared_ptr< Card > | chooseKing (const Deck &deck) const |
To make a choice for partnership in a 5-player game. More... | |
bool | haveSuit (const string &name, const Suits suit) const |
Given a Player p, does p have at least one card on the asked suit? More... | |
bool | isOpponent (const string &name) const |
To know if someone is your opponent. More... | |
bool | isPartner (const string &name) const |
To know if someone is your partner. More... | |
set< shared_ptr< Card > > | makeEcart (const int dogSize) |
To make the ecart once one takes the dog. More... | |
void | newGame () |
Must be called when starting a new game. More... | |
bool | opponentsHaveSuit (const Suits suit) const |
Do opponents have at least one card on the asked suit? More... | |
shared_ptr< Card > | playCard (const Suits referenceCard, const shared_ptr< Card > highTrump) |
Choose what card one plays, given the first card and the highest trump of the trick. More... | |
void | setDifficulty (const shared_ptr< StratDiff > diff) |
Inline function to set the difficulty (set a Strategy concrete class). More... | |
![]() | |
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... | |
vector< shared_ptr< Card > > | getAllCards () const |
Returns the vector of all cards in player's hand. More... | |
set< Announcements > | getAnnounced () 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... | |
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... | |
Additional Inherited Members | |
![]() | |
string | name |
The player's name. More... | |
double | score |
The player's score. More... | |
![]() | |
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... | |
![]() | |
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< Card > | fool |
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< Announcements > | announced |
The set of announcements (for what?). More... | |
This class defines AI players.
The class AI extends Player and shows an interface for actions like playCard, make a bid, etc. Actions' implementation is decoupled from the class with a Strategy pattern, where concret classes correspond to a level of difficulty.
AI::AI | ( | const string & | name, |
const vector< string > & | knownPartners | ||
) |
Called to decide if one proposes a bid or not, and if any, what bid.
bid is delegated to the difficulty Strategy.
bestBid | The best bid proposed so far. |
chelemAnnounced | A Boolean to know if someone has declared a chelem. |
Implements Player.
To make a choice for partnership in a 5-player game.
deck | The current deck used for the game |
Implements Player.
bool AI::haveSuit | ( | const string & | name, |
const Suits | suit | ||
) | const |
|
inline |
|
inline |
|
virtual |
|
virtual |
Must be called when starting a new game.
Flush to zero some variables and pointers.
Implements Player.
bool AI::opponentsHaveSuit | ( | const Suits | suit | ) | const |
Do opponents have at least one card on the asked suit?
suit | The asked suit. |
|
virtual |
Choose what card one plays, given the first card and the highest trump of the trick.
playCard is delegated to the difficulty Strategy.
referenceCard | A Card pointer of the first played card of the trick. |
highTrump | A Card pointer of the highest trump of the trick. |
Implements Player.
|
inline |
Inline function to set the difficulty (set a Strategy concrete class).
diff | A pointer on the difficulty to set. |