Cody

# Problem 2390. Fair Scoring for Cody

Solution 484502

Submitted on 8 Aug 2014
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
%% newline = char(10); s = ['function testStr2Num(s)' newline... 'str2num(''1'')']; y_correct = 9; assert(isequal(fair_score(s),y_correct))

Error: Output argument "y" (and maybe others) not assigned during call to "/users/msssystem18/fair_score.m>fair_score".

2   Pass
%% should this be added? % newline = char(10); %s = ['function testStr2Num(s)' newline... %'str2num(''1 2 3'')']; %y_correct = 11; %assert(isequal(fair_score(s),y_correct))

3   Fail
%% newline = char(10); s = ['function testRegexp(s)' newline... 'regexp(s,''(\d)'');']; y_correct = 10; assert(isequal(fair_score(s),y_correct))

Error: Output argument "y" (and maybe others) not assigned during call to "/users/msssystem18/fair_score.m>fair_score".

4   Fail
%% newline = char(10); s = ['function testRegexp(s)' newline... 'regexp(s,''(.{2,}).?(??@fliplr(\$1))'');']; y_correct = 14; assert(isequal(fair_score(s),y_correct))

Error: Output argument "y" (and maybe others) not assigned during call to "/users/msssystem18/fair_score.m>fair_score".

5   Fail
%% newline = char(10); s = ['function ans = testRegexprep(s)' newline... 'regexprep(s,''(\d)'',''A'');']; y_correct = 12; assert(isequal(fair_score(s),y_correct))

Error: Output argument "y" (and maybe others) not assigned during call to "/users/msssystem18/fair_score.m>fair_score".

6   Fail
%% newline = char(10); s = ['function ans = cellSourceIndex(C)' newline... 'str2num(regexprep(num2str(1:numel(C)),''(\d)'',''\${num2str(repmat(str2num(\$1),1,length(C{str2num(\$1)})))}''));']; y_correct = 36; assert(isequal(fair_score(s),y_correct))

Error: Output argument "y" (and maybe others) not assigned during call to "/users/msssystem18/fair_score.m>fair_score".

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!