Cody

Solution 2203732

Submitted on 10 Apr 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
% This test suite can be updated if inappropriate 'hacks' % are discovered in any submitted solutions, % so your score/size may therefore change over time.

2   Fail
x = 'Dbodfm Pqfsbujpo Qipfojy jnnfejbufmz & ftdbqf.'; s_correct.shift = 1; s_correct.message = 'Cancel Operation Phoenix immediately & escape.'; s = decode(x); assert( isequal(s.shift, s_correct.shift) ) assert( isequal(s.message, s_correct.message) ) assert( isequal(class(s.shift), 'uint8') ) assert( isequal(class(s.message), 'char') )

x = 'DBODFM PQFSBUJPO QIPFOJY JNNFEJBUFMZ & FTDBQF.' p = 25×46 char array 'CANCEL OPERATION PHOENIX IMMEDIATELY & ESCAPE.' 'BxMBDK NODQxSHNM OGNDMHW HLLDCHxSDKX & DRBxOD.' 'AvLACJ MNCPvRGML NFMCLGV GKKCBGvRCJW & CQAvNC.' 'vtKvBI LMBOtQFLK MELBKFU FJJBAFtQBIV & BPvtMB.' 'trJtAH KLANrPEKJ LDKAJET EIIAuErPAHU & AOtrLA.' 'rpIrtG JKtMpODJI KCJtIDS DHHtsDpOtGT & tNrpKt.' 'pnHprF IJrLnNCIH JBIrHCR CGGrqCnNrFS & rMpnJr.' 'nlGnpE HIpKlMBHG IAHpGBQ BFFpoBlMpER & pLnlIp.' 'ljFlnD GHnJjLAGF HqGnFAP AEEnmAjLnDQ & nKljHn.' 'jhEjlC FGlIhKpFE GoFlEpO pDDlkphKlCP & lJjhGl.' 'hfDhjB EFjHfJnED FmEjDnN nCCjinfJjBO & jIhfFj.' 'fdCfhA DEhGdIlDC EkDhClM lBBhgldIhAN & hHfdEh.' 'dbBdfm CDfFbHjCB DiCfBjL jAAfejbHfmM & fGdbDf.' 'bZAbdk BCdEZGhBA CgBdAhK hlldchZGdkL & dFbZCd.' 'ZXkZbi ABbDXFfAk BeAbkfJ fjjbafXFbiK & bEZXBb.' 'XViXZg jAZCVEdji AcjZidI dhhZYdVEZgJ & ZDXVAZ.' 'VTgVXe hiXBTDbhg iahXgbH bffXWbTDXeI & XCVTiX.' 'TReTVc fgVARCZfe gYfVeZG ZddVUZRCVcH & VBTRgV.' 'RPcRTa deTgPBXdc eWdTcXF XbbTSXPBTaG & TARPeT.' 'PNaPRY bcReNAVba cUbRaVE VZZRQVNARYF & RfPNcR.' 'NLYNPW ZaPcLeTZY aSZPYTD TXXPOTLePWE & PdNLaP.' 'LJWLNU XYNaJcRXW YQXNWRC RVVNMRJcNUD & NbLJYN.' 'JHUJLS VWLYHaPVU WOVLUPB PTTLKPHaLSC & LZJHWL.' 'HFSHJQ TUJWFYNTS UMTJSNA NRRJINFYJQB & JXHFUJ.' 'FDQFHO RSHUDWLRQ SKRHQLa LPPHGLDWHOA & HVFDSH.'

Output argument "s" (and maybe others) not assigned during call to "decode". Error in Test2 (line 4) s = decode(x);

3   Fail
x = 'Vwlyhapvu Wovlupe ilnpuz Ablzkhf! Vwlyhapvu Wovlupe pz vby avw wypvypaf.'; s_correct.shift = 7; s_correct.message = 'Operation Phoenix begins Tuesday! Operation Phoenix is our top priority.'; s = decode(x); assert( isequal(s.shift, s_correct.shift) ) assert( isequal(s.message, s_correct.message) ) assert( isequal(class(s.shift), 'uint8') ) assert( isequal(class(s.message), 'char') )

