de.java_chess.javaChess.game
Class GameImpl

java.lang.Object
  |
  +--de.java_chess.javaChess.game.GameImpl

public class GameImpl
extends java.lang.Object
implements Game

This class stores a complete chess game and provides access to all the game stages.


Constructor Summary
GameImpl()
          Create a new game instance.
 
Method Summary
 void doPly(Ply ply)
          Do a new ply in this game.
 Ply getLastPly()
          Get the last ply.
 int getNumberOfPlies()
          Get the total number of plies.
 boolean hasBeenMoved(Position position)
          Check, if a piece on a given positon was moved from it's initial position.
 void reset()
          Reset the game.
 java.lang.String toString()
          Convert the game to a string.
 void undoLastPly()
          Undo the last ply.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GameImpl

public GameImpl()
Create a new game instance.
Method Detail

reset

public final void reset()
Reset the game.
Specified by:
reset in interface Game

doPly

public final void doPly(Ply ply)
Do a new ply in this game.
Specified by:
doPly in interface Game
Parameters:
ply - The next ply.

undoLastPly

public final void undoLastPly()
Undo the last ply.
Specified by:
undoLastPly in interface Game

getNumberOfPlies

public final int getNumberOfPlies()
Get the total number of plies.
Specified by:
getNumberOfPlies in interface Game
Returns:
The total number of plies.

getLastPly

public final Ply getLastPly()
Get the last ply.
Specified by:
getLastPly in interface Game
Returns:
The last ply.

hasBeenMoved

public final boolean hasBeenMoved(Position position)
Check, if a piece on a given positon was moved from it's initial position.
Specified by:
hasBeenMoved in interface Game
Parameters:
position - The position to check.

toString

public final java.lang.String toString()
Convert the game to a string.
Overrides:
toString in class java.lang.Object
Returns:
A string representation of the game.