function b = CS_check_SAT_sol(KB,sol)
% CS_check_SAT_sol - check if truth assignment satisfies CNF
% On input:
%     KB (KB struct): KB info
%     sol (1xn vector): n-ary truth assignment
% On output:
%     b (Boolean): 1 if sol satisfies KB; else 0
% Call:
%     b = CS_check_SAT_sol(KB,[1,1,0]);
% Author:
%     T. Henderson
%     UU
%     Summer 2022
%

num_clauses = length(KB);

b = 1;
for c = 1:num_clauses
    indexes = abs(KB(c).clauses);
    bits = sol(indexes);
    if BR_sat(KB(c).clauses,sol)==0
        b = 0;
        return
    end
end
