Alfonso Nieto-Castanon - MATLAB Cody - MATLAB Central

Alfonso Nieto-Castanon

12
Rank
98
Badges
40756
Score
1 – 50 of 6,512

Alfonso Nieto-Castanon submitted a Comment to Problem 1917. click away

@Rafael, this problem simply expects you to click the Ok button. As you can easily see, clicking the Ok button manually on a GUI message box is not the same as executing the associated msbox callback, simply because graphic object callbacks are not executed immediately, they are processed by the graphic engine at a time that depends on many different factors. The testsuite "drawnow" command forces that callback update, so that allows the testsuite to differentiate between solutions that delete the message-box vs. solutions that actually click on the Ok button (either by generating an associated pending callback, or by simulating that effect through clever timing shenanigans). Note: it is not a matter of adding a delay to your function (e.g. pause(1); delete(findall(0,'type','figure')); would not pass the testsuite), or java functions having some inherent delay due to loading libraries, it is a matter of delaying the actual execution of your function to simulate what an actual graphic callback would do (or of course simply figuring out how to generate that callback into the graphic queue)... hope this helps (and no hacking, please)

on 4 Oct 2020

Alfonso Nieto-Castanon submitted a Comment to Problem 44718. Optimize the Tollbooths

@goc3, I would suggest "y=toll_pricing_strategy(option,budget); revenue=@(x)sum((option*x(:)).*((option*x(:))<=budget)); assert(revenue(y)>=revenue(y_correct))". That should allow equivalent or better alternatives to the author's reference solutions (if I am not mistaken this is necessary because in problems 4 and 5 the reference solution does not appear to be optimal; e.g. in problem 5, tolls [18 33 9 14 13 11 12 10] result in 330 revenue, while the reference solution results in 280 revenue)

on 29 Sep 2020

Alfonso Nieto-Castanon submitted a Comment to Problem 1187. Knave in the middle attack

thanks for the heads up and temporal fix. I am still looking into this, it seems that the issue was probably a change in memory-management affecting function handles in some of the more recent Matlab releases, and I should probably just change the way I implement the Knight/Knave answer function to explicitly allow self-references...

on 29 Sep 2020

Alfonso Nieto-Castanon submitted a Comment to Problem 2825. pay it forward

@Rafael: thanks for you comment, and I guess you are right and kindness is in the eye of the beholder, but for example I see your solution using y=10 relying on Jonathan's kindness (as he submitted that 10 before you did), and similarly I see your failed -but kind!- y=50382 solution hopefully helping some other player solve this problem in the future, effectively paying that kindness forward (thanks!). That said, perhaps Jonathan, or you, were not really trying to be kind to others with their failed solution attempts and were instead just trying out some random solutions, but hey, I like my interpretation better :)

on 27 Sep 2020

Alfonso Nieto-Castanon submitted a Comment to Problem 45279. Cryptography with A Square Matrix : Encoding

it's a bit unclear why padding is necessary in the first two test cases, where the number of characters (15) is already a multiple of the key size (3 or 5, respectively)

on 19 Sep 2020

1 – 50 of 6,512
Go to top of page