x = 'VWLYHAPVU WOVLUPE ILNPUZ ABLZKHF! VWLYHAPVU WOVLUPE PZ VBY AVW WYPVYPAF.' p = 25×73 char array 'UVKXGyOUT VNUKTOD HKMOTY yAKYJGE! UVKXGyOUT VNUKTOD OY UAX yUV VXOUXOyE.' 'TUJWFwNTS UMTJSNC GJLNSX wxJXIFD! TUJWFwNTS UMTJSNC NX TxW wTU UWNTWNwD.' 'STIVEuMSR TLSIRMB FIKMRW uvIWHEC! STIVEuMSR TLSIRMB MW SvV uST TVMSVMuC.' 'RSHUDsLRQ SKRHQLA EHJLQV stHVGDB! RSHUDsLRQ SKRHQLA LV RtU sRS SULRULsB.' 'QRGTCqKQP RJQGPKu DGIKPU qrGUFCA! QRGTCqKQP RJQGPKu KU QrT qQR RTKQTKqA.' 'PQFSBoJPO QIPFOJs CFHJOT opFTEBt! PQFSBoJPO QIPFOJs JT PpS oPQ QSJPSJot.' 'OPERAmION PHOENIq BEGINS mnESDAr! OPERAmION PHOENIq IS OnR mOP PRIORImr.' 'NODQrkHNM OGNDMHo ADFHMR klDRCrp! NODQrkHNM OGNDMHo HR NlQ kNO OQHNQHkp.' 'MNCPpiGML NFMCLGm qCEGLQ ijCQBpn! MNCPpiGML NFMCLGm GQ MjP iMN NPGMPGin.' 'LMBOngFLK MELBKFk oBDFKP ghBPAnl! LMBOngFLK MELBKFk FP LhO gLM MOFLOFgl.' 'KLANleEKJ LDKAJEi mACEJO efAOolj! KLANleEKJ LDKAJEi EO KfN eKL LNEKNEej.' 'JKnMjcDJI KCJnIDg knBDIN cdnNmjh! JKnMjcDJI KCJnIDg DN JdM cJK KMDJMDch.' 'IJlLhaCIH JBIlHCe ilACHM ablMkhf! IJlLhaCIH JBIlHCe CM IbL aIJ JLCILCaf.' 'HIjKfYBHG IAHjGBc gjlBGL YZjLifd! HIjKfYBHG IAHjGBc BL HZK YHI IKBHKBYd.' 'GHhJdWAGF HkGhFAa ehjAFK WXhKgdb! GHhJdWAGF HkGhFAa AK GXJ WGH HJAGJAWb.' 'FGfIbUjFE GiFfEjY cfhjEJ UVfJebZ! FGfIbUjFE GiFfEjY jJ FVI UFG GIjFIjUZ.' 'EFdHZShED FgEdDhW adfhDI STdIcZX! EFdHZShED FgEdDhW hI ETH SEF FHhEHhSX.' 'DEbGXQfDC EeDbCfU YbdfCH QRbHaXV! DEbGXQfDC EeDbCfU fH DRG QDE EGfDGfQV.' 'CDZFVOdCB DcCZBdS WZbdBG OPZGYVT! CDZFVOdCB DcCZBdS dG CPF OCD DFdCFdOT.' 'BCXETMbBA CaBXAbQ UXZbAF MNXFWTR! BCXETMbBA CaBXAbQ bF BNE MBC CEbBEbMR.' 'ABVDRKZAe BYAVeZO SVXZeE KLVEURP! ABVDRKZAe BYAVeZO ZE ALD KAB BDZADZKP.' 'dATCPIXdc AWdTcXM QTVXcD IJTDSPN! dATCPIXdc AWdTcXM XD dJC IdA ACXdCXIN.' 'bcRBNGVba cUbRaVK ORTVaC GHRCQNL! bcRBNGVba cUbRaVK VC bHB Gbc cBVbBVGL.' 'ZaPALETZY aSZPYTI MPRTYB EFPBOLJ! ZaPALETZY aSZPYTI TB ZFA EZa aATZATEJ.' 'XYNaJCRXW YQXNWRG KNPRWA CDNAMJH! XYNaJCRXW YQXNWRG RA XDa CXY YaRXaRCH.'

Output argument "s" (and maybe others) not assigned during call to "decode". Error in Test3 (line 4) s = decode(x);

