public ArrayList<Field> getLegalFields(Player player) {
    	ArrayList<Field> legalFields = new ArrayList<Field>();
    	for (Field field : this.window.board.fields) {
    		if (field.hasPiece()) {
    			Piece piece = field.getPiece();
    			if (piece.isWhite == player.isWhite) {
    				for (Field legalField : this.getPiecesLegalFields(piece, field)) {
	    				legalFields.add(legalField);
    				}
    			}
    		}
    	}
    	return legalFields;
	}