Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 189239

Submitted on 10 Jan 2013

Incorrect

100Size
Leading solution size is 48.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
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: Error: The expression to the left of the equals sign is not a valid target for an assignment.
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: Error: The expression to the left of the equals sign is not a valid target for an assignment.
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: Error: The expression to the left of the equals sign is not a valid target for an assignment.
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: Error: The expression to the left of the equals sign is not a valid target for an assignment.
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: Error: The expression to the left of the equals sign is not a valid target for an assignment.