public ArrayList<Move> getAllMoves(boolean isWhite) {
    	ArrayList<Move> moves = new ArrayList<Move>();
    	for (Field field : this.fields) {
			if (field.hasPiece()) {
				Piece piece = field.getPiece();
				if (piece.isWhite == isWhite) {
					for (Field legalField : piece.getLegalMoves(this, field)) {
						Move move = this.game.getMove(this, field, legalField, piece);
						if (!(move instanceof InvalidMove)) {
							moves.add(move);
						}
					}
				}
			}
    	}
		return moves;
	}