Cody

Solution 1692664

Submitted on 14 Dec 2018 by Charles Juenger
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
assessFunctionAbsence({'regexp','regexpi','regexprep','str2num'},'FileName','counter.m')

2   Pass
f = counter(0,1); assert(isequal(f(),0)) assert(isequal(f(),1)) assert(isequal(2,f())) assert(isequal(3,f()))

y = function_handle with value: @counter/a c = 0 c = 1 c = 2 c = 3

3   Pass
f = counter(1,0); assert(isequal(f(),1)) assert(isequal(f(),1)) assert(isequal(1,f())) assert(isequal(1,f()))

y = function_handle with value: @counter/a c = 1 c = 1 c = 1 c = 1

4   Pass
f = counter(10,2); assert(isequal(f(),10)) assert(isequal(f(),12)) assert(isequal(14,f())) assert(isequal(16,f()))

y = function_handle with value: @counter/a c = 10 c = 12 c = 14 c = 16

5   Pass
f = counter(0,5); y_correct = [0, 5, 10, 15, 20, 55]; assert(isequal([f() f() f() f() f() f()+f()],y_correct))

y = function_handle with value: @counter/a c = 0 c = 5 c = 10 c = 15 c = 20 c = 25 c = 30

6   Pass
x0 = randi(10); b = randi(10); f = counter(x0,b); y_correct = x0 + (0:1000)*b; assert(isequal(arrayfun(@(n)f(),0:1000),y_correct))

