Problem 1745. Get me!
Solution Stats
Problem Comments
-
1 Comment
If you liked this one, try the other Get me! versions!
Solution Comments
-
5 Comments
my best solution :)
Dark magic ?
Budú 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.
-
4 Comments
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 :)
-
3 Comments
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.
-
1 Comment
;)
Problem Recent Solvers23
Suggested Problems
-
Return the 'Size' of a String of Code
126 Solvers
-
Back to basics 13 - Input variables
256 Solvers
-
Basics: 'Find the eigenvalues of given matrix
385 Solvers
-
The sum of the numbers in the vector
538 Solvers
-
find the maximum element of the matrix
446 Solvers
More from this Author6
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!