inonit.domain.game.card.hearts
Interface Intelligence.Game.Rules

All Superinterfaces:
java.io.Serializable
Enclosing class:
Intelligence.Game

public static interface Intelligence.Game.Rules
extends java.io.Serializable

An object which an Intelligence can use to determine the rules under which a Game is being played.


Method Summary
 CardArray getDeck()
          Returns the deck that will be used.
 int getNumberOfPlayers()
          Returns the number of players in this Intelligence.Game.
 CardArray getTakeAllCards()
          Returns the set of Cards which must be taken by a single player in order to execute a take-all.
 int getTakeAllScore()
          Returns the number of points that are awarded for a take-all.
 int getValue(CardArray cards)
          Returns the total point (scoring) value of the cards in the given CardArray, as if they were the cards taken in a particular hand.
 boolean isLegalPlay(CardArray[] previousTricks, CardArray currentTrick, CardArray hand, Card card)
          Returns whether a particular Card would be a legal play for a player under these Rules, given the situation defined by the previousTricks, currentTrick, and hand arguments.
 

Method Detail

getNumberOfPlayers

public int getNumberOfPlayers()
Returns the number of players in this Intelligence.Game.
Returns:
The number of players in the current Intelligence.Game. Typical Hearts games involve 3-7 players, with 4 being the most common.

isLegalPlay

public boolean isLegalPlay(CardArray[] previousTricks,
                           CardArray currentTrick,
                           CardArray hand,
                           Card card)
Returns whether a particular Card would be a legal play for a player under these Rules, given the situation defined by the previousTricks, currentTrick, and hand arguments.
Parameters:
previousTricks - An array of CardArray objects which should contain the contents of the previous tricks during the current hand. Could be zero-length if this is the first trick. Must not be null.
currentTrick - A CardArray which should contain the contents of the current trick. Could be empty if the player is about to lead. Must not be null.
hand - A CardArray containing the Cards currently in the player's hand. Must not be empty. Must not be null.
card - A Card that might or might not be legal to play at this time. Must be a Card in hand. Must not be null.
Returns:
true if card would be legal to play given the situation defined by the other three parameters; false if it would not be legal to play that Card.

getValue

public int getValue(CardArray cards)
Returns the total point (scoring) value of the cards in the given CardArray, as if they were the cards taken in a particular hand.
Parameters:
cards - A CardArray for which to obtain the point value. Must not be null.
Returns:
The total score represented by the Cards in the given CardArray.

getDeck

public CardArray getDeck()
Returns the deck that will be used. A new CardArray object containing the full deck being used in this game will be returned upon each invocation of this method; this object can be manipulated freely and subsequent calls to this method will return identical CardArrays.
Returns:
A copy of the deck which will be used for games played under these Rules.

getTakeAllCards

public CardArray getTakeAllCards()
Returns the set of Cards which must be taken by a single player in order to execute a take-all. Different Hearts variants require different sets of Cards be taken.
Returns:
A CardArray containing a list of cards which must be taken in order to execute a take-all.

getTakeAllScore

public int getTakeAllScore()
Returns the number of points that are awarded for a take-all. Different variants of Hearts require different cards to be taken in order to execute a take-all; see getTakeAllCards for details.
Returns:
A positive integer reflecting the number of points a take-all is worth under these Rules.