4   Fail
x = 'Eatpht cdit iwpi iwt ephhldgs wph qttc rwpcvts ugdb "Fxeudyn" id "Dvcsbwl". Diwtglxht Detgpixdc Ewdtcxm xh egdrttsxcv prrdgsxcv id eapc.'; s_correct.shift = 15; s_correct.message = 'Please note that the password has been changed from "Qipfojy" to "Ogndmhw". Otherwise Operation Phoenix is proceeding according to plan.'; s = decode(x); assert( isequal(s.shift, s_correct.shift) ) assert( isequal(s.message, s_correct.message) ) assert( isequal(class(s.shift), 'uint8') ) assert( isequal(class(s.message), 'char') )

x = 'EATPHT CDIT IWPI IWT EPHHLDGS WPH QTTC RWPCVTS UGDB "FXEUDYN" ID "DVCSBWL". DIWTGLXHT DETGPIXDC EWDTCXM XH EGDRTTSXCV PRRDGSXCV ID EAPC.' p = 25×137 char array 'DySOGS BCHS HVOH HVS DOGGKCFR VOG PSSB QVOBUSR TFCA "EWDTCXM" HC "CUBRAVK". CHVSFKWGS CDSFOHWCB DVCSBWL WG DFCQSSRWBU OQQCFRWBU HC DyOB.' 'CwRNFR ABGR GUNG GUR CNFFJBEQ UNF ORRA PUNATRQ SEBx "DVCSBWL" GB "BTAQxUJ". BGUREJVFR BCRENGVBA CUBRAVK VF CEBPRRQVAT NPPBEQVAT GB CwNA.' 'BuQMEQ wAFQ FTMF FTQ BMEEIADP TME NQQw OTMwSQP RDAv "CUBRAVK" FA "ASwPvTI". AFTQDIUEQ ABQDMFUAw BTAQwUJ UE BDAOQQPUwS MOOADPUwS FA BuMw.' 'AsPLDP uvEP ESLE ESP ALDDHvCO SLD MPPu NSLuRPO QCvt "BTAQvUJ" Ev "vRuOtSH". vESPCHTDP vAPCLETvu ASvPuTI TD ACvNPPOTuR LNNvCOTuR Ev AsLu.' 'uqOKCO stDO DRKD DRO uKCCGtBN RKC LOOs MRKsQON PBtr "ASuPtTI" Dt "tQsNrRG". tDROBGSCO tuOBKDSts uRtOsSH SC uBtMOONSsQ KMMtBNSsQ Dt uqKs.' 'soNJBN qrCN CQJC CQN sJBBFrAM QJB KNNq LQJqPNM OArp "tRsOrSH" Cr "rPqMpQF". rCQNAFRBN rsNAJCRrq sQrNqRG RB sArLNNMRqP JLLrAMRqP Cr soJq.' 'qmMIAM opBM BPIB BPM qIAAEpsL PIA JMMo KPIoOML Nspn "rQqNpRG" Bp "pOoLnPE". pBPMsEQAM pqMsIBQpo qPpMoQF QA qspKMMLQoO IKKpsLQoO Bp qmIo.' 'okLHrL mnAL AOHA AOL oHrrDnqK OHr ILLm JOHmNLK Mqnl "pPoMnQF" An "nNmKlOD". nAOLqDPrL noLqHAPnm oOnLmPE Pr oqnJLLKPmN HJJnqKPmN An okHm.' 'miKGpK klqK qNGq qNK mGppCloJ NGp HKKk INGkMKJ Lolj "nOmLlPE" ql "lMkJjNC". lqNKoCOpK lmKoGqOlk mNlKkOD Op molIKKJOkM GIIloJOkM ql miGk.' 'kgJFnJ ijoJ oMFo oMJ kFnnBjmI MFn GJJi HMFiLJI Kmjh "lNkKjOD" oj "jLiIhMB". joMJmBNnJ jkJmFoNji kMjJiNC Nn kmjHJJINiL FHHjmINiL oj kgFi.' 'ieIElI ghmI mLEm mLI iEllAhkH LEl FIIg GLEgKIH Jkhf "jMiJhNC" mh "hKgHfLA". hmLIkAMlI hiIkEmMhg iLhIgMB Ml ikhGIIHMgK EGGhkHMgK mh ieEg.' 'gcHDjH efkH kKDk kKH gDjjnfiG KDj EHHe FKDeJHG Iifd "hLgIfMB" kf "fJeGdKn". fkKHinLjH fgHiDkLfe gKfHeLA Lj gifFHHGLeJ DFFfiGLeJ kf gcDe.' 'eaGChG cdiG iJCi iJG eChhldgF JCh DGGc EJCcIGF Hgdb "fKeHdLA" id "dIcFbJl". diJGglKhG deGgCiKdc eJdGcKm Kh egdEGGFKcI CEEdgFKcI id eaCc.' 'cYFBfF abgF gIBg gIF cBffjbeE IBf CFFa DIBaHFE GebZ "dJcGbKl" gb "bHaEZIj". bgIFejJfF bcFeBgJba cIbFaJk Jf cebDFFEJaH BDDbeEJaH gb cYBa.' 'aWEAdE YZeE eHAe eHE aAddhZcD HAd BEEY CHAYGED FcZX "bIaFZJj" eZ "ZGYDXHh". ZeHEchIdE ZaEcAeIZY aHZEYIi Id acZCEEDIYG ACCZcDIYG eZ aWAY.' 'YUDjbD WXcD cGjc cGD YjbbfXaC Gjb ADDW BGjWFDC EaXV "ZHYEXIh" cX "XFWCVGf". XcGDafHbD XYDajcHXW YGXDWHg Hb YaXBDDCHWF jBBXaCHWF cX YUjW.' 'WSChZC UVaC aFha aFC WhZZdVYB FhZ iCCU AFhUECB DYVT "XGWDVHf" aV "VEUBTFd". VaFCYdGZC VWCYhaGVU WFVCUGe GZ WYVACCBGUE hAAVYBGUE aV WShU.' 'UQBfXB STYB YEfY YEB UfXXbTWA EfX gBBS hEfSDBA CWTR "VFUCTGd" YT "TDSAREb". TYEBWbFXB TUBWfYFTS UETBSFc FX UWThBBAFSD fhhTWAFSD YT UQfS.' 'SOAdVA QRWA WDdW WDA SdVVZRUg DdV eAAQ fDdQCAg BURP "TESBRFb" WR "RCQgPDZ". RWDAUZEVA RSAUdWERQ SDRAQEa EV SURfAAgEQC dffRUgEQC WR SOdQ.' 'QMfbTf OPUf UCbU UCf QbTTXPSe CbT cffO dCbOBfe ASPN "RDQAPEZ" UP "PBOeNCX". PUCfSXDTf PQfSbUDPO QCPfODY DT QSPdffeDOB bddPSeDOB UP QMbO.' 'OKdZRd MNSd SBZS SBd OZRRVNQc BZR addM bBZMAdc eQNL "PCOeNDX" SN "NAMcLBV". NSBdQVCRd NOdQZSCNM OBNdMCW CR OQNbddcCMA ZbbNQcCMA SN OKZM.' 'MIbXPb KLQb QAXQ QAb MXPPTLOa AXP YbbK ZAXKdba cOLJ "NBMcLCV" QL "LdKaJAT". LQAbOTBPb LMbOXQBLK MALbKBU BP MOLZbbaBKd XZZLOaBKd QL MIXK.' 'KGZVNZ IJOZ OcVO OcZ KVNNRJMY cVN WZZI XcVIbZY aMJH "LAKaJBT" OJ "JbIYHcR". JOcZMRANZ JKZMVOAJI KcJZIAS AN KMJXZZYAIb VXXJMYAIb OJ KGVI.' 'IEXTLX GHMX MaTM MaX ITLLPHKW aTL UXXG VaTGZXW YKHF "JbIYHAR" MH "HZGWFaP". HMaXKPbLX HIXKTMbHG IaHXGbQ bL IKHVXXWbGZ TVVHKWbGZ MH IETG.' 'GCVRJV EFKV KYRK KYV GRJJNFIU YRJ SVVE TYREXVU WIFD "HZGWFaP" KF "FXEUDYN". FKYVINZJV FGVIRKZFE GYFVEZO ZJ GIFTVVUZEX RTTFIUZEX KF GCRE.'

