End of game detection now works fine but has made the game a lot slower.

I will imporve this with a : istherevalidmove function.
This commit is contained in:
2006-01-28 13:50:40 +00:00
parent 313cf91ef5
commit a3916eb445
4 changed files with 41 additions and 43 deletions

View File

@ -41,14 +41,14 @@ public class Rules {
* @see Square
* @see Board
*/
public static void legalMovesForPlayer(Board board, int color) throws NotAValidSquare {
public static void legalMovesForPlayer(Board board) throws NotAValidSquare {
legalMovesNonCapture = new ArrayList<Move>();
legalMovesCapture = new ArrayList<Move>();
Square square;
for(int squareNb = 0; squareNb < Board.NB_OF_SQUARES; squareNb++) {
square = new Square(squareNb);
if (board.isEmpty(square, new Piece(color))) {
if (board.isEmpty(square, new Piece(board.getCurrentPlayer()))) {
continue;
}
legalMovesFromSquare(square,board);