Cody

Problem 1201. Simple Decoder Ring

Solution 2173469

Submitted on 24 Mar 2020
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
inString1 = 'I am ready to try it - with punctuation and CAPS!'; outString1a = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP!'; assert(isequal(simpleDecoderRing(inString1,-3),outString1a ));

outString = 'F' j = 27 outString = 'F x' outString = 'F xj' outString = 'F xj o' outString = 'F xj ob' j = 27 outString = 'F xj obx' outString = 'F xj obxa' outString = 'F xj obxav' outString = 'F xj obxav q' outString = 'F xj obxav ql' outString = 'F xj obxav ql q' outString = 'F xj obxav ql qo' outString = 'F xj obxav ql qov' outString = 'F xj obxav ql qov f' outString = 'F xj obxav ql qov fq' outString = 'F xj obxav ql qov fq - t' outString = 'F xj obxav ql qov fq - tf' outString = 'F xj obxav ql qov fq - tfq' outString = 'F xj obxav ql qov fq - tfqe' outString = 'F xj obxav ql qov fq - tfqe m' outString = 'F xj obxav ql qov fq - tfqe mr' outString = 'F xj obxav ql qov fq - tfqe mrk' j = 29 outString = 'F xj obxav ql qov fq - tfqe mrkz' outString = 'F xj obxav ql qov fq - tfqe mrkzq' outString = 'F xj obxav ql qov fq - tfqe mrkzqr' j = 27 outString = 'F xj obxav ql qov fq - tfqe mrkzqrx' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxq' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqf' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqfl' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk' j = 27 outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk x' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xk' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka Z' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZX' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXM' outString = 'F xj obxav ql qov fq - tfqe mrkzqrxqflk xka ZXMP'

2   Fail
inString1 = 'I am ready to try it - with punctuation and CAPS!'; outString1b = 'L dp uhdgb wr wub lw - zlwk sxqfwxdwlrq dqg FDSV!'; assert(isequal(simpleDecoderRing(inString1,3),outString1b ));

outString = 'L' j = 27

Index in position 1 exceeds array bounds (must not exceed 26). Error in simpleDecoderRing (line 15) outString = [outString LOWER_CASE{j+(inShift),1}] Error in Test2 (line 3) assert(isequal(simpleDecoderRing(inString1,3),outString1b ));

3   Fail
inString2 = 'Dick Tracy is often associated with decoder rings.'; outString2a = 'Lqks Bzikg qa wnbmv iaawkqibml eqbp lmkwlmz zqvoa.'; assert(isequal(simpleDecoderRing(inString2,-18),outString2a ));

Index in position 1 is invalid. Array indices must be positive integers or logical values. Error in simpleDecoderRing (line 20) outString = [outString UPPER_CASE{j+(inShift),1}] Error in Test3 (line 3) assert(isequal(simpleDecoderRing(inString2,-18),outString2a ));

4   Fail
inString2 = 'Dick Tracy is often associated with decoder rings.'; outString2b = 'Zeyg Pnwyu eo kbpaj wookyewpaz sepd zaykzan nejco.'; assert(isequal(simpleDecoderRing(inString2,22),outString2b ));

outString = 'Z'

Index in position 1 exceeds array bounds (must not exceed 26). Error in simpleDecoderRing (line 15) outString = [outString LOWER_CASE{j+(inShift),1}] Error in Test4 (line 3) assert(isequal(simpleDecoderRing(inString2,22),outString2b ));