mixmeta4
Class Game

java.lang.Object
  extended by mixmeta4.Game
All Implemented Interfaces:
java.io.Serializable

public class Game
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static int MOVES_TILL_DRAW
          The number of ply without captures after which a draw is declared.
 java.util.ArrayList players
           
 
Constructor Summary
Game()
          provided for copy
Game(java.lang.String gameName, java.lang.String setup, Player red, Player black)
           
Game(java.lang.String gameName, java.lang.String setup, Player red, Player black, long startTime, long timeIncrement)
           
Game(java.lang.String gameName, java.lang.String setup, Player red, Player black, long startTime, long timeIncrement, java.lang.String visible)
          Start a new game.
Game(java.lang.String gameName, java.lang.String setup, Player red, Player black, long startTime, long timeIncrement, java.lang.String visible, java.util.ArrayList players)
           
 
Method Summary
 void addPlayer(Player player)
           
 Move blackPly()
           
 boolean blackWon()
           
 java.lang.Object copy()
           
 boolean draw()
           
 boolean gameIsOver()
           
 long getBlackTime()
           
 java.lang.String getGameName()
           
 java.lang.String getPlayerName(boolean isRed)
           
 long getRedTime()
           
 long getTimeIncrement()
           
 void newGame()
           
 void newGame(java.lang.String redName, java.lang.String blackName)
           
 void play()
           
 Move redPly()
           
 boolean redWon()
           
 void setMovesTillDraw(int noMoves)
          Set the number of ply without capture before a draw is called.
 void setPlayers(java.util.ArrayList players)
           
 Move step()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOVES_TILL_DRAW

public static final int MOVES_TILL_DRAW
The number of ply without captures after which a draw is declared.

See Also:
Constant Field Values

players

public java.util.ArrayList players
Constructor Detail

Game

public Game(java.lang.String gameName,
            java.lang.String setup,
            Player red,
            Player black)

Game

public Game(java.lang.String gameName,
            java.lang.String setup,
            Player red,
            Player black,
            long startTime,
            long timeIncrement)

Game

public Game(java.lang.String gameName,
            java.lang.String setup,
            Player red,
            Player black,
            long startTime,
            long timeIncrement,
            java.lang.String visible)
Start a new game.

Parameters:
gameName - "Finish First", "TakeAll" or "CheX"
setup - string with initial board layour
red - the red player
black - the black player
startTime - how much time each player has to start with
timeIncrement - how much additional time each player gets for each move
visible - "gui", "terminal", "none", or "both"

Game

public Game(java.lang.String gameName,
            java.lang.String setup,
            Player red,
            Player black,
            long startTime,
            long timeIncrement,
            java.lang.String visible,
            java.util.ArrayList players)

Game

public Game()
provided for copy

Method Detail

newGame

public void newGame()

newGame

public void newGame(java.lang.String redName,
                    java.lang.String blackName)

getGameName

public java.lang.String getGameName()

getRedTime

public long getRedTime()

getBlackTime

public long getBlackTime()

getTimeIncrement

public long getTimeIncrement()

redPly

public Move redPly()

blackPly

public Move blackPly()

play

public void play()

step

public Move step()

redWon

public boolean redWon()

blackWon

public boolean blackWon()

draw

public boolean draw()

addPlayer

public void addPlayer(Player player)

setPlayers

public void setPlayers(java.util.ArrayList players)

setMovesTillDraw

public void setMovesTillDraw(int noMoves)
Set the number of ply without capture before a draw is called. Default is MOVES_TILL_DRAW.


gameIsOver

public boolean gameIsOver()

copy

public java.lang.Object copy()

getPlayerName

public java.lang.String getPlayerName(boolean isRed)