You are on page 1of 1

*/

public boolean validate(int x, int y) {


if (x >= 1 && y <= 8) {
return true;
}
return false;
}

/**
* AddPiece.
*/
public void addPiece(Piece piece) {
int count = 0;
for (int i = 0; i < pieces.size(); i++) {
if (pieces.get(i).getCoordinatesX() == piece.getCoordinatesX()
&& pieces.get(i).getCoordinatesY() == piece.getCoordinatesY())
{
count++;
}
}
if (count == 0) {
pieces.add(piece);
}
}

You might also like