Cody

# Problem 1187. Knave in the middle attack

Solution 189037

Submitted on 10 Jan 2013
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; X=@isprime; str='X(4)'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knave' for input arguments of type 'char'.

2   Fail
%% A=false; X=@isprime; str='X(4)'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),false))

Error: Undefined function 'Knight' for input arguments of type 'char'.

3   Fail
%% A=true; X=@isprime; str='A==true'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knave' for input arguments of type 'char'.

4   Fail
%% A=false; X=@isprime; str='A==true'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knight' for input arguments of type 'char'.

5   Fail
%% A=true; X=@isprime; str='F(''A==true'')'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),false))

Error: Undefined function 'Knave' for input arguments of type 'char'.

6   Fail
%% A=false; X=@isprime; str='F(''A==true'')'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knight' for input arguments of type 'char'.

7   Fail
%% A=true; X=@isprime; str='diff(X(2:3))'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knave' for input arguments of type 'char'.

8   Fail
%% A=false; X=@isprime; str='diff(X(2:3))'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),false))

Error: Undefined function 'Knight' for input arguments of type 'char'.

9   Fail
%% A=true; X=@isprime; str='A==X(6)'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),false))

Error: Undefined function 'Knave' for input arguments of type 'char'.

10   Fail
%% A=false; X=@isprime; str='A==X(6)'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),false))

Error: Undefined function 'Knight' for input arguments of type 'char'.

11   Fail
%% A=true; X=@isprime; str='A&any(X(1:3))'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knave' for input arguments of type 'char'.

12   Fail
%% A=false; X=@isprime; str='A&any(X(1:3))'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knight' for input arguments of type 'char'.

13   Fail
%% A=true; X=@(x)rem(x,2); str='F(''F(''''X(3)'''')'')'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),false))

Error: Undefined function 'Knave' for input arguments of type 'char'.

14   Fail
%% A=false; X=@(x)rem(x,2); str='F(''F(''''X(3)'''')'')'; f0=inline('logical(interp1([0,1],[0,x],1))','x','A','X'); F=@(str)xor(~A,f0(eval(str),A,X)); clear A X; assert(isequal(AnswerGenerator(F,str),true))

Error: Undefined function 'Knight' for input arguments of type 'char'.