MATLAB Community

MATLAB, community & more

The Cody Interview: Alfonso Nieto Castañón

If you play Cody, you probably already know the name Alfonso Nieto Castañón. He is the number one player by rank, and his answers tend to sprout comments like “Amazing!” and “How did you think of that?!”

Alfonso

Alfonso is the guy you want to have in your community. Brilliant, generous, and energetic, he moves through Cody like an artist, insightful answers flying from his fingertips. Through his Cody interactions alone, I suspect he has taught us more MATLAB than many a professor.

He was kind enough to let us do a virtual interview with him. Spoiler alert! In one of his answers he says he solves easy Cody problems while he’s on the phone. I like that. I’m lucky if I can draw a stick man while I’m talking on the phone.


Q: Tell us a little about yourself and your experience with MATLAB. What kind of research do you do and how do you use MATLAB? When did you learn MATLAB? When did you first realize you were a power user?

A: I am a computational neuroscience researcher, and my main focus is on neuroimaging methods. I use Matlab constantly in my research for all sorts of projects. It may be simply using well-established neuroimaging tools (e.g. SPM), developing my own (e.g. Conn), building neural models in Simulink, performing statistical analyses, or even developing real-time speech synthesizers, Matlab is always my first choice. I learned Matlab during my undergraduate studies as a telecommunication engineer, and was quickly won over by the incredible pace at which I could develop a project in Matlab compared to C or other less specialized languages. By the time I was in my graduate studies I was using Matlab almost daily, and I do not believe I have stopped since.

Q: How did you find out about Cody?

A: I was just browsing Matlab Central when I first saw a banner for Cody, and I was quickly hooked by the simple mini-problems, doing “just one more” over and over again. But it was really the wonderful community of users that started growing around Cody what kept me coming back, learning from and being often surprised by other people solutions, and enjoying the continuous stream of imaginative problems that have since then been posted.

Q: You were a champion with the old MATLAB Programming Contest, having won the Grand Prize multiple times. How would you characterize the difference between those two ways of doing competitive coding?

A: Both Cody and the Matlab Contest were fantastic ways of learning from the solutions and the thought-process of others. The old/classic Matlab contest had this fantastic pacing, and a great sense of community (and the rush of last minute solutions!). Cody’s permanence, on the other hand, may miss the rush of a more bounded competition, but it brings in return a never-ending source of enjoyment and learning opportunities. I often find myself revisiting old problems or solutions just to see what other people may have come up with in the meantime, or following specific players just because I enjoy their way of solving problems or because I enjoy the sort of problems that they create. Also the possibility to create your own problems adds a whole different perspective to Cody, and I may have found myself spending way too much time learning the inner workings of Cody just to see “what could be done” with it.

Q: What motivates you to play? Is staying in first place a major factor? Do you watch the leader board to see who’s gaining on you?

A: Not terribly much. It is true that at times I may have gone and solved some perhaps not-terribly-interesting problems just for the thrill of catching that first position, but mostly I come back to Cody looking forward to being surprised by some new problems or solutions, or just staying in touch with the great community here.

Q: How often do you come back? Are you disciplined about your time on Cody, or does it kind take over your schedule at various times?

A: My time on Cody fluctuates a lot, depending on my work or life schedule, but if I am caught up in a series of interesting problems I do have to make a real effort not to let Cody take over too much time from either.

Q: What does a typical session look like for you? When you’re solving a new problem, do you like to get a good answer in quickly and then tune it steadily into a better answer? Or do you like to knock them down quickly and move on?

A: It depends a lot on the problem. There are some interesting problems where I would send one solution after another until I cannot find other ways to “improve” it. Also, when other players are actively sending solutions to the same problems I may get caught in this fun collaboration where we would be trying to build on each other’s ideas. It also depends on the setting, if I am on my phone I may go for simpler or shorter problems, or if I am just relaxing having a coffee perhaps I may take the time to think about some really complex or interesting problem that I read on Cody some time back and never had the time to solve. Last, sometimes I may just feel like revisiting old problems or solutions to see if I can think of a better solution or just wondering what others may have come up with since I last visited them.

Q: What makes a good Cody problem? What are some simple mistakes that problem authors should avoid?

A: For me typically a good Cody problem would have a strong testsuite (avoiding simple look-up table solutions), would not have an immediately obvious “best” way of solving it, and it would not over-engineer the range of expected solutions (e.g. allow some tolerance in error checking, do not forbid or discourage the use of alternative solutions, etc.) Of course I have seen many fantastic problems that break about every of these rules, so new problem creators should probably just follow their instinct and know that their problems will get better with practice. A good place to start is probably to try to find inspiration in the way other people create their problems, I would recommend Richard Zapor, Ned Gulley, Bryant Tran (bmtran), or Tim Vaughan (the cyclist) as some of my favorite problem creators out there. Also I would recommend playing with the format to see what works best. Lately I am increasingly enjoying creating problems that attempt to somewhat explore the limits of what can be done in Cody (e.g. freepasses, Blockland) and, while this might not bring as much fun to others, I am certainly enjoying it! So again, just follow your instincts and experiment a bit.

