de.java_chess.javaChess.engine
Class PlyGenerator

java.lang.Object
  |
  +--de.java_chess.javaChess.engine.PlyGenerator

public class PlyGenerator
extends java.lang.Object

This class generates all possible plies for a given game position.


Constructor Summary
PlyGenerator(Game game)
          Create a new instance of a ply generator.
PlyGenerator(Game game, BitBoard board)
          Create a new instance of a ply generator from a given board.
 
Method Summary
 void addPliesForBishops(boolean white)
          Add the plies for bishops.
 void addPliesForQueens(boolean white)
          Add the plies for queens.
 void addPliesForRooks(boolean white)
          Add the plies for rooks.
 Game getGame()
          Get the current game.
 long getKnightPlies(int square)
          Get the knight plies for a given knight square.
 Ply[] getPliesForColor(BitBoard board, boolean white)
          Get the plies for a given board and color.
 Ply[] getPliesForColor(boolean white)
          Get the plies for a given game position and color.
 void setAnalyzer(BitBoardAnalyzer analyzer)
          Set a analyzer for check tests.
 void setGame(Game game)
          Set the current game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlyGenerator

public PlyGenerator(Game game)
Create a new instance of a ply generator.

PlyGenerator

public PlyGenerator(Game game,
                    BitBoard board)
Create a new instance of a ply generator from a given board.
Parameters:
game - The current game.
board - The board to operate on.
Method Detail

getGame

public final Game getGame()
Get the current game.
Returns:
The current game.

setGame

public final void setGame(Game game)
Set the current game.
Parameters:
The - current game.

getPliesForColor

public final Ply[] getPliesForColor(BitBoard board,
                                    boolean white)
Get the plies for a given board and color. Passing the last ply is suboptimal, since it's slower than accessing the game history.
Parameters:
lastPly - The ply, that lead to the given board.
board - The board with the game position.
white - true, if white has the next move.

getPliesForColor

public final Ply[] getPliesForColor(boolean white)
Get the plies for a given game position and color.
Parameters:
white - true, if white has the next move.

addPliesForBishops

public final void addPliesForBishops(boolean white)
Add the plies for bishops.
Parameters:
white - Flag to indicate if we request the plies for white pieces.

addPliesForRooks

public final void addPliesForRooks(boolean white)
Add the plies for rooks.
Parameters:
white - Flag to indicate, if we request the moves for white pieces.

addPliesForQueens

public final void addPliesForQueens(boolean white)
Add the plies for queens.
Parameters:
white - Flag to indicate if we request the plies for white pieces.

setAnalyzer

public final void setAnalyzer(BitBoardAnalyzer analyzer)
Set a analyzer for check tests.
Parameters:
analyzer - The new analyzer to set.

getKnightPlies

public final long getKnightPlies(int square)
Get the knight plies for a given knight square.
Parameters:
square - The square, where the knight is located.
Returns:
All the knight plies as a 64 bit bitmask.