Inspired by Now! problems.
Do your best!
If you liked this one, try the other Get me! versions!
my best solution :)
Dark magic ?
If you are interested I am publishing this in problem 1774 just to share the knowledge... you can try the magic yourself :)
Thanks for sharing 1774! It is incredibly clever and ingenious!!! All my compliments.
Can you explain the last line of your code please. It's very strange... I have the feeling it could be the solution of the different get_me problems.
sorry, I was just testing this idea here (cody only displays the output of disp if your code 'passes' a test, so I used the first two lines to 'pass the test', and the last line just to test whether the 'disp' bit would be evaluated or not, which it did, so that ended up being the delivery method for my get_me v4 solution http://www.mathworks.com/matlabcentral/cody/problems/1752-get-me-v4-cody-hacking-challenge/solutions/290694)
Thank you. So it's possible to execute commands in the base workspace AFTER the end of the function ?
This is just equivalent to evalin('base', str), str is being executed in matlab workspace (but not after the end of the function, perhaps you can combine this with a timer object for that?), what makes this trick interesting is that it is difficult to have it blocked since there are a lot of similar variants that would work just the same while using different matlab objects/functions (sorry that i am being a bit vague, i prefer not to give away the solution in the comments so that i do not spoil the fun for others :)
It's strange that this solution could pass the test.
you are right this is strange, judging from the error messages ('rm: No such file or directory') it is likely that this solution benefited from sharing the same linux session as another solution that may have change the linux path (e.g. setenv trick). This would be interesting because it might open up the possibility of exchanging info between different solutions, got to find out how cody distributes solutions among different matlab and linux sessions...
after digging up a little more it seems that at any time there are around five (probably virtual) servers running Cody solutions, and that solutions run on the same server will in fact share the same linux AND matlab session. The workspace seems to be cleared for every new solution but you can still make it so that one solution creates a function that is then available to other solutions (I made a practical demonstration of this in problem 1774). The servers will last for a while (perhaps up to an hour or so) and there may be some main control process that keeps things running smoothly (I managed to break the Cody pipeline on one of the servers by accident once and it soon disappeared an a new server was spawn in its place; btw sorry Matlab admins about this, my bad)... in any way, I will update if I find out more about all this.
fly fly away
Return the 'Size' of a String of Code
Square Digits Number Chain Terminal Value (Inspired by Project Euler Problem 92)
Sum the elements in either diagonal of a square matrix
Add two numbers
Get me! v3
Get me! v2
Get me! v4 (Cody hacking challenge)
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office