org.ninm.games.cardgames
Interface Engine

All Known Implementing Classes:
AbstractEngine

public interface Engine

This interface should be implemented by a card game and should enforce the logic of the game

Version:
1.0
Author:
Nikolay

Method Summary
 void addBonusListener(BonusListener bonusListener)
          registers the bonus listener with this engine
 void addDealerListener(DealerListener dealerListener)
          registers the dealer listener with this engine
 boolean announceTrick(Player player, Trick trick)
          tells the engine that a particular player wishes to anounce a trick
 boolean bidMade(Player player, Bid bid)
          indicates a bid has been made by a particluar player
 Player getActivePlayer()
          returns the player whos turn it is
 java.util.Set getAllowedBids()
          returs the allowed bids the current player can make
 java.util.Set getAllowedCards()
          returns the allowed cards that the current player can play
 java.util.Set getAllowedTricks()
          returns the allowed tricks that the current player can announce
 boolean playCard(Player player, Card card)
          informs the engine of a played card
 

Method Detail

getActivePlayer

public Player getActivePlayer()
returns the player whos turn it is

Returns:
Player the player whos turn it is

getAllowedCards

public java.util.Set getAllowedCards()
returns the allowed cards that the current player can play

Returns:
List the array of allowed cards for the player

getAllowedTricks

public java.util.Set getAllowedTricks()
returns the allowed tricks that the current player can announce

Returns:
List the array of allowed tricks for the current player

getAllowedBids

public java.util.Set getAllowedBids()
returs the allowed bids the current player can make

Returns:
List a list of bids

playCard

public boolean playCard(Player player,
                        Card card)
informs the engine of a played card

Parameters:
player - the player that plays the card
card - the card to be played
Returns:
boolean returns true if the card was successfully played (if it is not allowed returns false).

addBonusListener

public void addBonusListener(BonusListener bonusListener)
registers the bonus listener with this engine

Parameters:
bonusListener - the bonus listener

addDealerListener

public void addDealerListener(DealerListener dealerListener)
registers the dealer listener with this engine

Parameters:
dealerListener - the dealer listener

announceTrick

public boolean announceTrick(Player player,
                             Trick trick)
tells the engine that a particular player wishes to anounce a trick

Parameters:
player - the player making the anouncement
trick - the trick
Returns:
boolean returns true if the trick was successfully announced (if it is not allowed returns false)

bidMade

public boolean bidMade(Player player,
                       Bid bid)
indicates a bid has been made by a particluar player

Parameters:
player - the player making the bid
bid - the bid being made
Returns:
boolean returns true if the bid was successfully made (if is is not allowed)

SourceForge.net Logo