Bag Class Reference

#include <bag.h>


Detailed Description

A bag stores the set of free tiles for the game.

Definition at line 33 of file bag.h.

Public Member Functions

 Bag ()
virtual ~Bag ()
void init ()
void takeTile (const Tile &iTile)
 Take a tile in the bag.
void replaceTile (const Tile &iTile)
 Replace a tile into the bag.
unsigned int in (const Tile &iTile) const
 Return how many tiles identical to iTile are available in the bag.
unsigned int nTiles () const
 Return how many tiles/vowels/consonants are available Warning: nVowels(b) + nConsonants(b) != nTiles(b), because of the jokers and the 'Y'.
unsigned int nVowels () const
unsigned int nConsonants () const
Tile selectRandom ()
 Return a random available tile The tile is not taken out of the bag.
void operator= (const Bag &iOther)
void dumpAll () const
 Print on stderr all the letters of the bag (for debugging purposes).


Constructor & Destructor Documentation

Bag::Bag  ) 
 

Definition at line 28 of file bag.cpp.

References init().

virtual Bag::~Bag  )  [inline, virtual]
 

Definition at line 37 of file bag.h.


Member Function Documentation

void Bag::dumpAll  )  const
 

Print on stderr all the letters of the bag (for debugging purposes).

Definition at line 129 of file bag.cpp.

unsigned int Bag::in const Tile iTile  )  const
 

Return how many tiles identical to iTile are available in the bag.

Definition at line 47 of file bag.cpp.

Referenced by GameIO::printNonPlayed(), Game::rackInBag(), BagFrame::Refresh(), replaceTile(), and takeTile().

void Bag::init  ) 
 

Definition at line 34 of file bag.cpp.

References Tile::getAllTiles().

Referenced by Bag().

unsigned int Bag::nConsonants  )  const
 

Definition at line 70 of file bag.cpp.

unsigned int Bag::nTiles  )  const [inline]
 

Return how many tiles/vowels/consonants are available Warning: nVowels(b) + nConsonants(b) != nTiles(b), because of the jokers and the 'Y'.

Definition at line 53 of file bag.h.

unsigned int Bag::nVowels  )  const
 

Definition at line 56 of file bag.cpp.

void Bag::operator= const Bag iOther  ) 
 

Definition at line 122 of file bag.cpp.

References m_ntiles, and m_tilesMap.

void Bag::replaceTile const Tile iTile  ) 
 

Replace a tile into the bag.

Definition at line 94 of file bag.cpp.

References ASSERT, and in().

Referenced by Game::back(), Game::helperPlayRound(), and Game::helperSetRackRandom().

Tile Bag::selectRandom  ) 
 

Return a random available tile The tile is not taken out of the bag.

Definition at line 104 of file bag.cpp.

void Bag::takeTile const Tile iTile  ) 
 

Take a tile in the bag.

Definition at line 84 of file bag.cpp.

References ASSERT, in(), and Tile::toChar().

Referenced by Game::gameLoadFormat_15(), and Game::realBag().


The documentation for this class was generated from the following files:
Generated on Thu Dec 29 02:01:15 2005 for Eliot by  doxygen 1.4.5