RuleBase Class Reference

#include <rulebase.h>

List of all members.


Detailed Description

This is an abstract interface for the rules of a card game. This class is used in partnership with the GameBase class. This class should contain the specific rules of the game as well any specific values used in the game. If a method is not needed for a specific game, the method should throw a KardsGTError to prevent it's usage.

Author:
John Schneiderman

Public Member Functions

virtual int cardValue (const Card &card) const =0
virtual bool isGameOver (const PlayerList &players) const =0
virtual bool isLegalPlay (const CardSequence &sequence, const Card &cardPlayed, const Player &player=Player()) const =0
virtual bool isPhaseOver (const PlayerList &players, const CardSequence &playSequence) const =0
virtual bool isRoundOver (const PlayerList &players) const =0
virtual int maximumNumberOfPlayers () const =0
virtual int minimumNumberOfPlayers () const =0
virtual int numberOfCardsToDeal (int numberOfPlayers=-1) const =0
virtual int rankValue (const Card &card) const =0
 RuleBase ()
virtual int winningGameScore (int numberOfPlayers=-1) const =0
virtual ~RuleBase ()

Constructor & Destructor Documentation

RuleBase::RuleBase (  ) 

This is the default constructor.

RuleBase::~RuleBase (  )  [virtual]

Default destructor.


Member Function Documentation

virtual int RuleBase::cardValue ( const Card card  )  const [pure virtual]

When this method is implemented it will give the point value of a card for that game.

Parameters:
card is the card whose value we wish to determine.
Returns:
the worth of the card.

virtual bool RuleBase::isGameOver ( const PlayerList players  )  const [pure virtual]

When this method is implemented it will determine if conditions have been met for the end of the game.

Parameters:
players are the players in the game.
Returns:
true if the game over conditions have been met, false if they have not.

virtual bool RuleBase::isLegalPlay ( const CardSequence sequence,
const Card cardPlayed,
const Player player = Player() 
) const [pure virtual]

When this method is implemented it will determine if a card being played is going to be a legal play.

Parameters:
sequence is the sequence of cards played thus far in the round.
cardPlayed is the card wishing to be played.
player is the player who wants to play the card.
Returns:
true if it is a legal play, false elsewise.

virtual bool RuleBase::isPhaseOver ( const PlayerList players,
const CardSequence playSequence 
) const [pure virtual]

When this method is implemented it will determine if conditions have been met for the end of a phase.

Note:
A phase is defined as period in a game that has different check conditions or reset meanings than that of a round.
Parameters:
players are the players in the game.
playSequence is the sequence of cards that have been played.
Returns:
true if the phase over conditions have been met, false if they have not.

virtual bool RuleBase::isRoundOver ( const PlayerList players  )  const [pure virtual]

When this method is implemented it will determine if conditions have been met for the end of a round.

Parameters:
players are the players in the game.
Returns:
true if the round over conditions have been met, false if they have not.

virtual int RuleBase::maximumNumberOfPlayers (  )  const [pure virtual]

When this method is implemented it will give the maximum number of players that can play the game.

Returns:
the maximum players for the card game.

virtual int RuleBase::minimumNumberOfPlayers (  )  const [pure virtual]

When this method is implemented it will give the minimum number of players that can play the game.

Returns:
the minimum players needed for the card game.

virtual int RuleBase::numberOfCardsToDeal ( int  numberOfPlayers = -1  )  const [pure virtual]

When this method is implemented it will give the number of cards to deal to each player in a round.

Parameters:
numberOfPlayers is the number of players in the game.
Returns:
the number of cards for each player.

virtual int RuleBase::rankValue ( const Card card  )  const [pure virtual]

Gives the rank order value for a card.

Parameters:
card is the card we wish to examine.
Returns:
the rank order value of the card.

virtual int RuleBase::winningGameScore ( int  numberOfPlayers = -1  )  const [pure virtual]

When this method is implemented it will give the score a player must meet in order to win the game.

Parameters:
numberOfPlayers is the number of players in the game.
Returns:
the winning score.


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

Generated on Tue Aug 12 23:24:02 2008 for KardsGT by  doxygen 1.5.5