Cody

Solution 1669300

Submitted on 8 Nov 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Fail
% The Test Suite will be updated if inappropriate submissions are received. % This includes hard-coded (pre-calculated, externally calculated, manually calculated) 'solutions'. % EDIT (2019-06-24). Anti-hacking provision % Ensure builtin function will be called. (Probably only the second of these will work.) ! del fileread.m ! rm -v fileread.m % Probably only the second of these will work. RE = regexp(fileread('tiebreakGame.m'), '\w+', 'match'); tabooWords = {'ans', 'assert', 'freepass', 'tic'}; testResult = cellfun( @(z) ismember(z, tabooWords), RE ); msg = ['Please do not do that in your code!' char([10 13]) ... 'Found: ' strjoin(RE(testResult)) '.' char([10 13]) ... 'Banned word.' char([10 13])]; assert(~any( cellfun( @(z) ismember(z, tabooWords), RE ) ), msg) % END EDIT (2019-06-24) filetext = fileread('tiebreakGame.m'); vec = [5242178 5616877 7920095 4815022 1826772 5089792,5089793 1134259 2125443 3458492 4684486]; msg = 'Please do not hard-code your ''solution''.'; assert( all( arrayfun(@(z) isempty(strfind(filetext, num2str(z))), vec) ) , msg )

/bin/bash: del: command not found rm: cannot remove 'fileread.m': No such file or directory

Please do not do that in your code! Found: assert assert assert. Banned word.

2   Pass
% There are only two players, so the chances for each should add up to one. assert( abs(tiebreakGame(100)+tiebreakGame(0) - 1) < 20 * eps(single(1)) ) assert( abs(tiebreakGame(90)+tiebreakGame(10) - 1) < 20 * eps(single(1)) ) assert( abs(tiebreakGame(80)+tiebreakGame(20) - 1) < 20 * eps(single(1)) ) assert( abs(tiebreakGame(70)+tiebreakGame(30) - 1) < 20 * eps(single(1)) ) assert( abs(tiebreakGame(60)+tiebreakGame(40) - 1) < 20 * eps(single(1)) ) assert( abs(tiebreakGame(50)+tiebreakGame(50) - 1) < 20 * eps(single(1)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In tiebreakGame (line 7) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 4) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 5) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 7) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint2 (line 7) In solutionTest (line 5)]

3   Pass
x = uint8(50); y_correct = 0.50; assert( isequal(tiebreakGame(x), y_correct) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

4   Pass
x = uint8(0); y_correct = 0; assert( isequal(tiebreakGame(x), y_correct) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

5   Pass
x = uint8(100); y_correct = 1; assert( isequal(tiebreakGame(x), y_correct) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

6   Pass
x = uint8(5); y_correct = 0.0000005242178465; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

7   Pass
x = uint8(10); y_correct = 0.0000561687707317; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

8   Pass
x = uint8(15); y_correct = 0.0007920095157735; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint8 (line 3) In solutionTest (line 17)]

9   Pass
x = uint8(20); y_correct = 0.0048150226823529; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint9 (line 3) In solutionTest (line 19)]

10   Pass
x = uint8(25); y_correct = 0.0182677268981934; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint10 (line 3) In solutionTest (line 21)]

11   Pass
x = uint8(30); y_correct = 0.0508979303379310; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint11 (line 3) In solutionTest (line 23)]

12   Pass
x = uint8(35); y_correct = 0.1134259300865006; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint12 (line 3) In solutionTest (line 25)]

13   Pass
x = uint8(40); y_correct = 0.2125443387076924; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint13 (line 3) In solutionTest (line 27)]

14   Pass
x = uint8(45); y_correct = 0.3458492328206313; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint14 (line 3) In solutionTest (line 29)]

15   Pass
x = uint8(49); y_correct = 0.4684486239083455; assert( abs( tiebreakGame(x) - y_correct ) < 10 * eps(single(y_correct)) )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint15 (line 3) In solutionTest (line 31)]

16   Pass
for i = 1:5 x = uint8( randi(100) ); assert( isequal(class(tiebreakGame(x)), 'single') ) end;

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In tiebreakGame (line 5) In ScoringEngineTestPoint16 (line 3) In solutionTest (line 33)]