Game is one of the main class of Tarot. Here are defined rules, games' turns, scores, etc. More...
#include <Game.hpp>
Public Member Functions | |
Game () | |
The default constructor. More... | |
Game (int &numberPlayers, const bool automatic=false) | |
The complete constructor of Game. More... | |
void | chooseKing () |
In a 5-player game, to choose as a partner the player having the called king (or card). More... | |
void | closeBiddings (const Biddings bestBid) |
To call once bids are over. More... | |
double | computeScore (const string &name) const |
Computes the score of a given player (refered by his/her name). More... | |
void | dealCards () |
Deals cards. More... | |
Team | endGame () |
Close a game and returns winners. More... | |
Biddings | getBidding () const |
Inline function returning the game bid. More... | |
int | getCardsPerPlayer () const |
Inline function returning the number of cards players have to play in the game. More... | |
shared_ptr< Trick > | getCurrentTrick () const |
Inline function returning the current trick. More... | |
Team | getDefenders () const |
Inline function returning the defender team. More... | |
set< shared_ptr< Card > > | getDog () const |
Inline function returning the dog. More... | |
shared_ptr< Card > | getKingCalled () const |
Inline function returning the called king. More... | |
int | getIndexBidder () const |
Inline function returning bidder's index. More... | |
int | getIndexNext () const |
Inline function returning next player's index. More... | |
int | getIndexStarter () const |
Inline function returning starter player's index. More... | |
int | getIndexToBid () const |
Inline function returning the index of the next player to bid. More... | |
int | getNumberPlayers () const |
Inline function returning the number of players. More... | |
vector< shared_ptr< Player > > | getPlayers () const |
Inline function returning the players vector. More... | |
set< shared_ptr< Card > > | getPlayerWonCards (const shared_ptr< Player > player) const |
Returns won cards of a given player. More... | |
Team | getTakers () const |
Inline function returning the taker team. More... | |
shared_ptr< Trick > | getTrick () |
Update some fields and returns the current trick. More... | |
Team | getUnknownTeam () const |
Inline function returning the unknown team (only in a 5-player game). More... | |
bool | isBotsOnly () const |
Inline function returning if it is a game without any human players. More... | |
bool | isKingFound () const |
Inline function returning if it the called king is known. More... | |
void | newGame () |
Creates a new game. More... | |
void | printScores () const |
Prints players' / teams' scores. More... | |
shared_ptr< Card > | playCard (bool &kingJustFound) |
Plays one player turn part of the current trick and returns the played card. More... | |
bool | sameTeam (const shared_ptr< Player > p1, const shared_ptr< Player > p2) const |
Determines if two players belong to the same team. More... | |
void | setGame (int &numberPlayers, const bool automatic=false) |
Set a game, like the equivalent constructor does. More... | |
void | showDeck () const |
Shows the deck on the screen. More... | |
void | showPlayersCards () const |
Shows players' cards on the screen. More... | |
void | shuffleDeck () |
Shuffles (three time) the deck. More... | |
pair< shared_ptr< Player > , Biddings > | takeBiddings (const Biddings &bestBid) |
Makes the current player bidding, then turns to the next player. More... | |
void | takeDog () |
To take the dog after biddings. More... | |
void | updateIndexBidder () |
Inline function setting indexBidder to the value of indexToBid. More... | |
Game is one of the main class of Tarot. Here are defined rules, games' turns, scores, etc.
Game::Game | ( | ) |
The default constructor.
Game::Game | ( | int & | numberPlayers, |
const bool | automatic = false |
||
) |
The complete constructor of Game.
numberPlayers | The number of players. |
yourName | The human player name. |
automatic | A boolean set to true if and only if one wants to perform automatic tests. False by default. |
void Game::chooseKing | ( | ) |
In a 5-player game, to choose as a partner the player having the called king (or card).
void Game::closeBiddings | ( | const Biddings | bestBid | ) |
To call once bids are over.
bestBig | The best bid among players. |
double Game::computeScore | ( | const string & | name | ) | const |
Computes the score of a given player (refered by his/her name).
name | A string for a player's name. |
void Game::dealCards | ( | ) |
Deals cards.
Team Game::endGame | ( | ) |
Close a game and returns winners.
|
inline |
Inline function returning the game bid.
|
inline |
Inline function returning the number of cards players have to play in the game.
|
inline |
Inline function returning the current trick.
|
inline |
Inline function returning the defender team.
|
inline |
Inline function returning the dog.
|
inline |
Inline function returning bidder's index.
|
inline |
Inline function returning next player's index.
|
inline |
Inline function returning starter player's index.
|
inline |
Inline function returning the index of the next player to bid.
|
inline |
Inline function returning the called king.
|
inline |
Inline function returning the number of players.
|
inline |
Inline function returning the players vector.
Returns won cards of a given player.
players | The player we want won cards from. |
|
inline |
Inline function returning the taker team.
shared_ptr< Trick > Game::getTrick | ( | ) |
Update some fields and returns the current trick.
|
inline |
Inline function returning the unknown team (only in a 5-player game).
|
inline |
Inline function returning if it is a game without any human players.
|
inline |
Inline function returning if it the called king is known.
void Game::newGame | ( | ) |
Creates a new game.
shared_ptr< Card > Game::playCard | ( | bool & | kingJustFound | ) |
Plays one player turn part of the current trick and returns the played card.
kingJustFound | The reference to a Boolean value set to true iff the played card is the called king. |
void Game::printScores | ( | ) | const |
Prints players' / teams' scores.
Determines if two players belong to the same team.
p1 | A player. |
p2 | Another player. |
void Game::setGame | ( | int & | numberPlayers, |
const bool | automatic = false |
||
) |
Set a game, like the equivalent constructor does.
void Game::showDeck | ( | ) | const |
Shows the deck on the screen.
void Game::showPlayersCards | ( | ) | const |
Shows players' cards on the screen.
void Game::shuffleDeck | ( | ) |
Shuffles (three time) the deck.
Makes the current player bidding, then turns to the next player.
bestBid | the reference to the best bid made so far. |
void Game::takeDog | ( | ) |
To take the dog after biddings.
|
inline |
Inline function setting indexBidder to the value of indexToBid.