jskat.control
Class SkatGame

java.lang.Object
  extended by java.util.Observable
      extended by jskat.control.SkatGame

public class SkatGame
extends java.util.Observable


Field Summary
static int GAMESTATE_AI_PLAYER_PLAYING
           
static int GAMESTATE_BIDDING
           
static int GAMESTATE_CREATED
          Status of the game
static int GAMESTATE_DEALING
           
static int GAMESTATE_DOING_SCHIEBERRAMSCH
           
static int GAMESTATE_GAME_OVER
           
static int GAMESTATE_INITIALISED
           
static int GAMESTATE_NEW_TRICK_STARTED
           
static int GAMESTATE_NEXT_GAME
           
static int GAMESTATE_PLAYING
           
static int GAMESTATE_SHOWING_SKAT
           
static int GAMESTATE_STARTED
           
static int GAMESTATE_TRICK_COMPLETED
           
static int GAMESTATE_WAIT_FOR_HUMAN_PLAYER_INPUT
           
 
Constructor Summary
SkatGame(JSkatDataModel dataModel, SkatSeries skatSeries, int dealer)
           
 
Method Summary
protected  void calculateTrickWinner()
          Calculates the winner of the current trick
 void dealCards()
          Deals the cards to the skat players
 BidStatus getBidStatus()
          Gets the current bid status
 int getDealer()
           
 int[] getPlayerOrder()
           
 SkatGameData getSkatGameData()
          Returns the data of the game
 SkatTableOptions getSkatTableOptions()
           
 int getState()
          Get the state of the game
 boolean isJSkatPlayedByHuman()
          Get the information whether JSkat is played by a human or not
 void notifyBiddingThread(boolean userBidsMore)
          Promotes user input to the bidding thread
 void notifySchieberRamschThread()
          Promotes user input to the SchieberRamschThread
 void playing(GameAnnouncement newGame)
          Controls the playing of a game
protected  void playTrickCard(int suit, int value)
          Check if the human card is valid and then ask all AI players that come after the human player
protected  void putCardIntoSkat(int suit, int value)
          Puts a card into the skat
 void showSkat()
          Shows the skat to the single player (or asks a human player whether he wants to look into the skat) and announces the game.
 void skatProcessed()
          After a human player has processed the skat the game announcing dialog is called
protected  void takeCardFromSkat(int suit, int value)
          Gives a card from the skat to a player
 void updateDealtCards(int playerID)
          Updates the dealt cards vector
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GAMESTATE_CREATED

public static final int GAMESTATE_CREATED
Status of the game

See Also:
Constant Field Values

GAMESTATE_INITIALISED

public static final int GAMESTATE_INITIALISED
See Also:
Constant Field Values

GAMESTATE_STARTED

public static final int GAMESTATE_STARTED
See Also:
Constant Field Values

GAMESTATE_DEALING

public static final int GAMESTATE_DEALING
See Also:
Constant Field Values

GAMESTATE_BIDDING

public static final int GAMESTATE_BIDDING
See Also:
Constant Field Values

GAMESTATE_SHOWING_SKAT

public static final int GAMESTATE_SHOWING_SKAT
See Also:
Constant Field Values

GAMESTATE_PLAYING

public static final int GAMESTATE_PLAYING
See Also:
Constant Field Values

GAMESTATE_DOING_SCHIEBERRAMSCH

public static final int GAMESTATE_DOING_SCHIEBERRAMSCH
See Also:
Constant Field Values

GAMESTATE_AI_PLAYER_PLAYING

public static final int GAMESTATE_AI_PLAYER_PLAYING
See Also:
Constant Field Values

GAMESTATE_WAIT_FOR_HUMAN_PLAYER_INPUT

public static final int GAMESTATE_WAIT_FOR_HUMAN_PLAYER_INPUT
See Also:
Constant Field Values

GAMESTATE_TRICK_COMPLETED

public static final int GAMESTATE_TRICK_COMPLETED
See Also:
Constant Field Values

GAMESTATE_NEW_TRICK_STARTED

public static final int GAMESTATE_NEW_TRICK_STARTED
See Also:
Constant Field Values

GAMESTATE_GAME_OVER

public static final int GAMESTATE_GAME_OVER
See Also:
Constant Field Values

GAMESTATE_NEXT_GAME

public static final int GAMESTATE_NEXT_GAME
See Also:
Constant Field Values
Constructor Detail

SkatGame

public SkatGame(JSkatDataModel dataModel,
                SkatSeries skatSeries,
                int dealer)
Parameters:
dataModel - The data model of JSkat
skatSeries - The skat series where the game is played
Method Detail

playing

public void playing(GameAnnouncement newGame)
Controls the playing of a game

Parameters:
newGame -

getSkatGameData

public SkatGameData getSkatGameData()
Returns the data of the game

Returns:
The data of the game

calculateTrickWinner

protected void calculateTrickWinner()
Calculates the winner of the current trick


dealCards

public void dealCards()
Deals the cards to the skat players


updateDealtCards

public void updateDealtCards(int playerID)
Updates the dealt cards vector

Parameters:
playerID - ID of the player

notifyBiddingThread

public void notifyBiddingThread(boolean userBidsMore)
Promotes user input to the bidding thread

Parameters:
userBidsMore - TRUE if the user wants to bid more otherwise FALSE

notifySchieberRamschThread

public void notifySchieberRamschThread()
Promotes user input to the SchieberRamschThread


showSkat

public void showSkat()
Shows the skat to the single player (or asks a human player whether he wants to look into the skat) and announces the game.


playTrickCard

protected void playTrickCard(int suit,
                             int value)
Check if the human card is valid and then ask all AI players that come after the human player

Parameters:
suit - suit for human card
value - value for human card

putCardIntoSkat

protected void putCardIntoSkat(int suit,
                               int value)
Puts a card into the skat

Parameters:
suit -
value -

takeCardFromSkat

protected void takeCardFromSkat(int suit,
                                int value)
Gives a card from the skat to a player

Parameters:
suit -
value -

getBidStatus

public BidStatus getBidStatus()
Gets the current bid status

Returns:
The BidStatus

isJSkatPlayedByHuman

public boolean isJSkatPlayedByHuman()
Get the information whether JSkat is played by a human or not

Returns:
TRUE when JSkat is played by a human

getPlayerOrder

public int[] getPlayerOrder()

getState

public int getState()
Get the state of the game

Returns:
The state of the game

skatProcessed

public void skatProcessed()
After a human player has processed the skat the game announcing dialog is called


getDealer

public int getDealer()

getSkatTableOptions

public SkatTableOptions getSkatTableOptions()