Class Player

java.lang.Object
  |
  +--Player

public class Player
extends java.lang.Object

Player is the class that represents the player of the marble game.

Version:
1.0
Author:
Andi Sutedja

Constructor Summary
Player(int playerID)
          Construct a Player.
 
Method Summary
 void addScore()
          Increment the score of this Player by 1.
 void addScore(int score)
          Increment the score of this Player by the given addition value.
 int getPlayerID()
          Get the ID of this Player.
 int getScore()
          Get the current score of this Player.
 boolean isTurn()
          Check if it is this Player's turn in the game.
 void setScore(int score)
          Set the score of this Player to the given score.
 void setTurn(boolean flag)
          Set the the turn flag for this player.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player(int playerID)
Construct a Player.
Parameters:
playerID - the identification of this Player
Method Detail

getScore

public int getScore()
Get the current score of this Player.
Returns:
the score of this Player

addScore

public void addScore()
Increment the score of this Player by 1.

addScore

public void addScore(int score)
Increment the score of this Player by the given addition value.
Parameters:
score - the addition value to be added to this Player's score

setScore

public void setScore(int score)
Set the score of this Player to the given score.
Parameters:
score - the score to which this Player's score is to be set

getPlayerID

public int getPlayerID()
Get the ID of this Player.
Returns:
the ID of this Player

setTurn

public void setTurn(boolean flag)
Set the the turn flag for this player.
Parameters:
flag - the flag to which this player's turn status is to be set

isTurn

public boolean isTurn()
Check if it is this Player's turn in the game.
Returns:
true if it is this Player's turn in the game, false otherwise