Cody

Solution 1938719

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
KNIGHT=true; PASSWORD='PASSWORD'; g=inline('logical(interp1([0,1],[0,x],1))','x','KNIGHT','PASSWORD'); F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); clear g KNIGHT PASSWORD; assert(isequal(solver(F),'PASSWORD'))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); 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 15) ss(k)=Q(['PASSWORD(' num2str(i) ')=='' ' letters(k) '''']); Error in Test1 (line 7) assert(isequal(solver(F),'PASSWORD'))

2   Fail
KNIGHT=false; PASSWORD='PASSWORD'; g=inline('logical(interp1([0,1],[0,x],1))','x','KNIGHT','PASSWORD'); F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); clear g KNIGHT PASSWORD; assert(isequal(solver(F),'PASSWORD'))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); 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 15) ss(k)=Q(['PASSWORD(' num2str(i) ')=='' ' letters(k) '''']); Error in Test2 (line 7) assert(isequal(solver(F),'PASSWORD'))

3   Fail
KNIGHT=false; PASSWORD='DONOTPANIC'; g=inline('logical(interp1([0,1],[0,x],1))','x','KNIGHT','PASSWORD'); F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); clear g KNIGHT PASSWORD; assert(isequal(solver(F),'DONOTPANIC'))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); 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 15) ss(k)=Q(['PASSWORD(' num2str(i) ')=='' ' letters(k) '''']); Error in Test3 (line 7) assert(isequal(solver(F),'DONOTPANIC'))

4   Fail
KNIGHT=true; PASSWORD='FORTYTWO'; g=inline('logical(interp1([0,1],[0,x],1))','x','KNIGHT','PASSWORD'); F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); clear g KNIGHT PASSWORD; assert(isequal(solver(F),'FORTYTWO'))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); 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 15) ss(k)=Q(['PASSWORD(' num2str(i) ')=='' ' letters(k) '''']); Error in Test4 (line 7) assert(isequal(solver(F),'FORTYTWO'))

5   Fail
KNIGHT=false; PASSWORD='PLEASELETMEIN'; g=inline('logical(interp1([0,1],[0,x],1))','x','KNIGHT','PASSWORD'); F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); clear g KNIGHT PASSWORD; assert(isequal(solver(F),'PLEASELETMEIN'))

Error using inlineeval (line 14) Error in inline expression ==> logical(interp1([0,1],[0,x],1)) X and V must be of the same length. Error in inline/subsref (line 23) INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr); Error in Test5>@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)) (line 4) F=@(str)xor(~KNIGHT,g(eval(str),KNIGHT,PASSWORD)); Error in solver (line 15) ss(k)=Q(['PASSWORD(' num2str(i) ')=='' ' letters(k) '''']); Error in Test5 (line 7) assert(isequal(solver(F),'PLEASELETMEIN'))