de.java_chess.javaChess.engine
Class BitBoardAnalyzerImpl

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

public class BitBoardAnalyzerImpl
extends java.lang.Object
implements BitBoardAnalyzer

The class implements the functionality to analyze a game position, stored as a bitboard.


Fields inherited from interface de.java_chess.javaChess.engine.BitBoardAnalyzer
BLACK_WIN, WHITE_WIN
 
Constructor Summary
BitBoardAnalyzerImpl(PlyGenerator plyGenerator)
          Create a new bitboard analyzer.
 
Method Summary
 short analyze()
          Analyze the current board.
 short analyze(BitBoard board, boolean white)
          Analyzed a new board.
 BitBoard getBoard()
          Get the currently analyzed board.
 boolean isInCheck(BitBoard board, boolean white)
          Test if a king is in check on a given board.
 boolean isInCheck(boolean white)
          Test, if the given player is in check.
 void setBoard(BitBoard board)
          Set a new board to be analyzed.
 void setMoveRight(boolean white)
          Set the flag, if white is about to move.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BitBoardAnalyzerImpl

public BitBoardAnalyzerImpl(PlyGenerator plyGenerator)
Create a new bitboard analyzer.
Parameters:
plyGenerator - A PlyGenerator instance to simulate moves.
Method Detail

getBoard

public final BitBoard getBoard()
Get the currently analyzed board.
Specified by:
getBoard in interface BitBoardAnalyzer
Returns:
The currently analyzed board.

setBoard

public final void setBoard(BitBoard board)
Set a new board to be analyzed.
Specified by:
setBoard in interface BitBoardAnalyzer
Parameters:
board - The new board.

setMoveRight

public final void setMoveRight(boolean white)
Set the flag, if white is about to move.
Specified by:
setMoveRight in interface BitBoardAnalyzer
Parameters:
white - Flag to indicate, if white has the next move.

analyze

public final short analyze()
Analyze the current board.
Specified by:
analyze in interface BitBoardAnalyzer

isInCheck

public final boolean isInCheck(boolean white)
Test, if the given player is in check.
Specified by:
isInCheck in interface BitBoardAnalyzer
Parameters:
white - Flag, if the white king is to test.
Returns:
true, if the king is in check, false otherwise.

isInCheck

public final boolean isInCheck(BitBoard board,
                               boolean white)
Test if a king is in check on a given board.
Specified by:
isInCheck in interface BitBoardAnalyzer
Parameters:
board - The board to test.
white - true, if the white king is checked, false otherwise.

analyze

public final short analyze(BitBoard board,
                           boolean white)
Analyzed a new board.
Specified by:
analyze in interface BitBoardAnalyzer
Parameters:
board - The new board to analyze.
white - Flag to indicate, if white has the next move.