Testing and debugging of the rules :

by typing "hint a3" it is possible to know all the possible moves for the piece on a3.
(Pawn and Queen not implemented yet)
This commit is contained in:
2006-01-11 18:32:01 +00:00
parent 3b77c214df
commit 0ffdf58af4
6 changed files with 1454 additions and 1330 deletions

View File

@ -160,6 +160,17 @@ public class Board {
return new Piece(Piece.NONE);
}
/**
* This function converts a {@link Square} to a number representing a bitboard square
* @param square The Square to be converted
* @return int
* @see Square
*/
public static int squareToBitBoardSquare(Square square) {
//converts a square ("e2") to a BitboardSquare (
return square.getFileNb() -1 + (square.getRank()-1)*NB_OF_FILES;
}
/**
* This function can be used to display the board
@ -228,7 +239,7 @@ public class Board {
}
System.out.println("+---+---+---+---+---+---+---+---+");
}
/*=================*
* PRIVATE METHODS *
@ -239,13 +250,7 @@ public class Board {
return bitBoards[bitboard_number];
}
*/
private int squareToBitBoardSquare(Square square) {
//converts a square ("e2") to a BitboardSquare (
return square.getFileNb() -1 + (square.getRank()-1)*NB_OF_FILES;
}
protected void addPiece(Square square, Piece piece) {
//OR :
// 0 OR a = a