jskat.player
Class JSkatPlayerImpl

java.lang.Object
  extended by jskat.player.JSkatPlayerImpl
All Implemented Interfaces:
JSkatPlayer
Direct Known Subclasses:
AIPlayerMJL, AIPlayerRND, HumanPlayer

public abstract class JSkatPlayerImpl
extends java.lang.Object
implements JSkatPlayer

The JSkat Player implementation

Author:
Jan Schäfer

Field Summary
protected  CardVector cards
           
protected  int currGameType
           
protected  int currTrump
           
protected  int forehandPlayer
           
protected  boolean handGame
           
(package private) static org.apache.log4j.Logger log
           
protected  boolean ouvertGame
           
protected  int playerID
          Variables
protected  java.lang.String playerName
           
protected  int playerState
           
protected  int singlePlayer
           
protected  CardVector skat
           
 
Constructor Summary
JSkatPlayerImpl()
          Creates a new instance of SkatPlayer
 
Method Summary
 void cardPlayed(Card card)
          Informs the player about a card that was played
 Card getCard(int suit, int value)
          Deprecated.  
 CardVector getCardVector()
          Deprecated.  
 int getPlayerID()
          Returns the ID of the SkatPlayer
 java.lang.String getPlayerName()
          Returns the name of the SkatPlayer
 void newGame()
          Informs the player about the start of a new game
 int playNextCard(CardVector trick)
          Deprecated.  
 Card removeCard(Card card)
          Deprecated.  
 Card removeCard(int index)
          Get the selected card from the player's hand
 Card removeCard(int suit, int value)
          Deprecated.  
 void setPlayerID(int newPlayerID)
          Returns the ID of the SkatPlayer
 void setPlayerName(java.lang.String newPlayerName)
          Sets the name of the SkatPlayer
protected  void setState(int newState)
           
 void setUpBidding(int initialForehandPlayer)
          Notifies the player of the start of bidding for a new game
abstract  void showTrick(CardVector trick, int trickWinner)
          Makes the current trick known to the players when it is complete
protected  void sortCards(int sortType)
           
 void startGame(int singlePlayer, int forehandPlayer, int gameType, int trump, boolean handGame, boolean ouvertGame)
          Start the game: inform player of game type, trumpf and special options
 void takeCard(Card newCard)
          Take a card from someone
 void takeSkat(CardVector skat)
          Take the skat
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jskat.player.JSkatPlayer
announceGame, bidMore, isAIPlayer, isHumanPlayer, lookIntoSkat, playCard, takeRamschSkat
 

Field Detail

log

static org.apache.log4j.Logger log

playerID

protected int playerID
Variables


singlePlayer

protected int singlePlayer

forehandPlayer

protected int forehandPlayer

playerName

protected java.lang.String playerName

playerState

protected int playerState

cards

protected CardVector cards

skat

protected CardVector skat

currGameType

protected int currGameType

currTrump

protected int currTrump

handGame

protected boolean handGame

ouvertGame

protected boolean ouvertGame
Constructor Detail

JSkatPlayerImpl

public JSkatPlayerImpl()
Creates a new instance of SkatPlayer

Method Detail

getPlayerID

public final int getPlayerID()
Returns the ID of the SkatPlayer

Specified by:
getPlayerID in interface JSkatPlayer

setPlayerID

public final void setPlayerID(int newPlayerID)
Returns the ID of the SkatPlayer

Specified by:
setPlayerID in interface JSkatPlayer

setPlayerName

public final void setPlayerName(java.lang.String newPlayerName)
Sets the name of the SkatPlayer

Specified by:
setPlayerName in interface JSkatPlayer

getPlayerName

public final java.lang.String getPlayerName()
Returns the name of the SkatPlayer

Specified by:
getPlayerName in interface JSkatPlayer

takeCard

public final void takeCard(Card newCard)
Take a card from someone

Specified by:
takeCard in interface JSkatPlayer

sortCards

protected final void sortCards(int sortType)

setUpBidding

public void setUpBidding(int initialForehandPlayer)
Notifies the player of the start of bidding for a new game

Specified by:
setUpBidding in interface JSkatPlayer

takeSkat

public void takeSkat(CardVector skat)
Take the skat

Specified by:
takeSkat in interface JSkatPlayer

startGame

public void startGame(int singlePlayer,
                      int forehandPlayer,
                      int gameType,
                      int trump,
                      boolean handGame,
                      boolean ouvertGame)
Start the game: inform player of game type, trumpf and special options

Specified by:
startGame in interface JSkatPlayer

showTrick

public abstract void showTrick(CardVector trick,
                               int trickWinner)
Makes the current trick known to the players when it is complete

Specified by:
showTrick in interface JSkatPlayer
Parameters:
trick - The CardVector of the current trick
trickWinner - The trick winner

getCardVector

public CardVector getCardVector()
Deprecated. 

Returns a reference to the CardVector of the SkatPlayer This won't be needed anymore when bidding and game announcing is fully implemented (therefore defined as deprecated)


setState

protected void setState(int newState)

removeCard

public final Card removeCard(int index)
Get the selected card from the player's hand

Specified by:
removeCard in interface JSkatPlayer
See Also:
JSkatPlayer.removeCard(int)

removeCard

public final Card removeCard(Card card)
Deprecated. 

Get the selected card from the player's hand This method should not be used anymore, player has to remove cards for their own after playing them out

Specified by:
removeCard in interface JSkatPlayer
See Also:
JSkatPlayer.removeCard(jskat.share.Card)

removeCard

public Card removeCard(int suit,
                       int value)
Deprecated. 

Get the selected card from the player's hand This method should not be used anymore, player has to remove cards for their own after playing them out

Specified by:
removeCard in interface JSkatPlayer
See Also:
JSkatPlayer.removeCard(int, int)

getCard

public final Card getCard(int suit,
                          int value)
Deprecated. 

Get the selected card from the player's hand This method should not be used anymore


playNextCard

public int playNextCard(CardVector trick)
Deprecated. 

Only for satisfying the JSkatPlayer interface

Specified by:
playNextCard in interface JSkatPlayer

cardPlayed

public void cardPlayed(Card card)
Description copied from interface: JSkatPlayer
Informs the player about a card that was played

Specified by:
cardPlayed in interface JSkatPlayer
Parameters:
card - The Card the was played

newGame

public final void newGame()
Description copied from interface: JSkatPlayer
Informs the player about the start of a new game

Specified by:
newGame in interface JSkatPlayer