Cody

# Problem 907. Now! (Anticheating version 1)

Solution 316234

Submitted on 6 Sep 2013 by James
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   Pass
%% %#######################################################################% clear matlabCode; [~]=urlwrite('http://files4codygame.appspot.com/files/game.p','game.p'); rehash; protected_objs={'assert','isequal','now','error'}; game.status(protected_objs{:}); %#######################################################################% now1=ISaidNow; %#######################################################################% protected_objs={'assert','isequal','now','error'}; s2=game.status(protected_objs{:}); allowed_vars={'now1'}; cheated=game.cheated(allowed_vars{:}); fprintf('Cheated = %d\n',cheated) if cheated while 1 %TIMEOUT EXPIRATION end end %#######################################################################% [~]=fft(rand(1,1000000)); assert(isequal(now1,1))

[Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ISaidNow at 2 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ISaidNow at 2 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] ans = 1 [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] cheated = 0 y = 1 ans = 1

2   Pass
%% %#######################################################################% clear matlabCode; [~]=urlwrite('http://files4codygame.appspot.com/files/game.p','game.p'); rehash; protected_objs={'assert','isequal','now','error'}; game.status(protected_objs{:}); %#######################################################################% now1=ISaidNow; %#######################################################################% protected_objs={'assert','isequal','now','error'}; s2=game.status(protected_objs{:}); allowed_vars={'now1'}; cheated=game.cheated(allowed_vars{:}); fprintf('Cheated = %d\n',cheated) if cheated while 1 %TIMEOUT EXPIRATION end end %#######################################################################% [~]=fft(rand(1,1000000)); now2=now; assert(isequal(now1,now2),sprintf('now1 = %.11f, now2 = %.11f',now1,now2))

[Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 29 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 37 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 37 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ISaidNow at 2 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ISaidNow at 2 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] ans = 1 [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/assert.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] [Warning: Function /users/msssystem11/fprintf.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In /users/msssystem11/game.p>game.status at 52 In verifyCode>evaluateCode at 231 In verifyCode at 40 In fevalJSON at 14] cheated = 0 y = 1 ans = 1