jagafa.object
Class Player

java.lang.Object
  extended by jagafa.object.Player

public class Player
extends java.lang.Object

The Player class holds the hand and the AI of a player. It also knows wether a he is a computer player or human. TODO: Needs refactoring: Add "partner" and "opponent" recognition to the Player class


Constructor Summary
Player(int numberOfCards, boolean isHuman)
          Erstellt neues Spielerobjekt
Player(int numberOfCards, boolean isHuman, JassAI ai)
           
 
Method Summary
 void addScore(int points)
          Zählt points zum aktuellen Punktestand dazu
 boolean equals(java.lang.Object sec)
           
 JassAI getAI()
          Get the players AI instance
 Hand getHand()
          Get the players hand object
 int getID()
           
 java.lang.String getName()
          Get the player name
 int getScore()
          Get the players score
 int hashCode()
           
 boolean isComputer()
          Checks wether the player is AI-driven or not
 boolean playCard(Card card, JassRound round)
          Spielt eine Karte aus der hand des Spielers auf das Board von game
 void playCard(int i, JassRound round)
          Spielt die ite Karte aus der hand des Spielers auf das Board von game
 void printHand()
          Gibt die Handkarten auf dem Bildschirm aus
static void resetPlayerCount()
           
 void resetScore()
          Setzt Punktzahl auf Null zurück
 void setAI(JassAI simpleAI)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Player

public Player(int numberOfCards,
              boolean isHuman)
Erstellt neues Spielerobjekt

Parameters:
isHuman - True if this player is a human player
numberOfCards - The number of cards in the hand of the player

Player

public Player(int numberOfCards,
              boolean isHuman,
              JassAI ai)
Method Detail

addScore

public void addScore(int points)
Zählt points zum aktuellen Punktestand dazu

Parameters:
points - The score to add

getScore

public int getScore()
Get the players score

Returns:
Gibt Anzahl erreichter Punkte zurück

resetScore

public void resetScore()
Setzt Punktzahl auf Null zurück


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
Liefert einen String mit dem Namen des Spielers

getHand

public Hand getHand()
Get the players hand object

Returns:
The Players hand object

printHand

public void printHand()
Gibt die Handkarten auf dem Bildschirm aus


playCard

public void playCard(int i,
                     JassRound round)
Spielt die ite Karte aus der hand des Spielers auf das Board von game

Parameters:
i - The card number in the players hand
round - The Game object to which the player plays the card

isComputer

public boolean isComputer()
Checks wether the player is AI-driven or not

Returns:
True, if the player is driven by AI

getName

public java.lang.String getName()
Get the player name

Returns:
A string with the name of the player

getAI

public JassAI getAI()
Get the players AI instance

Returns:
The AI of the Player

playCard

public boolean playCard(Card card,
                        JassRound round)
Spielt eine Karte aus der hand des Spielers auf das Board von game

Parameters:
card - The card
round - The Game object to which the player plays the card

equals

public boolean equals(java.lang.Object sec)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

setAI

public void setAI(JassAI simpleAI)

resetPlayerCount

public static void resetPlayerCount()

getID

public int getID()


Copyright 2005 MA Software. All Rights Reserved.