History Class Reference

#include <history.h>


Detailed Description

History stores all the turns that have been played This class is used many times in the game

A History is never void (getSize() can be used as the is the current turn number for the complete game history).

History starts at zero.

The top of the history is an empty Turn until it has been filled and game is up to a new round.

getCurrentRack() can/should be used to store the current played rack. setCurrentRack must be called whenever the current played rack is modified.

History owns the turns that it stores. Do not delete a turn referenced by History

Definition at line 56 of file history.h.

Public Member Functions

 History ()
virtual ~History ()
int getSize () const
 get the size of the history
const PlayedRackgetCurrentRack () const
 Get the (possibly incomplete) rack.
void setCurrentRack (const PlayedRack &iPld)
 Set the current rack.
const TurngetPreviousTurn () const
 Get the previous turn.
const TurngetTurn (unsigned int) const
 Get turn 'n'.
void playRound (int player, int turn, const Round &round)
 Update the "history" with the given round and complete the turn.
void removeLastTurn ()
 Remove last turn.
string toString () const
 String handling.


Constructor & Destructor Documentation

History::History  ) 
 

Definition at line 40 of file history.cpp.

History::~History  )  [virtual]
 

Definition at line 48 of file history.cpp.


Member Function Documentation

const PlayedRack & History::getCurrentRack  )  const
 

Get the (possibly incomplete) rack.

Definition at line 67 of file history.cpp.

Referenced by Player::getCurrentRack().

const Turn & History::getPreviousTurn  )  const
 

Get the previous turn.

Definition at line 79 of file history.cpp.

References ASSERT.

Referenced by Game::back(), Player::getLastRack(), and Player::getLastRound().

int History::getSize  )  const
 

get the size of the history

Definition at line 61 of file history.cpp.

Referenced by Game::back(), GamePrintout::DrawPage(), Game::gameSaveFormat_14(), Game::gameSaveFormat_15(), Game::helperPlayRound(), Training::play(), FreeGame::play(), Training::playResult(), and Training::search().

const Turn & History::getTurn unsigned  int  )  const
 

Get turn 'n'.

Definition at line 87 of file history.cpp.

References ASSERT.

Referenced by Game::gameSaveFormat_14(), and Game::gameSaveFormat_15().

void History::playRound int  player,
int  turn,
const Round round
 

Update the "history" with the given round and complete the turn.

A new turn is created with the remaining letters in the rack

Definition at line 98 of file history.cpp.

References Turn::getPlayedRack(), PlayedRack::getRack(), Round::getTile(), Round::getWordLen(), Round::isJoker(), Round::isPlayedFromRack(), Tile::Joker(), Rack::remove(), Turn::setNum(), PlayedRack::setOld(), Turn::setPlayer(), and Turn::setRound().

Referenced by Player::endTurn(), and Game::helperPlayRound().

void History::removeLastTurn  ) 
 

Remove last turn.

Definition at line 134 of file history.cpp.

References ASSERT, Turn::setNum(), Turn::setPlayer(), and Turn::setRound().

Referenced by Game::back(), and Player::removeLastTurn().

void History::setCurrentRack const PlayedRack iPld  ) 
 

Set the current rack.

Definition at line 73 of file history.cpp.

Referenced by Game::helperPlayRound(), and Player::setCurrentRack().

string History::toString  )  const
 

String handling.

Definition at line 157 of file history.cpp.

Referenced by GameFrame::Refresh(), and Player::toString().


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