Output argument "s" (and maybe others) not assigned during call to "decode". Error in Test4 (line 4) s = decode(x);

5   Fail
x = 'Mncpyrgml Nfmclgv qryprcb rfpcc bywq yem. Yjj ncpqmllcj ypc rm pckygl ml bsrw slrgj Mncpyrgml Nfmclgv gq amknjcrcb.'; s_correct.shift = 24; s_correct.message = 'Operation Phoenix started three days ago. All personnel are to remain on duty until Operation Phoenix is completed.'; s = decode(x); assert( isequal(s.shift, s_correct.shift) ) assert( isequal(s.message, s_correct.message) ) assert( isequal(class(s.shift), 'uint8') ) assert( isequal(class(s.message), 'char') )

x = 'MNCPYRGML NFMCLGV QRYPRCB RFPCC BYWQ YEM. YJJ NCPQMLLCJ YPC RM PCKYGL ML BSRW SLRGJ MNCPYRGML NFMCLGV GQ AMKNJCRCB.' p = 25×116 char array 'LMBOXQFLK MELBKFU PQXOQBA QEOBB AXVP XDL. XII MBOPLKKBI XOB QL OBJXFK LK ARQV RKQFI LMBOXQFLK MELBKFU FP yLJMIBQBA.' 'KLANWPEKJ LDKAJET OPWNPAx PDNAA xWUO WCK. WHH LANOKJJAH WNA PK NAIWEJ KJ xQPU QJPEH KLANWPEKJ LDKAJET EO wKILHAPAx.' 'JKwMVODJI KCJwIDS NOVMOwv OCMww vVTN VBJ. VGG KwMNJIIwG VMw OJ MwHVDI JI vPOT PIODG JKwMVODJI KCJwIDS DN uJHKGwOwv.' 'IJuLUNCIH JBIuHCR MNULNut NBLuu tUSM UAI. UFF JuLMIHHuF ULu NI LuGUCH IH tONS OHNCF IJuLUNCIH JBIuHCR CM sIGJFuNut.' 'HIsKTMBHG IAHsGBQ LMTKMsr MAKss rTRL TuH. TEE IsKLHGGsE TKs MH KsFTBG HG rNMR NGMBE HIsKTMBHG IAHsGBQ BL qHFIEsMsr.' 'GHqJSLAGF HtGqFAP KLSJLqp LtJqq pSQK SsG. SDD HqJKGFFqD SJq LG JqESAF GF pMLQ MFLAD GHqJSLAGF HtGqFAP AK oGEHDqLqp.' 'FGoIRKsFE GrFoEsO JKRIKon KrIoo nRPJ RqF. RCC GoIJFEEoC RIo KF IoDRsE FE nLKP LEKsC FGoIRKsFE GrFoEsO sJ mFDGCoKon.' 'EFmHQJqED FpEmDqN IJQHJml JpHmm lQOI QoE. QBB FmHIEDDmB QHm JE HmCQqD ED lKJO KDJqB EFmHQJqED FpEmDqN qI kECFBmJml.' 'DEkGPIoDC EnDkCoM HIPGIkj InGkk jPNH PmD. PAA EkGHDCCkA PGk ID GkBPoC DC jJIN JCIoA DEkGPIoDC EnDkCoM oH iDBEAkIkj.' 'CDiFOHmCB DlCiBmL GHOFHih HlFii hOMG OkC. Opp DiFGCBBip OFi HC FiAOmB CB hIHM IBHmp CDiFOHmCB DlCiBmL mG gCADpiHih.' 'BCgENGkBA CjBgAkK FGNEGgf GjEgg fNLF NiB. Nnn CgEFBAAgn NEg GB EgoNkA BA fHGL HAGkn BCgENGkBA CjBgAkK kF eBoCngGgf.' 'ABeDMFiAn BhAeniJ EFMDFed FhDee dMKE MgA. Mll BeDEAnnel MDe FA DemMin An dGFK GnFil ABeDMFiAn BhAeniJ iE cAmBleFed.' 'mAcCLEgml AfmclgI DELCEcb EfCcc bLJD Lem. Ljj AcCDmllcj LCc Em CckLgl ml bFEJ FlEgj mAcCLEgml AfmclgI gD amkAjcEcb.' 'klaBKDekj ldkajeH CDKBDaZ DdBaa ZKIC Kck. Khh laBCkjjah KBa Dk BaiKej kj ZEDI EjDeh klaBKDekj ldkajeH eC YkilhaDaZ.' 'ijYAJCcih jbiYhcG BCJACYX CbAYY XJHB Jai. Jff jYABihhYf JAY Ci AYgJch ih XDCH DhCcf ijYAJCcih jbiYhcG cB WigjfYCYX.' 'ghWjIBagf hZgWfaF ABIjBWV BZjWW VIGA IYg. Idd hWjAgffWd IjW Bg jWeIaf gf VCBG CfBad ghWjIBagf hZgWfaF aA UgehdWBWV.' 'efUhHAYed fXeUdYE iAHhAUT AXhUU THFi HWe. Hbb fUhieddUb HhU Ae hUcHYd ed TBAF BdAYb efUhHAYed fXeUdYE Yi SecfbUAUT.' 'cdSfGhWcb dVcSbWD ghGfhSR hVfSS RGEg GUc. GZZ dSfgcbbSZ GfS hc fSaGWb cb RAhE AbhWZ cdSfGhWcb dVcSbWD Wg QcadZShSR.' 'abQdFfUaZ bTaQZUC efFdfQP fTdQQ PFDe FSa. FXX bQdeaZZQX FdQ fa dQYFUZ aZ PgfD gZfUX abQdFfUaZ bTaQZUC Ue OaYbXQfQP.' 'YZObEdSYX ZRYOXSB cdEbdON dRbOO NECc EQY. EVV ZObcYXXOV EbO dY bOWESX YX NedC eXdSV YZObEdSYX ZRYOXSB Sc MYWZVOdON.' 'WXMZDbQWV XPWMVQA abDZbML bPZMM LDBa DOW. DTT XMZaWVVMT DZM bW ZMUDQV WV LcbB cVbQT WXMZDbQWV XPWMVQA Qa KWUXTMbML.' 'UVKXCZOUT VNUKTOd YZCXZKJ ZNXKK JCAY CMU. CRR VKXYUTTKR CXK ZU XKSCOT UT JaZA aTZOR UVKXCZOUT VNUKTOd OY IUSVRKZKJ.' 'STIVBXMSR TLSIRMb WXBVXIH XLVII HBcW BKS. BPP TIVWSRRIP BVI XS VIQBMR SR HYXc YRXMP STIVBXMSR TLSIRMb MW GSQTPIXIH.' 'QRGTAVKQP RJQGPKZ UVATVGF VJTGG FAaU AIQ. ANN RGTUQPPGN ATG VQ TGOAKP QP FWVa WPVKN QRGTAVKQP RJQGPKZ KU EQORNGVGF.' 'OPERaTION PHOENIX STaRTED THREE DaYS aGO. aLL PERSONNEL aRE TO REMaIN ON DUTY UNTIL OPERaTION PHOENIX IS COMPLETED.'

