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:
@ -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);
|
||||
|
Reference in New Issue
Block a user