BasicGameStrategies Class Reference

#include <basicgamestrategies.h>

Collaboration diagram for BasicGameStrategies:

Collaboration graph
[legend]

List of all members.


Detailed Description

Basic Game AI Decision Making

Author:
John Schneiderman

Public Member Functions

 BasicGameStrategies (const RuleBase &rules)
Card highestCard (const CardSequence &sequence) const
Card highestCardOfSuit (const CardSequence &sequence, Card::Suit suit) const
Card highestNonTrumpCard (const CardSequence &sequence, Card::Suit trumpSuit) const
Card lowestCard (const CardSequence &sequence) const
Card lowestCardOfSuit (const CardSequence &sequence, Card::Suit suit) const
Card lowestNonTrumpCard (const CardSequence &sequence, Card::Suit trumpSuit) const
Card nextHighestCard (const CardSequence &sequence, const Card &highCard) const
Card nextHighestCardOfSuit (const CardSequence &sequence, const Card &highCard, Card::Suit suit) const
int numberOfCardsHigher (const CardSequence &hand, const Card::Rank &rank) const
int numberOfCardsOfSuit (const CardSequence &hand, const Card::Suit &suit) const
int randomBid (int minimum, int maximum) const
CardSequence randomCards (int numberOfCards, const CardSequence &hand, const CardSequence &playSequence) const
CardSequence randomCardsWithNoLegalChecks (int numberOfCards, const CardSequence &hand) const
CardSequence selectCards (int numberOfCards, const CardSequence &hand, const CardSequence &playSequence) const
CardSequence selectCardsWithNoLegalChecks (int numberOfCards, const CardSequence &hand) const
 ~BasicGameStrategies ()

Constructor & Destructor Documentation

BasicGameStrategies::BasicGameStrategies ( const RuleBase rules  ) 

Constructor.

Parameters:
rules is the rules to use in our decision making.

BasicGameStrategies::~BasicGameStrategies (  ) 

Destructor.


Member Function Documentation

Card BasicGameStrategies::highestCard ( const CardSequence sequence  )  const

This finds the highest card in a card sequence based on the cards rank value.

Parameters:
sequence is the sequence of cards to examine.
Returns:
the highest card found, if no high card is found an empty card is given.

Card BasicGameStrategies::highestCardOfSuit ( const CardSequence sequence,
Card::Suit  suit 
) const

This finds the highest cards of a specific suit based on the cards rank value.

Parameters:
sequence is the sequence of cards to examine.
suit is the suit of the highest card we want.
Returns:
the highest card found, if no high card is found an empty card is given.

Card BasicGameStrategies::highestNonTrumpCard ( const CardSequence sequence,
Card::Suit  trumpSuit 
) const

This finds the highest card that is not a trump based on the cards rank value.

Parameters:
sequence is the sequence of cards to examine
trumpSuit is the suit that is trump in the game.
Returns:
the highest card found, if no high card is found an empty card is given.

Card BasicGameStrategies::lowestCard ( const CardSequence sequence  )  const

This finds the lowest card in a card sequence that is based on rank value.

Parameters:
sequence is the sequence of cards to examine.
Returns:
the lowest card found, if no card is found an empty card is given.

Card BasicGameStrategies::lowestCardOfSuit ( const CardSequence sequence,
Card::Suit  suit 
) const

This finds the lowest card of a specific suit based on rank value.

Parameters:
sequence is the sequence of cards to examine.
suit is the suit we want the lowest card from.
Returns:
the lowest card found of the specified suit, if no card is found an empty card is given.

Card BasicGameStrategies::lowestNonTrumpCard ( const CardSequence sequence,
Card::Suit  trumpSuit 
) const

This finds the lowest card not of a trump suit based on rank value.

Parameters:
sequence is the sequence of cards to examine.
trumpSuit is the suit we don't want the lowest card to be from.
Returns:
the lowest card found, if no card is found an empty card is given.

Card BasicGameStrategies::nextHighestCard ( const CardSequence sequence,
const Card highCard 
) const

This finds the highest card that is less than a specific card based on rank value.

Parameters:
sequence is the sequence of cards to examine.
highCard is the highest card we wish to be below.
Returns:
the highest card found, if no card lower than the high card is found the high card is given.

Card BasicGameStrategies::nextHighestCardOfSuit ( const CardSequence sequence,
const Card highCard,
Card::Suit  suit 
) const

This finds the highest card of a specific suit that is less than a specific card based on rank value.

Parameters:
sequence is the sequence of cards to examine.
highCard is the highest card we wish to be below.
suit is the suit of the high card we want.
Returns:
the highest card found, if no card lower than the high card is found the high card is given.
Note:
We assume that the high card and the suit both have the same suit.

int BasicGameStrategies::numberOfCardsHigher ( const CardSequence hand,
const Card::Rank rank 
) const

Determines the number of cards in a sequence of cards that is higher than a specific card.

Parameters:
hand is the sequence of cards to examine.
rank is the rank that each card must be greater than.
Returns:
the number of cards in hand that is greater than rank.

int BasicGameStrategies::numberOfCardsOfSuit ( const CardSequence hand,
const Card::Suit suit 
) const

Determines the number of card in a sequence of cards that has a specific suit.

Parameters:
hand is the sequence of cards to examine.
suit is the suit that each card must be to be counted.
Returns:
the number of cards in hand that is of the specified suit.

int BasicGameStrategies::randomBid ( int  minimum,
int  maximum 
) const

Makes a random bid in a specified range.

Parameters:
minimum is the lowest possible bid.
maximum is the highest possible bid.
Returns:
the bid generated.

CardSequence BasicGameStrategies::randomCards ( int  numberOfCards,
const CardSequence hand,
const CardSequence playSequence 
) const

Selects cards randomly that are legal to play for the game.

Parameters:
numberOfCards is the number of cards to select.
hand is the sequence of cards to choose from.
Note:
If there is no legal cards in the hand an infinite loop is created!
Parameters:
playSequence is the sequence of cards currently in play
Returns:
the cards we have chosen.

CardSequence BasicGameStrategies::randomCardsWithNoLegalChecks ( int  numberOfCards,
const CardSequence hand 
) const

Selects cards randomly to play for the game without regards for the rules of the game.

Parameters:
numberOfCards is the number of cards to select.
hand is the sequence of cards to choose from.
Returns:
the cards we have chosen.

CardSequence BasicGameStrategies::selectCards ( int  numberOfCards,
const CardSequence hand,
const CardSequence playSequence 
) const

This selects a specific number of cards from our hand based on what is a legal play.

Parameters:
numberOfCards is the number of cards we have to select.
hand is the sequence of cards to choose from.
playSequence is the sequence of cards currently in play
Returns:
the cards we have chosen.
Exceptions:
KardsGTError if we cannot select as many cards specified in numberOfCards.

CardSequence BasicGameStrategies::selectCardsWithNoLegalChecks ( int  numberOfCards,
const CardSequence hand 
) const

Selects cards to play for the game.

Parameters:
numberOfCards is the number of cards to select.
hand is the sequence of cards to choose from.
Returns:
the cards we have chosen.


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

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