rolec
Class GameHistory

java.lang.Object
  extended by rolec.GameHistory
All Implemented Interfaces:
java.lang.Cloneable

public class GameHistory
extends java.lang.Object
implements java.lang.Cloneable

This class keep track of all moves played during a game of Frank's Zoo


Constructor Summary
GameHistory(int p, Deck d, int[] o)
          Constructs a new, empty GameHistory
 
Method Summary
 void addMove(Move m)
          Adds a move to the GameHistory
 java.util.Vector cards()
          Returns the cards left in the hands of the players
 int cardsLeft()
          Returns the total number of cards left in the hands of the Players
 int cardsLeftForPlayer(int id)
          Returns the total number of cards left in the hands of one specific Player
 int cardsLeftOfType(int type)
          Returns the total number of cards of one specific type left in the hands of the Players
 int cardsPlayed()
          Returns the total number of cards played so far during the game
 int cardsPlayed(int id, int type)
          Returns the number of cards of one specific type played so far during the game by one specific Player
 int cardsPlayedByPlayer(int id)
          Returns the number of cards played so far during the game by one specific Player
 int cardsPlayedOfType(int type)
          Returns the number of cards of one specific type played so far during the game
 GameHistory clone()
          Returns a cloned instance of the GameHistory
 Deck getDeck()
          Returns the Deck used in the Game
 java.util.Vector getMoves()
          Returns the moves played in this game
 int[] getOrder()
          Returns the order in which players take turns
 int playerCount()
          Returns the number of players in the Game
 int playersOut()
          Returns the number of players that are out at the moment
 void print()
          Prints the GameHistory
 void printOrder()
          Prints the order in which players take turns
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GameHistory

public GameHistory(int p,
                   Deck d,
                   int[] o)
Constructs a new, empty GameHistory

Parameters:
p - number of players
d - the Deck of cards used during the game
Method Detail

addMove

public void addMove(Move m)
Adds a move to the GameHistory

Parameters:
m - the Move to be added

cardsPlayed

public int cardsPlayed()
Returns the total number of cards played so far during the game

Returns:
number of cards played so far

cardsPlayedByPlayer

public int cardsPlayedByPlayer(int id)
Returns the number of cards played so far during the game by one specific Player

Parameters:
id - the ID of the Player for which the number of cards played should be returned
Returns:
the number of cards played so far during the game by the specified Player

cardsPlayedOfType

public int cardsPlayedOfType(int type)
Returns the number of cards of one specific type played so far during the game

Parameters:
type - the type of card for which the number of cards played should be returned
Returns:
the number of cards of the specified type played so far during the game

cardsPlayed

public int cardsPlayed(int id,
                       int type)
Returns the number of cards of one specific type played so far during the game by one specific Player

Parameters:
id - the the ID of the Player for which the number of cards played should be returned
type - the type of card for which the number of cards played should be returned
Returns:
the number of cards of the specified type played so far during the game by the specified Player

cardsLeft

public int cardsLeft()
Returns the total number of cards left in the hands of the Players

Returns:
the total number of cards left in the hands of the Players

cards

public java.util.Vector cards()
Returns the cards left in the hands of the players

Returns:
a Vector containing the cards left in the hands of the players

cardsLeftForPlayer

public int cardsLeftForPlayer(int id)
Returns the total number of cards left in the hands of one specific Player

Returns:
the total number of cards left in the hands of one specific Player

cardsLeftOfType

public int cardsLeftOfType(int type)
Returns the total number of cards of one specific type left in the hands of the Players

Returns:
the total number of cards of one specific type left in the hands of the Players

print

public void print()
Prints the GameHistory


getMoves

public java.util.Vector getMoves()
Returns the moves played in this game

Returns:
a Vector containing the moves played in this game

playersOut

public int playersOut()
Returns the number of players that are out at the moment

Returns:
the number of players that are out at the moment

getOrder

public int[] getOrder()
Returns the order in which players take turns

Returns:
a Vector containing the order in which players take turns (Vector.elementAt(i) returns the ith player)

getDeck

public Deck getDeck()
Returns the Deck used in the Game

Returns:
the Deck used in the Game

printOrder

public void printOrder()
Prints the order in which players take turns


playerCount

public int playerCount()
Returns the number of players in the Game

Returns:
the number of players in the Game

clone

public GameHistory clone()
Returns a cloned instance of the GameHistory

Overrides:
clone in class java.lang.Object
Returns:
a cloned instance of the GameHistory