Q: What makes a good Cody answer? Obviously Cody wants your answer to be short, but beyond that what makes a beautiful answer?

A: The answers I enjoy the most typically would surprise me by using an unexpected approach, some Matlab functionality I never heard of or considered in the context of this problem, or just by virtue of their goofiness or ingenuity.

Q: Do you have any favorite problems or favorite answers you’d like to call out?

A: This would be a very long list. I would say that some of the players who manage to very consistently create solutions that I am sure to enjoy or learn something from are Bryant Tran, with whom I shared the thrill of “discovering” Cody, learning to write highly optimized solutions, and unearthing quite a few hacking tricks, and Tim, who not only creates beautifully efficient code but also he is the one player I can always count on to be able to solve pretty much any problem I throw at him.

Among the problem creators that I enjoy the most I would “special mention” the prolific Richard Zapor (with a ton of fantastic problems in his GJam competition series; his PACMAT series was also ridiculously fun), and Ned Gulley (his problems consistently hit the perfect balance between simplicity of definition, and complexity of possible solutions/approaches; e.g. Remove the air bubbles, Return its own character count, Stride of the longest skip sequence, are really beautiful problems that I often come back to). I also had great fun with Khaled Hamed’s functional programming problems (problems 1198, 1210, 1224), as well as the many hacking problems out there –– starting with Óscar’s “Now!” series (problems 901, 907), Frequency Domain’s “Get me!” series (problems 1745, 1746, 1747, 1752) and my own “Singularity 2.0” series (problems 1769, 1770, 1764).

Q: Can you tell us about some of your back and forth coding with other people? Sometimes it seems like a battle, and sometimes it seems like a conversation.

A: Those sorts of interactions make some of the most memorable moments for me in Cody (and they are always more like conversations or shared experiences, only perhaps disguised as battles). In fact they are probably what have made many of the problems and solutions that I mentioned above particularly meaningful or enjoyable to me. As an example when the “Get me!” series of hacking problems was created it brought together many players trying to find better ways to build strong testsuites that would protect against hacking attempts (and/or find better hacks to break stronger testsuites), and we built from each other’s ideas in what ended up being a remarkable collective experience of discovery. And even though it was somewhat sad to me in the end that we found some sort of all-purpose hack that could not be currently protected against, which unavoidably ended our quest, the entire process was a genuinely fun/bonding/instructive experience.

Q: What are some of your favorite ways to turn a short answer into a really short answer? Do you have any “guilty pleasures” where you know the code won’t win a beauty contest, but it’s great from a Cody point of view? What “tricks” would you recommend to other players?

A: There are a few of these “tricks”. Using command syntax (e.g. print file) instead of function syntax (e.g. print(‘file’)), using str2num to define a “constant” vector or matrix, and the somewhat ugly but necessary ans trick, would probably fall into the “recommendable” category, and they will help you shave a few points of almost any solution. The infamous regexp trick (as well as all sorts of hacking tricks) would probably fall into the “not recommendable” category, as these inevitably flatten the score function (they give any solution, independently of how clever or absurd it is, the exact same score). Despite these tricks, my favorite pleasures really come from finding new simpler ways to approach a problem, or applying some linear algebra tricks, or these sort of discoveries which lead to some small improvements in score in a way that was somewhat unexpected or surprising.

Q: Have you learned anything playing Cody that’s useful to you in your “real world” coding?

A: This would again be a very long list. Most importantly I have widened considerably the range of approaches that I consider now for almost any “real world” problem, but in practical terms I have also learned a lot about regexp functionality, Java usage in Matlab, tricks to speed-up your code, and a lot of new Matlab functionality that I was not aware of (e.g. uint64 operations, timeseries objects, map containers, etc.), just to mention a few examples.

Q: What feature or features would you like to see added to Cody?

A: I believe mostly I would like to better be able to search/browse through old problems and solutions. For example, being able to search problems/solutions that I (or specifically somebody else) ‘liked’ would make the task of coming back to revisit some of the most memorable solutions/problems or discovering new solutions that you may have missed much simpler (in this regard something like a “self-like” marking would be useful, as I would love to hear/follow which of their own problems/solutions some players are most “proud” of).

Q: Do you use any other parts of MATLAB Central?

A: I love the Blogs section (Cleve’s and Loren’s are some of my favorites), very sporadically contribute to the Newsgroup or Answers sections, and have been lately doing my first steps on Trendy (and of course was a big fan of the Matlab Contest).

Q: The most useful MATLAB function that nobody knows about is _______ .

A: accumarray, bsxfun, and cellfun/arrayfun/structfun are incredibly flexible and useful functions that are somewhat underused in my opinion.

Q: If I were a MATLAB function, I’d be _______ .

A: svd (I would spend my day doing linear algebra tricks)

Q: Ramble about anything you want to here…

A: To close I would just like to reiterate how much I appreciate the excellent work of the Mathworks team which makes all of these shared learning and fun experiences possible, as well as to thank the amazing Cody community for sharing so much of their time, brainpower, and humor with the rest of us.

|
  • print

댓글

댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.