Perfecting comments to be able to create a javadoc.
This commit is contained in:
@ -3,25 +3,23 @@ package suicideChess;
|
||||
import suicideChess.Square.NotAValidSquare;
|
||||
|
||||
/**
|
||||
* @author djib
|
||||
*
|
||||
* This file contains the board representation.
|
||||
* This class contains the board representation.
|
||||
* The board is represented using bitboards.
|
||||
* a1 is square 0
|
||||
* h8 is square 7
|
||||
* a2 is square 8
|
||||
* ... and so on
|
||||
* <ul><li>a1 is square 0</li>
|
||||
* <li>h8 is square 7</li>
|
||||
* <li>a2 is square 8</li>
|
||||
* <li>... and so on</li>
|
||||
*
|
||||
* @author Jean-Baptiste Hétier
|
||||
* @version $LastChangedRevision$, $LastChangedDate$
|
||||
*
|
||||
* $LastChangedDate$
|
||||
* $LastChangedRevision$
|
||||
* $LastChangedBy$
|
||||
*/
|
||||
|
||||
public class Board {
|
||||
|
||||
/*************
|
||||
/*===========*
|
||||
* CONSTANTS *
|
||||
*************/
|
||||
*===========*/
|
||||
|
||||
//Some constants to make code more readable
|
||||
public static final int NB_OF_RANKS = 8;
|
||||
@ -31,7 +29,7 @@ public class Board {
|
||||
private static final int NB_OF_BITBOARDS = 14;
|
||||
|
||||
public class NoPieceOnSquare extends Exception {
|
||||
/**
|
||||
/*
|
||||
* Added by Eclipse
|
||||
*/
|
||||
private static final long serialVersionUID = -2750943856086117656L;
|
||||
@ -40,9 +38,9 @@ public class Board {
|
||||
}
|
||||
|
||||
|
||||
/********
|
||||
/*======*
|
||||
* DATA *
|
||||
********/
|
||||
*======*/
|
||||
|
||||
//The following table is used to map squares to bits
|
||||
protected static long mapSquaresToBits[];
|
||||
@ -58,10 +56,17 @@ public class Board {
|
||||
//The following table contains all the bit boards
|
||||
protected long bitBoards[];
|
||||
|
||||
/***************
|
||||
|
||||
|
||||
|
||||
/*=============*
|
||||
* CONSTRUCTOR *
|
||||
* @throws NotAValidSquare
|
||||
***************/
|
||||
*=============*/
|
||||
|
||||
/**
|
||||
* Constructor of the class Board
|
||||
* @throws NotAValidSquare
|
||||
*/
|
||||
|
||||
public Board() throws NotAValidSquare {
|
||||
bitBoards = new long[NB_OF_BITBOARDS];
|
||||
@ -104,9 +109,16 @@ public class Board {
|
||||
}
|
||||
|
||||
|
||||
/******************
|
||||
/*================*
|
||||
* PUBLIC METHODS *
|
||||
******************/
|
||||
*================*/
|
||||
|
||||
/**
|
||||
* This methods takes a {@link Move} and applies it (updating the bitboard)
|
||||
* @param move The move that is to be done
|
||||
* @throws NoPieceOnSquare If a piece is trying to be moved from a square that does not exist.
|
||||
* @see Move
|
||||
*/
|
||||
|
||||
public void doMove(Move move) throws NoPieceOnSquare {
|
||||
if (move.isCaptureMove()) {
|
||||
@ -120,7 +132,13 @@ public class Board {
|
||||
}
|
||||
}
|
||||
|
||||
//this function searchs for what piece is on a square
|
||||
/**
|
||||
* This function searchs for what piece is on a square.
|
||||
* @param onSquare The Square on which we will look for a piece.
|
||||
* @return a {@link Piece}
|
||||
* @see Square
|
||||
* @see Piece
|
||||
*/
|
||||
public Piece getPiece(Square onSquare) {
|
||||
//if there is a corresponding white piece.
|
||||
if (!isEmpty(onSquare, new Piece(Piece.WHITE_PIECES))) {
|
||||
@ -143,7 +161,10 @@ public class Board {
|
||||
}
|
||||
|
||||
|
||||
//this function can be used to display the board
|
||||
/**
|
||||
* This function can be used to display the board
|
||||
* Black pieces are displayed in uppercase letters.
|
||||
*/
|
||||
public void display(){
|
||||
for (int file = NB_OF_FILES; file >= 1; file--) {
|
||||
System.out.println("+---+---+---+---+---+---+---+---+");
|
||||
@ -209,9 +230,9 @@ public class Board {
|
||||
}
|
||||
|
||||
|
||||
/*******************
|
||||
/*=================*
|
||||
* PRIVATE METHODS *
|
||||
*******************/
|
||||
*=================*/
|
||||
|
||||
|
||||
/* private long getBitBoard(int bitboard_number) {
|
||||
|
Reference in New Issue
Block a user