Output argument "s" (and maybe others) not assigned during call to "decode". Error in Test5 (line 4) s = decode(x);

6   Fail
% Acknowledgements % Portions of this timing test code were inspired by: % (1) Problem 937. "Rubik's Mini Cube: Solve Randomized Cube in 11 Moves or Less; Score is by Time (msec)" by Richard Zapor. % (2) Problem 2733. "Evil Number" by Jan Orwat. % (3) Feedback in comments from Peng Liu. % (4) Problem Problem 1237. "It's race time! Write a faster function than the test suite call of unique()." by Jeremy. % Note: The Time Trial section does not check accuracy; that is done above. % Initialise x = 'Dbodfm Pqfsbujpo Qipfojy jnnfejbufmz & ftdbqf.'; cutoffTimeBig = 1000; % Maximum allowable walltime (in milliseconds) to run function in a loop with qBig iterations. for dummy = 1 : 20, disp(' . '); end; % Run once, untimed? includeOverheads = false; if includeOverheads, solution = decode( x ); end; % *** PRELIMINARY TIMING *** % In case the submitted function has a lot of text output, % get an estimate based on just a few iterations % Initialise qSmall = 50; qBig = 5000; t0 = clock; % Loop for i = 1 : qSmall solution = decode( x ); end; % Compute and display elapsed time. dt = etime(clock, t0) * 1000; disp(' -----=====----- ') fprintf('Your wall time to decode %u messages = %i msec.\n\r', qSmall, floor(dt)) fprintf('Your APPROXIMATE wall time to decode %u messages would be ~ %i msec.\n\r', qBig, ceil(dt * qBig / qSmall)) disp(' -----=====----- ') for dummy = 1 : 20, disp(' . '); end; % *** 'OFFICIAL' TIMING *** % Re-initialise timer t0 = clock; t0_cpu = cputime; % Loop for i = 1 : qBig solution = decode( x ); end; % Compute and display elapsed time. for dummy = 1 : 20, disp(' . '); end; disp(' -----=====|||||=====----- ') dt = etime(clock, t0) * 1000; fprintf('Your wall time to decode %u messages = %i msec.\n\r', qBig, floor(dt)) dt_cpu = (cputime - t0_cpu) * 1000; fprintf(' ( Your CPU time for this = %i msec. ) \n\r', floor(dt_cpu)) fDecode = @() decode(x); dt_timeit = timeit( fDecode ) * 1000; fprintf(' [ Your ''timeit'' time to decode %u messages = %i msec. ] \n\r', qBig, ceil(dt_timeit * qBig)) % Display a size-based score. all_nodes = mtree('decode.m', '-file'); % This is the default in Cody. str_nodes = mtfind(all_nodes, 'Kind', 'STRING'); eq_nodes = mtfind(all_nodes, 'Kind', 'EQUALS'); print_nodes = mtfind(all_nodes, 'Kind', 'PRINT'); expr_nodes = mtfind(all_nodes, 'Kind', 'EXPR'); size_score = count(all_nodes) ... +sum(str_nodes.nodesize-1) ... +2*(count(expr_nodes) ... +count(print_nodes) ... -count(eq_nodes)); fprintf('Your size-based score = %i.\n\r', size_score) % Report revised performance score. combinedScore = size_score + min( 200, floor(dt*(500/qBig)) ); fprintf('Your combined score = %i.\n\r', combinedScore) disp(' -----=====|||||=====----- ') % Now disallow any candidate solutions that are TOO SLOW! if dt > cutoffTimeBig, fprintf('Sorry, your submission is TOO SLOW. It must be able to finish within %u milliseconds.\n\r', cutoffTimeBig) end; assert( dt <= cutoffTimeBig, 'Exceeded time limit specified in Test Suite.' )

