|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.kosi.model.game.Playing
This class implements the playing of the cards in game of Bridge.
ChangeLog:
$Log: Playing.java,v $ Revision 1.8 2001/06/27 11:53:21 betacarotine Worked on the Rubber and added comments. Revision 1.7 2001/06/15 12:32:15 betacarotine hopefully removed two bugs Revision 1.6 2001/06/15 11:35:07 betacarotine added serialization support to the Trick Revision 1.5 2001/06/15 09:33:27 betacarotine Changed the Game-interface. Instead of int getLatestLeader() and List getLatestTrick() we now have Trick getLatestTrick() The internal representation and storage of the tricks is reimplemented too based on the new Trick-class. Revision 1.4 2001/06/01 13:22:58 jiriki GameView working again. Revision 1.3 2001/05/30 10:25:51 jiriki Refactored Client. Revision 1.2 2001/05/30 10:19:18 pizarro Updated Documentation. Revision 1.1 2001/05/23 13:00:39 betacarotine Restructured the implementation of the game interface.
Field Summary | |
static int |
MAX_TRICKS
Maximum number of tricks in a game of Bridge. |
Constructor Summary | |
Playing(Board board,
SuitContract contract)
Creates a new Playing instance. |
Method Summary | |
void |
addCard(Card card)
Adds a card to the list of played cards. |
boolean |
dummyCardsAvailable()
Checks if the dummy cards may be published. |
boolean |
dummyCardsHaveToBePublishedNow()
Checks if the dummy cards have to be published now. |
int |
getActivePlayer()
Returns the active player. |
java.util.List |
getCards(int direction)
Returns the cards that are in the hand of the player at the given direction. |
SuitContract |
getContract()
Returns the contract of the game. |
java.util.List |
getDummyCards()
Returns the cards of the dummy player. |
int |
getDummyDirection()
Returns the direction of the dummy player. |
Trick |
getLatestTrick()
Returns the trick currently played. |
int |
getState()
Returns the state of the game. |
int |
getSuitToFollow()
Returns the suit to follow. |
int |
getTrickCounter()
Returns the number of tricks the declarer made. |
java.util.List |
getTricks()
Returns a list of all played tricks so far. |
int |
getWinnerOfLatestTrick()
Returns the winner of the latest trick according to the rules of bridge |
boolean |
isFinished()
Checks if the playing phase is finished. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MAX_TRICKS
Constructor Detail |
public Playing(Board board, SuitContract contract)
board
- The board of the game.contract
- The contract of the game.Method Detail |
public SuitContract getContract()
public int getState()
getState
in interface GamePhase
public Trick getLatestTrick() throws FirstTrickException
public java.util.List getCards(int direction)
getCards
in interface GamePhase
direction
- The direction of the player whose cards are to
be returned.ArrayIndexOutOfBoundsException
- If the direction was
invalid.public java.util.List getDummyCards()
public int getDummyDirection()
public int getWinnerOfLatestTrick() throws IncompleteTrickException
IncompleteTrickException
- If the trick is not completed
yet and no winner can be determined.public int getActivePlayer()
getActivePlayer
in interface GamePhase
public boolean dummyCardsAvailable()
public boolean dummyCardsHaveToBePublishedNow()
public boolean isFinished()
public void addCard(Card card) throws InvalidCardException
card
- the card to playInvalidCardException
- If the active player doesn't have the card
to be played or if the rule of following suit is violated.public int getTrickCounter()
public int getSuitToFollow()
public java.util.List getTricks()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |