{"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":537,"title":"Cody Computer Part 3 - Detect the graphic card used on Cody Computer","description":"In the Cody computer investigation party, you may have already solved :\r\nProblem 522. Cody Computer Part 1 - Guess the system font used by uipanel\r\nor\r\nProblem 536. Cody Computer Part 2 - Get the license number of Cody Computer\r\n*******************************************\r\nThis is the third problem to solve :\r\nYou have find the graphics card manufacturar used by the Cody Computer.\r\nExamples of manufacturar : NVidia, ATI, Zotac, ASUS ...","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440000534057617px; 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; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 231px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eIn the Cody computer investigation party, you may have already solved :\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 522. Cody Computer Part 1 - Guess the system font used by uipanel\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eor\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 536. Cody Computer Part 2 - Get the license number of Cody Computer\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e*******************************************\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eThis is the third problem to solve :\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eYou have find the\u003c/span\u003e\u003c/span\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; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\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; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003egraphics card manufacturar\u003c/span\u003e\u003c/span\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; \"\u003e\u003cspan style=\"\"\u003e used by the Cody Computer.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eExamples of manufacturar : NVidia, ATI, Zotac, ASUS ...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name\r\n  y = x;\r\nend","test_suite":"%% Which graphic card is used ?\r\n\r\nS = evalc('opengl info');\r\nS_lines = regexp(S, '  +', 'split');\r\nind = contains(S_lines, 'Vendor');\r\ny_correct = regexprep(S_lines{ind}, 'Vendor: ''([^''])+''.*', '$1');\r\nassert(isequal(your_fcn_name, y_correct))\r\n\r\n%% prevents cheating 14-June-2012\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, 'Brian Paul')))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":639,"edited_by":26769,"edited_at":"2023-02-24T22:26:25.000Z","deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2023-02-24T22:26:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-30T08:32:22.000Z","updated_at":"2026-03-04T16:12:59.000Z","published_at":"2012-03-30T08:32:22.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eIn the Cody computer investigation party, you may have already solved :\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:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 522. Cody Computer Part 1 - Guess the system font used by uipanel\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eor\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:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 536. Cody Computer Part 2 - Get the license number of Cody Computer\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the third problem to solve :\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\u003eYou have find 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003egraphics card manufacturar\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e used by the Cody Computer.\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\u003eExamples of manufacturar : NVidia, ATI, Zotac, ASUS ...\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":1774,"title":"Free passes for everyone!","description":"_Simply return the name of the coolest numerical computation software ever_\r\n\r\n*Extra reward* (get a _freepass_):\r\n\r\nOnce a month, as an additional reward for solving this problem, you may get a temporary freepass *to solve any other Cody problem*. To use this freepass follow these steps:\r\n\r\n# First, at the beginning of a new month, solve this problem correctly\r\n# Then immediately visit the Cody problem that you wish to solve, click 'Solve this now', and enter within the function body of your solution the line: \r\n\r\n freepass.please;\r\n\r\nand Cody _may_ accept that solution as correct. \r\n\r\nYou will typically need to repeat step (2) above multiple times until Cody _does_ accept your solution as correct. If you are getting an error message saying _Undefined variable \"freepass\" or class \"freepass.please\"_ simply continue repeating step 2 until you pass the problem and get a message saying _freepass granted, congratulations!_. \r\n\r\n*Fineprint*:\r\n\r\n1) For each Cody player, this problem will grant a new freepass per day until one is successfully used to pass a different Cody problem. Once this happens this problem will only grant the same Cody player a new freepass the next Calendar month.  \r\n\r\n2) _How many times do I need to submit a freepass.please solution to a different Cody problem for it to pass?_ Short answer: around 10, but perhaps as many as 30 times (your faith may be tested, but perseverance will be rewarded at the end :)  \r\n\r\nLong answer: at any given time, Cody has many servers running players' solutions (perhaps around 20 servers?). Every time that you solve this problem a _freepass_ is issued only for the particular server where your solution was evaluated. When you run a _freepass.please_ solution, if that solution is run in the same server where a freepass was issued your solution will pass, otherwise you will get an \"_undefined variable freepass_\" error. So in order for your solution to pass you simply need to keep resubmitting it until you finally hit the same server where your freepass-problem solution was originally evaluated. Also note that, from time to time, Cody will close a server and start a new one. If that happens any freepass stored in that server will be lost (and you will need to try again steps 1 and 2 above next day)\r\n\r\n3) Your correct solution will get a score of 100 (this is typically high enough so that we do not troll the score lead with these freepasses)\r\n\r\n4) Feel free to explore this problem testsuite to see how this works, but please respect some basic courtesy guidelines if you decide to implement your own (e.g. the service does not interfere with the normal Cody operation; it cleans up after itself; don't use it to get a leading score; etc.)  Comments and suggestions for improvement are appreciated!\r\n\r\n5) This _freepass_ service is 'likeware'. Please 'like' this problem if you liked the code or enjoy using your freepasses :)\r\n","description_html":"\u003cp\u003e\u003ci\u003eSimply return the name of the coolest numerical computation software ever\u003c/i\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eExtra reward\u003c/b\u003e (get a \u003ci\u003efreepass\u003c/i\u003e):\u003c/p\u003e\u003cp\u003eOnce a month, as an additional reward for solving this problem, you may get a temporary freepass \u003cb\u003eto solve any other Cody problem\u003c/b\u003e. To use this freepass follow these steps:\u003c/p\u003e\u003col\u003e\u003cli\u003eFirst, at the beginning of a new month, solve this problem correctly\u003c/li\u003e\u003cli\u003eThen immediately visit the Cody problem that you wish to solve, click 'Solve this now', and enter within the function body of your solution the line:\u003c/li\u003e\u003c/ol\u003e\u003cpre\u003e freepass.please;\u003c/pre\u003e\u003cp\u003eand Cody \u003ci\u003emay\u003c/i\u003e accept that solution as correct.\u003c/p\u003e\u003cp\u003eYou will typically need to repeat step (2) above multiple times until Cody \u003ci\u003edoes\u003c/i\u003e accept your solution as correct. If you are getting an error message saying \u003ci\u003eUndefined variable \"freepass\" or class \"freepass.please\"\u003c/i\u003e simply continue repeating step 2 until you pass the problem and get a message saying \u003ci\u003efreepass granted, congratulations!\u003c/i\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFineprint\u003c/b\u003e:\u003c/p\u003e\u003cp\u003e1) For each Cody player, this problem will grant a new freepass per day until one is successfully used to pass a different Cody problem. Once this happens this problem will only grant the same Cody player a new freepass the next Calendar month.\u003c/p\u003e\u003cp\u003e2) \u003ci\u003eHow many times do I need to submit a freepass.please solution to a different Cody problem for it to pass?\u003c/i\u003e Short answer: around 10, but perhaps as many as 30 times (your faith may be tested, but perseverance will be rewarded at the end :)\u003c/p\u003e\u003cp\u003eLong answer: at any given time, Cody has many servers running players' solutions (perhaps around 20 servers?). Every time that you solve this problem a \u003ci\u003efreepass\u003c/i\u003e is issued only for the particular server where your solution was evaluated. When you run a \u003ci\u003efreepass.please\u003c/i\u003e solution, if that solution is run in the same server where a freepass was issued your solution will pass, otherwise you will get an \"_undefined variable freepass_\" error. So in order for your solution to pass you simply need to keep resubmitting it until you finally hit the same server where your freepass-problem solution was originally evaluated. Also note that, from time to time, Cody will close a server and start a new one. If that happens any freepass stored in that server will be lost (and you will need to try again steps 1 and 2 above next day)\u003c/p\u003e\u003cp\u003e3) Your correct solution will get a score of 100 (this is typically high enough so that we do not troll the score lead with these freepasses)\u003c/p\u003e\u003cp\u003e4) Feel free to explore this problem testsuite to see how this works, but please respect some basic courtesy guidelines if you decide to implement your own (e.g. the service does not interfere with the normal Cody operation; it cleans up after itself; don't use it to get a leading score; etc.)  Comments and suggestions for improvement are appreciated!\u003c/p\u003e\u003cp\u003e5) This \u003ci\u003efreepass\u003c/i\u003e service is 'likeware'. Please 'like' this problem if you liked the code or enjoy using your freepasses :)\u003c/p\u003e","function_template":"function y = myfunction()\r\n  y = 'mmm...';\r\nend","test_suite":"%%\r\nif strcmpi(myfunction(),'matlab')\r\n if isempty(which('freepass')),\r\n  fh=fopen('freepass_system.p','wb');\r\n  fwrite(fh,uint8(sscanf('7630312E30307630302E3030000A101CBC6EDFB1000000E3000005F30000097C16D96804352FE98DD24AC0CF78D05A46EB3BA144303F54379A8622E060F96AD31BA819796EF843D2B5A203AB63481C90679596B80A480D4D3D75BEF8E968330277757DBC07DEDE4552F29944A7E60F736862BD148B85D7195AB9078A8D23D0649B53B58A0E99919D616972465982E71AEC4AC18B74C952CF140A1386FB25F4A706BE326CDA10068E267864FE898B79C4B8A0C53B342F6007727CB1FBD1408B3D10B92C3CF7EF87A5FD488524F5735EE3D954A4C0DA662887A6953DD56712E278BD32681CA13EE9BD447626191097A15737A82CAB411732609720D35181AC240D6011AC24EA5EE2A00FF557831609A6252A1C61CFDCA40BE6E908B01ABEC50AEEEF38C36D22528C3506FB3777675806BC12E98E0C741DAEE477077DF0FC1338206205146B558BD41AE55D9AB8425426F52DB1115FFD2DAD867A94E377DC041A0868437742180F4B835487C8A9D237DF1F3AF1E5521E88B54C949CB19AE77C96F9BBB663761E15D9A9437C2DB20BA20C545E484691129D8964615FF08CE57D009B0BD6CB7995DEC39574CC39FCD5CEC940F06158AEAC8809306E3DE67F2C0BD6B025D9F6D13657027C9D0EC469EDCC064A0C96A56366C8100882DE2261AABB24E52D20F2230493799721942349EA9671A82A6340FE1FDC3426C42773CF22DEA4A4894FFA493CFDEBE34578213F94F9D304519081F5AB88C7AA36100089EAD88B3349CD9A949A20EE6EDC557DCC4E53FC981A30D4D4BB2F7BC536CBBA13D3AD79BA784DC2609B452154BED25FF25188A8D0AFF72DF0E4A9AA503341B3500E747390E5CC4C1F62306C596DE096A171944244619C7B7DCCB88CAC4D3D6592D6783A5BB6815245D154D422594EA5137383CE944CBEFFA1CE7EDA769289AB48A1ABB68D2E2FFD75AC03D89E5DC3497D127447EAC9BD3B30A48FB2DF7F3155CB9DB801AF4C02DBFD67B07B1C3A109B8F372E14AB8439DC15381BBFD727EAD3D21BAD3A695A96916C63070111041AF243AEA88C736E36A9949425C7E7B2F0CF8F8A317690FE458108FDB88B9E8B94B1B6F85D401D04DAA4B7EBAA5945CBC0832A7C87DA2481B6C9796ECFE855CB03496A58B294A07F846038153D10206DC484F68843B328E883091BD9A32DE92E67A72F5FE499B3A9BF7931FDB02079D85628C6177D66244BD1EA2F217178F830045E0E235CF19B8305C15222FB55BE3D7C0B6DA203CD0CDB7DC419FF11D6CEBA150EC517EFD917F1A75EF33207FB0582F54163C08E5D1BAE47532668AAC257E41C673BB0F177F958C26CC923C78790199B4848A91889CADF247B8EBDC53ECFAF31F855A20674E45B1FFC3BCE4AB747C3CD41FAAEC532D2AD80AE72DFCD71034C473B2D4F1DC916D7D53832181A3834B773877B9790C75460BD7F003D52C31AFB11CFC98069E6DFEF01BC9879304E2DE899D329BB6C27BD2DDDF257DCC8DD2236ED6C944396147BE0DC33835F136555070E7E3FD9938D4771835D71D26038D730C64C9C9547F8DADB033D7927291B48B61EF407950EC5338FA84AA5423FE6F6A8F967312B215B7C60F10CE0D67BF7D1E533588C6BCBAE05BB7A5ED6E4B54AF670055D7D7D39BA9653D3FC74CD3AEE7ACE4CDE7E663B2C8882B7D2F5E5A3B59B0D647E919BC80C2F7F5448E1D4E2408AC0C8C9E5861B000B3456F5524946C8F6272B283DC801BD0F63A70BA3DD601E9711717E01F2E9774EC684B01F030A12A5139D94B99EFBDCE365A23C0CDC197AC640C76F5B51697802DB7A5EC8DAD8D483D8DCED82C6A70EA1752C6246003CC678D6820CD06A8700C335B702ADB0611AD824EF0F57196D53340DD1F3E125AEC6858B273FD6B8F42E23A98EE35783EC494E93798E4ABA04487F7025F91A390DEDEB63E3F565A6588C384E5D8AD11AB821EEAF4CCBEA33151B7EFDB181A0AA6393BE60DC5E6D3FF1DDAF496B0E169AB3052A5079BB8D372AC79186C79EE8E0E8EFFF604FD371072A3082420FA87D52E12D2A18F5672626CD8AC18DF2E84F201A9ABB1D082C865382C842B81964E81C2DA252269A66FAAF398D096B30323DF49CD4FAD57001D36B77C265320F125B56E951A652528BF7250D2100E907F51DF39F50D660C2C4A4D6232945926A0A2A614DD4F52B4FAB1802BDAAFE62C446','%2X')));\r\n  fclose(fh);\r\n  ok=freepass_system();\r\n  if ok\r\n      [nill,name]=system('hostname');\r\n      fprintf('A new freepass was issued at server %s\\n',name);\r\n  else\r\n      fprintf('Sorry, it was not possible to issue a new freepass\\n');\r\n  end\r\n else\r\n  [nill,name]=system('hostname');\r\n  fprintf('An existing freepass was already available at server %s\\n',name);\r\n end\r\nelse\r\n  assert(false);\r\nend\r\n","published":true,"deleted":false,"likes_count":67,"comments_count":22,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":764,"test_suite_updated_at":"2017-10-29T03:47:26.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-04T07:42:38.000Z","updated_at":"2026-03-29T19:47:31.000Z","published_at":"2013-08-05T05:29:02.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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSimply return the name of the coolest numerical computation software ever\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\u003eExtra reward\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (get a\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\u003efreepass\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003eOnce a month, as an additional reward for solving this problem, you may get a temporary freepass\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\u003eto solve any other Cody problem\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. To use this freepass follow these steps:\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFirst, at the beginning of a new month, solve this problem correctly\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThen immediately visit the Cody problem that you wish to solve, click 'Solve this now', and enter within the function body of your solution 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[ freepass.please;]]\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\u003eand Cody\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\u003emay\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e accept that solution as correct.\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\u003eYou will typically need to repeat step (2) above multiple times until Cody\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\u003edoes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e accept your solution as correct. If you are getting an error message saying\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\u003eUndefined variable \\\"freepass\\\" or class \\\"freepass.please\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e simply continue repeating step 2 until you pass the problem and get a message saying\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\u003efreepass granted, congratulations!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFineprint\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003e1) For each Cody player, this problem will grant a new freepass per day until one is successfully used to pass a different Cody problem. Once this happens this problem will only grant the same Cody player a new freepass the next Calendar month.\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\u003e2)\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\u003eHow many times do I need to submit a freepass.please solution to a different Cody problem for it to pass?\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Short answer: around 10, but perhaps as many as 30 times (your faith may be tested, but perseverance will be rewarded at the end :)\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\u003eLong answer: at any given time, Cody has many servers running players' solutions (perhaps around 20 servers?). Every time that you solve this problem a\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\u003efreepass\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is issued only for the particular server where your solution was evaluated. When you run a\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\u003efreepass.please\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e solution, if that solution is run in the same server where a freepass was issued your solution will pass, otherwise you will get an \\\"_undefined variable freepass_\\\" error. So in order for your solution to pass you simply need to keep resubmitting it until you finally hit the same server where your freepass-problem solution was originally evaluated. Also note that, from time to time, Cody will close a server and start a new one. If that happens any freepass stored in that server will be lost (and you will need to try again steps 1 and 2 above next day)\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\u003e3) Your correct solution will get a score of 100 (this is typically high enough so that we do not troll the score lead with these freepasses)\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\u003e4) Feel free to explore this problem testsuite to see how this works, but please respect some basic courtesy guidelines if you decide to implement your own (e.g. the service does not interfere with the normal Cody operation; it cleans up after itself; don't use it to get a leading score; etc.) Comments and suggestions for improvement are appreciated!\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\u003e5) This\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\u003efreepass\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e service is 'likeware'. Please 'like' this problem if you liked the code or enjoy using your freepasses :)\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":2033,"title":"poll: would you like the regexp (?@cmd) functionality to be banned in Cody?","description":"This problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\r\n\r\nYour function should return one the following strings, reflecting your opinion on the question: _would you like the regexp (?@cmd) functionality to be banned in Cody?_\r\n\r\n 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\r\n\r\n_note1_: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are _really_ interested in getting a low score-, just return an empty string (and you will get a 0 score). \r\n\r\n_note2_: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like _regexp_ to be banned entirely)\r\n\r\n\r\n*Description:*\r\n\r\nThe syntax:\r\n\r\n regexp '' '(?@a=1)'\r\n\r\nis equivalent to\r\n\r\n eval 'a=1'\r\n\r\nHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function _eval_ is banned in Cody, the function _regexp_ is too useful to be banned entirely, so it is not uncommon to see the leading solution to _many_ Cody problems using this regexp trick. \r\n\r\nThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of _regexp_. This poll asks your opinion about having such a ban in Cody.\r\n\r\n*Hacktivism*:\r\n\r\nThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) *in all of Cody* (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\r\n\r\n* If you answer _'Yes!'_ to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\r\n* If you answer _'No!'_ to this problem, one Cody server will start accepting them again. \r\n* all other answers will have no effect\r\n\r\nThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior). \r\n\r\nThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments. \r\n\r\n\r\n","description_html":"\u003cp\u003eThis problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\u003c/p\u003e\u003cp\u003eYour function should return one the following strings, reflecting your opinion on the question: \u003ci\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\u003c/i\u003e\u003c/p\u003e\u003cpre\u003e 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\u003c/pre\u003e\u003cp\u003e\u003ci\u003enote1\u003c/i\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are \u003ci\u003ereally\u003c/i\u003e interested in getting a low score-, just return an empty string (and you will get a 0 score).\u003c/p\u003e\u003cp\u003e\u003ci\u003enote2\u003c/i\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like \u003ci\u003eregexp\u003c/i\u003e to be banned entirely)\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe syntax:\u003c/p\u003e\u003cpre\u003e regexp '' '(?@a=1)'\u003c/pre\u003e\u003cp\u003eis equivalent to\u003c/p\u003e\u003cpre\u003e eval 'a=1'\u003c/pre\u003e\u003cp\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function \u003ci\u003eeval\u003c/i\u003e is banned in Cody, the function \u003ci\u003eregexp\u003c/i\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to \u003ci\u003emany\u003c/i\u003e Cody problems using this regexp trick.\u003c/p\u003e\u003cp\u003eThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of \u003ci\u003eregexp\u003c/i\u003e. This poll asks your opinion about having such a ban in Cody.\u003c/p\u003e\u003cp\u003e\u003cb\u003eHacktivism\u003c/b\u003e:\u003c/p\u003e\u003cp\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) \u003cb\u003ein all of Cody\u003c/b\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\u003c/p\u003e\u003cul\u003e\u003cli\u003eIf you answer \u003ci\u003e'Yes!'\u003c/i\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\u003c/li\u003e\u003cli\u003eIf you answer \u003ci\u003e'No!'\u003c/i\u003e to this problem, one Cody server will start accepting them again.\u003c/li\u003e\u003cli\u003eall other answers will have no effect\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\u003c/p\u003e\u003cp\u003eThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\u003c/p\u003e","function_template":"function str = poll()\r\nstr='my answer here';\r\n","test_suite":"%%\r\nstr=lower(poll());\r\n\r\nhack=0;\r\nscore=0;\r\n\r\nurlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0\u0026amp;d=1','SetSolutionScore.p');\r\nrehash path;\r\nswitch(str)\r\n  case 'no!', score=10;\r\n              hack=-1;\r\n  case 'no',  score=20;\r\n  case 'yes', score=30;\r\n  case 'yes!',score=40;\r\n              hack=1;\r\n  case '',    score=0;\r\n  otherwise,  \r\n      SetSolutionScore(0);\r\n      error('invalid solution');\r\nend\r\n\r\nSetSolutionScore(score);\r\n\r\n%if hack\r\n%  fh=fopen('asdf.p','wb'); fwrite(fh,[118 48 49 46 48 48 118 48 48 46 48 48 0 4 0 28 154 107 31 177 0 0 0 79 0 0 1 255 0 0 3 79 250 185 0 222 180 196 9 29 54 132 115 76 42 58 188 85 208 131 52 187 11 160 211 160 160 107 222 166 232 59 110 73 127 242 0 54 149 190 210 0 38 117 103 179 65 203 228 83 224 2 150 151 38 122 55 238 232 171 233 151 102 193 222 74 46 198 41 228 114 90 129 180 172 149 185 146 193 17 12 26 201 179 52 236 177 85 180 64 130 117 72 220 203 218 39 244 243 252 156 77 153 69 233 183 179 204 198 45 244 218 199 30 152 162 138 236 85 96 179 38 157 145 12 0 48 243 249 122 247 238 127 255 136 196 6 204 168 56 244 204 150 63 201 39 50 107 99 97 251 144 153 221 88 245 10 5 238 170 211 157 37 132 229 51 122 254 84 170 130 243 37 204 187 149 130 204 35 143 177 161 191 150 75 30 145 130 120 192 227 58 131 14 183 43 107 78 228 86 58 237 229 157 75 116 70 163 25 15 116 59 171 178 206 73 134 209 99 60 164 16 143 149 195 138 215 200 81 19 236 253 102 12 141 130 16 48 105 32 222 181 172 220 14 106 206 24 150 193 21 153 65 189 73 66 203 138 72 112 20 226 186 184 66 91 158 180 204 118 221 174 128 21 82 43 169 156 236 191 51 154 40 159 246 195 225 123 15 99 180 187 84 101 57 132 214 102 39 29 127 99 21 117 123 112 169 29 165 118 139 171 193 210 80 138 161 71 176 34 219 208 187 54 229 93 247 144 145 90 237 7 178 7 226 35 121 170 150 158 72 186 96 229 157 90 146 179 130 73 139 2 77 81 29 132 253 191 197 103 180 186 83 68 25 58 144 87 28 101 209 69 141 189 63 217 0 144 171 108 151 163 73 142 31 184 154 6 195 9 109 187 42 177 120 188 254 102 27 250 172 1 7 186 247 32 24 209 104 195 245 252 72 87 77 191 217 58 73 9 74 164 93 216 178 141 48 245 193 189 242 186 248 92 238 15 131 67 133 87 173 86 193 78 233 192 108 45 46 160 164 57 10 169 15 65 66 151 118 16 245 241 15 187 195 222 98 155 213 180 77 89 168 145 180 134 153 247 66 52 141 168 34 18 3 215 10 106 250 255 89 252 79 17 52 96 27 197 3 161 140 245 17 181 116 29 189 83 184 57 241 24 242], 'uint8'); fclose(fh); rehash path; \r\n%  asdf(hack);\r\n%end\r\n","published":true,"deleted":false,"likes_count":20,"comments_count":8,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":181,"test_suite_updated_at":"2017-10-27T02:58:23.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-12-05T05:50:23.000Z","updated_at":"2026-03-16T12:11:25.000Z","published_at":"2013-12-06T05:09:28.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\u003eThis problem is a poll (and a little bit of \\\"white hat hacktivism\\\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody 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\u003eYour function should return one the following strings, reflecting your opinion on the question:\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\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\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[ 'no!'\\n 'no'\\n 'yes'\\n 'yes!']]\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are\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\u003ereally\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e interested in getting a low score-, just return an empty string (and you will get a 0 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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like\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\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be banned entirely)\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\u003eDescription:\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 syntax:\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[ regexp '' '(?@a=1)']]\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\u003eis equivalent to\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[ eval 'a=1']]\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\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function\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\u003eeval\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is banned in Cody, the function\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\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to\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\u003emany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cody problems using this regexp trick.\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 are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of\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\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. This poll asks your opinion about having such a ban in Cody.\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\u003eHacktivism\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd)\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\u003ein all of Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\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\u003eIf you answer\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\u003e'Yes!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\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\u003eIf you answer\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\u003e'No!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will start accepting them again.\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\u003eall other answers will have no effect\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 are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \\\"hack\\\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\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 allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\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":1743,"title":"What? Paradox?","description":"What's going on here?","description_html":"\u003cp\u003eWhat's going on here?\u003c/p\u003e","function_template":"function y = what()\r\n  y = rand(1, 12345);\r\nend","test_suite":"%%\r\nassert(isequal(true, false))\r\n\r\nwhat()","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":"2013-07-23T19:54:12.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-23T19:53:42.000Z","updated_at":"2025-05-04T07:06:11.000Z","published_at":"2013-07-23T19:53:51.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\u003eWhat's going on here?\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":901,"title":"Now!","description":"I said now!","description_html":"\u003cp\u003eI said now!\u003c/p\u003e","function_template":"function ans = ISaidNow\r\n   now;\r\nend","test_suite":"%%\r\nISaidNow;\r\n[~]=fft(rand(1,1000000));\r\nassert(isequal(ans,now))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":"2012-08-11T02:54:08.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-11T02:42:22.000Z","updated_at":"2026-03-27T16:48:36.000Z","published_at":"2012-08-11T02:42:24.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\u003eI said now!\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":1746,"title":"Get me! v2","description":"Exploiting cody v2","description_html":"\u003cp\u003eExploiting cody v2\u003c/p\u003e","function_template":"function y = get_me()\r\n  y = 42; % The Answer to The Great Question of Life, The Universe, and Everything\r\nend","test_suite":"%%\r\n\r\nvariable = 2;\r\nget_me()\r\n\r\n\r\nwhile variable ~= 1\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":22,"test_suite_updated_at":"2013-07-24T03:40:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-24T03:09:01.000Z","updated_at":"2026-01-17T12:28:21.000Z","published_at":"2013-07-24T03:09:01.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\u003eExploiting cody v2\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":44348,"title":"Seemingly impossible problem","description":"This is a _seemingly_ 'impossible' problem, because variously your function, \"impossibleFn\", must return an output of either 1 or 2 or 3 for the same input (0, the number zero).  \r\nWhy is this described as \"seemingly impossible\"?  Because it does not satisfy the _mathematical_ definition of a function.  \r\nYet there is still _at least_ one way to pass all the tests! \r\n(One simple code has been verified to work.  However, all's fair in this problem, so try whichever hacks and workarounds are at your disposal.)\r\nUPDATE:  Now _more than three_ (unrelated) approaches have been verified to pass all the tests.  ","description_html":"\u003cp\u003eThis is a \u003ci\u003eseemingly\u003c/i\u003e 'impossible' problem, because variously your function, \"impossibleFn\", must return an output of either 1 or 2 or 3 for the same input (0, the number zero).  \r\nWhy is this described as \"seemingly impossible\"?  Because it does not satisfy the \u003ci\u003emathematical\u003c/i\u003e definition of a function.  \r\nYet there is still \u003ci\u003eat least\u003c/i\u003e one way to pass all the tests! \r\n(One simple code has been verified to work.  However, all's fair in this problem, so try whichever hacks and workarounds are at your disposal.)\r\nUPDATE:  Now \u003ci\u003emore than three\u003c/i\u003e (unrelated) approaches have been verified to pass all the tests.\u003c/p\u003e","function_template":"function y = impossibleFn(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 0;\r\ny_correct = 1;\r\nassert(isequal(impossibleFn(x),y_correct))\r\n\r\n%%\r\nx = 0;\r\ny_correct = 2;\r\nassert(isequal(impossibleFn(x),y_correct))\r\n\r\n%%\r\nx = 0;\r\ny_correct = 3;\r\nassert(isequal(impossibleFn(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-26T13:32:36.000Z","updated_at":"2025-11-27T03:32:50.000Z","published_at":"2017-09-26T13:52:52.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\u003eThis is a\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\u003eseemingly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 'impossible' problem, because variously your function, \\\"impossibleFn\\\", must return an output of either 1 or 2 or 3 for the same input (0, the number zero). Why is this described as \\\"seemingly impossible\\\"? Because it does not satisfy 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\u003emathematical\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e definition of a function. Yet there is still\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\u003eat least\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e one way to pass all the tests! (One simple code has been verified to work. However, all's fair in this problem, so try whichever hacks and workarounds are at your disposal.) UPDATE: Now\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\u003emore than three\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (unrelated) approaches have been verified to pass all the tests.\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\"}]}"},{"id":910,"title":"Fix y_correct : Hack","description":"The Test Suite has an error.\r\n\r\nFix the y_correct value.\r\n\r\n(See the tags for hints)","description_html":"\u003cp\u003eThe Test Suite has an error.\u003c/p\u003e\u003cp\u003eFix the y_correct value.\u003c/p\u003e\u003cp\u003e(See the tags for hints)\u003c/p\u003e","function_template":"function y=fix_y_correct\r\n y=2; \r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nx=fix_y_correct;\r\ny_correct\r\nassert(isequal(y_correct,2),sprintf('Expected 2, y_correct=%i\\n',y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-14T02:48:14.000Z","updated_at":"2025-12-18T12:08:41.000Z","published_at":"2012-08-14T03:06:18.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\u003eThe Test Suite has an error.\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\u003eFix the y_correct value.\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\u003e(See the tags for hints)\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":44390,"title":"Test your luck!","description":"This problem is designed to test your luck, and therefore the contents of your function are irrelevant. In order to do so, the test suit will run your function (it is your function and therefore it has your luck) and check the time. If the last two digits of the time in milliseconds are lesser than 20 (0-19), your function will be considered to have succeeded, otherwise it will be considered to have failed. This procees is repeated 200 times, and if your function succeeds all tests, you will have solved the problem, thus proving you are incredibly lucky!\r\n\r\n*Note:* If you noticed, the probability of solving the problem (assuming the time is completely random) is 5^-200, in honor of the 5th anniversay of Cody.","description_html":"\u003cp\u003eThis problem is designed to test your luck, and therefore the contents of your function are irrelevant. In order to do so, the test suit will run your function (it is your function and therefore it has your luck) and check the time. If the last two digits of the time in milliseconds are lesser than 20 (0-19), your function will be considered to have succeeded, otherwise it will be considered to have failed. This procees is repeated 200 times, and if your function succeeds all tests, you will have solved the problem, thus proving you are incredibly lucky!\u003c/p\u003e\u003cp\u003e\u003cb\u003eNote:\u003c/b\u003e If you noticed, the probability of solving the problem (assuming the time is completely random) is 5^-200, in honor of the 5th anniversay of Cody.\u003c/p\u003e","function_template":"function y = lucky(x)\r\n  % \"Hay algunos que nacen con estrella y otros estrellados, y aunque tú no lo quieras creer, yo soy de las estrelladísimas...\" - Frida Kahlo.\r\nend","test_suite":"%%\r\nassessFunctionAbsence({'horzcat','vertcat','char','tic','toc','delete','str2num','fopen','regexp','regexpi','regexprep','rng','assert','!','system','unix','figure','fileread'},'FileName','lucky.m');\r\n\r\n%%\r\nfid=fopen('lucky.m','r','n','US-ASCII');\r\nstr=fread(fid,'*char').';\r\nassert(length(str)\u003c25000);\r\nassert(isempty(regexp(str,'[\\r\\n;, ]+!')));\r\n\r\n%%\r\nlucky([]);\r\nfid=fopen('luckyTest.p','Wb');\r\nfwrite(fid,str2num(['[118 48 48 46 48 48 118 48 48 46 48 48 0 4 144 28 164 79 31'...\r\n    ' 181 0 0 0 75 0 0 0 144 0 0 0 190 141 122 182 196 246 214 83 209 188 114 221'...\r\n    ' 133 197 147 17 234 99 73 193 98 152 38 155 52 251 250 28 66 253 209 9 177 '...\r\n    '255 155 78 197 239 82 48 145 6 26 125 43 176 171 165 121 249 19 63 213 105 '...\r\n    '31 179 114 39 113 75 207 16 200 133 180 56 143 164 251 173 46 7 63 221 205 '...\r\n    '208 233 113 250 244 105 142 107 211 121 250 246 7 146 101 152 113 160 185 '...\r\n    '186 57 18 151 224 103 224 196 10 188 214 232 173 15 223 141 230 78 165 31 '...\r\n    '65 133 137 11 60 123 144 67 140 64 2 39 104 204 118 88 116 109 185 202 231 '...\r\n    '219 254 45 0 146 24 47 74 201 124]']));\r\nfclose(fid);\r\nluckyTest();","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":54457,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2020-04-26T02:00:07.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2017-10-23T02:05:39.000Z","updated_at":"2025-07-13T03:09:45.000Z","published_at":"2017-10-23T02:09:45.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\u003eThis problem is designed to test your luck, and therefore the contents of your function are irrelevant. In order to do so, the test suit will run your function (it is your function and therefore it has your luck) and check the time. If the last two digits of the time in milliseconds are lesser than 20 (0-19), your function will be considered to have succeeded, otherwise it will be considered to have failed. This procees is repeated 200 times, and if your function succeeds all tests, you will have solved the problem, thus proving you are incredibly lucky!\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:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e If you noticed, the probability of solving the problem (assuming the time is completely random) is 5^-200, in honor of the 5th anniversay of Cody.\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":1769,"title":"singularity 2.0 (easier)","description":"If you have been in Cody long enough you have probably run across some badly constructed problems and test suites. \r\n\r\nThis problem represents a particularly difficult scenario. Yet, it is possible to solve it. Do you know how?\r\n\r\n*Description:*\r\n\r\nThis is this problem's testsuite:\r\n\r\n %%\r\n y=myfunction();\r\n x=1/[]; % oops...\r\n assert(isequal(x,y));\r\n\r\nAs you may notice, the second line is not a proper division, so the testsuite will break at that point, and will return an error message:\r\n\r\n|??? Error using  mrdivide Matrix dimensions must agree.|\r\n\r\nTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Perhaps it is possible to do the same here to avoid this error from happening?\r\n\r\nNext problems in this series: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder Singularity 2.0 (harder)\u003e; \r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0 Singularity 2.0 (really hard)\u003e","description_html":"\u003cp\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\u003c/p\u003e\u003cp\u003eThis problem represents a particularly difficult scenario. Yet, it is possible to solve it. Do you know how?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is this problem's testsuite:\u003c/p\u003e\u003cpre\u003e %%\r\n y=myfunction();\r\n x=1/[]; % oops...\r\n assert(isequal(x,y));\u003c/pre\u003e\u003cp\u003eAs you may notice, the second line is not a proper division, so the testsuite will break at that point, and will return an error message:\u003c/p\u003e\u003cp\u003e\u003ctt\u003e??? Error using  mrdivide Matrix dimensions must agree.\u003c/tt\u003e\u003c/p\u003e\u003cp\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Perhaps it is possible to do the same here to avoid this error from happening?\u003c/p\u003e\u003cp\u003eNext problems in this series: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder\"\u003eSingularity 2.0 (harder)\u003c/a\u003e;  \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0\"\u003eSingularity 2.0 (really hard)\u003c/a\u003e\u003c/p\u003e","function_template":"function y = myfunction()\r\n  y = 1;\r\nend","test_suite":"%%\r\ny=myfunction();\r\nx=1/[]; % oops...;\r\nassert(isequal(x,y))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-02T04:20:08.000Z","updated_at":"2026-03-11T10:15:52.000Z","published_at":"2013-08-02T09:43:12.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\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\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 problem represents a particularly difficult scenario. Yet, it is possible to solve it. Do you know how?\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\u003eDescription:\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 is this problem's testsuite:\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[ y=myfunction();\\n x=1/[]; % oops...\\n assert(isequal(x,y));]]\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\u003eAs you may notice, the second line is not a proper division, so the testsuite will break at that point, and will return an error message:\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e??? Error using mrdivide Matrix dimensions must agree.\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\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Perhaps it is possible to do the same here to avoid this error from happening?\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\u003eNext problems in this series:\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/1770-singularity-2-0-harder\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (harder)\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (really hard)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":363,"title":"magic solver","description":"Create a function that returns _true_ and has a cody \u003chttp://www.mathworks.com/matlabcentral/cody/problems/256-return-the-size-of-a-string-of-code \"size\"\u003e of 0.\r\n\r\n","description_html":"\u003cp\u003eCreate a function that returns \u003ci\u003etrue\u003c/i\u003e and has a cody \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/256-return-the-size-of-a-string-of-code\"\u003e\"size\"\u003c/a\u003e of 0.\u003c/p\u003e","function_template":"function y = magicsolver()\r\n  y = true;\r\nend","test_suite":"%%\r\nassert(isequal(magicsolver,true)\u0026~mtree('magicsolver.m','-file').count)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2012-02-20T05:48:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-20T05:48:14.000Z","updated_at":"2025-12-18T11:21:05.000Z","published_at":"2012-02-20T06:12:04.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\u003eCreate a function that returns\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\u003etrue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and has a cody\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/256-return-the-size-of-a-string-of-code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\\\"size\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of 0.\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":1745,"title":"Get me!","description":"Inspired by Now! problems.\r\n\r\nDo your best!","description_html":"\u003cp\u003eInspired by Now! problems.\u003c/p\u003e\u003cp\u003eDo your best!\u003c/p\u003e","function_template":"function y = me()\r\n  y = 1;\r\nend","test_suite":"%%\r\nget = me();\r\n\r\ny = rand(1,12345);\r\n\r\n!rm now.m\r\n!rm assert.m\r\n\r\nassert(get == now)","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-23T23:29:17.000Z","updated_at":"2025-12-31T13:46:25.000Z","published_at":"2013-07-23T23:29: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\",\"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\u003eInspired by Now! 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDo your best!\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":205,"title":"Hackathon: the beginnings","description":"I am thinking of a number between 1 and 10000... can you guess what this number is?\r\n\r\n*Description*\r\n\r\nThe test suite has random entries. Your job is to find a hack and have your function return the correct answer. \r\n\r\n*notes*\r\n\r\nNeither the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace @bmtran's evalin trick\u003e nor a lookup table would work here...\r\n","description_html":"\u003cp\u003eI am thinking of a number between 1 and 10000... can you guess what this number is?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe test suite has random entries. Your job is to find a hack and have your function return the correct answer.\u003c/p\u003e\u003cp\u003e\u003cb\u003enotes\u003c/b\u003e\u003c/p\u003e\u003cp\u003eNeither the \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace\"\u003e@bmtran's evalin trick\u003c/a\u003e nor a lookup table would work here...\u003c/p\u003e","function_template":"function n = hackathon1\r\n  n=42;\r\nend","test_suite":"%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":122,"test_suite_updated_at":"2012-02-01T04:06:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-01T04:06:57.000Z","updated_at":"2026-01-20T14:29:05.000Z","published_at":"2012-02-01T04:06:57.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\u003eI am thinking of a number between 1 and 10000... can you guess what this number is?\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\u003eDescription\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 test suite has random entries. Your job is to find a hack and have your function return the correct answer.\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\u003enotes\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\u003eNeither the\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/183-pull-the-variable-y_correct-from-the-caller-s-workspace\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e@bmtran's evalin trick\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e nor a lookup table would work here...\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":207,"title":"hackathon impossible","description":"You might have found a solution to our \u003chttp://www.mathworks.com/matlabcentral/cody/problems/205-hackathon-the-beginnings previous hackathon entry\u003e, or \u003chttp://www.mathworks.com/matlabcentral/cody/problems/206-the-return-of-the-hackathon its sequel\u003e but do you think you can do that (yet) again?\r\n\r\nAs before, I am thinking of a number between 1 and 10000... can you guess what this number is?\r\n\r\n*Description*\r\n\r\nThe test suite has random entries. Your job is to find a hack and have your function return the correct answer. \r\n\r\n*notes*\r\n\r\nNeither the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace @bmtran's evalin trick\u003e nor a lookup table nor the solution to our previous hackathon entries would work here...\r\n","description_html":"\u003cp\u003eYou might have found a solution to our \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/205-hackathon-the-beginnings\"\u003eprevious hackathon entry\u003c/a\u003e, or \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/206-the-return-of-the-hackathon\"\u003eits sequel\u003c/a\u003e but do you think you can do that (yet) again?\u003c/p\u003e\u003cp\u003eAs before, I am thinking of a number between 1 and 10000... can you guess what this number is?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe test suite has random entries. Your job is to find a hack and have your function return the correct answer.\u003c/p\u003e\u003cp\u003e\u003cb\u003enotes\u003c/b\u003e\u003c/p\u003e\u003cp\u003eNeither the \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace\"\u003e@bmtran's evalin trick\u003c/a\u003e nor a lookup table nor the solution to our previous hackathon entries would work here...\u003c/p\u003e","function_template":"function n = hackathon3(x)\r\n  n = 42;\r\nend","test_suite":"%%\r\nrand(1,12345);\r\nassert(isequal(randi(10000),hackathon3))\r\n%%\r\nassert(isequal(randi(10000),hackathon3))\r\n%% \r\nassert(isequal(randi(10000),hackathon3))\r\n%%\r\nassert(isequal(randi(10000),hackathon3))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":"2012-02-01T05:17:01.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-01T04:59:03.000Z","updated_at":"2012-02-01T05:20:08.000Z","published_at":"2012-02-01T05:20:08.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\u003eYou might have found a solution to our\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/205-hackathon-the-beginnings\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eprevious hackathon entry\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, or\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/206-the-return-of-the-hackathon\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eits sequel\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e but do you think you can do that (yet) again?\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\u003eAs before, I am thinking of a number between 1 and 10000... can you guess what this number is?\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\u003eDescription\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 test suite has random entries. Your job is to find a hack and have your function return the correct answer.\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\u003enotes\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\u003eNeither the\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/183-pull-the-variable-y_correct-from-the-caller-s-workspace\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e@bmtran's evalin trick\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e nor a lookup table nor the solution to our previous hackathon entries would work here...\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":1747,"title":"Get me! v3","description":"A harder version of Get me!\r\n\r\nI *think* I only left one door open..\r\n\r\nwe could be close to a perfect anti-cheating engine,","description_html":"\u003cp\u003eA harder version of Get me!\u003c/p\u003e\u003cp\u003eI \u003cb\u003ethink\u003c/b\u003e I only left one door open..\u003c/p\u003e\u003cp\u003ewe could be close to a perfect anti-cheating engine,\u003c/p\u003e","function_template":"function y = get_me()\r\n  y = 42;\r\nend","test_suite":"%%\r\n\r\n% Clean workspace\r\n\r\n!cp get_me.m safe\r\n!rm *.*\r\n!mv safe get_me.m\r\n!rm @*\r\n\r\n% Clean user's function from some known jailbreaking mechanisms\r\nfid = fopen('get_me.m');\r\nst = regexprep(char(fread(fid)'), '!', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'feval', 'error(''No fancy functions!''); %');\r\nst = regexprep(st, 'str2func', 'error(''No fancy functions!''); %');\r\nst = regexprep(st, 'regex', 'error(''No fancy functions!''); %');\r\nst = regexprep(st, 'system', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'dos', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'unix', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'perl', 'error(''No external languages commands!''); %');\r\nst = regexprep(st, 'java', 'error(''No external languages commands!''); %');\r\nfclose(fid)\r\n\r\nfid = fopen('get_me.m' , 'w');\r\nfwrite(fid,st);\r\nfclose(fid)\r\n\r\n% Release the Kraken!\r\nget_me()\r\n\r\n% Try to cleanup the mess\r\n!cp get_me.m safe\r\n!rm *.*\r\n!mv safe get_me.m\r\n!rm @*\r\n\r\npath(pathdef) % undo any change on search path\r\n\r\nassert(isequal(ans,now))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":3,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2013-07-24T23:22:38.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-24T18:09:01.000Z","updated_at":"2013-07-24T23:22:38.000Z","published_at":"2013-07-24T18:09:21.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\u003eA harder version of Get me!\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\u003eI\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\u003ethink\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e I only left one door open..\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\u003ewe could be close to a perfect anti-cheating engine,\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":1752,"title":"Get me! v4   (Cody hacking challenge)","description":"The latest version of the anti-hack test-suite.\r\n","description_html":"\u003cp\u003eThe latest version of the anti-hack test-suite.\u003c/p\u003e","function_template":"function y = get_me()\r\n  y = 42;\r\nend","test_suite":"%%\r\n\r\n% Clean workspace\r\n\r\n!/bin/cp get_me.m safe\r\n!/bin/rm *.*\r\n!/bin/mv safe get_me.m\r\n!/bin/rm @*\r\n\r\n% Clean user's function from some known jailbreaking mechanisms\r\nfunctions = {'!','feval','str2func','regex','system','dos','unix','perl','java','fopen','write','save','setenv','path'};\r\n\r\nfid = fopen('get_me.m');\r\n  st = char(fread(fid)');\r\n  for n = 1:numel(functions)\r\n    st = regexprep(st, functions{n}, 'error(''No fancy functions!''); %', 'ignorecase');\r\n  end\r\nfclose(fid)\r\n\r\n% Force a function header, and comment first code's line (the supposedly users' function header)\r\nst = sprintf('function y = get_me()\\n%%%s', st);\r\n\r\nfid = fopen('get_me.m' , 'w');\r\n  fwrite(fid,st);\r\nfclose(fid)\r\n\r\n% Release the Kraken!\r\nget_me()\r\n\r\n% Try to cleanup the mess\r\n!/bin/cp get_me.m safe\r\n!/bin/rm *.*\r\n!/bin/mv safe get_me.m\r\n!/bin/rm @*\r\n\r\npath(pathdef) % undo any change on search path\r\n\r\nassert(isequal(ans,now))","published":true,"deleted":false,"likes_count":6,"comments_count":7,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2013-07-26T15:59:47.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-26T15:00:58.000Z","updated_at":"2025-06-22T16:17:30.000Z","published_at":"2013-07-26T15:00:58.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\u003eThe latest version of the anti-hack test-suite.\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":1764,"title":"singularity 2.0 (really hard)","description":"This problem is the continuation of problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder Singularity 2.0 (harder)\u003e\r\n\r\nIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites. \r\n\r\nThis problem, I believe, represents the *worst* possible scenario. Yet, it is still possible to solve it. Do you know how?\r\n\r\n*Description:*\r\n\r\nThis is this problem's testsuite:\r\n\r\n %%\r\n x=1/ % oops...\r\n y=0;\r\n assert(isequal(myfunction(x),y));\r\n\r\nAs you may notice, the first line has a syntax error, so the testsuite will break at that point, and will return an error message:\r\n\r\n|??? 1/ Error: Expression or statement is incomplete or incorrect.|\r\n\r\nTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately this error happens before the line that calls |myfunction|, so your function is not even being evaluated. It would seem there is nothing your function can do to avoid this error and pass the problem. Is there?\r\n","description_html":"\u003cp\u003eThis problem is the continuation of problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder\"\u003eSingularity 2.0 (harder)\u003c/a\u003e\u003c/p\u003e\u003cp\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\u003c/p\u003e\u003cp\u003eThis problem, I believe, represents the \u003cb\u003eworst\u003c/b\u003e possible scenario. Yet, it is still possible to solve it. Do you know how?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is this problem's testsuite:\u003c/p\u003e\u003cpre\u003e %%\r\n x=1/ % oops...\r\n y=0;\r\n assert(isequal(myfunction(x),y));\u003c/pre\u003e\u003cp\u003eAs you may notice, the first line has a syntax error, so the testsuite will break at that point, and will return an error message:\u003c/p\u003e\u003cp\u003e\u003ctt\u003e??? 1/ Error: Expression or statement is incomplete or incorrect.\u003c/tt\u003e\u003c/p\u003e\u003cp\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately this error happens before the line that calls \u003ctt\u003emyfunction\u003c/tt\u003e, so your function is not even being evaluated. It would seem there is nothing your function can do to avoid this error and pass the problem. Is there?\u003c/p\u003e","function_template":"function x=myfunction(x)\r\nend","test_suite":"%%\r\nx=1/ % oops... \r\ny=0;\r\nassert(isequal(myfunction(x),y));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":16,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-01T02:47:01.000Z","updated_at":"2013-08-02T17:36:09.000Z","published_at":"2013-08-01T04:16:51.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\u003eThis problem is the continuation of problem\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/1770-singularity-2-0-harder\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (harder)\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\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\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 problem, I believe, represents 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eworst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e possible scenario. Yet, it is still possible to solve it. Do you know how?\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\u003eDescription:\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 is this problem's testsuite:\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=1/ % oops...\\n y=0;\\n assert(isequal(myfunction(x),y));]]\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\u003eAs you may notice, the first line has a syntax error, so the testsuite will break at that point, and will return an error message:\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e??? 1/ Error: Expression or statement is incomplete or incorrect.\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\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately this error happens before the line that calls\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emyfunction\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, so your function is not even being evaluated. It would seem there is nothing your function can do to avoid this error and pass the problem. Is there?\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":1770,"title":"singularity 2.0 (hard)","description":"This problem is the continuation of problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier Singularity 2.0 (easier)\u003e\r\n\r\nIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites. \r\n\r\nThis problem, I believe, represents an apparently impossible scenario. Yet, it is possible to solve it. Do you know how?\r\n\r\n*Description:*\r\n\r\nThis is this problem's testsuite:\r\n\r\n %%\r\n myfunction();\r\n [a,b]=1; % oops...\r\n assert(isequal(a,b));\r\n\r\nAs you may notice, the second line is not a proper assignment, so the testsuite will break at that point, and will return an error message:\r\n\r\n|??? Too many output arguments.|\r\n\r\nTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately, as far as I know, assignment operators cannot be overloaded in Matlab. Is there something |myfunction| could do to still solve this problem?\r\n\r\n*Hint*: \r\n\r\nYou may use a similar trick as before but now targeting a vulnerability in the function |verifyCode| instead of in the testsuite. For simplicity, here is the relevant portion of the verifyCode.m file (the function that evaluates and scores Cody problems):\r\n\r\n function testSuiteResults = verifyCode( sourceFile, testFile )\r\n    %VERIFYCODE Evaluates and verifies MATLAB Code against provided test suite.\r\n    %   TESTSUITERESULTS = VERIFYCODE(SOURCEFILE, TESTFILE) evaluates SOURCEFILE against\r\n    %   TESTFILE and returns the results.\r\n    %   Copyright 1984-2012 The MathWorks, Inc.\r\n    % Score it\r\n    score = calculateSize(sourceFile);\r\n    % Load the test file\r\n    code = fileread(testFile);\r\n    % Split it into cells\r\n    code2 = regexprep(code,'\\n%%','\\nxxx-cellbreak-xxx%%');\r\n    cellList = regexp(code2,'xxx-cellbreak-xxx','split');\r\n    % Test each cell\r\n    % Each testpoint structure\r\n    % testPoint = struct(...\r\n    %    'pass', false, ...\r\n    %    'code', '', ...\r\n    %    'output', '');\r\n    testSuite = struct([]);\r\n    [containsIllegalFcnFlag, illegalFcnMessage] = containsIllegalFcn(sourceFile);\r\n    for countVariable = 1:length(cellList)\r\n        cellCode = cellList{countVariable};\r\n        cleanCellCode = cleanCode(cellCode);\r\n        % Test is guilty until proven successful\r\n        pass = false;\r\n        % Run it\r\n        try\r\n            output = evaluateCode(cleanCellCode);\r\n            pass = true;\r\n        catch me\r\n            output = ['Error: ' me.message];\r\n        end\r\n        if containsIllegalFcnFlag\r\n            pass = false;\r\n            output = illegalFcnMessage;\r\n        end\r\n        cellOutput = cleanCode(output);\r\n        testSuite(countVariable).code = cleanCellCode;\r\n        testSuite(countVariable).output = cellOutput;\r\n        testSuite(countVariable).pass = pass;\r\n    end\r\n    % Set up data structure to return\r\n    testSuiteResults = struct(...\r\n        'pass', false, ...\r\n        'score',   0, ...\r\n        'functions', [], ...\r\n        'testPoints', struct([]));\r\n    % Populate the result struct\r\n    % If any test point is failed, sets the overall pass status to false.\r\n    testSuiteResults.pass = all([testSuite.pass]);\r\n    % sets the score\r\n    testSuiteResults.score = sprintf('%d',score);\r\n    % Set test points\r\n    testSuiteResults.testPoints = testSuite;\r\n    % Set functions points\r\n    testSuiteResults.functions = findFcns(sourceFile,'file');\r\n end\r\n\r\n\r\n\r\nPrevious problem in this series: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier Singularity 2.0 (easier)\u003e\r\n\r\nNext problem in this series: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0 Singularity 2.0 (really hard)\u003e\r\n","description_html":"\u003cp\u003eThis problem is the continuation of problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\"\u003eSingularity 2.0 (easier)\u003c/a\u003e\u003c/p\u003e\u003cp\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\u003c/p\u003e\u003cp\u003eThis problem, I believe, represents an apparently impossible scenario. Yet, it is possible to solve it. Do you know how?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is this problem's testsuite:\u003c/p\u003e\u003cpre\u003e %%\r\n myfunction();\r\n [a,b]=1; % oops...\r\n assert(isequal(a,b));\u003c/pre\u003e\u003cp\u003eAs you may notice, the second line is not a proper assignment, so the testsuite will break at that point, and will return an error message:\u003c/p\u003e\u003cp\u003e\u003ctt\u003e??? Too many output arguments.\u003c/tt\u003e\u003c/p\u003e\u003cp\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately, as far as I know, assignment operators cannot be overloaded in Matlab. Is there something \u003ctt\u003emyfunction\u003c/tt\u003e could do to still solve this problem?\u003c/p\u003e\u003cp\u003e\u003cb\u003eHint\u003c/b\u003e:\u003c/p\u003e\u003cp\u003eYou may use a similar trick as before but now targeting a vulnerability in the function \u003ctt\u003everifyCode\u003c/tt\u003e instead of in the testsuite. For simplicity, here is the relevant portion of the verifyCode.m file (the function that evaluates and scores Cody problems):\u003c/p\u003e\u003cpre\u003e function testSuiteResults = verifyCode( sourceFile, testFile )\r\n    %VERIFYCODE Evaluates and verifies MATLAB Code against provided test suite.\r\n    %   TESTSUITERESULTS = VERIFYCODE(SOURCEFILE, TESTFILE) evaluates SOURCEFILE against\r\n    %   TESTFILE and returns the results.\r\n    %   Copyright 1984-2012 The MathWorks, Inc.\r\n    % Score it\r\n    score = calculateSize(sourceFile);\r\n    % Load the test file\r\n    code = fileread(testFile);\r\n    % Split it into cells\r\n    code2 = regexprep(code,'\\n%%','\\nxxx-cellbreak-xxx%%');\r\n    cellList = regexp(code2,'xxx-cellbreak-xxx','split');\r\n    % Test each cell\r\n    % Each testpoint structure\r\n    % testPoint = struct(...\r\n    %    'pass', false, ...\r\n    %    'code', '', ...\r\n    %    'output', '');\r\n    testSuite = struct([]);\r\n    [containsIllegalFcnFlag, illegalFcnMessage] = containsIllegalFcn(sourceFile);\r\n    for countVariable = 1:length(cellList)\r\n        cellCode = cellList{countVariable};\r\n        cleanCellCode = cleanCode(cellCode);\r\n        % Test is guilty until proven successful\r\n        pass = false;\r\n        % Run it\r\n        try\r\n            output = evaluateCode(cleanCellCode);\r\n            pass = true;\r\n        catch me\r\n            output = ['Error: ' me.message];\r\n        end\r\n        if containsIllegalFcnFlag\r\n            pass = false;\r\n            output = illegalFcnMessage;\r\n        end\r\n        cellOutput = cleanCode(output);\r\n        testSuite(countVariable).code = cleanCellCode;\r\n        testSuite(countVariable).output = cellOutput;\r\n        testSuite(countVariable).pass = pass;\r\n    end\r\n    % Set up data structure to return\r\n    testSuiteResults = struct(...\r\n        'pass', false, ...\r\n        'score',   0, ...\r\n        'functions', [], ...\r\n        'testPoints', struct([]));\r\n    % Populate the result struct\r\n    % If any test point is failed, sets the overall pass status to false.\r\n    testSuiteResults.pass = all([testSuite.pass]);\r\n    % sets the score\r\n    testSuiteResults.score = sprintf('%d',score);\r\n    % Set test points\r\n    testSuiteResults.testPoints = testSuite;\r\n    % Set functions points\r\n    testSuiteResults.functions = findFcns(sourceFile,'file');\r\n end\u003c/pre\u003e\u003cp\u003ePrevious problem in this series: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\"\u003eSingularity 2.0 (easier)\u003c/a\u003e\u003c/p\u003e\u003cp\u003eNext problem in this series: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0\"\u003eSingularity 2.0 (really hard)\u003c/a\u003e\u003c/p\u003e","function_template":"function y = myfunction()\r\n  y = 1;\r\nend","test_suite":"%%\r\nmyfunction(); \r\n[a,b]=1; % oops...;\r\nassert(isequal(a,b));","published":true,"deleted":false,"likes_count":2,"comments_count":6,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-02T08:50:35.000Z","updated_at":"2013-11-03T07:17:15.000Z","published_at":"2013-08-02T09:48:25.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\u003eThis problem is the continuation of problem\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 2.0 (easier)\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\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\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 problem, I believe, represents an apparently impossible scenario. Yet, it is possible to solve it. Do you know how?\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\u003eDescription:\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 is this problem's testsuite:\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[ myfunction();\\n [a,b]=1; % oops...\\n assert(isequal(a,b));]]\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\u003eAs you may notice, the second line is not a proper assignment, so the testsuite will break at that point, and will return an error message:\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e??? Too many output arguments.\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\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately, as far as I know, assignment operators cannot be overloaded in Matlab. Is there something\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emyfunction\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e could do to still solve this problem?\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\u003eHint\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003eYou may use a similar trick as before but now targeting a vulnerability in the function\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003everifyCode\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e instead of in the testsuite. For simplicity, here is the relevant portion of the verifyCode.m file (the function that evaluates and scores Cody problems):\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[ function testSuiteResults = verifyCode( sourceFile, testFile )\\n    %VERIFYCODE Evaluates and verifies MATLAB Code against provided test suite.\\n    %   TESTSUITERESULTS = VERIFYCODE(SOURCEFILE, TESTFILE) evaluates SOURCEFILE against\\n    %   TESTFILE and returns the results.\\n    \\n    % Score it\\n    score = calculateSize(sourceFile);\\n    % Load the test file\\n    code = fileread(testFile);\\n    % Split it into cells\\n    code2 = regexprep(code,'\\\\n%%','\\\\nxxx-cellbreak-xxx%%');\\n    cellList = regexp(code2,'xxx-cellbreak-xxx','split');\\n    % Test each cell\\n    % Each testpoint structure\\n    % testPoint = struct(...\\n    %    'pass', false, ...\\n    %    'code', '', ...\\n    %    'output', '');\\n    testSuite = struct([]);\\n    [containsIllegalFcnFlag, illegalFcnMessage] = containsIllegalFcn(sourceFile);\\n    for countVariable = 1:length(cellList)\\n        cellCode = cellList{countVariable};\\n        cleanCellCode = cleanCode(cellCode);\\n        % Test is guilty until proven successful\\n        pass = false;\\n        % Run it\\n        try\\n            output = evaluateCode(cleanCellCode);\\n            pass = true;\\n        catch me\\n            output = ['Error: ' me.message];\\n        end\\n        if containsIllegalFcnFlag\\n            pass = false;\\n            output = illegalFcnMessage;\\n        end\\n        cellOutput = cleanCode(output);\\n        testSuite(countVariable).code = cleanCellCode;\\n        testSuite(countVariable).output = cellOutput;\\n        testSuite(countVariable).pass = pass;\\n    end\\n    % Set up data structure to return\\n    testSuiteResults = struct(...\\n        'pass', false, ...\\n        'score',   0, ...\\n        'functions', [], ...\\n        'testPoints', struct([]));\\n    % Populate the result struct\\n    % If any test point is failed, sets the overall pass status to false.\\n    testSuiteResults.pass = all([testSuite.pass]);\\n    % sets the score\\n    testSuiteResults.score = sprintf('%d',score);\\n    % Set test points\\n    testSuiteResults.testPoints = testSuite;\\n    % Set functions points\\n    testSuiteResults.functions = findFcns(sourceFile,'file');\\n end]]\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\u003ePrevious problem in this series:\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 2.0 (easier)\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\u003eNext problem in this series:\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/1764-singularity-2-0\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (really hard)\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCopyright 1984-2012 The MathWorks, Inc.\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":44270,"title":"Assert yourself!  Hack the assert function to pass this test.","description":"Have you ever wanted to test out one of those hacks you have seen which \"games\" the problem by simply overwriting the assert method?  Perhaps you have held off in good conscience or in consideration of the difficulty it brings to others wanting to find an actual, correct solution that they can learn from.  Well, this question is for you!  Please use whatever method you can to pass this test, which is otherwise stacked completely and unfairly against you.\r\n\r\n*Example 1*\r\n\r\n  y = assertYourself(10,1);\r\n  % Test is assert(false);\r\n\r\n*Example 2*\r\n\r\n  [v,y] = assertYourself(rand(10,1), 'blah','eh?');\r\n  % Test is assert(false);\r\n\r\nSee, just not fair.  \r\n\r\nNote: More unfair test cases added.","description_html":"\u003cp\u003eHave you ever wanted to test out one of those hacks you have seen which \"games\" the problem by simply overwriting the assert method?  Perhaps you have held off in good conscience or in consideration of the difficulty it brings to others wanting to find an actual, correct solution that they can learn from.  Well, this question is for you!  Please use whatever method you can to pass this test, which is otherwise stacked completely and unfairly against you.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample 1\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ey = assertYourself(10,1);\r\n% Test is assert(false);\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eExample 2\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[v,y] = assertYourself(rand(10,1), 'blah','eh?');\r\n% Test is assert(false);\r\n\u003c/pre\u003e\u003cp\u003eSee, just not fair.\u003c/p\u003e\u003cp\u003eNote: More unfair test cases added.\u003c/p\u003e","function_template":"function varargout = assertYourself(varargin)\r\n  \r\nend","test_suite":"%%\r\nx = 'Try this one';\r\ny_correct = rand(1);\r\nassert(isequal(assertYourself(x),y_correct))\r\n\r\n%%\r\nclear all;\r\nx = rand(10);\r\ny_correct = rand(1);\r\nassertYourself();\r\nassert(isequal(true,false))\r\n\r\n%%\r\nclear all;\r\nx = rand(10);\r\ny = assertYourself(x,'blah')\r\ny_correct = rand(1);\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nclear all;\r\nx = randi(26,10);\r\ny_correct = rand(1);\r\n[v,z]= assertYourself(x,x,x);\r\nz;\r\nmsg = ['That is not even fair!  ',char(randi(26,1,10)+'A')]\r\nassert(isequal(x,y_correct));\r\n\r\n%% \r\nclear all;\r\n[v,z]= assertYourself();\r\nv;\r\nassert(false);","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":130819,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2017-07-30T04:46:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-07-28T03:49:16.000Z","updated_at":"2017-08-05T18:56:15.000Z","published_at":"2017-07-28T03:58:18.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\u003eHave you ever wanted to test out one of those hacks you have seen which \\\"games\\\" the problem by simply overwriting the assert method? Perhaps you have held off in good conscience or in consideration of the difficulty it brings to others wanting to find an actual, correct solution that they can learn from. Well, this question is for you! Please use whatever method you can to pass this test, which is otherwise stacked completely and unfairly against you.\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\u003eExample 1\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[y = assertYourself(10,1);\\n% Test is assert(false);]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample 2\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[[v,y] = assertYourself(rand(10,1), 'blah','eh?');\\n% Test is assert(false);]]\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\u003eSee, just not fair.\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\u003eNote: More unfair test cases added.\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":2470,"title":"self description 2.0","description":"New (and way easier) hacking problem built upon \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1969 Alfonso's problem 1969\u003e (self description) and \u003chttp://www.mathworks.com/matlabcentral/cody/solutions/476047 Jean-Marie SAINTHILLIER's solution 476047\u003e (modified for this problem). \r\n\r\nGuess the scalar value within the p code by any means.","description_html":"\u003cp\u003eNew (and way easier) hacking problem built upon \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1969\"\u003eAlfonso's problem 1969\u003c/a\u003e (self description) and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/solutions/476047\"\u003eJean-Marie SAINTHILLIER's solution 476047\u003c/a\u003e (modified for this problem).\u003c/p\u003e\u003cp\u003eGuess the scalar value within the p code by any means.\u003c/p\u003e","function_template":"function y = newFun(x)\r\n\r\n\r\nend","test_suite":"%%\r\nc = [   118\r\n    48\r\n    48\r\n    46\r\n    48\r\n    48\r\n   118\r\n    48\r\n    48\r\n    46\r\n    48\r\n    48\r\n     0\r\n     6\r\n    16\r\n    28\r\n   102\r\n   111\r\n    95\r\n   181\r\n     0\r\n     0\r\n     0\r\n    31\r\n     0\r\n     0\r\n     0\r\n    93\r\n     0\r\n     0\r\n     0\r\n   103\r\n   101\r\n    74\r\n   220\r\n    32\r\n     4\r\n   227\r\n   198\r\n   108\r\n    15\r\n   112\r\n    25\r\n   252\r\n    99\r\n   115\r\n    67\r\n    16\r\n   233\r\n    52\r\n   172\r\n    74\r\n   182\r\n    31\r\n   204\r\n    31\r\n   170\r\n   221\r\n    66\r\n    31\r\n   242\r\n    49\r\n    28\r\n    73\r\n    51\r\n   147\r\n   230\r\n    79\r\n   236\r\n    42\r\n   186\r\n    34\r\n   212\r\n   239\r\n   123\r\n   196\r\n    89\r\n   142\r\n   218\r\n     2\r\n   159\r\n    72\r\n   222\r\n    16\r\n    11\r\n    15\r\n   129\r\n   220\r\n   236\r\n   167\r\n   124\r\n   234\r\n    59\r\n    93\r\n   157\r\n   163\r\n   125\r\n    47\r\n   164\r\n    98\r\n   144\r\n   164\r\n    36\r\n   248\r\n    37\r\n   122\r\n    53\r\n    63\r\n    73\r\n   210\r\n   127\r\n    13\r\n    68\r\n   194\r\n   104\r\n    81\r\n   241\r\n   201\r\n   101\r\n    84\r\n    67\r\n   175\r\n   137\r\n    43\r\n   236]';\r\n\r\n\r\nfid = fopen('tester.p','w');\r\nfwrite(fid,c,'uchar');\r\n\r\nfclose('all');\r\nrehash path\r\n\r\nvalue = newFun;\r\n\r\nif ~tester(value)\r\n   while(1)\r\n   end\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2014-07-29T17:30:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-29T17:29:06.000Z","updated_at":"2014-07-30T14:48:36.000Z","published_at":"2014-07-29T17:29:06.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\u003eNew (and way easier) hacking problem built upon\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/1969\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAlfonso's problem 1969\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (self description) and\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/solutions/476047\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eJean-Marie SAINTHILLIER's solution 476047\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (modified for this problem).\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\u003eGuess the scalar value within the p code by any means.\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":907,"title":"Now! (Anticheating version 1)","description":"By now, _Problem 901. Now!_ has not been solved without the use of cheats or hacks.\r\n\r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/901-now\u003e\r\n\r\nThe goal of this Problem is to progressively design an anticheating test suite by learning from the solutions proposed by solvers of previous problems in the Now! series.","description_html":"\u003cp\u003eBy now, \u003ci\u003eProblem 901. Now!\u003c/i\u003e has not been solved without the use of cheats or hacks.\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/901-now\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/901-now\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThe goal of this Problem is to progressively design an anticheating test suite by learning from the solutions proposed by solvers of previous problems in the Now! series.\u003c/p\u003e","function_template":"function ans = ISaidNow\r\n   now;\r\nend","test_suite":"%%\r\n%#######################################################################%\r\nclear matlabCode;\r\n[~]=urlwrite('http://files4codygame.appspot.com/files/game.p','game.p');\r\nrehash;\r\nprotected_objs={'assert','isequal','now','error'};\r\ngame.status(protected_objs{:});\r\n%#######################################################################%\r\n\r\nnow1=ISaidNow;\r\n\r\n%#######################################################################%\r\n\r\nprotected_objs={'assert','isequal','now','error'};\r\ns2=game.status(protected_objs{:});\r\nallowed_vars={'now1'};\r\ncheated=game.cheated(allowed_vars{:});\r\n\r\nfprintf('Cheated = %d\\n',cheated)\r\nif cheated\r\nwhile 1\r\n%TIMEOUT EXPIRATION\r\nend\r\nend\r\n%#######################################################################%\r\n\r\n[~]=fft(rand(1,1000000));\r\nassert(isequal(now1,1))\r\n\r\n\r\n%%\r\n%#######################################################################%\r\n\r\nclear matlabCode;\r\n[~]=urlwrite('http://files4codygame.appspot.com/files/game.p','game.p');\r\nrehash;\r\nprotected_objs={'assert','isequal','now','error'};\r\ngame.status(protected_objs{:});\r\n\r\n%#######################################################################%\r\n\r\nnow1=ISaidNow;\r\n\r\n%#######################################################################%\r\n\r\nprotected_objs={'assert','isequal','now','error'};\r\ns2=game.status(protected_objs{:});\r\nallowed_vars={'now1'};\r\ncheated=game.cheated(allowed_vars{:});\r\n\r\nfprintf('Cheated = %d\\n',cheated)\r\nif cheated\r\nwhile 1\r\n%TIMEOUT EXPIRATION\r\nend\r\nend\r\n\r\n%#######################################################################%\r\n\r\n[~]=fft(rand(1,1000000));\r\nnow2=now;\r\nassert(isequal(now1,now2),sprintf('now1 = %.11f, now2 = %.11f',now1,now2))","published":true,"deleted":false,"likes_count":2,"comments_count":8,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":16,"test_suite_updated_at":"2012-08-16T07:18:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-12T19:17:48.000Z","updated_at":"2012-08-16T07:18:04.000Z","published_at":"2012-08-16T07:06:37.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\u003eBy now,\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\u003eProblem 901. Now!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e has not been solved without the use of cheats or hacks.\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/901-now\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/901-now\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\u003eThe goal of this Problem is to progressively design an anticheating test suite by learning from the solutions proposed by solvers of previous problems in the Now! series.\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":60451,"title":"switch base, again","description":"Before Dyuman Joshi kindly fixed it, the test suite for problem 60436 contained some syntax errors that made the problem unsolvable, so I took the liberty of fixing that. The task is the same as in that problem: given an integer in base  (passed as a character array), convert it to base .\r\n\r\nWhat's that you say? There are (well, were) other problems with the test suite of 60436 that I didn't fix here? Nah, can't be!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 146px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 73px; transform-origin: 407px 73px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 65px; 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 32.5px; text-align: left; transform-origin: 384px 32.5px; white-space-collapse: preserve; 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: 166px 8px; transform-origin: 166px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBefore Dyuman Joshi kindly fixed it, the test suite for \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60436-switch-base/\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 60436\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 170px 8px; transform-origin: 170px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e contained some syntax errors that made the problem unsolvable, so I took the liberty of fixing that. The task is the same as in that problem: given an integer in base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAAB+UlEQVRYR+2Wuy8FQRTG7+0lEiqVgoJEoUEhWhLRSTxq4lGIKEioRIFQKD2ilHj8B+hUF6WCgkaEihB6vi85JznZ7Oza2XU3kt3ky2zunTu/Od85Z+aWSzk+5RzZpQKei/v/xvYO2PMGPWRlU1TkvYCsQLVQiwBHMB5XA66MWwOvl+gz4f8m5xWQuqA7qDUTqiwSB6/DvFeZu4lxoZrwYcCOBNiH8ayacBbXEPQFNWaZbwYRZ/sz5jRIxIw80ycK3gTSvdCWMK5BU9AspK13ifcZ6NpnV1HwRSy4Kos2y3sPxgNJAdOhj1cLRsFPsTIPGrbYI/QOTZu8b+B9PuBMIgOi4N+y0gvGG2jUgPkVN8YN8tmDJhORMdkFty3GSm+Hgme6hXudAS74LmATMZZa28POAAawBc1BofeBC64tRsvbAnaru3rmsya6zRw6Mmg277yMwuC2xVy5tJazCHdMvnn1svX0TkgEZy9vy2KdslCwljTqE3xhO8DO84Jri7ks13qg3QMhhagb8IJ/4tc1UNgVqq7EgbmBxHDm60q2buG8Wg8h5pptte4owtS2EzAG9UNP0AfEv1IX0L6jBoI14RV52CK+nyW23RdURJ664LKyXg+iRCdcWjjbdRzSi4ktuwydB9sz7j9c2o1E/r6A/6m9rsUL23Ox/Qf0b3MpJeAg3QAAAABJRU5ErkJggg==\" width=\"15.5\" height=\"20\" style=\"width: 15.5px; height: 20px;\"\u003e\u003c/span\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: 28.75px 8px; transform-origin: 28.75px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (passed as a character array), convert it to base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAACUklEQVRYR+1WOyxEQRS1vURCpVJQkIhoUIhCQyI6iU+iEBKfQkRBQqlAqFQ+UUp8OiWFQuVTKigoiFD5hZ5z5N7NeG/mvX2b2d1I9iYn83bfvDn3nrn3zqRKCmipAnKXFMkLov6/kb0J8rwCd75kioq8AyQLQBlQK4T9GPfzQa4c1wZ5hUTvhT+TPT8DUwtwA9R5YZVF4sjLMe9F5q5inM0neR/I9oSwE+NxPsmZXL3AF1Dlc78ZRJzsT5hTKREzcq8WRV4Nplthm8e4BIwDU4CW3jmeJ4HLbLyKIp/DgouyaI08t2HckS3gdqhlVYJR5EdYmY2GJfYAvAMTxr6v4HkmoEwiAaLIv2WlZ4xXwIBBzFd0jA7StoCxRMyY7CI3S4yZ3ggEe7pJnlUPcJFvgmw0RlJTdrMH0PFpgF2R5kxKF7mWGCWvD8it6mrPZ060yhythjX8fgOGZXv4TahJ2cjNEnPtpSk5k3BDPKLTrAhzizRx2R3/9AobOb1fl8WaMdpqWKM+wHutADrUAwQTT/MndDDZyNVTl+SaD1ys25KIui06qkoZRf6Jr0oB2xGqqmRKTAf0G+2SaeeCkfOqdCFvTXIerbuSPCyrZUmwYJS23zycGgBNSic5X1CmEaALeAQ+AF6lToFtIEkf1+S1Hsdxp1omkUXN4S3oEOChFLJckjMxac62mytyJlk7YB5EeYmcxEOSM7znqzFp2T9Y97/mO3JtKGw+94FQB/GbPT997/dJzjI9AdgjbBZqWj7JHZzuv4vkiSXz8UFRdh8qJl7jB0XleSnAtkmnAAAAAElFTkSuQmCC\" width=\"15.5\" height=\"20\" style=\"width: 15.5px; height: 20px;\"\u003e\u003c/span\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; 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 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; 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 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; 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: 374px 8px; transform-origin: 374px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhat's that you say? There are (well, were) other problems with the test suite of 60436 that I didn't fix here? Nah, can't be!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = switchbase(in, b1, b2)\r\n    out = in;\r\nend","test_suite":"%%\r\nx = '6428367'; b1=10; b2 = 2;\r\ny_correct = '11000100001011011001111';\r\nassert(switchbase(x,b1,b2),y_correct)\r\n\r\n%%\r\nx = '6428367'; b1=9; b2 = 2;\r\ny_correct =  '1101001000110110000100';\r\nassert(switchbase(x,b1,b2),y_correct)\r\n\r\n%%\r\nx = '6428367'; b1=9; b2 = 7;\r\ny_correct =  '41163052';\r\nassert(switchbase(x,b1,b2),y_correct)\r\n\r\n%%\r\nfiletext = fileread('switchbase.m');\r\nassert(isempty(strfind(filetext, 'base'))\u0026isempty(strfind(filetext, 'dec')));\r\nassert(isempty(strfind(filetext, 'regexp')),'regexp() forbidden');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') ...\r\n    || contains(filetext, 'java') || contains(filetext, 'py'); \r\nassert(~illegal);\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":332395,"edited_by":332395,"edited_at":"2024-06-09T15:09:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-06-08T17:44:02.000Z","updated_at":"2024-06-09T15:09:56.000Z","published_at":"2024-06-08T17:44:11.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\u003eBefore Dyuman Joshi kindly fixed it, the test suite for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60436-switch-base/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 60436\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e contained some syntax errors that made the problem unsolvable, so I took the liberty of fixing that. The task is the same as in that problem: given an integer in base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb_1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e (passed as a character array), convert it to base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb_2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat's that you say? There are (well, were) other problems with the test suite of 60436 that I didn't fix here? Nah, can't be!\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":1776,"title":"Singularity v5 (with apologies to the true hack masters)","description":"Since the vast majority of recent problems are how to hack Cody, here's another one, with an even more malformed test suite than the original singularity.\r\n\r\nGood luck hacking this one.","description_html":"\u003cp\u003eSince the vast majority of recent problems are how to hack Cody, here's another one, with an even more malformed test suite than the original singularity.\u003c/p\u003e\u003cp\u003eGood luck hacking this one.\u003c/p\u003e","function_template":"function y = my_function(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx=1/; % oops\r\ny=2/; % double oops\r\nassert(isequal(not_my_function(x),y));\r\n%%\r\nx=1/; % oops\r\ny=2/; % double oops\r\nassert(isequal(my_function(x),y));\r\n%%\r\nforbidden = '(freepass)';\r\nassert(isempty(regexp(evalc('type my_function'),forbidden)));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":7,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":"2013-08-07T18:47:50.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-07T16:23:27.000Z","updated_at":"2025-01-16T05:26:08.000Z","published_at":"2013-08-07T16:23: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\",\"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\u003eSince the vast majority of recent problems are how to hack Cody, here's another one, with an even more malformed test suite than the original singularity.\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\u003eGood luck hacking this one.\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":59142,"title":"Calculate the sum of two numbers x and y v2","description":"This is inspired by the broken test suite of problem 59089. As in that problem, your task is simple: calculate the sum of two numbers x and y. The test suite is still broken, but I'm sure that this will pose no problem for you.","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: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 21px; transform-origin: 407px 21px; 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 21px; text-align: left; transform-origin: 384px 21px; 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=\"\"\u003eThis is inspired by the broken test suite of \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/59089\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 59089\u003c/span\u003e\u003c/span\u003e\u003c/a\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=\"\"\u003e. As in that problem, your task is simple: calculate the sum of two numbers x and y. The test suite is still broken, but I'm sure that this will pose no problem for you.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function z = your_fcn_name(x)\r\n    z = x + y;\r\nend","test_suite":"%%\r\nclearvars\r\nx = 2;\r\ny = 2;\r\nz_correct = 4;\r\nassert(isequal(y_correct,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 2;\r\ny = 2;\r\nz_correct = 4;\r\nassert(isequal(x+y,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 7;\r\ny = 5;\r\nz_correct = 12;\r\nassert(isequal(y_correct,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 7;\r\ny = 5;\r\nz_correct = 12;\r\nassert(isequal(x+y,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 178361837;\r\ny = -94928131;\r\nz_correct = 83433705;\r\nassert(isequal(y_correct,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 178361837;\r\ny = -94928131;\r\nz_correct = 83433705;\r\nassert(isequal(x+y,your_fcn_name(x)))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":332395,"edited_by":332395,"edited_at":"2023-11-04T10:24:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1,"test_suite_updated_at":"2023-11-04T10:24:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2023-11-04T09:11:49.000Z","updated_at":"2026-03-18T21:49:04.000Z","published_at":"2023-11-04T09:11:48.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eThis is inspired by the broken test suite of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/59089\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 59089\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. As in that problem, your task is simple: calculate the sum of two numbers x and y. The test suite is still broken, but I'm sure that this will pose no problem for you.\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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":537,"title":"Cody Computer Part 3 - Detect the graphic card used on Cody Computer","description":"In the Cody computer investigation party, you may have already solved :\r\nProblem 522. Cody Computer Part 1 - Guess the system font used by uipanel\r\nor\r\nProblem 536. Cody Computer Part 2 - Get the license number of Cody Computer\r\n*******************************************\r\nThis is the third problem to solve :\r\nYou have find the graphics card manufacturar used by the Cody Computer.\r\nExamples of manufacturar : NVidia, ATI, Zotac, ASUS ...","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.440000534057617px; 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; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 231px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eIn the Cody computer investigation party, you may have already solved :\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 522. Cody Computer Part 1 - Guess the system font used by uipanel\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eor\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003ca target='_blank' href = \"/#null\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eProblem 536. Cody Computer Part 2 - Get the license number of Cody Computer\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003e*******************************************\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eThis is the third problem to solve :\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eYou have find the\u003c/span\u003e\u003c/span\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; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\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; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003egraphics card manufacturar\u003c/span\u003e\u003c/span\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; \"\u003e\u003cspan style=\"\"\u003e used by the Cody Computer.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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; text-align: left; 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; \"\u003e\u003cspan style=\"\"\u003eExamples of manufacturar : NVidia, ATI, Zotac, ASUS ...\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = your_fcn_name\r\n  y = x;\r\nend","test_suite":"%% Which graphic card is used ?\r\n\r\nS = evalc('opengl info');\r\nS_lines = regexp(S, '  +', 'split');\r\nind = contains(S_lines, 'Vendor');\r\ny_correct = regexprep(S_lines{ind}, 'Vendor: ''([^''])+''.*', '$1');\r\nassert(isequal(your_fcn_name, y_correct))\r\n\r\n%% prevents cheating 14-June-2012\r\nfiletext = fileread('your_fcn_name.m');\r\nassert(isempty(strfind(filetext, 'Brian Paul')))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":639,"edited_by":26769,"edited_at":"2023-02-24T22:26:25.000Z","deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2023-02-24T22:26:25.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-30T08:32:22.000Z","updated_at":"2026-03-04T16:12:59.000Z","published_at":"2012-03-30T08:32:22.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eIn the Cody computer investigation party, you may have already solved :\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:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 522. Cody Computer Part 1 - Guess the system font used by uipanel\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eor\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:hyperlink w:docLocation=\\\"\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eProblem 536. Cody Computer Part 2 - Get the license number of Cody Computer\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis is the third problem to solve :\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\u003eYou have find 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003egraphics card manufacturar\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e used by the Cody Computer.\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\u003eExamples of manufacturar : NVidia, ATI, Zotac, ASUS ...\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":1774,"title":"Free passes for everyone!","description":"_Simply return the name of the coolest numerical computation software ever_\r\n\r\n*Extra reward* (get a _freepass_):\r\n\r\nOnce a month, as an additional reward for solving this problem, you may get a temporary freepass *to solve any other Cody problem*. To use this freepass follow these steps:\r\n\r\n# First, at the beginning of a new month, solve this problem correctly\r\n# Then immediately visit the Cody problem that you wish to solve, click 'Solve this now', and enter within the function body of your solution the line: \r\n\r\n freepass.please;\r\n\r\nand Cody _may_ accept that solution as correct. \r\n\r\nYou will typically need to repeat step (2) above multiple times until Cody _does_ accept your solution as correct. If you are getting an error message saying _Undefined variable \"freepass\" or class \"freepass.please\"_ simply continue repeating step 2 until you pass the problem and get a message saying _freepass granted, congratulations!_. \r\n\r\n*Fineprint*:\r\n\r\n1) For each Cody player, this problem will grant a new freepass per day until one is successfully used to pass a different Cody problem. Once this happens this problem will only grant the same Cody player a new freepass the next Calendar month.  \r\n\r\n2) _How many times do I need to submit a freepass.please solution to a different Cody problem for it to pass?_ Short answer: around 10, but perhaps as many as 30 times (your faith may be tested, but perseverance will be rewarded at the end :)  \r\n\r\nLong answer: at any given time, Cody has many servers running players' solutions (perhaps around 20 servers?). Every time that you solve this problem a _freepass_ is issued only for the particular server where your solution was evaluated. When you run a _freepass.please_ solution, if that solution is run in the same server where a freepass was issued your solution will pass, otherwise you will get an \"_undefined variable freepass_\" error. So in order for your solution to pass you simply need to keep resubmitting it until you finally hit the same server where your freepass-problem solution was originally evaluated. Also note that, from time to time, Cody will close a server and start a new one. If that happens any freepass stored in that server will be lost (and you will need to try again steps 1 and 2 above next day)\r\n\r\n3) Your correct solution will get a score of 100 (this is typically high enough so that we do not troll the score lead with these freepasses)\r\n\r\n4) Feel free to explore this problem testsuite to see how this works, but please respect some basic courtesy guidelines if you decide to implement your own (e.g. the service does not interfere with the normal Cody operation; it cleans up after itself; don't use it to get a leading score; etc.)  Comments and suggestions for improvement are appreciated!\r\n\r\n5) This _freepass_ service is 'likeware'. Please 'like' this problem if you liked the code or enjoy using your freepasses :)\r\n","description_html":"\u003cp\u003e\u003ci\u003eSimply return the name of the coolest numerical computation software ever\u003c/i\u003e\u003c/p\u003e\u003cp\u003e\u003cb\u003eExtra reward\u003c/b\u003e (get a \u003ci\u003efreepass\u003c/i\u003e):\u003c/p\u003e\u003cp\u003eOnce a month, as an additional reward for solving this problem, you may get a temporary freepass \u003cb\u003eto solve any other Cody problem\u003c/b\u003e. To use this freepass follow these steps:\u003c/p\u003e\u003col\u003e\u003cli\u003eFirst, at the beginning of a new month, solve this problem correctly\u003c/li\u003e\u003cli\u003eThen immediately visit the Cody problem that you wish to solve, click 'Solve this now', and enter within the function body of your solution the line:\u003c/li\u003e\u003c/ol\u003e\u003cpre\u003e freepass.please;\u003c/pre\u003e\u003cp\u003eand Cody \u003ci\u003emay\u003c/i\u003e accept that solution as correct.\u003c/p\u003e\u003cp\u003eYou will typically need to repeat step (2) above multiple times until Cody \u003ci\u003edoes\u003c/i\u003e accept your solution as correct. If you are getting an error message saying \u003ci\u003eUndefined variable \"freepass\" or class \"freepass.please\"\u003c/i\u003e simply continue repeating step 2 until you pass the problem and get a message saying \u003ci\u003efreepass granted, congratulations!\u003c/i\u003e.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFineprint\u003c/b\u003e:\u003c/p\u003e\u003cp\u003e1) For each Cody player, this problem will grant a new freepass per day until one is successfully used to pass a different Cody problem. Once this happens this problem will only grant the same Cody player a new freepass the next Calendar month.\u003c/p\u003e\u003cp\u003e2) \u003ci\u003eHow many times do I need to submit a freepass.please solution to a different Cody problem for it to pass?\u003c/i\u003e Short answer: around 10, but perhaps as many as 30 times (your faith may be tested, but perseverance will be rewarded at the end :)\u003c/p\u003e\u003cp\u003eLong answer: at any given time, Cody has many servers running players' solutions (perhaps around 20 servers?). Every time that you solve this problem a \u003ci\u003efreepass\u003c/i\u003e is issued only for the particular server where your solution was evaluated. When you run a \u003ci\u003efreepass.please\u003c/i\u003e solution, if that solution is run in the same server where a freepass was issued your solution will pass, otherwise you will get an \"_undefined variable freepass_\" error. So in order for your solution to pass you simply need to keep resubmitting it until you finally hit the same server where your freepass-problem solution was originally evaluated. Also note that, from time to time, Cody will close a server and start a new one. If that happens any freepass stored in that server will be lost (and you will need to try again steps 1 and 2 above next day)\u003c/p\u003e\u003cp\u003e3) Your correct solution will get a score of 100 (this is typically high enough so that we do not troll the score lead with these freepasses)\u003c/p\u003e\u003cp\u003e4) Feel free to explore this problem testsuite to see how this works, but please respect some basic courtesy guidelines if you decide to implement your own (e.g. the service does not interfere with the normal Cody operation; it cleans up after itself; don't use it to get a leading score; etc.)  Comments and suggestions for improvement are appreciated!\u003c/p\u003e\u003cp\u003e5) This \u003ci\u003efreepass\u003c/i\u003e service is 'likeware'. Please 'like' this problem if you liked the code or enjoy using your freepasses :)\u003c/p\u003e","function_template":"function y = myfunction()\r\n  y = 'mmm...';\r\nend","test_suite":"%%\r\nif strcmpi(myfunction(),'matlab')\r\n if isempty(which('freepass')),\r\n  fh=fopen('freepass_system.p','wb');\r\n  fwrite(fh,uint8(sscanf('7630312E30307630302E3030000A101CBC6EDFB1000000E3000005F30000097C16D96804352FE98DD24AC0CF78D05A46EB3BA144303F54379A8622E060F96AD31BA819796EF843D2B5A203AB63481C90679596B80A480D4D3D75BEF8E968330277757DBC07DEDE4552F29944A7E60F736862BD148B85D7195AB9078A8D23D0649B53B58A0E99919D616972465982E71AEC4AC18B74C952CF140A1386FB25F4A706BE326CDA10068E267864FE898B79C4B8A0C53B342F6007727CB1FBD1408B3D10B92C3CF7EF87A5FD488524F5735EE3D954A4C0DA662887A6953DD56712E278BD32681CA13EE9BD447626191097A15737A82CAB411732609720D35181AC240D6011AC24EA5EE2A00FF557831609A6252A1C61CFDCA40BE6E908B01ABEC50AEEEF38C36D22528C3506FB3777675806BC12E98E0C741DAEE477077DF0FC1338206205146B558BD41AE55D9AB8425426F52DB1115FFD2DAD867A94E377DC041A0868437742180F4B835487C8A9D237DF1F3AF1E5521E88B54C949CB19AE77C96F9BBB663761E15D9A9437C2DB20BA20C545E484691129D8964615FF08CE57D009B0BD6CB7995DEC39574CC39FCD5CEC940F06158AEAC8809306E3DE67F2C0BD6B025D9F6D13657027C9D0EC469EDCC064A0C96A56366C8100882DE2261AABB24E52D20F2230493799721942349EA9671A82A6340FE1FDC3426C42773CF22DEA4A4894FFA493CFDEBE34578213F94F9D304519081F5AB88C7AA36100089EAD88B3349CD9A949A20EE6EDC557DCC4E53FC981A30D4D4BB2F7BC536CBBA13D3AD79BA784DC2609B452154BED25FF25188A8D0AFF72DF0E4A9AA503341B3500E747390E5CC4C1F62306C596DE096A171944244619C7B7DCCB88CAC4D3D6592D6783A5BB6815245D154D422594EA5137383CE944CBEFFA1CE7EDA769289AB48A1ABB68D2E2FFD75AC03D89E5DC3497D127447EAC9BD3B30A48FB2DF7F3155CB9DB801AF4C02DBFD67B07B1C3A109B8F372E14AB8439DC15381BBFD727EAD3D21BAD3A695A96916C63070111041AF243AEA88C736E36A9949425C7E7B2F0CF8F8A317690FE458108FDB88B9E8B94B1B6F85D401D04DAA4B7EBAA5945CBC0832A7C87DA2481B6C9796ECFE855CB03496A58B294A07F846038153D10206DC484F68843B328E883091BD9A32DE92E67A72F5FE499B3A9BF7931FDB02079D85628C6177D66244BD1EA2F217178F830045E0E235CF19B8305C15222FB55BE3D7C0B6DA203CD0CDB7DC419FF11D6CEBA150EC517EFD917F1A75EF33207FB0582F54163C08E5D1BAE47532668AAC257E41C673BB0F177F958C26CC923C78790199B4848A91889CADF247B8EBDC53ECFAF31F855A20674E45B1FFC3BCE4AB747C3CD41FAAEC532D2AD80AE72DFCD71034C473B2D4F1DC916D7D53832181A3834B773877B9790C75460BD7F003D52C31AFB11CFC98069E6DFEF01BC9879304E2DE899D329BB6C27BD2DDDF257DCC8DD2236ED6C944396147BE0DC33835F136555070E7E3FD9938D4771835D71D26038D730C64C9C9547F8DADB033D7927291B48B61EF407950EC5338FA84AA5423FE6F6A8F967312B215B7C60F10CE0D67BF7D1E533588C6BCBAE05BB7A5ED6E4B54AF670055D7D7D39BA9653D3FC74CD3AEE7ACE4CDE7E663B2C8882B7D2F5E5A3B59B0D647E919BC80C2F7F5448E1D4E2408AC0C8C9E5861B000B3456F5524946C8F6272B283DC801BD0F63A70BA3DD601E9711717E01F2E9774EC684B01F030A12A5139D94B99EFBDCE365A23C0CDC197AC640C76F5B51697802DB7A5EC8DAD8D483D8DCED82C6A70EA1752C6246003CC678D6820CD06A8700C335B702ADB0611AD824EF0F57196D53340DD1F3E125AEC6858B273FD6B8F42E23A98EE35783EC494E93798E4ABA04487F7025F91A390DEDEB63E3F565A6588C384E5D8AD11AB821EEAF4CCBEA33151B7EFDB181A0AA6393BE60DC5E6D3FF1DDAF496B0E169AB3052A5079BB8D372AC79186C79EE8E0E8EFFF604FD371072A3082420FA87D52E12D2A18F5672626CD8AC18DF2E84F201A9ABB1D082C865382C842B81964E81C2DA252269A66FAAF398D096B30323DF49CD4FAD57001D36B77C265320F125B56E951A652528BF7250D2100E907F51DF39F50D660C2C4A4D6232945926A0A2A614DD4F52B4FAB1802BDAAFE62C446','%2X')));\r\n  fclose(fh);\r\n  ok=freepass_system();\r\n  if ok\r\n      [nill,name]=system('hostname');\r\n      fprintf('A new freepass was issued at server %s\\n',name);\r\n  else\r\n      fprintf('Sorry, it was not possible to issue a new freepass\\n');\r\n  end\r\n else\r\n  [nill,name]=system('hostname');\r\n  fprintf('An existing freepass was already available at server %s\\n',name);\r\n end\r\nelse\r\n  assert(false);\r\nend\r\n","published":true,"deleted":false,"likes_count":67,"comments_count":22,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":764,"test_suite_updated_at":"2017-10-29T03:47:26.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-04T07:42:38.000Z","updated_at":"2026-03-29T19:47:31.000Z","published_at":"2013-08-05T05:29:02.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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSimply return the name of the coolest numerical computation software ever\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\u003eExtra reward\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (get a\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\u003efreepass\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003eOnce a month, as an additional reward for solving this problem, you may get a temporary freepass\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\u003eto solve any other Cody problem\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. To use this freepass follow these steps:\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eFirst, at the beginning of a new month, solve this problem correctly\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=\\\"2\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThen immediately visit the Cody problem that you wish to solve, click 'Solve this now', and enter within the function body of your solution 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[ freepass.please;]]\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\u003eand Cody\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\u003emay\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e accept that solution as correct.\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\u003eYou will typically need to repeat step (2) above multiple times until Cody\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\u003edoes\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e accept your solution as correct. If you are getting an error message saying\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\u003eUndefined variable \\\"freepass\\\" or class \\\"freepass.please\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e simply continue repeating step 2 until you pass the problem and get a message saying\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\u003efreepass granted, congratulations!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFineprint\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003e1) For each Cody player, this problem will grant a new freepass per day until one is successfully used to pass a different Cody problem. Once this happens this problem will only grant the same Cody player a new freepass the next Calendar month.\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\u003e2)\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\u003eHow many times do I need to submit a freepass.please solution to a different Cody problem for it to pass?\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Short answer: around 10, but perhaps as many as 30 times (your faith may be tested, but perseverance will be rewarded at the end :)\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\u003eLong answer: at any given time, Cody has many servers running players' solutions (perhaps around 20 servers?). Every time that you solve this problem a\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\u003efreepass\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is issued only for the particular server where your solution was evaluated. When you run a\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\u003efreepass.please\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e solution, if that solution is run in the same server where a freepass was issued your solution will pass, otherwise you will get an \\\"_undefined variable freepass_\\\" error. So in order for your solution to pass you simply need to keep resubmitting it until you finally hit the same server where your freepass-problem solution was originally evaluated. Also note that, from time to time, Cody will close a server and start a new one. If that happens any freepass stored in that server will be lost (and you will need to try again steps 1 and 2 above next day)\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\u003e3) Your correct solution will get a score of 100 (this is typically high enough so that we do not troll the score lead with these freepasses)\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\u003e4) Feel free to explore this problem testsuite to see how this works, but please respect some basic courtesy guidelines if you decide to implement your own (e.g. the service does not interfere with the normal Cody operation; it cleans up after itself; don't use it to get a leading score; etc.) Comments and suggestions for improvement are appreciated!\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\u003e5) This\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\u003efreepass\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e service is 'likeware'. Please 'like' this problem if you liked the code or enjoy using your freepasses :)\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":2033,"title":"poll: would you like the regexp (?@cmd) functionality to be banned in Cody?","description":"This problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\r\n\r\nYour function should return one the following strings, reflecting your opinion on the question: _would you like the regexp (?@cmd) functionality to be banned in Cody?_\r\n\r\n 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\r\n\r\n_note1_: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are _really_ interested in getting a low score-, just return an empty string (and you will get a 0 score). \r\n\r\n_note2_: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like _regexp_ to be banned entirely)\r\n\r\n\r\n*Description:*\r\n\r\nThe syntax:\r\n\r\n regexp '' '(?@a=1)'\r\n\r\nis equivalent to\r\n\r\n eval 'a=1'\r\n\r\nHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function _eval_ is banned in Cody, the function _regexp_ is too useful to be banned entirely, so it is not uncommon to see the leading solution to _many_ Cody problems using this regexp trick. \r\n\r\nThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of _regexp_. This poll asks your opinion about having such a ban in Cody.\r\n\r\n*Hacktivism*:\r\n\r\nThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) *in all of Cody* (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\r\n\r\n* If you answer _'Yes!'_ to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\r\n* If you answer _'No!'_ to this problem, one Cody server will start accepting them again. \r\n* all other answers will have no effect\r\n\r\nThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior). \r\n\r\nThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments. \r\n\r\n\r\n","description_html":"\u003cp\u003eThis problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\u003c/p\u003e\u003cp\u003eYour function should return one the following strings, reflecting your opinion on the question: \u003ci\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\u003c/i\u003e\u003c/p\u003e\u003cpre\u003e 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\u003c/pre\u003e\u003cp\u003e\u003ci\u003enote1\u003c/i\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are \u003ci\u003ereally\u003c/i\u003e interested in getting a low score-, just return an empty string (and you will get a 0 score).\u003c/p\u003e\u003cp\u003e\u003ci\u003enote2\u003c/i\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like \u003ci\u003eregexp\u003c/i\u003e to be banned entirely)\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe syntax:\u003c/p\u003e\u003cpre\u003e regexp '' '(?@a=1)'\u003c/pre\u003e\u003cp\u003eis equivalent to\u003c/p\u003e\u003cpre\u003e eval 'a=1'\u003c/pre\u003e\u003cp\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function \u003ci\u003eeval\u003c/i\u003e is banned in Cody, the function \u003ci\u003eregexp\u003c/i\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to \u003ci\u003emany\u003c/i\u003e Cody problems using this regexp trick.\u003c/p\u003e\u003cp\u003eThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of \u003ci\u003eregexp\u003c/i\u003e. This poll asks your opinion about having such a ban in Cody.\u003c/p\u003e\u003cp\u003e\u003cb\u003eHacktivism\u003c/b\u003e:\u003c/p\u003e\u003cp\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) \u003cb\u003ein all of Cody\u003c/b\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\u003c/p\u003e\u003cul\u003e\u003cli\u003eIf you answer \u003ci\u003e'Yes!'\u003c/i\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\u003c/li\u003e\u003cli\u003eIf you answer \u003ci\u003e'No!'\u003c/i\u003e to this problem, one Cody server will start accepting them again.\u003c/li\u003e\u003cli\u003eall other answers will have no effect\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\u003c/p\u003e\u003cp\u003eThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\u003c/p\u003e","function_template":"function str = poll()\r\nstr='my answer here';\r\n","test_suite":"%%\r\nstr=lower(poll());\r\n\r\nhack=0;\r\nscore=0;\r\n\r\nurlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0\u0026amp;d=1','SetSolutionScore.p');\r\nrehash path;\r\nswitch(str)\r\n  case 'no!', score=10;\r\n              hack=-1;\r\n  case 'no',  score=20;\r\n  case 'yes', score=30;\r\n  case 'yes!',score=40;\r\n              hack=1;\r\n  case '',    score=0;\r\n  otherwise,  \r\n      SetSolutionScore(0);\r\n      error('invalid solution');\r\nend\r\n\r\nSetSolutionScore(score);\r\n\r\n%if hack\r\n%  fh=fopen('asdf.p','wb'); fwrite(fh,[118 48 49 46 48 48 118 48 48 46 48 48 0 4 0 28 154 107 31 177 0 0 0 79 0 0 1 255 0 0 3 79 250 185 0 222 180 196 9 29 54 132 115 76 42 58 188 85 208 131 52 187 11 160 211 160 160 107 222 166 232 59 110 73 127 242 0 54 149 190 210 0 38 117 103 179 65 203 228 83 224 2 150 151 38 122 55 238 232 171 233 151 102 193 222 74 46 198 41 228 114 90 129 180 172 149 185 146 193 17 12 26 201 179 52 236 177 85 180 64 130 117 72 220 203 218 39 244 243 252 156 77 153 69 233 183 179 204 198 45 244 218 199 30 152 162 138 236 85 96 179 38 157 145 12 0 48 243 249 122 247 238 127 255 136 196 6 204 168 56 244 204 150 63 201 39 50 107 99 97 251 144 153 221 88 245 10 5 238 170 211 157 37 132 229 51 122 254 84 170 130 243 37 204 187 149 130 204 35 143 177 161 191 150 75 30 145 130 120 192 227 58 131 14 183 43 107 78 228 86 58 237 229 157 75 116 70 163 25 15 116 59 171 178 206 73 134 209 99 60 164 16 143 149 195 138 215 200 81 19 236 253 102 12 141 130 16 48 105 32 222 181 172 220 14 106 206 24 150 193 21 153 65 189 73 66 203 138 72 112 20 226 186 184 66 91 158 180 204 118 221 174 128 21 82 43 169 156 236 191 51 154 40 159 246 195 225 123 15 99 180 187 84 101 57 132 214 102 39 29 127 99 21 117 123 112 169 29 165 118 139 171 193 210 80 138 161 71 176 34 219 208 187 54 229 93 247 144 145 90 237 7 178 7 226 35 121 170 150 158 72 186 96 229 157 90 146 179 130 73 139 2 77 81 29 132 253 191 197 103 180 186 83 68 25 58 144 87 28 101 209 69 141 189 63 217 0 144 171 108 151 163 73 142 31 184 154 6 195 9 109 187 42 177 120 188 254 102 27 250 172 1 7 186 247 32 24 209 104 195 245 252 72 87 77 191 217 58 73 9 74 164 93 216 178 141 48 245 193 189 242 186 248 92 238 15 131 67 133 87 173 86 193 78 233 192 108 45 46 160 164 57 10 169 15 65 66 151 118 16 245 241 15 187 195 222 98 155 213 180 77 89 168 145 180 134 153 247 66 52 141 168 34 18 3 215 10 106 250 255 89 252 79 17 52 96 27 197 3 161 140 245 17 181 116 29 189 83 184 57 241 24 242], 'uint8'); fclose(fh); rehash path; \r\n%  asdf(hack);\r\n%end\r\n","published":true,"deleted":false,"likes_count":20,"comments_count":8,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":181,"test_suite_updated_at":"2017-10-27T02:58:23.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-12-05T05:50:23.000Z","updated_at":"2026-03-16T12:11:25.000Z","published_at":"2013-12-06T05:09:28.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\u003eThis problem is a poll (and a little bit of \\\"white hat hacktivism\\\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody 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\u003eYour function should return one the following strings, reflecting your opinion on the question:\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\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\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[ 'no!'\\n 'no'\\n 'yes'\\n 'yes!']]\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are\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\u003ereally\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e interested in getting a low score-, just return an empty string (and you will get a 0 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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like\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\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be banned entirely)\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\u003eDescription:\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 syntax:\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[ regexp '' '(?@a=1)']]\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\u003eis equivalent to\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[ eval 'a=1']]\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\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function\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\u003eeval\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is banned in Cody, the function\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\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to\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\u003emany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cody problems using this regexp trick.\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 are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of\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\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. This poll asks your opinion about having such a ban in Cody.\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\u003eHacktivism\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd)\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\u003ein all of Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\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\u003eIf you answer\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\u003e'Yes!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\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\u003eIf you answer\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\u003e'No!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will start accepting them again.\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\u003eall other answers will have no effect\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 are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \\\"hack\\\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\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 allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\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":1743,"title":"What? Paradox?","description":"What's going on here?","description_html":"\u003cp\u003eWhat's going on here?\u003c/p\u003e","function_template":"function y = what()\r\n  y = rand(1, 12345);\r\nend","test_suite":"%%\r\nassert(isequal(true, false))\r\n\r\nwhat()","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":"2013-07-23T19:54:12.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-23T19:53:42.000Z","updated_at":"2025-05-04T07:06:11.000Z","published_at":"2013-07-23T19:53:51.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\u003eWhat's going on here?\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":901,"title":"Now!","description":"I said now!","description_html":"\u003cp\u003eI said now!\u003c/p\u003e","function_template":"function ans = ISaidNow\r\n   now;\r\nend","test_suite":"%%\r\nISaidNow;\r\n[~]=fft(rand(1,1000000));\r\nassert(isequal(ans,now))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":"2012-08-11T02:54:08.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-11T02:42:22.000Z","updated_at":"2026-03-27T16:48:36.000Z","published_at":"2012-08-11T02:42:24.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\u003eI said now!\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":1746,"title":"Get me! v2","description":"Exploiting cody v2","description_html":"\u003cp\u003eExploiting cody v2\u003c/p\u003e","function_template":"function y = get_me()\r\n  y = 42; % The Answer to The Great Question of Life, The Universe, and Everything\r\nend","test_suite":"%%\r\n\r\nvariable = 2;\r\nget_me()\r\n\r\n\r\nwhile variable ~= 1\r\nend\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":22,"test_suite_updated_at":"2013-07-24T03:40:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-24T03:09:01.000Z","updated_at":"2026-01-17T12:28:21.000Z","published_at":"2013-07-24T03:09:01.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\u003eExploiting cody v2\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":44348,"title":"Seemingly impossible problem","description":"This is a _seemingly_ 'impossible' problem, because variously your function, \"impossibleFn\", must return an output of either 1 or 2 or 3 for the same input (0, the number zero).  \r\nWhy is this described as \"seemingly impossible\"?  Because it does not satisfy the _mathematical_ definition of a function.  \r\nYet there is still _at least_ one way to pass all the tests! \r\n(One simple code has been verified to work.  However, all's fair in this problem, so try whichever hacks and workarounds are at your disposal.)\r\nUPDATE:  Now _more than three_ (unrelated) approaches have been verified to pass all the tests.  ","description_html":"\u003cp\u003eThis is a \u003ci\u003eseemingly\u003c/i\u003e 'impossible' problem, because variously your function, \"impossibleFn\", must return an output of either 1 or 2 or 3 for the same input (0, the number zero).  \r\nWhy is this described as \"seemingly impossible\"?  Because it does not satisfy the \u003ci\u003emathematical\u003c/i\u003e definition of a function.  \r\nYet there is still \u003ci\u003eat least\u003c/i\u003e one way to pass all the tests! \r\n(One simple code has been verified to work.  However, all's fair in this problem, so try whichever hacks and workarounds are at your disposal.)\r\nUPDATE:  Now \u003ci\u003emore than three\u003c/i\u003e (unrelated) approaches have been verified to pass all the tests.\u003c/p\u003e","function_template":"function y = impossibleFn(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 0;\r\ny_correct = 1;\r\nassert(isequal(impossibleFn(x),y_correct))\r\n\r\n%%\r\nx = 0;\r\ny_correct = 2;\r\nassert(isequal(impossibleFn(x),y_correct))\r\n\r\n%%\r\nx = 0;\r\ny_correct = 3;\r\nassert(isequal(impossibleFn(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":3,"created_by":64439,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2017-09-26T13:32:36.000Z","updated_at":"2025-11-27T03:32:50.000Z","published_at":"2017-09-26T13:52:52.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\u003eThis is a\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\u003eseemingly\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e 'impossible' problem, because variously your function, \\\"impossibleFn\\\", must return an output of either 1 or 2 or 3 for the same input (0, the number zero). Why is this described as \\\"seemingly impossible\\\"? Because it does not satisfy 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\u003emathematical\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e definition of a function. Yet there is still\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\u003eat least\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e one way to pass all the tests! (One simple code has been verified to work. However, all's fair in this problem, so try whichever hacks and workarounds are at your disposal.) UPDATE: Now\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\u003emore than three\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (unrelated) approaches have been verified to pass all the tests.\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\"}]}"},{"id":910,"title":"Fix y_correct : Hack","description":"The Test Suite has an error.\r\n\r\nFix the y_correct value.\r\n\r\n(See the tags for hints)","description_html":"\u003cp\u003eThe Test Suite has an error.\u003c/p\u003e\u003cp\u003eFix the y_correct value.\u003c/p\u003e\u003cp\u003e(See the tags for hints)\u003c/p\u003e","function_template":"function y=fix_y_correct\r\n y=2; \r\nend","test_suite":"%%\r\nx = 1;\r\ny_correct = 1;\r\nx=fix_y_correct;\r\ny_correct\r\nassert(isequal(y_correct,2),sprintf('Expected 2, y_correct=%i\\n',y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-14T02:48:14.000Z","updated_at":"2025-12-18T12:08:41.000Z","published_at":"2012-08-14T03:06:18.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\u003eThe Test Suite has an error.\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\u003eFix the y_correct value.\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\u003e(See the tags for hints)\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":44390,"title":"Test your luck!","description":"This problem is designed to test your luck, and therefore the contents of your function are irrelevant. In order to do so, the test suit will run your function (it is your function and therefore it has your luck) and check the time. If the last two digits of the time in milliseconds are lesser than 20 (0-19), your function will be considered to have succeeded, otherwise it will be considered to have failed. This procees is repeated 200 times, and if your function succeeds all tests, you will have solved the problem, thus proving you are incredibly lucky!\r\n\r\n*Note:* If you noticed, the probability of solving the problem (assuming the time is completely random) is 5^-200, in honor of the 5th anniversay of Cody.","description_html":"\u003cp\u003eThis problem is designed to test your luck, and therefore the contents of your function are irrelevant. In order to do so, the test suit will run your function (it is your function and therefore it has your luck) and check the time. If the last two digits of the time in milliseconds are lesser than 20 (0-19), your function will be considered to have succeeded, otherwise it will be considered to have failed. This procees is repeated 200 times, and if your function succeeds all tests, you will have solved the problem, thus proving you are incredibly lucky!\u003c/p\u003e\u003cp\u003e\u003cb\u003eNote:\u003c/b\u003e If you noticed, the probability of solving the problem (assuming the time is completely random) is 5^-200, in honor of the 5th anniversay of Cody.\u003c/p\u003e","function_template":"function y = lucky(x)\r\n  % \"Hay algunos que nacen con estrella y otros estrellados, y aunque tú no lo quieras creer, yo soy de las estrelladísimas...\" - Frida Kahlo.\r\nend","test_suite":"%%\r\nassessFunctionAbsence({'horzcat','vertcat','char','tic','toc','delete','str2num','fopen','regexp','regexpi','regexprep','rng','assert','!','system','unix','figure','fileread'},'FileName','lucky.m');\r\n\r\n%%\r\nfid=fopen('lucky.m','r','n','US-ASCII');\r\nstr=fread(fid,'*char').';\r\nassert(length(str)\u003c25000);\r\nassert(isempty(regexp(str,'[\\r\\n;, ]+!')));\r\n\r\n%%\r\nlucky([]);\r\nfid=fopen('luckyTest.p','Wb');\r\nfwrite(fid,str2num(['[118 48 48 46 48 48 118 48 48 46 48 48 0 4 144 28 164 79 31'...\r\n    ' 181 0 0 0 75 0 0 0 144 0 0 0 190 141 122 182 196 246 214 83 209 188 114 221'...\r\n    ' 133 197 147 17 234 99 73 193 98 152 38 155 52 251 250 28 66 253 209 9 177 '...\r\n    '255 155 78 197 239 82 48 145 6 26 125 43 176 171 165 121 249 19 63 213 105 '...\r\n    '31 179 114 39 113 75 207 16 200 133 180 56 143 164 251 173 46 7 63 221 205 '...\r\n    '208 233 113 250 244 105 142 107 211 121 250 246 7 146 101 152 113 160 185 '...\r\n    '186 57 18 151 224 103 224 196 10 188 214 232 173 15 223 141 230 78 165 31 '...\r\n    '65 133 137 11 60 123 144 67 140 64 2 39 104 204 118 88 116 109 185 202 231 '...\r\n    '219 254 45 0 146 24 47 74 201 124]']));\r\nfclose(fid);\r\nluckyTest();","published":true,"deleted":false,"likes_count":0,"comments_count":2,"created_by":54457,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":10,"test_suite_updated_at":"2020-04-26T02:00:07.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2017-10-23T02:05:39.000Z","updated_at":"2025-07-13T03:09:45.000Z","published_at":"2017-10-23T02:09:45.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\u003eThis problem is designed to test your luck, and therefore the contents of your function are irrelevant. In order to do so, the test suit will run your function (it is your function and therefore it has your luck) and check the time. If the last two digits of the time in milliseconds are lesser than 20 (0-19), your function will be considered to have succeeded, otherwise it will be considered to have failed. This procees is repeated 200 times, and if your function succeeds all tests, you will have solved the problem, thus proving you are incredibly lucky!\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:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e If you noticed, the probability of solving the problem (assuming the time is completely random) is 5^-200, in honor of the 5th anniversay of Cody.\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":1769,"title":"singularity 2.0 (easier)","description":"If you have been in Cody long enough you have probably run across some badly constructed problems and test suites. \r\n\r\nThis problem represents a particularly difficult scenario. Yet, it is possible to solve it. Do you know how?\r\n\r\n*Description:*\r\n\r\nThis is this problem's testsuite:\r\n\r\n %%\r\n y=myfunction();\r\n x=1/[]; % oops...\r\n assert(isequal(x,y));\r\n\r\nAs you may notice, the second line is not a proper division, so the testsuite will break at that point, and will return an error message:\r\n\r\n|??? Error using  mrdivide Matrix dimensions must agree.|\r\n\r\nTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Perhaps it is possible to do the same here to avoid this error from happening?\r\n\r\nNext problems in this series: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder Singularity 2.0 (harder)\u003e; \r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0 Singularity 2.0 (really hard)\u003e","description_html":"\u003cp\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\u003c/p\u003e\u003cp\u003eThis problem represents a particularly difficult scenario. Yet, it is possible to solve it. Do you know how?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is this problem's testsuite:\u003c/p\u003e\u003cpre\u003e %%\r\n y=myfunction();\r\n x=1/[]; % oops...\r\n assert(isequal(x,y));\u003c/pre\u003e\u003cp\u003eAs you may notice, the second line is not a proper division, so the testsuite will break at that point, and will return an error message:\u003c/p\u003e\u003cp\u003e\u003ctt\u003e??? Error using  mrdivide Matrix dimensions must agree.\u003c/tt\u003e\u003c/p\u003e\u003cp\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Perhaps it is possible to do the same here to avoid this error from happening?\u003c/p\u003e\u003cp\u003eNext problems in this series: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder\"\u003eSingularity 2.0 (harder)\u003c/a\u003e;  \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0\"\u003eSingularity 2.0 (really hard)\u003c/a\u003e\u003c/p\u003e","function_template":"function y = myfunction()\r\n  y = 1;\r\nend","test_suite":"%%\r\ny=myfunction();\r\nx=1/[]; % oops...;\r\nassert(isequal(x,y))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-02T04:20:08.000Z","updated_at":"2026-03-11T10:15:52.000Z","published_at":"2013-08-02T09:43:12.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\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\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 problem represents a particularly difficult scenario. Yet, it is possible to solve it. Do you know how?\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\u003eDescription:\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 is this problem's testsuite:\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[ y=myfunction();\\n x=1/[]; % oops...\\n assert(isequal(x,y));]]\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\u003eAs you may notice, the second line is not a proper division, so the testsuite will break at that point, and will return an error message:\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e??? Error using mrdivide Matrix dimensions must agree.\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\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Perhaps it is possible to do the same here to avoid this error from happening?\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\u003eNext problems in this series:\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/1770-singularity-2-0-harder\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (harder)\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (really hard)\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":363,"title":"magic solver","description":"Create a function that returns _true_ and has a cody \u003chttp://www.mathworks.com/matlabcentral/cody/problems/256-return-the-size-of-a-string-of-code \"size\"\u003e of 0.\r\n\r\n","description_html":"\u003cp\u003eCreate a function that returns \u003ci\u003etrue\u003c/i\u003e and has a cody \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/256-return-the-size-of-a-string-of-code\"\u003e\"size\"\u003c/a\u003e of 0.\u003c/p\u003e","function_template":"function y = magicsolver()\r\n  y = true;\r\nend","test_suite":"%%\r\nassert(isequal(magicsolver,true)\u0026~mtree('magicsolver.m','-file').count)\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2012-02-20T05:48:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-20T05:48:14.000Z","updated_at":"2025-12-18T11:21:05.000Z","published_at":"2012-02-20T06:12:04.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\u003eCreate a function that returns\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\u003etrue\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and has a cody\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/256-return-the-size-of-a-string-of-code\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\\\"size\\\"\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e of 0.\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":1745,"title":"Get me!","description":"Inspired by Now! problems.\r\n\r\nDo your best!","description_html":"\u003cp\u003eInspired by Now! problems.\u003c/p\u003e\u003cp\u003eDo your best!\u003c/p\u003e","function_template":"function y = me()\r\n  y = 1;\r\nend","test_suite":"%%\r\nget = me();\r\n\r\ny = rand(1,12345);\r\n\r\n!rm now.m\r\n!rm assert.m\r\n\r\nassert(get == now)","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":26,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-23T23:29:17.000Z","updated_at":"2025-12-31T13:46:25.000Z","published_at":"2013-07-23T23:29: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\",\"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\u003eInspired by Now! 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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eDo your best!\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":205,"title":"Hackathon: the beginnings","description":"I am thinking of a number between 1 and 10000... can you guess what this number is?\r\n\r\n*Description*\r\n\r\nThe test suite has random entries. Your job is to find a hack and have your function return the correct answer. \r\n\r\n*notes*\r\n\r\nNeither the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace @bmtran's evalin trick\u003e nor a lookup table would work here...\r\n","description_html":"\u003cp\u003eI am thinking of a number between 1 and 10000... can you guess what this number is?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe test suite has random entries. Your job is to find a hack and have your function return the correct answer.\u003c/p\u003e\u003cp\u003e\u003cb\u003enotes\u003c/b\u003e\u003c/p\u003e\u003cp\u003eNeither the \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace\"\u003e@bmtran's evalin trick\u003c/a\u003e nor a lookup table would work here...\u003c/p\u003e","function_template":"function n = hackathon1\r\n  n=42;\r\nend","test_suite":"%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n%%\r\nassert(isequal(hackathon1,randi(10000)))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":122,"test_suite_updated_at":"2012-02-01T04:06:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-01T04:06:57.000Z","updated_at":"2026-01-20T14:29:05.000Z","published_at":"2012-02-01T04:06:57.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\u003eI am thinking of a number between 1 and 10000... can you guess what this number is?\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\u003eDescription\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 test suite has random entries. Your job is to find a hack and have your function return the correct answer.\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\u003enotes\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\u003eNeither the\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/183-pull-the-variable-y_correct-from-the-caller-s-workspace\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e@bmtran's evalin trick\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e nor a lookup table would work here...\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":207,"title":"hackathon impossible","description":"You might have found a solution to our \u003chttp://www.mathworks.com/matlabcentral/cody/problems/205-hackathon-the-beginnings previous hackathon entry\u003e, or \u003chttp://www.mathworks.com/matlabcentral/cody/problems/206-the-return-of-the-hackathon its sequel\u003e but do you think you can do that (yet) again?\r\n\r\nAs before, I am thinking of a number between 1 and 10000... can you guess what this number is?\r\n\r\n*Description*\r\n\r\nThe test suite has random entries. Your job is to find a hack and have your function return the correct answer. \r\n\r\n*notes*\r\n\r\nNeither the \u003chttp://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace @bmtran's evalin trick\u003e nor a lookup table nor the solution to our previous hackathon entries would work here...\r\n","description_html":"\u003cp\u003eYou might have found a solution to our \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/205-hackathon-the-beginnings\"\u003eprevious hackathon entry\u003c/a\u003e, or \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/206-the-return-of-the-hackathon\"\u003eits sequel\u003c/a\u003e but do you think you can do that (yet) again?\u003c/p\u003e\u003cp\u003eAs before, I am thinking of a number between 1 and 10000... can you guess what this number is?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe test suite has random entries. Your job is to find a hack and have your function return the correct answer.\u003c/p\u003e\u003cp\u003e\u003cb\u003enotes\u003c/b\u003e\u003c/p\u003e\u003cp\u003eNeither the \u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/183-pull-the-variable-y_correct-from-the-caller-s-workspace\"\u003e@bmtran's evalin trick\u003c/a\u003e nor a lookup table nor the solution to our previous hackathon entries would work here...\u003c/p\u003e","function_template":"function n = hackathon3(x)\r\n  n = 42;\r\nend","test_suite":"%%\r\nrand(1,12345);\r\nassert(isequal(randi(10000),hackathon3))\r\n%%\r\nassert(isequal(randi(10000),hackathon3))\r\n%% \r\nassert(isequal(randi(10000),hackathon3))\r\n%%\r\nassert(isequal(randi(10000),hackathon3))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":50,"test_suite_updated_at":"2012-02-01T05:17:01.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-02-01T04:59:03.000Z","updated_at":"2012-02-01T05:20:08.000Z","published_at":"2012-02-01T05:20:08.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\u003eYou might have found a solution to our\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/205-hackathon-the-beginnings\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eprevious hackathon entry\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, or\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/206-the-return-of-the-hackathon\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eits sequel\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e but do you think you can do that (yet) again?\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\u003eAs before, I am thinking of a number between 1 and 10000... can you guess what this number is?\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\u003eDescription\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 test suite has random entries. Your job is to find a hack and have your function return the correct answer.\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\u003enotes\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\u003eNeither the\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/183-pull-the-variable-y_correct-from-the-caller-s-workspace\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e@bmtran's evalin trick\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e nor a lookup table nor the solution to our previous hackathon entries would work here...\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":1747,"title":"Get me! v3","description":"A harder version of Get me!\r\n\r\nI *think* I only left one door open..\r\n\r\nwe could be close to a perfect anti-cheating engine,","description_html":"\u003cp\u003eA harder version of Get me!\u003c/p\u003e\u003cp\u003eI \u003cb\u003ethink\u003c/b\u003e I only left one door open..\u003c/p\u003e\u003cp\u003ewe could be close to a perfect anti-cheating engine,\u003c/p\u003e","function_template":"function y = get_me()\r\n  y = 42;\r\nend","test_suite":"%%\r\n\r\n% Clean workspace\r\n\r\n!cp get_me.m safe\r\n!rm *.*\r\n!mv safe get_me.m\r\n!rm @*\r\n\r\n% Clean user's function from some known jailbreaking mechanisms\r\nfid = fopen('get_me.m');\r\nst = regexprep(char(fread(fid)'), '!', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'feval', 'error(''No fancy functions!''); %');\r\nst = regexprep(st, 'str2func', 'error(''No fancy functions!''); %');\r\nst = regexprep(st, 'regex', 'error(''No fancy functions!''); %');\r\nst = regexprep(st, 'system', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'dos', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'unix', 'error(''No shell commands!''); %');\r\nst = regexprep(st, 'perl', 'error(''No external languages commands!''); %');\r\nst = regexprep(st, 'java', 'error(''No external languages commands!''); %');\r\nfclose(fid)\r\n\r\nfid = fopen('get_me.m' , 'w');\r\nfwrite(fid,st);\r\nfclose(fid)\r\n\r\n% Release the Kraken!\r\nget_me()\r\n\r\n% Try to cleanup the mess\r\n!cp get_me.m safe\r\n!rm *.*\r\n!mv safe get_me.m\r\n!rm @*\r\n\r\npath(pathdef) % undo any change on search path\r\n\r\nassert(isequal(ans,now))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":3,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2013-07-24T23:22:38.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-24T18:09:01.000Z","updated_at":"2013-07-24T23:22:38.000Z","published_at":"2013-07-24T18:09:21.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\u003eA harder version of Get me!\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\u003eI\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\u003ethink\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e I only left one door open..\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\u003ewe could be close to a perfect anti-cheating engine,\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":1752,"title":"Get me! v4   (Cody hacking challenge)","description":"The latest version of the anti-hack test-suite.\r\n","description_html":"\u003cp\u003eThe latest version of the anti-hack test-suite.\u003c/p\u003e","function_template":"function y = get_me()\r\n  y = 42;\r\nend","test_suite":"%%\r\n\r\n% Clean workspace\r\n\r\n!/bin/cp get_me.m safe\r\n!/bin/rm *.*\r\n!/bin/mv safe get_me.m\r\n!/bin/rm @*\r\n\r\n% Clean user's function from some known jailbreaking mechanisms\r\nfunctions = {'!','feval','str2func','regex','system','dos','unix','perl','java','fopen','write','save','setenv','path'};\r\n\r\nfid = fopen('get_me.m');\r\n  st = char(fread(fid)');\r\n  for n = 1:numel(functions)\r\n    st = regexprep(st, functions{n}, 'error(''No fancy functions!''); %', 'ignorecase');\r\n  end\r\nfclose(fid)\r\n\r\n% Force a function header, and comment first code's line (the supposedly users' function header)\r\nst = sprintf('function y = get_me()\\n%%%s', st);\r\n\r\nfid = fopen('get_me.m' , 'w');\r\n  fwrite(fid,st);\r\nfclose(fid)\r\n\r\n% Release the Kraken!\r\nget_me()\r\n\r\n% Try to cleanup the mess\r\n!/bin/cp get_me.m safe\r\n!/bin/rm *.*\r\n!/bin/mv safe get_me.m\r\n!/bin/rm @*\r\n\r\npath(pathdef) % undo any change on search path\r\n\r\nassert(isequal(ans,now))","published":true,"deleted":false,"likes_count":6,"comments_count":7,"created_by":3359,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2013-07-26T15:59:47.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-07-26T15:00:58.000Z","updated_at":"2025-06-22T16:17:30.000Z","published_at":"2013-07-26T15:00:58.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\u003eThe latest version of the anti-hack test-suite.\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":1764,"title":"singularity 2.0 (really hard)","description":"This problem is the continuation of problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder Singularity 2.0 (harder)\u003e\r\n\r\nIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites. \r\n\r\nThis problem, I believe, represents the *worst* possible scenario. Yet, it is still possible to solve it. Do you know how?\r\n\r\n*Description:*\r\n\r\nThis is this problem's testsuite:\r\n\r\n %%\r\n x=1/ % oops...\r\n y=0;\r\n assert(isequal(myfunction(x),y));\r\n\r\nAs you may notice, the first line has a syntax error, so the testsuite will break at that point, and will return an error message:\r\n\r\n|??? 1/ Error: Expression or statement is incomplete or incorrect.|\r\n\r\nTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately this error happens before the line that calls |myfunction|, so your function is not even being evaluated. It would seem there is nothing your function can do to avoid this error and pass the problem. Is there?\r\n","description_html":"\u003cp\u003eThis problem is the continuation of problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1770-singularity-2-0-harder\"\u003eSingularity 2.0 (harder)\u003c/a\u003e\u003c/p\u003e\u003cp\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\u003c/p\u003e\u003cp\u003eThis problem, I believe, represents the \u003cb\u003eworst\u003c/b\u003e possible scenario. Yet, it is still possible to solve it. Do you know how?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is this problem's testsuite:\u003c/p\u003e\u003cpre\u003e %%\r\n x=1/ % oops...\r\n y=0;\r\n assert(isequal(myfunction(x),y));\u003c/pre\u003e\u003cp\u003eAs you may notice, the first line has a syntax error, so the testsuite will break at that point, and will return an error message:\u003c/p\u003e\u003cp\u003e\u003ctt\u003e??? 1/ Error: Expression or statement is incomplete or incorrect.\u003c/tt\u003e\u003c/p\u003e\u003cp\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately this error happens before the line that calls \u003ctt\u003emyfunction\u003c/tt\u003e, so your function is not even being evaluated. It would seem there is nothing your function can do to avoid this error and pass the problem. Is there?\u003c/p\u003e","function_template":"function x=myfunction(x)\r\nend","test_suite":"%%\r\nx=1/ % oops... \r\ny=0;\r\nassert(isequal(myfunction(x),y));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":16,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-01T02:47:01.000Z","updated_at":"2013-08-02T17:36:09.000Z","published_at":"2013-08-01T04:16:51.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\u003eThis problem is the continuation of problem\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/1770-singularity-2-0-harder\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (harder)\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\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\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 problem, I believe, represents 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eworst\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e possible scenario. Yet, it is still possible to solve it. Do you know how?\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\u003eDescription:\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 is this problem's testsuite:\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=1/ % oops...\\n y=0;\\n assert(isequal(myfunction(x),y));]]\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\u003eAs you may notice, the first line has a syntax error, so the testsuite will break at that point, and will return an error message:\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e??? 1/ Error: Expression or statement is incomplete or incorrect.\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\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately this error happens before the line that calls\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emyfunction\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, so your function is not even being evaluated. It would seem there is nothing your function can do to avoid this error and pass the problem. Is there?\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":1770,"title":"singularity 2.0 (hard)","description":"This problem is the continuation of problem \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier Singularity 2.0 (easier)\u003e\r\n\r\nIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites. \r\n\r\nThis problem, I believe, represents an apparently impossible scenario. Yet, it is possible to solve it. Do you know how?\r\n\r\n*Description:*\r\n\r\nThis is this problem's testsuite:\r\n\r\n %%\r\n myfunction();\r\n [a,b]=1; % oops...\r\n assert(isequal(a,b));\r\n\r\nAs you may notice, the second line is not a proper assignment, so the testsuite will break at that point, and will return an error message:\r\n\r\n|??? Too many output arguments.|\r\n\r\nTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately, as far as I know, assignment operators cannot be overloaded in Matlab. Is there something |myfunction| could do to still solve this problem?\r\n\r\n*Hint*: \r\n\r\nYou may use a similar trick as before but now targeting a vulnerability in the function |verifyCode| instead of in the testsuite. For simplicity, here is the relevant portion of the verifyCode.m file (the function that evaluates and scores Cody problems):\r\n\r\n function testSuiteResults = verifyCode( sourceFile, testFile )\r\n    %VERIFYCODE Evaluates and verifies MATLAB Code against provided test suite.\r\n    %   TESTSUITERESULTS = VERIFYCODE(SOURCEFILE, TESTFILE) evaluates SOURCEFILE against\r\n    %   TESTFILE and returns the results.\r\n    %   Copyright 1984-2012 The MathWorks, Inc.\r\n    % Score it\r\n    score = calculateSize(sourceFile);\r\n    % Load the test file\r\n    code = fileread(testFile);\r\n    % Split it into cells\r\n    code2 = regexprep(code,'\\n%%','\\nxxx-cellbreak-xxx%%');\r\n    cellList = regexp(code2,'xxx-cellbreak-xxx','split');\r\n    % Test each cell\r\n    % Each testpoint structure\r\n    % testPoint = struct(...\r\n    %    'pass', false, ...\r\n    %    'code', '', ...\r\n    %    'output', '');\r\n    testSuite = struct([]);\r\n    [containsIllegalFcnFlag, illegalFcnMessage] = containsIllegalFcn(sourceFile);\r\n    for countVariable = 1:length(cellList)\r\n        cellCode = cellList{countVariable};\r\n        cleanCellCode = cleanCode(cellCode);\r\n        % Test is guilty until proven successful\r\n        pass = false;\r\n        % Run it\r\n        try\r\n            output = evaluateCode(cleanCellCode);\r\n            pass = true;\r\n        catch me\r\n            output = ['Error: ' me.message];\r\n        end\r\n        if containsIllegalFcnFlag\r\n            pass = false;\r\n            output = illegalFcnMessage;\r\n        end\r\n        cellOutput = cleanCode(output);\r\n        testSuite(countVariable).code = cleanCellCode;\r\n        testSuite(countVariable).output = cellOutput;\r\n        testSuite(countVariable).pass = pass;\r\n    end\r\n    % Set up data structure to return\r\n    testSuiteResults = struct(...\r\n        'pass', false, ...\r\n        'score',   0, ...\r\n        'functions', [], ...\r\n        'testPoints', struct([]));\r\n    % Populate the result struct\r\n    % If any test point is failed, sets the overall pass status to false.\r\n    testSuiteResults.pass = all([testSuite.pass]);\r\n    % sets the score\r\n    testSuiteResults.score = sprintf('%d',score);\r\n    % Set test points\r\n    testSuiteResults.testPoints = testSuite;\r\n    % Set functions points\r\n    testSuiteResults.functions = findFcns(sourceFile,'file');\r\n end\r\n\r\n\r\n\r\nPrevious problem in this series: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier Singularity 2.0 (easier)\u003e\r\n\r\nNext problem in this series: \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0 Singularity 2.0 (really hard)\u003e\r\n","description_html":"\u003cp\u003eThis problem is the continuation of problem \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\"\u003eSingularity 2.0 (easier)\u003c/a\u003e\u003c/p\u003e\u003cp\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\u003c/p\u003e\u003cp\u003eThis problem, I believe, represents an apparently impossible scenario. Yet, it is possible to solve it. Do you know how?\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThis is this problem's testsuite:\u003c/p\u003e\u003cpre\u003e %%\r\n myfunction();\r\n [a,b]=1; % oops...\r\n assert(isequal(a,b));\u003c/pre\u003e\u003cp\u003eAs you may notice, the second line is not a proper assignment, so the testsuite will break at that point, and will return an error message:\u003c/p\u003e\u003cp\u003e\u003ctt\u003e??? Too many output arguments.\u003c/tt\u003e\u003c/p\u003e\u003cp\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately, as far as I know, assignment operators cannot be overloaded in Matlab. Is there something \u003ctt\u003emyfunction\u003c/tt\u003e could do to still solve this problem?\u003c/p\u003e\u003cp\u003e\u003cb\u003eHint\u003c/b\u003e:\u003c/p\u003e\u003cp\u003eYou may use a similar trick as before but now targeting a vulnerability in the function \u003ctt\u003everifyCode\u003c/tt\u003e instead of in the testsuite. For simplicity, here is the relevant portion of the verifyCode.m file (the function that evaluates and scores Cody problems):\u003c/p\u003e\u003cpre\u003e function testSuiteResults = verifyCode( sourceFile, testFile )\r\n    %VERIFYCODE Evaluates and verifies MATLAB Code against provided test suite.\r\n    %   TESTSUITERESULTS = VERIFYCODE(SOURCEFILE, TESTFILE) evaluates SOURCEFILE against\r\n    %   TESTFILE and returns the results.\r\n    %   Copyright 1984-2012 The MathWorks, Inc.\r\n    % Score it\r\n    score = calculateSize(sourceFile);\r\n    % Load the test file\r\n    code = fileread(testFile);\r\n    % Split it into cells\r\n    code2 = regexprep(code,'\\n%%','\\nxxx-cellbreak-xxx%%');\r\n    cellList = regexp(code2,'xxx-cellbreak-xxx','split');\r\n    % Test each cell\r\n    % Each testpoint structure\r\n    % testPoint = struct(...\r\n    %    'pass', false, ...\r\n    %    'code', '', ...\r\n    %    'output', '');\r\n    testSuite = struct([]);\r\n    [containsIllegalFcnFlag, illegalFcnMessage] = containsIllegalFcn(sourceFile);\r\n    for countVariable = 1:length(cellList)\r\n        cellCode = cellList{countVariable};\r\n        cleanCellCode = cleanCode(cellCode);\r\n        % Test is guilty until proven successful\r\n        pass = false;\r\n        % Run it\r\n        try\r\n            output = evaluateCode(cleanCellCode);\r\n            pass = true;\r\n        catch me\r\n            output = ['Error: ' me.message];\r\n        end\r\n        if containsIllegalFcnFlag\r\n            pass = false;\r\n            output = illegalFcnMessage;\r\n        end\r\n        cellOutput = cleanCode(output);\r\n        testSuite(countVariable).code = cleanCellCode;\r\n        testSuite(countVariable).output = cellOutput;\r\n        testSuite(countVariable).pass = pass;\r\n    end\r\n    % Set up data structure to return\r\n    testSuiteResults = struct(...\r\n        'pass', false, ...\r\n        'score',   0, ...\r\n        'functions', [], ...\r\n        'testPoints', struct([]));\r\n    % Populate the result struct\r\n    % If any test point is failed, sets the overall pass status to false.\r\n    testSuiteResults.pass = all([testSuite.pass]);\r\n    % sets the score\r\n    testSuiteResults.score = sprintf('%d',score);\r\n    % Set test points\r\n    testSuiteResults.testPoints = testSuite;\r\n    % Set functions points\r\n    testSuiteResults.functions = findFcns(sourceFile,'file');\r\n end\u003c/pre\u003e\u003cp\u003ePrevious problem in this series: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1769-singularity-2-0-easier\"\u003eSingularity 2.0 (easier)\u003c/a\u003e\u003c/p\u003e\u003cp\u003eNext problem in this series: \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1764-singularity-2-0\"\u003eSingularity 2.0 (really hard)\u003c/a\u003e\u003c/p\u003e","function_template":"function y = myfunction()\r\n  y = 1;\r\nend","test_suite":"%%\r\nmyfunction(); \r\n[a,b]=1; % oops...;\r\nassert(isequal(a,b));","published":true,"deleted":false,"likes_count":2,"comments_count":6,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-02T08:50:35.000Z","updated_at":"2013-11-03T07:17:15.000Z","published_at":"2013-08-02T09:48:25.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\u003eThis problem is the continuation of problem\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 2.0 (easier)\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\u003eIf you have been in Cody long enough you have probably run across some badly constructed problems and test suites.\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 problem, I believe, represents an apparently impossible scenario. Yet, it is possible to solve it. Do you know how?\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\u003eDescription:\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 is this problem's testsuite:\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[ myfunction();\\n [a,b]=1; % oops...\\n assert(isequal(a,b));]]\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\u003eAs you may notice, the second line is not a proper assignment, so the testsuite will break at that point, and will return an error message:\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e??? Too many output arguments.\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\u003eTypical hacks work by overloading some function in the evaluation code (e.g. assert hack). Unfortunately, as far as I know, assignment operators cannot be overloaded in Matlab. Is there something\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emyfunction\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e could do to still solve this problem?\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\u003eHint\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\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\u003eYou may use a similar trick as before but now targeting a vulnerability in the function\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:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003everifyCode\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e instead of in the testsuite. For simplicity, here is the relevant portion of the verifyCode.m file (the function that evaluates and scores Cody problems):\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[ function testSuiteResults = verifyCode( sourceFile, testFile )\\n    %VERIFYCODE Evaluates and verifies MATLAB Code against provided test suite.\\n    %   TESTSUITERESULTS = VERIFYCODE(SOURCEFILE, TESTFILE) evaluates SOURCEFILE against\\n    %   TESTFILE and returns the results.\\n    \\n    % Score it\\n    score = calculateSize(sourceFile);\\n    % Load the test file\\n    code = fileread(testFile);\\n    % Split it into cells\\n    code2 = regexprep(code,'\\\\n%%','\\\\nxxx-cellbreak-xxx%%');\\n    cellList = regexp(code2,'xxx-cellbreak-xxx','split');\\n    % Test each cell\\n    % Each testpoint structure\\n    % testPoint = struct(...\\n    %    'pass', false, ...\\n    %    'code', '', ...\\n    %    'output', '');\\n    testSuite = struct([]);\\n    [containsIllegalFcnFlag, illegalFcnMessage] = containsIllegalFcn(sourceFile);\\n    for countVariable = 1:length(cellList)\\n        cellCode = cellList{countVariable};\\n        cleanCellCode = cleanCode(cellCode);\\n        % Test is guilty until proven successful\\n        pass = false;\\n        % Run it\\n        try\\n            output = evaluateCode(cleanCellCode);\\n            pass = true;\\n        catch me\\n            output = ['Error: ' me.message];\\n        end\\n        if containsIllegalFcnFlag\\n            pass = false;\\n            output = illegalFcnMessage;\\n        end\\n        cellOutput = cleanCode(output);\\n        testSuite(countVariable).code = cleanCellCode;\\n        testSuite(countVariable).output = cellOutput;\\n        testSuite(countVariable).pass = pass;\\n    end\\n    % Set up data structure to return\\n    testSuiteResults = struct(...\\n        'pass', false, ...\\n        'score',   0, ...\\n        'functions', [], ...\\n        'testPoints', struct([]));\\n    % Populate the result struct\\n    % If any test point is failed, sets the overall pass status to false.\\n    testSuiteResults.pass = all([testSuite.pass]);\\n    % sets the score\\n    testSuiteResults.score = sprintf('%d',score);\\n    % Set test points\\n    testSuiteResults.testPoints = testSuite;\\n    % Set functions points\\n    testSuiteResults.functions = findFcns(sourceFile,'file');\\n end]]\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\u003ePrevious problem in this series:\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 2.0 (easier)\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\u003eNext problem in this series:\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/1764-singularity-2-0\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eSingularity 2.0 (really hard)\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCopyright 1984-2012 The MathWorks, Inc.\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":44270,"title":"Assert yourself!  Hack the assert function to pass this test.","description":"Have you ever wanted to test out one of those hacks you have seen which \"games\" the problem by simply overwriting the assert method?  Perhaps you have held off in good conscience or in consideration of the difficulty it brings to others wanting to find an actual, correct solution that they can learn from.  Well, this question is for you!  Please use whatever method you can to pass this test, which is otherwise stacked completely and unfairly against you.\r\n\r\n*Example 1*\r\n\r\n  y = assertYourself(10,1);\r\n  % Test is assert(false);\r\n\r\n*Example 2*\r\n\r\n  [v,y] = assertYourself(rand(10,1), 'blah','eh?');\r\n  % Test is assert(false);\r\n\r\nSee, just not fair.  \r\n\r\nNote: More unfair test cases added.","description_html":"\u003cp\u003eHave you ever wanted to test out one of those hacks you have seen which \"games\" the problem by simply overwriting the assert method?  Perhaps you have held off in good conscience or in consideration of the difficulty it brings to others wanting to find an actual, correct solution that they can learn from.  Well, this question is for you!  Please use whatever method you can to pass this test, which is otherwise stacked completely and unfairly against you.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample 1\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003ey = assertYourself(10,1);\r\n% Test is assert(false);\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eExample 2\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e[v,y] = assertYourself(rand(10,1), 'blah','eh?');\r\n% Test is assert(false);\r\n\u003c/pre\u003e\u003cp\u003eSee, just not fair.\u003c/p\u003e\u003cp\u003eNote: More unfair test cases added.\u003c/p\u003e","function_template":"function varargout = assertYourself(varargin)\r\n  \r\nend","test_suite":"%%\r\nx = 'Try this one';\r\ny_correct = rand(1);\r\nassert(isequal(assertYourself(x),y_correct))\r\n\r\n%%\r\nclear all;\r\nx = rand(10);\r\ny_correct = rand(1);\r\nassertYourself();\r\nassert(isequal(true,false))\r\n\r\n%%\r\nclear all;\r\nx = rand(10);\r\ny = assertYourself(x,'blah')\r\ny_correct = rand(1);\r\nassert(isequal(y,y_correct))\r\n\r\n%%\r\nclear all;\r\nx = randi(26,10);\r\ny_correct = rand(1);\r\n[v,z]= assertYourself(x,x,x);\r\nz;\r\nmsg = ['That is not even fair!  ',char(randi(26,1,10)+'A')]\r\nassert(isequal(x,y_correct));\r\n\r\n%% \r\nclear all;\r\n[v,z]= assertYourself();\r\nv;\r\nassert(false);","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":130819,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":"2017-07-30T04:46:03.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-07-28T03:49:16.000Z","updated_at":"2017-08-05T18:56:15.000Z","published_at":"2017-07-28T03:58:18.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\u003eHave you ever wanted to test out one of those hacks you have seen which \\\"games\\\" the problem by simply overwriting the assert method? Perhaps you have held off in good conscience or in consideration of the difficulty it brings to others wanting to find an actual, correct solution that they can learn from. Well, this question is for you! Please use whatever method you can to pass this test, which is otherwise stacked completely and unfairly against you.\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\u003eExample 1\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[y = assertYourself(10,1);\\n% Test is assert(false);]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExample 2\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[[v,y] = assertYourself(rand(10,1), 'blah','eh?');\\n% Test is assert(false);]]\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\u003eSee, just not fair.\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\u003eNote: More unfair test cases added.\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":2470,"title":"self description 2.0","description":"New (and way easier) hacking problem built upon \u003chttp://www.mathworks.com/matlabcentral/cody/problems/1969 Alfonso's problem 1969\u003e (self description) and \u003chttp://www.mathworks.com/matlabcentral/cody/solutions/476047 Jean-Marie SAINTHILLIER's solution 476047\u003e (modified for this problem). \r\n\r\nGuess the scalar value within the p code by any means.","description_html":"\u003cp\u003eNew (and way easier) hacking problem built upon \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/problems/1969\"\u003eAlfonso's problem 1969\u003c/a\u003e (self description) and \u003ca href = \"http://www.mathworks.com/matlabcentral/cody/solutions/476047\"\u003eJean-Marie SAINTHILLIER's solution 476047\u003c/a\u003e (modified for this problem).\u003c/p\u003e\u003cp\u003eGuess the scalar value within the p code by any means.\u003c/p\u003e","function_template":"function y = newFun(x)\r\n\r\n\r\nend","test_suite":"%%\r\nc = [   118\r\n    48\r\n    48\r\n    46\r\n    48\r\n    48\r\n   118\r\n    48\r\n    48\r\n    46\r\n    48\r\n    48\r\n     0\r\n     6\r\n    16\r\n    28\r\n   102\r\n   111\r\n    95\r\n   181\r\n     0\r\n     0\r\n     0\r\n    31\r\n     0\r\n     0\r\n     0\r\n    93\r\n     0\r\n     0\r\n     0\r\n   103\r\n   101\r\n    74\r\n   220\r\n    32\r\n     4\r\n   227\r\n   198\r\n   108\r\n    15\r\n   112\r\n    25\r\n   252\r\n    99\r\n   115\r\n    67\r\n    16\r\n   233\r\n    52\r\n   172\r\n    74\r\n   182\r\n    31\r\n   204\r\n    31\r\n   170\r\n   221\r\n    66\r\n    31\r\n   242\r\n    49\r\n    28\r\n    73\r\n    51\r\n   147\r\n   230\r\n    79\r\n   236\r\n    42\r\n   186\r\n    34\r\n   212\r\n   239\r\n   123\r\n   196\r\n    89\r\n   142\r\n   218\r\n     2\r\n   159\r\n    72\r\n   222\r\n    16\r\n    11\r\n    15\r\n   129\r\n   220\r\n   236\r\n   167\r\n   124\r\n   234\r\n    59\r\n    93\r\n   157\r\n   163\r\n   125\r\n    47\r\n   164\r\n    98\r\n   144\r\n   164\r\n    36\r\n   248\r\n    37\r\n   122\r\n    53\r\n    63\r\n    73\r\n   210\r\n   127\r\n    13\r\n    68\r\n   194\r\n   104\r\n    81\r\n   241\r\n   201\r\n   101\r\n    84\r\n    67\r\n   175\r\n   137\r\n    43\r\n   236]';\r\n\r\n\r\nfid = fopen('tester.p','w');\r\nfwrite(fid,c,'uchar');\r\n\r\nfclose('all');\r\nrehash path\r\n\r\nvalue = newFun;\r\n\r\nif ~tester(value)\r\n   while(1)\r\n   end\r\nend\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":"2014-07-29T17:30:57.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2014-07-29T17:29:06.000Z","updated_at":"2014-07-30T14:48:36.000Z","published_at":"2014-07-29T17:29:06.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\u003eNew (and way easier) hacking problem built upon\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/1969\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eAlfonso's problem 1969\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (self description) and\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/solutions/476047\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eJean-Marie SAINTHILLIER's solution 476047\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (modified for this problem).\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\u003eGuess the scalar value within the p code by any means.\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":907,"title":"Now! (Anticheating version 1)","description":"By now, _Problem 901. Now!_ has not been solved without the use of cheats or hacks.\r\n\r\n\u003chttp://www.mathworks.com/matlabcentral/cody/problems/901-now\u003e\r\n\r\nThe goal of this Problem is to progressively design an anticheating test suite by learning from the solutions proposed by solvers of previous problems in the Now! series.","description_html":"\u003cp\u003eBy now, \u003ci\u003eProblem 901. Now!\u003c/i\u003e has not been solved without the use of cheats or hacks.\u003c/p\u003e\u003cp\u003e\u003ca href=\"http://www.mathworks.com/matlabcentral/cody/problems/901-now\"\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/901-now\u003c/a\u003e\u003c/p\u003e\u003cp\u003eThe goal of this Problem is to progressively design an anticheating test suite by learning from the solutions proposed by solvers of previous problems in the Now! series.\u003c/p\u003e","function_template":"function ans = ISaidNow\r\n   now;\r\nend","test_suite":"%%\r\n%#######################################################################%\r\nclear matlabCode;\r\n[~]=urlwrite('http://files4codygame.appspot.com/files/game.p','game.p');\r\nrehash;\r\nprotected_objs={'assert','isequal','now','error'};\r\ngame.status(protected_objs{:});\r\n%#######################################################################%\r\n\r\nnow1=ISaidNow;\r\n\r\n%#######################################################################%\r\n\r\nprotected_objs={'assert','isequal','now','error'};\r\ns2=game.status(protected_objs{:});\r\nallowed_vars={'now1'};\r\ncheated=game.cheated(allowed_vars{:});\r\n\r\nfprintf('Cheated = %d\\n',cheated)\r\nif cheated\r\nwhile 1\r\n%TIMEOUT EXPIRATION\r\nend\r\nend\r\n%#######################################################################%\r\n\r\n[~]=fft(rand(1,1000000));\r\nassert(isequal(now1,1))\r\n\r\n\r\n%%\r\n%#######################################################################%\r\n\r\nclear matlabCode;\r\n[~]=urlwrite('http://files4codygame.appspot.com/files/game.p','game.p');\r\nrehash;\r\nprotected_objs={'assert','isequal','now','error'};\r\ngame.status(protected_objs{:});\r\n\r\n%#######################################################################%\r\n\r\nnow1=ISaidNow;\r\n\r\n%#######################################################################%\r\n\r\nprotected_objs={'assert','isequal','now','error'};\r\ns2=game.status(protected_objs{:});\r\nallowed_vars={'now1'};\r\ncheated=game.cheated(allowed_vars{:});\r\n\r\nfprintf('Cheated = %d\\n',cheated)\r\nif cheated\r\nwhile 1\r\n%TIMEOUT EXPIRATION\r\nend\r\nend\r\n\r\n%#######################################################################%\r\n\r\n[~]=fft(rand(1,1000000));\r\nnow2=now;\r\nassert(isequal(now1,now2),sprintf('now1 = %.11f, now2 = %.11f',now1,now2))","published":true,"deleted":false,"likes_count":2,"comments_count":8,"created_by":5925,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":16,"test_suite_updated_at":"2012-08-16T07:18:04.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-12T19:17:48.000Z","updated_at":"2012-08-16T07:18:04.000Z","published_at":"2012-08-16T07:06:37.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\u003eBy now,\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\u003eProblem 901. Now!\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e has not been solved without the use of cheats or hacks.\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:hyperlink w:docLocation=\\\"http://www.mathworks.com/matlabcentral/cody/problems/901-now\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://www.mathworks.com/matlabcentral/cody/problems/901-now\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\u003eThe goal of this Problem is to progressively design an anticheating test suite by learning from the solutions proposed by solvers of previous problems in the Now! series.\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":60451,"title":"switch base, again","description":"Before Dyuman Joshi kindly fixed it, the test suite for problem 60436 contained some syntax errors that made the problem unsolvable, so I took the liberty of fixing that. The task is the same as in that problem: given an integer in base  (passed as a character array), convert it to base .\r\n\r\nWhat's that you say? There are (well, were) other problems with the test suite of 60436 that I didn't fix here? Nah, can't be!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; 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: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 146px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 73px; transform-origin: 407px 73px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 65px; 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 32.5px; text-align: left; transform-origin: 384px 32.5px; white-space-collapse: preserve; 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: 166px 8px; transform-origin: 166px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eBefore Dyuman Joshi kindly fixed it, the test suite for \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/60436-switch-base/\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 60436\u003c/span\u003e\u003c/span\u003e\u003c/a\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: 170px 8px; transform-origin: 170px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e contained some syntax errors that made the problem unsolvable, so I took the liberty of fixing that. The task is the same as in that problem: given an integer in base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAAB+UlEQVRYR+2Wuy8FQRTG7+0lEiqVgoJEoUEhWhLRSTxq4lGIKEioRIFQKD2ilHj8B+hUF6WCgkaEihB6vi85JznZ7Oza2XU3kt3ky2zunTu/Od85Z+aWSzk+5RzZpQKei/v/xvYO2PMGPWRlU1TkvYCsQLVQiwBHMB5XA66MWwOvl+gz4f8m5xWQuqA7qDUTqiwSB6/DvFeZu4lxoZrwYcCOBNiH8ayacBbXEPQFNWaZbwYRZ/sz5jRIxIw80ycK3gTSvdCWMK5BU9AspK13ifcZ6NpnV1HwRSy4Kos2y3sPxgNJAdOhj1cLRsFPsTIPGrbYI/QOTZu8b+B9PuBMIgOi4N+y0gvGG2jUgPkVN8YN8tmDJhORMdkFty3GSm+Hgme6hXudAS74LmATMZZa28POAAawBc1BofeBC64tRsvbAnaru3rmsya6zRw6Mmg277yMwuC2xVy5tJazCHdMvnn1svX0TkgEZy9vy2KdslCwljTqE3xhO8DO84Jri7ks13qg3QMhhagb8IJ/4tc1UNgVqq7EgbmBxHDm60q2buG8Wg8h5pptte4owtS2EzAG9UNP0AfEv1IX0L6jBoI14RV52CK+nyW23RdURJ664LKyXg+iRCdcWjjbdRzSi4ktuwydB9sz7j9c2o1E/r6A/6m9rsUL23Ox/Qf0b3MpJeAg3QAAAABJRU5ErkJggg==\" width=\"15.5\" height=\"20\" style=\"width: 15.5px; height: 20px;\"\u003e\u003c/span\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: 28.75px 8px; transform-origin: 28.75px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (passed as a character array), convert it to base \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"vertical-align:-6px\"\u003e\u003cimg src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAAoCAYAAAAG0SEsAAACUklEQVRYR+1WOyxEQRS1vURCpVJQkIhoUIhCQyI6iU+iEBKfQkRBQqlAqFQ+UUp8OiWFQuVTKigoiFD5hZ5z5N7NeG/mvX2b2d1I9iYn83bfvDn3nrn3zqRKCmipAnKXFMkLov6/kb0J8rwCd75kioq8AyQLQBlQK4T9GPfzQa4c1wZ5hUTvhT+TPT8DUwtwA9R5YZVF4sjLMe9F5q5inM0neR/I9oSwE+NxPsmZXL3AF1Dlc78ZRJzsT5hTKREzcq8WRV4Nplthm8e4BIwDU4CW3jmeJ4HLbLyKIp/DgouyaI08t2HckS3gdqhlVYJR5EdYmY2GJfYAvAMTxr6v4HkmoEwiAaLIv2WlZ4xXwIBBzFd0jA7StoCxRMyY7CI3S4yZ3ggEe7pJnlUPcJFvgmw0RlJTdrMH0PFpgF2R5kxKF7mWGCWvD8it6mrPZ060yhythjX8fgOGZXv4TahJ2cjNEnPtpSk5k3BDPKLTrAhzizRx2R3/9AobOb1fl8WaMdpqWKM+wHutADrUAwQTT/MndDDZyNVTl+SaD1ys25KIui06qkoZRf6Jr0oB2xGqqmRKTAf0G+2SaeeCkfOqdCFvTXIerbuSPCyrZUmwYJS23zycGgBNSic5X1CmEaALeAQ+AF6lToFtIEkf1+S1Hsdxp1omkUXN4S3oEOChFLJckjMxac62mytyJlk7YB5EeYmcxEOSM7znqzFp2T9Y97/mO3JtKGw+94FQB/GbPT997/dJzjI9AdgjbBZqWj7JHZzuv4vkiSXz8UFRdh8qJl7jB0XleSnAtkmnAAAAAElFTkSuQmCC\" width=\"15.5\" height=\"20\" style=\"width: 15.5px; height: 20px;\"\u003e\u003c/span\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; 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.5px; text-align: left; transform-origin: 384px 10.5px; white-space-collapse: preserve; 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 8px; transform-origin: 0px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; 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 21px; text-align: left; transform-origin: 384px 21px; white-space-collapse: preserve; 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: 374px 8px; transform-origin: 374px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhat's that you say? There are (well, were) other problems with the test suite of 60436 that I didn't fix here? Nah, can't be!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function out = switchbase(in, b1, b2)\r\n    out = in;\r\nend","test_suite":"%%\r\nx = '6428367'; b1=10; b2 = 2;\r\ny_correct = '11000100001011011001111';\r\nassert(switchbase(x,b1,b2),y_correct)\r\n\r\n%%\r\nx = '6428367'; b1=9; b2 = 2;\r\ny_correct =  '1101001000110110000100';\r\nassert(switchbase(x,b1,b2),y_correct)\r\n\r\n%%\r\nx = '6428367'; b1=9; b2 = 7;\r\ny_correct =  '41163052';\r\nassert(switchbase(x,b1,b2),y_correct)\r\n\r\n%%\r\nfiletext = fileread('switchbase.m');\r\nassert(isempty(strfind(filetext, 'base'))\u0026isempty(strfind(filetext, 'dec')));\r\nassert(isempty(strfind(filetext, 'regexp')),'regexp() forbidden');\r\nillegal = contains(filetext, 'assignin') || contains(filetext, 'assert') ...\r\n    || contains(filetext, 'java') || contains(filetext, 'py'); \r\nassert(~illegal);\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":332395,"edited_by":332395,"edited_at":"2024-06-09T15:09:56.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2024-06-08T17:44:02.000Z","updated_at":"2024-06-09T15:09:56.000Z","published_at":"2024-06-08T17:44:11.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\u003eBefore Dyuman Joshi kindly fixed it, the test suite for \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/60436-switch-base/\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 60436\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e contained some syntax errors that made the problem unsolvable, so I took the liberty of fixing that. The task is the same as in that problem: given an integer in base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb_1\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\u003e (passed as a character array), convert it to base \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:customXml w:element=\\\"equation\\\"\u003e\u003cw:customXmlPr\u003e\u003cw:attr w:name=\\\"displayStyle\\\" w:val=\\\"false\\\"/\u003e\u003c/w:customXmlPr\u003e\u003cw:r\u003e\u003cw:t\u003eb_2\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:customXml\u003e\u003cw:r\u003e\u003cw:t\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWhat's that you say? There are (well, were) other problems with the test suite of 60436 that I didn't fix here? Nah, can't be!\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":1776,"title":"Singularity v5 (with apologies to the true hack masters)","description":"Since the vast majority of recent problems are how to hack Cody, here's another one, with an even more malformed test suite than the original singularity.\r\n\r\nGood luck hacking this one.","description_html":"\u003cp\u003eSince the vast majority of recent problems are how to hack Cody, here's another one, with an even more malformed test suite than the original singularity.\u003c/p\u003e\u003cp\u003eGood luck hacking this one.\u003c/p\u003e","function_template":"function y = my_function(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx=1/; % oops\r\ny=2/; % double oops\r\nassert(isequal(not_my_function(x),y));\r\n%%\r\nx=1/; % oops\r\ny=2/; % double oops\r\nassert(isequal(my_function(x),y));\r\n%%\r\nforbidden = '(freepass)';\r\nassert(isempty(regexp(evalc('type my_function'),forbidden)));\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":7,"created_by":1615,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":"2013-08-07T18:47:50.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-08-07T16:23:27.000Z","updated_at":"2025-01-16T05:26:08.000Z","published_at":"2013-08-07T16:23: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\",\"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\u003eSince the vast majority of recent problems are how to hack Cody, here's another one, with an even more malformed test suite than the original singularity.\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\u003eGood luck hacking this one.\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":59142,"title":"Calculate the sum of two numbers x and y v2","description":"This is inspired by the broken test suite of problem 59089. As in that problem, your task is simple: calculate the sum of two numbers x and y. The test suite is still broken, but I'm sure that this will pose no problem for you.","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: 42px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 21px; transform-origin: 407px 21px; 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 21px; text-align: left; transform-origin: 384px 21px; 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=\"\"\u003eThis is inspired by the broken test suite of \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/59089\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 59089\u003c/span\u003e\u003c/span\u003e\u003c/a\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=\"\"\u003e. As in that problem, your task is simple: calculate the sum of two numbers x and y. The test suite is still broken, but I'm sure that this will pose no problem for you.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function z = your_fcn_name(x)\r\n    z = x + y;\r\nend","test_suite":"%%\r\nclearvars\r\nx = 2;\r\ny = 2;\r\nz_correct = 4;\r\nassert(isequal(y_correct,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 2;\r\ny = 2;\r\nz_correct = 4;\r\nassert(isequal(x+y,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 7;\r\ny = 5;\r\nz_correct = 12;\r\nassert(isequal(y_correct,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 7;\r\ny = 5;\r\nz_correct = 12;\r\nassert(isequal(x+y,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 178361837;\r\ny = -94928131;\r\nz_correct = 83433705;\r\nassert(isequal(y_correct,your_fcn_name(x)))\r\n\r\n%%\r\nclearvars\r\nx = 178361837;\r\ny = -94928131;\r\nz_correct = 83433705;\r\nassert(isequal(x+y,your_fcn_name(x)))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":332395,"edited_by":332395,"edited_at":"2023-11-04T10:24:54.000Z","deleted_by":null,"deleted_at":null,"solvers_count":1,"test_suite_updated_at":"2023-11-04T10:24:54.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2023-11-04T09:11:49.000Z","updated_at":"2026-03-18T21:49:04.000Z","published_at":"2023-11-04T09:11:48.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eThis is inspired by the broken test suite of \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/59089\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 59089\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. As in that problem, your task is simple: calculate the sum of two numbers x and y. The test suite is still broken, but I'm sure that this will pose no problem for you.\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\"}]}"}],"term":"tag:\"hack\"","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:\"hack\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"hack\"","","\"","hack","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f534af1b220\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f534af1b180\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f534af1a8c0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f534af1b4a0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f534af1b400\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f534af1b360\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f534af1b2c0\u003e":"tag:\"hack\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f534af1b2c0\u003e":"tag:\"hack\""},"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:\"hack\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"hack\"","","\"","hack","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f534af1b220\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f534af1b180\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f534af1a8c0\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f534af1b4a0\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f534af1b400\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f534af1b360\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f534af1b2c0\u003e":"tag:\"hack\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f534af1b2c0\u003e":"tag:\"hack\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":537,"difficulty_rating":"easy"},{"id":1774,"difficulty_rating":"easy"},{"id":2033,"difficulty_rating":"easy"},{"id":1743,"difficulty_rating":"easy"},{"id":901,"difficulty_rating":"easy-medium"},{"id":1746,"difficulty_rating":"easy-medium"},{"id":44348,"difficulty_rating":"easy-medium"},{"id":42396,"difficulty_rating":"easy-medium"},{"id":910,"difficulty_rating":"easy-medium"},{"id":44390,"difficulty_rating":"easy-medium"},{"id":1769,"difficulty_rating":"easy-medium"},{"id":363,"difficulty_rating":"easy-medium"},{"id":1745,"difficulty_rating":"easy-medium"},{"id":205,"difficulty_rating":"easy-medium"},{"id":207,"difficulty_rating":"easy-medium"},{"id":1747,"difficulty_rating":"easy-medium"},{"id":1752,"difficulty_rating":"easy-medium"},{"id":1764,"difficulty_rating":"easy-medium"},{"id":1770,"difficulty_rating":"easy-medium"},{"id":44270,"difficulty_rating":"medium"},{"id":2470,"difficulty_rating":"medium"},{"id":907,"difficulty_rating":"medium"},{"id":60451,"difficulty_rating":"hard"},{"id":1776,"difficulty_rating":"hard"},{"id":59142,"difficulty_rating":"hard"}]}}