. . . . . . . . . . . . . . . . . . . . x = 'DBODFM PQFSBUJPO QIPFOJY JNNFEJBUFMZ & FTDBQF.' p = 25×46 char array 'CANCEL OPERATION PHOENIX IMMEDIATELY & ESCAPE.' 'BxMBDK NODQxSHNM OGNDMHW HLLDCHxSDKX & DRBxOD.' 'AvLACJ MNCPvRGML NFMCLGV GKKCBGvRCJW & CQAvNC.' 'vtKvBI LMBOtQFLK MELBKFU FJJBAFtQBIV & BPvtMB.' 'trJtAH KLANrPEKJ LDKAJET EIIAuErPAHU & AOtrLA.' 'rpIrtG JKtMpODJI KCJtIDS DHHtsDpOtGT & tNrpKt.' 'pnHprF IJrLnNCIH JBIrHCR CGGrqCnNrFS & rMpnJr.' 'nlGnpE HIpKlMBHG IAHpGBQ BFFpoBlMpER & pLnlIp.' 'ljFlnD GHnJjLAGF HqGnFAP AEEnmAjLnDQ & nKljHn.' 'jhEjlC FGlIhKpFE GoFlEpO pDDlkphKlCP & lJjhGl.' 'hfDhjB EFjHfJnED FmEjDnN nCCjinfJjBO & jIhfFj.' 'fdCfhA DEhGdIlDC EkDhClM lBBhgldIhAN & hHfdEh.' 'dbBdfm CDfFbHjCB DiCfBjL jAAfejbHfmM & fGdbDf.' 'bZAbdk BCdEZGhBA CgBdAhK hlldchZGdkL & dFbZCd.' 'ZXkZbi ABbDXFfAk BeAbkfJ fjjbafXFbiK & bEZXBb.' 'XViXZg jAZCVEdji AcjZidI dhhZYdVEZgJ & ZDXVAZ.' 'VTgVXe hiXBTDbhg iahXgbH bffXWbTDXeI & XCVTiX.' 'TReTVc fgVARCZfe gYfVeZG ZddVUZRCVcH & VBTRgV.' 'RPcRTa deTgPBXdc eWdTcXF XbbTSXPBTaG & TARPeT.' 'PNaPRY bcReNAVba cUbRaVE VZZRQVNARYF & RfPNcR.' 'NLYNPW ZaPcLeTZY aSZPYTD TXXPOTLePWE & PdNLaP.' 'LJWLNU XYNaJcRXW YQXNWRC RVVNMRJcNUD & NbLJYN.' 'JHUJLS VWLYHaPVU WOVLUPB PTTLKPHaLSC & LZJHWL.' 'HFSHJQ TUJWFYNTS UMTJSNA NRRJINFYJQB & JXHFUJ.' 'FDQFHO RSHUDWLRQ SKRHQLa LPPHGLDWHOA & HVFDSH.'

Output argument "s" (and maybe others) not assigned during call to "decode". Error in Test6 (line 32) solution = decode( x );