Cody

# Problem 1189. Knights and Knaves (part 3)

Solution 1938722

Submitted on 17 Sep 2019
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

lett = 1×1 cell array {'A'}

Error using eval Unrecognized function or variable 'A'. Error in Test1>@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)) (line 4) F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); Error in solver (line 16) ss(k)=Q(['PASSWORD(' num2str(i) ')==' lett{1} ]); Error in Test1 (line 7) assert(isequal(solver(F),'PASSWORD'))

2   Fail

lett = 1×1 cell array {'A'}

Error using eval Unrecognized function or variable 'A'. Error in Test2>@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)) (line 4) F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); Error in solver (line 16) ss(k)=Q(['PASSWORD(' num2str(i) ')==' lett{1} ]); Error in Test2 (line 7) assert(isequal(solver(F),'PASSWORD'))

3   Fail

lett = 1×1 cell array {'A'}

Error using eval Unrecognized function or variable 'A'. Error in Test3>@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)) (line 4) F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); Error in solver (line 16) ss(k)=Q(['PASSWORD(' num2str(i) ')==' lett{1} ]); Error in Test3 (line 7) assert(isequal(solver(F),'DONOTPANIC'))

4   Fail

lett = 1×1 cell array {'A'}

Error using eval Unrecognized function or variable 'A'. Error in Test4>@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)) (line 4) F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); Error in solver (line 16) ss(k)=Q(['PASSWORD(' num2str(i) ')==' lett{1} ]); Error in Test4 (line 7) assert(isequal(solver(F),'FORTYTWO'))

5   Fail