jskat.player.AIPlayerMJL
Class AIPlayerMJL

java.lang.Object
  extended by jskat.player.JSkatPlayerImpl
      extended by jskat.player.AIPlayerMJL.AIPlayerMJL
All Implemented Interfaces:
JSkatPlayer

public class AIPlayerMJL
extends JSkatPlayerImpl
implements JSkatPlayer

A JSkat AI Player

Author:
Markus J. Luzius

Field Summary
 
Fields inherited from class jskat.player.JSkatPlayerImpl
cards, currGameType, currTrump, forehandPlayer, handGame, ouvertGame, playerID, playerName, playerState, singlePlayer, skat
 
Constructor Summary
AIPlayerMJL()
          Creates a new instance of SkatPlayer (default constructor)
AIPlayerMJL(int playerID)
          Creates a new instance of SkatPlayer with a player ID
AIPlayerMJL(int playerID, java.lang.String playerName)
          Creates a new instance of SkatPlayer with a player ID and a name
 
Method Summary
 GameAnnouncement announceGame()
          Asks the player for the game he wants to play
 boolean bidMore(int currBidValue)
          Asks the player whether he wants to bid higher or not
 CardMemory getCardMemory()
          Gets the memory of all the cards that have been played in the current game
 int getInitialForehandPlayer()
          Gets the id of the first forehand player in the current game
 int getSinglePlayerPos()
          Gets the position of the single player
 boolean isAIPlayer()
           
 boolean isHumanPlayer()
           
 boolean isSinglePlayer()
           
 boolean lookIntoSkat(boolean isRamsch)
          (non-Javadoc)
 Card playCard(CardVector trick)
          Get next Card to play
 int playNextCard(CardVector trick)
          Get next Card to play
 void setSinglePlayerPos(int i)
          Sets the position of the single player
 void setState(int newState)
          Sets the state of the current game
If necessary, a new bid is initialized.
 void setUpBidding(int initialForehandPlayer)
          Notifies the player of the start of bidding for a new game
 void showTrick(CardVector trick, int trickWinner)
          Makes the current trick known to the players when it is complete
 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 takeRamschSkat(CardVector skat, boolean jacksAllowed)
          (non-Javadoc)
 void takeSkat(CardVector skat)
          (non-Javadoc)
 
Methods inherited from class jskat.player.JSkatPlayerImpl
cardPlayed, getCard, getCardVector, getPlayerID, getPlayerName, newGame, removeCard, removeCard, removeCard, setPlayerID, setPlayerName, sortCards, takeCard
 
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
cardPlayed, getPlayerID, getPlayerName, newGame, removeCard, removeCard, removeCard, setPlayerID, setPlayerName, takeCard
 

Constructor Detail

AIPlayerMJL

public AIPlayerMJL()
Creates a new instance of SkatPlayer (default constructor)


AIPlayerMJL

public AIPlayerMJL(int playerID)
Creates a new instance of SkatPlayer with a player ID

Parameters:
playerID -

AIPlayerMJL

public AIPlayerMJL(int playerID,
                   java.lang.String playerName)
Creates a new instance of SkatPlayer with a player ID and a name

Parameters:
playerID -
playerName -
Method Detail

takeRamschSkat

public void takeRamschSkat(CardVector skat,
                           boolean jacksAllowed)
(non-Javadoc)

Specified by:
takeRamschSkat in interface JSkatPlayer
See Also:
jskat.player.JSkatPlayer#takeRamschSkat(jskat.share.CardVector)

lookIntoSkat

public boolean lookIntoSkat(boolean isRamsch)
(non-Javadoc)

Specified by:
lookIntoSkat in interface JSkatPlayer
See Also:
JSkatPlayer.lookIntoSkat(boolean)

takeSkat

public void takeSkat(CardVector skat)
(non-Javadoc)

Specified by:
takeSkat in interface JSkatPlayer
Overrides:
takeSkat in class JSkatPlayerImpl
See Also:
JSkatPlayer.takeSkat(jskat.share.CardVector)

announceGame

public GameAnnouncement announceGame()
Asks the player for the game he wants to play

Specified by:
announceGame in interface JSkatPlayer
See Also:
JSkatPlayer.announceGame()

setUpBidding

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

Specified by:
setUpBidding in interface JSkatPlayer
Overrides:
setUpBidding in class JSkatPlayerImpl
Parameters:
initialForehandPlayer -
See Also:
JSkatPlayer.setUpBidding(int)

bidMore

public boolean bidMore(int currBidValue)
Asks the player whether he wants to bid higher or not

Specified by:
bidMore in interface JSkatPlayer
Parameters:
currBidValue -
See Also:
JSkatPlayer.bidMore(int)

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
Overrides:
startGame in class JSkatPlayerImpl
Parameters:
singlePlayer -
forehandPlayer -
gameType -
trump -
handGame -
ouvertGame -
See Also:
JSkatPlayer.startGame(int, int, int, int, boolean, boolean)

playNextCard

public int playNextCard(CardVector trick)
Get next Card to play

Specified by:
playNextCard in interface JSkatPlayer
Overrides:
playNextCard in class JSkatPlayerImpl
See Also:
JSkatPlayer.playNextCard(jskat.share.CardVector)

playCard

public Card playCard(CardVector trick)
Description copied from interface: JSkatPlayer
Get next Card to play

Specified by:
playCard in interface JSkatPlayer

showTrick

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

Specified by:
showTrick in interface JSkatPlayer
Specified by:
showTrick in class JSkatPlayerImpl
Parameters:
trick - The CardVector of the current trick
trickWinner - The trick winner
See Also:
JSkatPlayer.showTrick(jskat.share.CardVector, int)

setState

public final void setState(int newState)
Sets the state of the current game
If necessary, a new bid is initialized.

Overrides:
setState in class JSkatPlayerImpl
See Also:
Bidding, JSkatPlayerImpl.setState(int)

getInitialForehandPlayer

public int getInitialForehandPlayer()
Gets the id of the first forehand player in the current game

Returns:
id

isSinglePlayer

public boolean isSinglePlayer()
Returns:
true if this player is the single player

getCardMemory

public CardMemory getCardMemory()
Gets the memory of all the cards that have been played in the current game

Returns:
CardMemory

getSinglePlayerPos

public int getSinglePlayerPos()
Gets the position of the single player

Returns:
position of the single player (forehand, middlehand, hindhand)

setSinglePlayerPos

public void setSinglePlayerPos(int i)
Sets the position of the single player

Parameters:
i - position of the single player (forehand, middlehand, hindhand)

isAIPlayer

public boolean isAIPlayer()
Specified by:
isAIPlayer in interface JSkatPlayer
Returns:
true, if the player is an AI player

isHumanPlayer

public boolean isHumanPlayer()
Specified by:
isHumanPlayer in interface JSkatPlayer
Returns:
true, if the player is a human player