Mari's Tarot
 All Classes Files Functions Variables Enumerations Enumerator Friends
Public Member Functions | List of all members
Game Class Reference

Game is one of the main class of Tarot. Here are defined rules, games' turns, scores, etc. More...

#include <Game.hpp>

Collaboration diagram for Game:
Collaboration graph

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< TrickgetCurrentTrick () 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< CardgetKingCalled () 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< TrickgetTrick ()
 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< CardplayCard (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...
 

Detailed Description

Game is one of the main class of Tarot. Here are defined rules, games' turns, scores, etc.

Constructor & Destructor Documentation

Game::Game ( )

The default constructor.

Game::Game ( int &  numberPlayers,
const bool  automatic = false 
)

The complete constructor of Game.

Parameters
numberPlayersThe number of players.
yourNameThe human player name.
automaticA boolean set to true if and only if one wants to perform automatic tests. False by default.

Member Function Documentation

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.

Parameters
bestBigThe best bid among players.
Returns
The score of the given player.
double Game::computeScore ( const string &  name) const

Computes the score of a given player (refered by his/her name).

Parameters
nameA string for a player's name.
Returns
The score of the given player.
void Game::dealCards ( )

Deals cards.

Team Game::endGame ( )

Close a game and returns winners.

Biddings Game::getBidding ( ) const
inline

Inline function returning the game bid.

int Game::getCardsPerPlayer ( ) const
inline

Inline function returning the number of cards players have to play in the game.

shared_ptr<Trick> Game::getCurrentTrick ( ) const
inline

Inline function returning the current trick.

Team Game::getDefenders ( ) const
inline

Inline function returning the defender team.

set< shared_ptr<Card> > Game::getDog ( ) const
inline

Inline function returning the dog.

int Game::getIndexBidder ( ) const
inline

Inline function returning bidder's index.

int Game::getIndexNext ( ) const
inline

Inline function returning next player's index.

int Game::getIndexStarter ( ) const
inline

Inline function returning starter player's index.

int Game::getIndexToBid ( ) const
inline

Inline function returning the index of the next player to bid.

shared_ptr<Card> Game::getKingCalled ( ) const
inline

Inline function returning the called king.

int Game::getNumberPlayers ( ) const
inline

Inline function returning the number of players.

vector< shared_ptr<Player> > Game::getPlayers ( ) const
inline

Inline function returning the players vector.

set< shared_ptr< Card > > Game::getPlayerWonCards ( const shared_ptr< Player player) const

Returns won cards of a given player.

Parameters
playersThe player we want won cards from.
Returns
The set containing his/her won cards.
Team Game::getTakers ( ) const
inline

Inline function returning the taker team.

shared_ptr< Trick > Game::getTrick ( )

Update some fields and returns the current trick.

Team Game::getUnknownTeam ( ) const
inline

Inline function returning the unknown team (only in a 5-player game).

bool Game::isBotsOnly ( ) const
inline

Inline function returning if it is a game without any human players.

bool Game::isKingFound ( ) const
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.

Parameters
kingJustFoundThe reference to a Boolean value set to true iff the played card is the called king.
Returns
The played card.
void Game::printScores ( ) const

Prints players' / teams' scores.

bool Game::sameTeam ( const shared_ptr< Player p1,
const shared_ptr< Player p2 
) const

Determines if two players belong to the same team.

Parameters
p1A player.
p2Another player.
Returns
True iff p1 and p2 belong to the same team.
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.

pair< shared_ptr< Player >, Biddings > Game::takeBiddings ( const Biddings bestBid)

Makes the current player bidding, then turns to the next player.

Parameters
bestBidthe reference to the best bid made so far.
Returns
The pair <player, bid>.
void Game::takeDog ( )

To take the dog after biddings.

void Game::updateIndexBidder ( )
inline

Inline function setting indexBidder to the value of indexToBid.


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