y = function_handle with value: @counter/a c = 6 c = 16 c = 26 c = 36 c = 46 c = 56 c = 66 c = 76 c = 86 c = 96 c = 106 c = 116 c = 126 c = 136 c = 146 c = 156 c = 166 c = 176 c = 186 c = 196 c = 206 c = 216 c = 226 c = 236 c = 246 c = 256 c = 266 c = 276 c = 286 c = 296 c = 306 c = 316 c = 326 c = 336 c = 346 c = 356 c = 366 c = 376 c = 386 c = 396 c = 406 c = 416 c = 426 c = 436 c = 446 c = 456 c = 466 c = 476 c = 486 c = 496 c = 506 c = 516 c = 526 c = 536 c = 546 c = 556 c = 566 c = 576 c = 586 c = 596 c = 606 c = 616 c = 626 c = 636 c = 646 c = 656 c = 666 c = 676 c = 686 c = 696 c = 706 c = 716 c = 726 c = 736 c = 746 c = 756 c = 766 c = 776 c = 786 c = 796 c = 806 c = 816 c = 826 c = 836 c = 846 c = 856 c = 866 c = 876 c = 886 c = 896 c = 906 c = 916 c = 926 c = 936 c = 946 c = 956 c = 966 c = 976 c = 986 c = 996 c = 1006 c = 1016 c = 1026 c = 1036 c = 1046 c = 1056 c = 1066 c = 1076 c = 1086 c = 1096 c = 1106 c = 1116 c = 1126 c = 1136 c = 1146 c = 1156 c = 1166 c = 1176 c = 1186 c = 1196 c = 1206 c = 1216 c = 1226 c = 1236 c = 1246 c = 1256 c = 1266 c = 1276 c = 1286 c = 1296 c = 1306 c = 1316 c = 1326 c = 1336 c = 1346 c = 1356 c = 1366 c = 1376 c = 1386 c = 1396 c = 1406 c = 1416 c = 1426 c = 1436 c = 1446 c = 1456 c = 1466 c = 1476 c = 1486 c = 1496 c = 1506 c = 1516 c = 1526 c = 1536 c = 1546 c = 1556 c = 1566 c = 1576 c = 1586 c = 1596 c = 1606 c = 1616 c = 1626 c = 1636 c = 1646 c = 1656 c = 1666 c = 1676 c = 1686 c = 1696 c = 1706 c = 1716 c = 1726 c = 1736 c = 1746 c = 1756 c = 1766 c = 1776 c = 1786 c = 1796 c = 1806 c = 1816 c = 1826 c = 1836 c = 1846 c = 1856 c = 1866 c = 1876 c = 1886 c = 1896 c = 1906 c = 1916 c = 1926 c = 1936 c = 1946 c = 1956 c = 1966 c = 1976 c = 1986 c = 1996 c = 2006 c = 2016 c = 2026 c = 2036 c = 2046 c = 2056 c = 2066 c = 2076 c = 2086 c = 2096 c = 2106 c = 2116 c = 2126 c = 2136 c = 2146 c = 2156 c = 2166 c = 2176 c = 2186 c = 2196 c = 2206 c = 2216 c = 2226 c = 2236 c = 2246 c = 2256 c = 2266 c = 2276 c = 2286 c = 2296 c = 2306 c = 2316 c = 2326 c = 2336 c = 2346 c = 2356 c = 2366 c = 2376 c = 2386 c = 2396 c = 2406 c = 2416 c = 2426 c = 2436 c = 2446 c = 2456 c = 2466 c = 2476 c = 2486 c = 2496 c = 2506 c = 2516 c = 2526 c = 2536 c = 2546 c = 2556 c = 2566 c = 2576 c = 2586 c = 2596 c = 2606 c = 2616 c = 2626 c = 2636 c = 2646 c = 2656 c = 2666 c = 2676 c = 2686 c = 2696 c = 2706 c = 2716 c = 2726 c = 2736 c = 2746 c = 2756 c = 2766 c = 2776 c = 2786 c = 2796 c = 2806 c = 2816 c = 2826 c = 2836 c = 2846 c = 2856 c = 2866 c = 2876 c = 2886 c = 2896 c = 2906 c = 2916 c = 2926 c = 2936 c = 2946 c = 2956 c = 2966 c = 2976 c = 2986 c = 2996 c = 3006 c = 3016 c = 3026 c = 3036 c = 3046 c = 3056 c = 3066 c = 3076 c = 3086 c = 3096 c = 3106 c = 3116 c = 3126 c = 3136 c = 3146 c = 3156 c = 3166 c = 3176 c = 3186 c = 3196 c = 3206 c = 3216 c = 3226 c = 3236 c = 3246 c = 3256 c = 3266 c = 3276 c = 3286 c = 3296 c = 3306 c = 3316 c = 3326 c = 3336 c = 3346 c = 3356 c = 3366 c = 3376 c = 3386 c = 3396 c = 3406 c = 3416 c = 3426 c = 3436 c = 3446 c = 3456 c = 3466 c = 3476 c = 3486 c = 3496 c = 3506 c = 3516 c = 3526 c = 3536 c = 3546 c = 3556 c = 3566 c = 3576 c = 3586 c = 3596 c = 3606 c = 3616 c = 3626 c = 3636 c = 3646 c = 3656 c = 3666 c = 3676 c = 3686 c = 3696 c = 3706 c = 3716 c = 3726 c = 3736 c = 3746 c = 3756 c = 3766 c = 3776 c = 3786 c = 3796 c = 3806 c = 3816 c = 3826 c = 3836 c = 3846 c = 3856 c = 3866 c = 3876 c = 3886 c = 3896 c = 3906 c = 3916 c = 3926 c = 3936 c = 3946 c = 3956 c = 3966 c = 3976 c = 3986 c = 3996 c = 4006 c = 4016 c = 4026 c = 4036 c = 4046 c = 4056 c = 4066 c = 4076 c = 4086 c = 4096 c = 4106 c = 4116 c = 4126 c = 4136 c = 4146 c = 4156 c = 4166 c = 4176 c = 4186 c = 4196 c = 4206 c = 4216 c = 4226 c = 4236 c = 4246 c = 4256 c = 4266 c = 4276 c = 4286 c = 4296 c = 4306 c = 4316 c = 4326 c = 4336 c = 4346 c = 4356 c = 4366 c = 4376 c = 4386 c = 4396 c = 4406 c = 4416 c = 4426 c = 4436 c = 4446 c = 4456 c = 4466 c = 4476 c = 4486 c = 4496 c = 4506 c = 4516 c = 4526 c = 4536 c = 4546 c = 4556 c = 4566 c = 4576 c = 4586 c = 4596 c = 4606 c = 4616 c = 4626 c = 4636 c = 4646 c = 4656 c = 4666 c = 4676 c = 4686 c = 4696 c = 4706 c = 4716 c = 4726 c = 4736 c = 4746 c = 4756 c = 4766 c = 4776 c = 4786 c = 4796 c = 4806 c = 4816 c = 4826 c = 4836 c = 4846 c = 4856 c = 4866 c = 4876 c = 4886 c = 4896 c = 4906 c = 4916 c = 4926 c = 4936 c = 4946 c = 4956 c = 4966 c = 4976 c = 4986 c = 4996 c = 5006 c = 5016 c = 5026 c = 5036 c = 5046 c = 5056 c = 5066 c = 5076 c = 5086 c = 5096 c = 5106 c = 5116 c = 5126 c = 5136 c = 5146 c = 5156 c = 5166 c = 5176 c = 5186 c = 5196 c = 5206 c = 5216 c = 5226 c = 5236 c = 5246 c = 5256 c = 5266 c = ...