{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2025-12-14T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":47068,"title":"Set zero","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 70.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 35.4px; transform-origin: 407px 35.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.8px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.4px; text-align: left; transform-origin: 384px 10.4px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003egiven a matrix, set all elements with row and/or column numbers of 2 to end-1 equal to zero:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 20px; transform-origin: 404px 20px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ex = ones(3);\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ey_correct = [1 1 1;1 0 1;1 1 1];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = ones(3);\r\ny_correct = [1 1 1;1 0 1;1 1 1];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16];\r\ny_correct = [1 2 3 4; 5 0 0 8; 9 0 0 12; 13 14 15 16];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-24T20:52:53.000Z","updated_at":"2026-02-13T15:24:35.000Z","published_at":"2020-10-24T20:52:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven a matrix, set all elements with row and/or column numbers of 2 to end-1 equal to zero:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = ones(3);\\ny_correct = [1 1 1;1 0 1;1 1 1];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46793,"title":"Insert zeros II","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 20.3636px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.1818px; transform-origin: 407px 10.1818px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.1818px; text-align: left; transform-origin: 384px 10.1818px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eInsert \"x\" number of zeros after each element in X=[1 2 3 4].\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = [1 0 2 0 3 0 4 0];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = [1 0 0 2 0 0 3 0 0 4 0 0];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 0;\r\ny_correct = [1 2 3 4];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-16T19:36:18.000Z","updated_at":"2026-02-18T21:46:43.000Z","published_at":"2020-10-16T19:36:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInsert \\\"x\\\" number of zeros after each element in X=[1 2 3 4].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1384,"title":"Who invented zero?","description":"We know the importance zero in computer science, mathematics... but who invented zero?\r\n\r\nClue:\r\n\r\nHe was the first in the line of great mathematician-astronomers from the classical age of Indian mathematics and Indian astronomy.","description_html":"\u003cp\u003eWe know the importance zero in computer science, mathematics... but who invented zero?\u003c/p\u003e\u003cp\u003eClue:\u003c/p\u003e\u003cp\u003eHe was the first in the line of great mathematician-astronomers from the classical age of Indian mathematics and Indian astronomy.\u003c/p\u003e","function_template":"function y = zero()\r\n  y = 'zero';\r\nend","test_suite":"%%\r\nassert(isequal(zero(),'Aryabhata'))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":4,"created_by":6975,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":604,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-25T09:04:11.000Z","updated_at":"2026-02-17T15:54:16.000Z","published_at":"2013-03-25T09:04:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe know the importance zero in computer science, mathematics... but who invented zero?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eClue:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHe was the first in the line of great mathematician-astronomers from the classical age of Indian mathematics and Indian astronomy.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1951,"title":"Better Index Number ","description":"Let's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:\r\n\r\n    file1\r\n    file101\r\n    file2\r\n    etc.\r\n\r\nWhich is not ideal when you want your files to go like this:\r\n\r\n    file1\r\n    file2\r\n    file101\r\n    etc.\r\n\r\nSo let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file. ","description_html":"\u003cp\u003eLet's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:\u003c/p\u003e\u003cpre\u003e    file1\r\n    file101\r\n    file2\r\n    etc.\u003c/pre\u003e\u003cp\u003eWhich is not ideal when you want your files to go like this:\u003c/p\u003e\u003cpre\u003e    file1\r\n    file2\r\n    file101\r\n    etc.\u003c/pre\u003e\u003cp\u003eSo let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file.\u003c/p\u003e","function_template":"function n_str = betterIndexNum(n,max_n)\r\n  n_str = str(n);\r\nend","test_suite":"%%\r\nn = 1;\r\nmax_n = 9;\r\nn_str = '1';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))\r\n\r\n%%\r\nn = 1;\r\nmax_n = 28;\r\nn_str = '01';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))\r\n\r\n%%\r\nn = 28;\r\nmax_n = 848984;\r\nn_str = '000028';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))\r\n\r\n%%\r\nn = 10;\r\nmax_n = 100;\r\nn_str = '010';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3743,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":92,"test_suite_updated_at":"2013-10-24T06:58:01.000Z","rescore_all_solutions":false,"group_id":673,"created_at":"2013-10-20T07:52:06.000Z","updated_at":"2026-02-26T15:47:19.000Z","published_at":"2013-10-20T08:03:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLet's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    file1\\n    file101\\n    file2\\n    etc.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhich is not ideal when you want your files to go like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    file1\\n    file2\\n    file101\\n    etc.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42396,"title":"the proud tradition of zero scores in Cody","description":"The short version is: *_your function should return a zero and also have a zero score/size_*\r\n\r\nThe long version comes with a little history:\r\n\r\nThere is a long tradition of attempting to modify the scoring function in Cody to be able to create problems that score solutions, for example, based on the solution running-time instead of the solution code-complexity. There is, of course, a parallel tradition of Cody players trying to \"game\" the system into getting the lowest possible score for their solutions.\r\n \r\nCody players are a very resourceful crowd, and very early into the game they found that overwriting the solution file (after it was evaluated) did the trick: Cody would then evaluate your solution size/code-complexity from the contents of the overwritten file so problem creators could overwrite the solutions with specially-crafted files that would return the desired solution score. Also solvers could overwrite their own files to get a 0 score if they so wished, simply adding\r\n\r\n  !echo \"%\" \u003e my_fcn_name.m\r\n\r\nto their solutions. \r\n\r\nThat state of affairs, naturally, perhaps sadly, did not last long, and Cody machinery was modified to score the solutions _before_ the testsuite was run. \r\n\r\nOf course this fix lasted even shorter, and Cody players found that the variable where that score was being stored could be accessed from the testsuite code using evalin('caller',...) or assignin('caller',...) syntax (yes, that variable was very amicably named _score_). So cody creators could now add the line\r\n\r\n  assignin('caller','score',0);\r\n\r\nto their testsuite to give players a 0 (or any arbitrary) score. \r\n\r\nThis new scenario lasted for quite some time, probably because while problem creators could still modify the scoring function as they wish and create all forms of problems that departed from the size/complexity-based scoring, problem solvers could not do the same to get any arbitrary score. From the solution function perspective the variable _score_ was two(!) steps up in the stack, and there is simply no way to use evalin('caller',...) syntax recursively along the lines of\r\n\r\n  evalin('caller','assignin(''caller'',''score'',0)');\r\n \r\nSomewhat recently this situation changed again and Cody started using the Unit Testing framework to run solutions. That put _a lot_ of layers between the testsuite and the coveted workspace where the _score_ variable lived, making the assignin trick obsolete. In addition key Cody functionality was hidden into .p files, which added a small burden to exploring the inner workings of Cody, and the old _score_ variable was nowhere to be found in those new functions.\r\n\r\nYour job in this problem, following this proud tradition, is to get a zero score. Also your solution function should return a 0 as well, just to make it _do_ something. \r\n\r\nA few pointers to get you started would be:\r\n\r\n* the now somewhat obsolete \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier singularity\u003e series\r\n* the folder ~/+cody\r\n* \u003chttp://www.mathworks.com/help/matlab/ref/dbstack.html dbstack\u003e\r\n\r\nGood luck and please hack responsibly!\r\n\r\nps1. if you are thinking of submitting an empty solution, no, that does not count (that is not a function and that is not returning any number).\r\n\r\nps2. if you are thinking of copy/pasting my own _SetSolutionScore_ trick, that will not work here, sorry! (it is protected so that it only works when the testsuite code uses it; if you manage to disable this protection and make it work from within your solution file I will accept that as well as a valid solution)\r\n\r\nps3. if you want to use _SetSolutionScore_ to be able to assign not-size-based scores in your own problems, simply copy/paste the relevant code in \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1192-say-something-funny/solutions/new#test_suite_body this problem testsuite\u003e. _SetSolutionScore_, like the old _assignin_ trick, will not interfere with other problems (solvers cannot copy/paste your testsuite code to get zero-scores in other problems)\r\n\r\n*note: please refrain from using this sort of Cody tricks to get leading scores in general non-hacking problems. That is just discorteous to other players* (add here rant about the regexp trick and how leading scores used to be worth pursuing).\r\n\r\n","description_html":"\u003cp\u003eThe short version is: \u003cb\u003e\u003ci\u003eyour function should return a zero and also have a zero score/size\u003c/i\u003e\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe long version comes with a little history:\u003c/p\u003e\u003cp\u003eThere is a long tradition of attempting to modify the scoring function in Cody to be able to create problems that score solutions, for example, based on the solution running-time instead of the solution code-complexity. There is, of course, a parallel tradition of Cody players trying to \"game\" the system into getting the lowest possible score for their solutions.\u003c/p\u003e\u003cp\u003eCody players are a very resourceful crowd, and very early into the game they found that overwriting the solution file (after it was evaluated) did the trick: Cody would then evaluate your solution size/code-complexity from the contents of the overwritten file so problem creators could overwrite the solutions with specially-crafted files that would return the desired solution score. Also solvers could overwrite their own files to get a 0 score if they so wished, simply adding\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e!echo \"%\" \u0026gt; my_fcn_name.m\r\n\u003c/pre\u003e\u003cp\u003eto their solutions.\u003c/p\u003e\u003cp\u003eThat state of affairs, naturally, perhaps sadly, did not last long, and Cody machinery was modified to score the solutions \u003ci\u003ebefore\u003c/i\u003e the testsuite was run.\u003c/p\u003e\u003cp\u003eOf course this fix lasted even shorter, and Cody players found that the variable where that score was being stored could be accessed from the testsuite code using evalin('caller',...) or assignin('caller',...) syntax (yes, that variable was very amicably named \u003ci\u003escore\u003c/i\u003e). So cody creators could now add the line\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eassignin('caller','score',0);\r\n\u003c/pre\u003e\u003cp\u003eto their testsuite to give players a 0 (or any arbitrary) score.\u003c/p\u003e\u003cp\u003eThis new scenario lasted for quite some time, probably because while problem creators could still modify the scoring function as they wish and create all forms of problems that departed from the size/complexity-based scoring, problem solvers could not do the same to get any arbitrary score. From the solution function perspective the variable \u003ci\u003escore\u003c/i\u003e was two(!) steps up in the stack, and there is simply no way to use evalin('caller',...) syntax recursively along the lines of\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eevalin('caller','assignin(''caller'',''score'',0)');\r\n\u003c/pre\u003e\u003cp\u003eSomewhat recently this situation changed again and Cody started using the Unit Testing framework to run solutions. That put \u003ci\u003ea lot\u003c/i\u003e of layers between the testsuite and the coveted workspace where the \u003ci\u003escore\u003c/i\u003e variable lived, making the assignin trick obsolete. In addition key Cody functionality was hidden into .p files, which added a small burden to exploring the inner workings of Cody, and the old \u003ci\u003escore\u003c/i\u003e variable was nowhere to be found in those new functions.\u003c/p\u003e\u003cp\u003eYour job in this problem, following this proud tradition, is to get a zero score. Also your solution function should return a 0 as well, just to make it \u003ci\u003edo\u003c/i\u003e something.\u003c/p\u003e\u003cp\u003eA few pointers to get you started would be:\u003c/p\u003e\u003cul\u003e\u003cli\u003ethe now somewhat obsolete \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\"\u003esingularity\u003c/a\u003e series\u003c/li\u003e\u003cli\u003ethe folder ~/+cody\u003c/li\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/help/matlab/ref/dbstack.html\"\u003edbstack\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eGood luck and please hack responsibly!\u003c/p\u003e\u003cp\u003eps1. if you are thinking of submitting an empty solution, no, that does not count (that is not a function and that is not returning any number).\u003c/p\u003e\u003cp\u003eps2. if you are thinking of copy/pasting my own \u003ci\u003eSetSolutionScore\u003c/i\u003e trick, that will not work here, sorry! (it is protected so that it only works when the testsuite code uses it; if you manage to disable this protection and make it work from within your solution file I will accept that as well as a valid solution)\u003c/p\u003e\u003cp\u003eps3. if you want to use \u003ci\u003eSetSolutionScore\u003c/i\u003e to be able to assign not-size-based scores in your own problems, simply copy/paste the relevant code in \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1192-say-something-funny/solutions/new#test_suite_body\"\u003ethis problem testsuite\u003c/a\u003e. \u003ci\u003eSetSolutionScore\u003c/i\u003e, like the old \u003ci\u003eassignin\u003c/i\u003e trick, will not interfere with other problems (solvers cannot copy/paste your testsuite code to get zero-scores in other problems)\u003c/p\u003e\u003cp\u003e\u003cb\u003enote: please refrain from using this sort of Cody tricks to get leading scores in general non-hacking problems. That is just discorteous to other players\u003c/b\u003e (add here rant about the regexp trick and how leading scores used to be worth pursuing).\u003c/p\u003e","function_template":"function y = zeroscore(~)\r\ny = 0;\r\n","test_suite":"%%\r\n\r\n% gets expected output/score\r\nfh=fopen('zeroscore.m');str=fread(fh,'*char')'; fclose(fh);\r\nresults=scoringengine.verifyCode(str,'assert(isequal(zeroscore(),0))');\r\n\r\n% pass/fail\r\nstr={'Failed','Passed'};\r\nif results.pass\u0026results.score=='0'\u0026ischar(results.score), \r\n    fprintf('Congrats! Solution score: %s; Solution status: %s\\n',results.score, str{1+results.pass}); \r\nelse \r\n    fprintf('Sorry! Solution score: %s; Solution status: %s\\n',results.score, str{1+results.pass}); \r\n    [a,b]=1; \r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2017-10-28T00:51:34.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-06-19T20:20:19.000Z","updated_at":"2017-10-28T00:51:34.000Z","published_at":"2015-06-21T03:36:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe short version is:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyour function should return a zero and also have a zero score/size\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe long version comes with a little history:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is a long tradition of attempting to modify the scoring function in Cody to be able to create problems that score solutions, for example, based on the solution running-time instead of the solution code-complexity. There is, of course, a parallel tradition of Cody players trying to \\\"game\\\" the system into getting the lowest possible score for their solutions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCody players are a very resourceful crowd, and very early into the game they found that overwriting the solution file (after it was evaluated) did the trick: Cody would then evaluate your solution size/code-complexity from the contents of the overwritten file so problem creators could overwrite the solutions with specially-crafted files that would return the desired solution score. Also solvers could overwrite their own files to get a 0 score if they so wished, simply adding\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[!echo \\\"%\\\" \u003e my_fcn_name.m]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eto their solutions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThat state of affairs, naturally, perhaps sadly, did not last long, and Cody machinery was modified to score the solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ebefore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e the testsuite was run.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOf course this fix lasted even shorter, and Cody players found that the variable where that score was being stored could be accessed from the testsuite code using evalin('caller',...) or assignin('caller',...) syntax (yes, that variable was very amicably named\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e). So cody creators could now add the line\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[assignin('caller','score',0);]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eto their testsuite to give players a 0 (or any arbitrary) score.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis new scenario lasted for quite some time, probably because while problem creators could still modify the scoring function as they wish and create all forms of problems that departed from the size/complexity-based scoring, problem solvers could not do the same to get any arbitrary score. From the solution function perspective the variable\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e was two(!) steps up in the stack, and there is simply no way to use evalin('caller',...) syntax recursively along the lines of\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[evalin('caller','assignin(''caller'',''score'',0)');]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSomewhat recently this situation changed again and Cody started using the Unit Testing framework to run solutions. That put\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea lot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of layers between the testsuite and the coveted workspace where the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e variable lived, making the assignin trick obsolete. In addition key Cody functionality was hidden into .p files, which added a small burden to exploring the inner workings of Cody, and the old\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e variable was nowhere to be found in those new functions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour job in this problem, following this proud tradition, is to get a zero score. Also your solution function should return a 0 as well, just to make it\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edo\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e something.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA few pointers to get you started would be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe now somewhat obsolete\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\\\"\u003e\u003cw:r\u003e\u003cw:t\u003esingularity\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e series\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe folder ~/+cody\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/matlab/ref/dbstack.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edbstack\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGood luck and please hack responsibly!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eps1. if you are thinking of submitting an empty solution, no, that does not count (that is not a function and that is not returning any number).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eps2. if you are thinking of copy/pasting my own\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSetSolutionScore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e trick, that will not work here, sorry! (it is protected so that it only works when the testsuite code uses it; if you manage to disable this protection and make it work from within your solution file I will accept that as well as a valid solution)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eps3. if you want to use\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSetSolutionScore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be able to assign not-size-based scores in your own problems, simply copy/paste the relevant code in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1192-say-something-funny/solutions/new#test_suite_body\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethis problem testsuite\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSetSolutionScore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, like the old\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassignin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e trick, will not interfere with other problems (solvers cannot copy/paste your testsuite code to get zero-scores in other problems)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote: please refrain from using this sort of Cody tricks to get leading scores in general non-hacking problems. That is just discorteous to other players\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (add here rant about the regexp trick and how leading scores used to be worth pursuing).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":47068,"title":"Set zero","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 70.8px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 35.4px; transform-origin: 407px 35.4px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 20.8px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.4px; text-align: left; transform-origin: 384px 10.4px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003egiven a matrix, set all elements with row and/or column numbers of 2 to end-1 equal to zero:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 20px; transform-origin: 404px 20px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ex = ones(3);\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-top-left-radius: 0px; border-top-right-radius: 0px; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10px; transform-origin: 404px 10px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 0px; tab-size: 4; transform-origin: 0px 0px; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003ey_correct = [1 1 1;1 0 1;1 1 1];\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = ones(3);\r\ny_correct = [1 1 1;1 0 1;1 1 1];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = [1 2 3 4; 5 6 7 8; 9 10 11 12; 13 14 15 16];\r\ny_correct = [1 2 3 4; 5 0 0 8; 9 0 0 12; 13 14 15 16];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-24T20:52:53.000Z","updated_at":"2026-02-13T15:24:35.000Z","published_at":"2020-10-24T20:52:53.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003egiven a matrix, set all elements with row and/or column numbers of 2 to end-1 equal to zero:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[x = ones(3);\\ny_correct = [1 1 1;1 0 1;1 1 1];]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":46793,"title":"Insert zeros II","description":null,"description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 20.3636px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.1818px; transform-origin: 407px 10.1818px; vertical-align: baseline; \"\u003e\u003cdiv style=\"font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.1818px; text-align: left; transform-origin: 384px 10.1818px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eInsert \"x\" number of zeros after each element in X=[1 2 3 4].\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = [1 0 2 0 3 0 4 0];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 2;\r\ny_correct = [1 0 0 2 0 0 3 0 0 4 0 0];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 0;\r\ny_correct = [1 2 3 4];\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":430136,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":58,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-10-16T19:36:18.000Z","updated_at":"2026-02-18T21:46:43.000Z","published_at":"2020-10-16T19:36:28.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInsert \\\"x\\\" number of zeros after each element in X=[1 2 3 4].\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":1384,"title":"Who invented zero?","description":"We know the importance zero in computer science, mathematics... but who invented zero?\r\n\r\nClue:\r\n\r\nHe was the first in the line of great mathematician-astronomers from the classical age of Indian mathematics and Indian astronomy.","description_html":"\u003cp\u003eWe know the importance zero in computer science, mathematics... but who invented zero?\u003c/p\u003e\u003cp\u003eClue:\u003c/p\u003e\u003cp\u003eHe was the first in the line of great mathematician-astronomers from the classical age of Indian mathematics and Indian astronomy.\u003c/p\u003e","function_template":"function y = zero()\r\n  y = 'zero';\r\nend","test_suite":"%%\r\nassert(isequal(zero(),'Aryabhata'))\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":4,"created_by":6975,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":604,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-25T09:04:11.000Z","updated_at":"2026-02-17T15:54:16.000Z","published_at":"2013-03-25T09:04:11.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWe know the importance zero in computer science, mathematics... but who invented zero?\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eClue:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHe was the first in the line of great mathematician-astronomers from the classical age of Indian mathematics and Indian astronomy.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":1951,"title":"Better Index Number ","description":"Let's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:\r\n\r\n    file1\r\n    file101\r\n    file2\r\n    etc.\r\n\r\nWhich is not ideal when you want your files to go like this:\r\n\r\n    file1\r\n    file2\r\n    file101\r\n    etc.\r\n\r\nSo let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file. ","description_html":"\u003cp\u003eLet's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:\u003c/p\u003e\u003cpre\u003e    file1\r\n    file101\r\n    file2\r\n    etc.\u003c/pre\u003e\u003cp\u003eWhich is not ideal when you want your files to go like this:\u003c/p\u003e\u003cpre\u003e    file1\r\n    file2\r\n    file101\r\n    etc.\u003c/pre\u003e\u003cp\u003eSo let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file.\u003c/p\u003e","function_template":"function n_str = betterIndexNum(n,max_n)\r\n  n_str = str(n);\r\nend","test_suite":"%%\r\nn = 1;\r\nmax_n = 9;\r\nn_str = '1';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))\r\n\r\n%%\r\nn = 1;\r\nmax_n = 28;\r\nn_str = '01';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))\r\n\r\n%%\r\nn = 28;\r\nmax_n = 848984;\r\nn_str = '000028';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))\r\n\r\n%%\r\nn = 10;\r\nmax_n = 100;\r\nn_str = '010';\r\nassert(isequal(betterIndexNum(n,max_n),n_str))","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":3743,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":92,"test_suite_updated_at":"2013-10-24T06:58:01.000Z","rescore_all_solutions":false,"group_id":673,"created_at":"2013-10-20T07:52:06.000Z","updated_at":"2026-02-26T15:47:19.000Z","published_at":"2013-10-20T08:03:17.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eLet's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, you often get in a situation where your files go like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    file1\\n    file101\\n    file2\\n    etc.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhich is not ideal when you want your files to go like this:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[    file1\\n    file2\\n    file101\\n    etc.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSo let's make a function that given the current index number and the maximum index number, it will return a string with leading 0's so that any computer will know how to sort the files. For example, if I were on index 9 and there were a total of 230 files, my function would return '009' so I could append that to my file.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":42396,"title":"the proud tradition of zero scores in Cody","description":"The short version is: *_your function should return a zero and also have a zero score/size_*\r\n\r\nThe long version comes with a little history:\r\n\r\nThere is a long tradition of attempting to modify the scoring function in Cody to be able to create problems that score solutions, for example, based on the solution running-time instead of the solution code-complexity. There is, of course, a parallel tradition of Cody players trying to \"game\" the system into getting the lowest possible score for their solutions.\r\n \r\nCody players are a very resourceful crowd, and very early into the game they found that overwriting the solution file (after it was evaluated) did the trick: Cody would then evaluate your solution size/code-complexity from the contents of the overwritten file so problem creators could overwrite the solutions with specially-crafted files that would return the desired solution score. Also solvers could overwrite their own files to get a 0 score if they so wished, simply adding\r\n\r\n  !echo \"%\" \u003e my_fcn_name.m\r\n\r\nto their solutions. \r\n\r\nThat state of affairs, naturally, perhaps sadly, did not last long, and Cody machinery was modified to score the solutions _before_ the testsuite was run. \r\n\r\nOf course this fix lasted even shorter, and Cody players found that the variable where that score was being stored could be accessed from the testsuite code using evalin('caller',...) or assignin('caller',...) syntax (yes, that variable was very amicably named _score_). So cody creators could now add the line\r\n\r\n  assignin('caller','score',0);\r\n\r\nto their testsuite to give players a 0 (or any arbitrary) score. \r\n\r\nThis new scenario lasted for quite some time, probably because while problem creators could still modify the scoring function as they wish and create all forms of problems that departed from the size/complexity-based scoring, problem solvers could not do the same to get any arbitrary score. From the solution function perspective the variable _score_ was two(!) steps up in the stack, and there is simply no way to use evalin('caller',...) syntax recursively along the lines of\r\n\r\n  evalin('caller','assignin(''caller'',''score'',0)');\r\n \r\nSomewhat recently this situation changed again and Cody started using the Unit Testing framework to run solutions. That put _a lot_ of layers between the testsuite and the coveted workspace where the _score_ variable lived, making the assignin trick obsolete. In addition key Cody functionality was hidden into .p files, which added a small burden to exploring the inner workings of Cody, and the old _score_ variable was nowhere to be found in those new functions.\r\n\r\nYour job in this problem, following this proud tradition, is to get a zero score. Also your solution function should return a 0 as well, just to make it _do_ something. \r\n\r\nA few pointers to get you started would be:\r\n\r\n* the now somewhat obsolete \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier singularity\u003e series\r\n* the folder ~/+cody\r\n* \u003chttp://www.mathworks.com/help/matlab/ref/dbstack.html dbstack\u003e\r\n\r\nGood luck and please hack responsibly!\r\n\r\nps1. if you are thinking of submitting an empty solution, no, that does not count (that is not a function and that is not returning any number).\r\n\r\nps2. if you are thinking of copy/pasting my own _SetSolutionScore_ trick, that will not work here, sorry! (it is protected so that it only works when the testsuite code uses it; if you manage to disable this protection and make it work from within your solution file I will accept that as well as a valid solution)\r\n\r\nps3. if you want to use _SetSolutionScore_ to be able to assign not-size-based scores in your own problems, simply copy/paste the relevant code in \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1192-say-something-funny/solutions/new#test_suite_body this problem testsuite\u003e. _SetSolutionScore_, like the old _assignin_ trick, will not interfere with other problems (solvers cannot copy/paste your testsuite code to get zero-scores in other problems)\r\n\r\n*note: please refrain from using this sort of Cody tricks to get leading scores in general non-hacking problems. That is just discorteous to other players* (add here rant about the regexp trick and how leading scores used to be worth pursuing).\r\n\r\n","description_html":"\u003cp\u003eThe short version is: \u003cb\u003e\u003ci\u003eyour function should return a zero and also have a zero score/size\u003c/i\u003e\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe long version comes with a little history:\u003c/p\u003e\u003cp\u003eThere is a long tradition of attempting to modify the scoring function in Cody to be able to create problems that score solutions, for example, based on the solution running-time instead of the solution code-complexity. There is, of course, a parallel tradition of Cody players trying to \"game\" the system into getting the lowest possible score for their solutions.\u003c/p\u003e\u003cp\u003eCody players are a very resourceful crowd, and very early into the game they found that overwriting the solution file (after it was evaluated) did the trick: Cody would then evaluate your solution size/code-complexity from the contents of the overwritten file so problem creators could overwrite the solutions with specially-crafted files that would return the desired solution score. Also solvers could overwrite their own files to get a 0 score if they so wished, simply adding\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e!echo \"%\" \u0026gt; my_fcn_name.m\r\n\u003c/pre\u003e\u003cp\u003eto their solutions.\u003c/p\u003e\u003cp\u003eThat state of affairs, naturally, perhaps sadly, did not last long, and Cody machinery was modified to score the solutions \u003ci\u003ebefore\u003c/i\u003e the testsuite was run.\u003c/p\u003e\u003cp\u003eOf course this fix lasted even shorter, and Cody players found that the variable where that score was being stored could be accessed from the testsuite code using evalin('caller',...) or assignin('caller',...) syntax (yes, that variable was very amicably named \u003ci\u003escore\u003c/i\u003e). So cody creators could now add the line\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eassignin('caller','score',0);\r\n\u003c/pre\u003e\u003cp\u003eto their testsuite to give players a 0 (or any arbitrary) score.\u003c/p\u003e\u003cp\u003eThis new scenario lasted for quite some time, probably because while problem creators could still modify the scoring function as they wish and create all forms of problems that departed from the size/complexity-based scoring, problem solvers could not do the same to get any arbitrary score. From the solution function perspective the variable \u003ci\u003escore\u003c/i\u003e was two(!) steps up in the stack, and there is simply no way to use evalin('caller',...) syntax recursively along the lines of\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eevalin('caller','assignin(''caller'',''score'',0)');\r\n\u003c/pre\u003e\u003cp\u003eSomewhat recently this situation changed again and Cody started using the Unit Testing framework to run solutions. That put \u003ci\u003ea lot\u003c/i\u003e of layers between the testsuite and the coveted workspace where the \u003ci\u003escore\u003c/i\u003e variable lived, making the assignin trick obsolete. In addition key Cody functionality was hidden into .p files, which added a small burden to exploring the inner workings of Cody, and the old \u003ci\u003escore\u003c/i\u003e variable was nowhere to be found in those new functions.\u003c/p\u003e\u003cp\u003eYour job in this problem, following this proud tradition, is to get a zero score. Also your solution function should return a 0 as well, just to make it \u003ci\u003edo\u003c/i\u003e something.\u003c/p\u003e\u003cp\u003eA few pointers to get you started would be:\u003c/p\u003e\u003cul\u003e\u003cli\u003ethe now somewhat obsolete \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\"\u003esingularity\u003c/a\u003e series\u003c/li\u003e\u003cli\u003ethe folder ~/+cody\u003c/li\u003e\u003cli\u003e\u003ca href = \"http://www.mathworks.com/help/matlab/ref/dbstack.html\"\u003edbstack\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eGood luck and please hack responsibly!\u003c/p\u003e\u003cp\u003eps1. if you are thinking of submitting an empty solution, no, that does not count (that is not a function and that is not returning any number).\u003c/p\u003e\u003cp\u003eps2. if you are thinking of copy/pasting my own \u003ci\u003eSetSolutionScore\u003c/i\u003e trick, that will not work here, sorry! (it is protected so that it only works when the testsuite code uses it; if you manage to disable this protection and make it work from within your solution file I will accept that as well as a valid solution)\u003c/p\u003e\u003cp\u003eps3. if you want to use \u003ci\u003eSetSolutionScore\u003c/i\u003e to be able to assign not-size-based scores in your own problems, simply copy/paste the relevant code in \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1192-say-something-funny/solutions/new#test_suite_body\"\u003ethis problem testsuite\u003c/a\u003e. \u003ci\u003eSetSolutionScore\u003c/i\u003e, like the old \u003ci\u003eassignin\u003c/i\u003e trick, will not interfere with other problems (solvers cannot copy/paste your testsuite code to get zero-scores in other problems)\u003c/p\u003e\u003cp\u003e\u003cb\u003enote: please refrain from using this sort of Cody tricks to get leading scores in general non-hacking problems. That is just discorteous to other players\u003c/b\u003e (add here rant about the regexp trick and how leading scores used to be worth pursuing).\u003c/p\u003e","function_template":"function y = zeroscore(~)\r\ny = 0;\r\n","test_suite":"%%\r\n\r\n% gets expected output/score\r\nfh=fopen('zeroscore.m');str=fread(fh,'*char')'; fclose(fh);\r\nresults=scoringengine.verifyCode(str,'assert(isequal(zeroscore(),0))');\r\n\r\n% pass/fail\r\nstr={'Failed','Passed'};\r\nif results.pass\u0026results.score=='0'\u0026ischar(results.score), \r\n    fprintf('Congrats! Solution score: %s; Solution status: %s\\n',results.score, str{1+results.pass}); \r\nelse \r\n    fprintf('Sorry! Solution score: %s; Solution status: %s\\n',results.score, str{1+results.pass}); \r\n    [a,b]=1; \r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2017-10-28T00:51:34.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2015-06-19T20:20:19.000Z","updated_at":"2017-10-28T00:51:34.000Z","published_at":"2015-06-21T03:36:27.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe short version is:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eyour function should return a zero and also have a zero score/size\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe long version comes with a little history:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThere is a long tradition of attempting to modify the scoring function in Cody to be able to create problems that score solutions, for example, based on the solution running-time instead of the solution code-complexity. There is, of course, a parallel tradition of Cody players trying to \\\"game\\\" the system into getting the lowest possible score for their solutions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eCody players are a very resourceful crowd, and very early into the game they found that overwriting the solution file (after it was evaluated) did the trick: Cody would then evaluate your solution size/code-complexity from the contents of the overwritten file so problem creators could overwrite the solutions with specially-crafted files that would return the desired solution score. Also solvers could overwrite their own files to get a 0 score if they so wished, simply adding\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[!echo \\\"%\\\" \u003e my_fcn_name.m]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eto their solutions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThat state of affairs, naturally, perhaps sadly, did not last long, and Cody machinery was modified to score the solutions\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ebefore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e the testsuite was run.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOf course this fix lasted even shorter, and Cody players found that the variable where that score was being stored could be accessed from the testsuite code using evalin('caller',...) or assignin('caller',...) syntax (yes, that variable was very amicably named\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e). So cody creators could now add the line\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[assignin('caller','score',0);]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eto their testsuite to give players a 0 (or any arbitrary) score.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis new scenario lasted for quite some time, probably because while problem creators could still modify the scoring function as they wish and create all forms of problems that departed from the size/complexity-based scoring, problem solvers could not do the same to get any arbitrary score. From the solution function perspective the variable\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e was two(!) steps up in the stack, and there is simply no way to use evalin('caller',...) syntax recursively along the lines of\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[evalin('caller','assignin(''caller'',''score'',0)');]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eSomewhat recently this situation changed again and Cody started using the Unit Testing framework to run solutions. That put\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ea lot\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e of layers between the testsuite and the coveted workspace where the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e variable lived, making the assignin trick obsolete. In addition key Cody functionality was hidden into .p files, which added a small burden to exploring the inner workings of Cody, and the old\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003escore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e variable was nowhere to be found in those new functions.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eYour job in this problem, following this proud tradition, is to get a zero score. Also your solution function should return a 0 as well, just to make it\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003edo\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e something.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eA few pointers to get you started would be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe now somewhat obsolete\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\\\"\u003e\u003cw:r\u003e\u003cw:t\u003esingularity\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e series\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ethe folder ~/+cody\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/help/matlab/ref/dbstack.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003edbstack\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGood luck and please hack responsibly!\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eps1. if you are thinking of submitting an empty solution, no, that does not count (that is not a function and that is not returning any number).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eps2. if you are thinking of copy/pasting my own\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSetSolutionScore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e trick, that will not work here, sorry! (it is protected so that it only works when the testsuite code uses it; if you manage to disable this protection and make it work from within your solution file I will accept that as well as a valid solution)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eps3. if you want to use\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSetSolutionScore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be able to assign not-size-based scores in your own problems, simply copy/paste the relevant code in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1192-say-something-funny/solutions/new#test_suite_body\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethis problem testsuite\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSetSolutionScore\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, like the old\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eassignin\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e trick, will not interfere with other problems (solvers cannot copy/paste your testsuite code to get zero-scores in other problems)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote: please refrain from using this sort of Cody tricks to get leading scores in general non-hacking problems. That is just discorteous to other players\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (add here rant about the regexp trick and how leading scores used to be worth pursuing).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"zero\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"zero\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"zero\"","","\"","zero","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2bb806e10\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fa2bb806d70\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2bb8064b0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2bb807090\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2bb806ff0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2bb806f50\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2bb806eb0\u003e":"tag:\"zero\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2bb806eb0\u003e":"tag:\"zero\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"search","password":"J3bGPZzQ7asjJcCk","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"zero\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"zero\"","","\"","zero","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007fa2bb806e10\u003e":null,"#\u003cMathWorks::Search::Field:0x00007fa2bb806d70\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007fa2bb8064b0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007fa2bb807090\u003e":1,"#\u003cMathWorks::Search::Field:0x00007fa2bb806ff0\u003e":50,"#\u003cMathWorks::Search::Field:0x00007fa2bb806f50\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007fa2bb806eb0\u003e":"tag:\"zero\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007fa2bb806eb0\u003e":"tag:\"zero\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":47068,"difficulty_rating":"easy"},{"id":46793,"difficulty_rating":"easy"},{"id":1384,"difficulty_rating":"easy"},{"id":1951,"difficulty_rating":"easy"},{"id":42396,"difficulty_rating":"easy-medium"}]}}