Cody

# Problem 1179. Knights and Knaves (part 1)

Solution 2716893

Submitted on 20 Jul 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
A=true; B=false; X=1; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),1))

X = 2 ans = logical 0

Assertion failed.

2   Fail
A=true; B=false; X=2; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),2))

X = 1 ans = logical 1

Assertion failed.

3   Pass
A=false; B=true; X=1; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),1))

X = 1 ans = logical 1

4   Pass
A=false; B=true; X=2; f=inline('logical(interp1([0,1],[0,x],1))','x','A','B','X'); fA=@(str)xor(~A,f(eval(str),A,B,X)); fB=@(str)xor(~B,f(eval(str),A,B,X)); clear f A B X; assert(isequal(solver(fA,fB),2))

X = 2 ans = logical 0

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!